xdp-project / xdp-tutorial

XDP tutorial
2.52k stars 584 forks source link

xdp_vlan01_kern.c:66:2: error: loop not unrolled: the optimizer was unable to perform the requested transformation; the transformation might be disabled or specified as part of an unsupported transformation ordering [-Werror,-Wpass-failed=transform-warning] #411

Open NobinPegasus opened 8 months ago

NobinPegasus commented 8 months ago

When I try to compile the codes the xdp_vlan01_kern.c uses #pragma unroll, it throws error.

    CC       xdp_prog_user
    CLANG    xdp_prog_kern_02.o
    LLC      xdp_prog_kern_02.o
    CLANG    xdp_prog_kern_03.o
    LLC      xdp_prog_kern_03.o
    CLANG    tc_reply_kern_02.o
    LLC      tc_reply_kern_02.o
    CLANG    xdp_vlan01_kern.o
xdp_vlan01_kern.c:66:2: error: loop not unrolled: the optimizer was unable to perform the requested transformation; the transformation might be disabled or specified as part of an unsupported transformation ordering [-Werror,-Wpass-failed=transform-warning]
   66 |         for (i = 0; i < VLAN_MAX_DEPTH; i++) {
      |         ^
1 error generated.
make: *** [../common/common.mk:116: xdp_vlan01_kern.o] Error 1

I'm using the latest clang

pegasus@pegasus:~/Documents/xdp-tutorial/packet-solutions$ clang --version
clang version 19.0.0git (https://github.com/llvm/llvm-project.git 815644b4dd882ade2e5649d4f97c3dd6f7aea200)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/pegasus/Documents/llvm-project/build/bin
tohojo commented 7 months ago

NobinPegasus @.***> writes:

When I try to compile the codes the xdp_vlan01_kern.c uses #pragma unroll, it throws error.

    CC       xdp_prog_user
    CLANG    xdp_prog_kern_02.o
    LLC      xdp_prog_kern_02.o
    CLANG    xdp_prog_kern_03.o
    LLC      xdp_prog_kern_03.o
    CLANG    tc_reply_kern_02.o
    LLC      tc_reply_kern_02.o
    CLANG    xdp_vlan01_kern.o
xdp_vlan01_kern.c:66:2: error: loop not unrolled: the optimizer was unable to perform the requested transformation; the transformation might be disabled or specified as part of an unsupported transformation ordering [-Werror,-Wpass-failed=transform-warning]
   66 |         for (i = 0; i < VLAN_MAX_DEPTH; i++) {
      |         ^
1 error generated.
make: *** [../common/common.mk:116: xdp_vlan01_kern.o] Error 1

I'm using the latest clang

***@***.***:~/Documents/xdp-tutorial/packet-solutions$ clang --version
clang version 19.0.0git (https://github.com/llvm/llvm-project.git 815644b4dd882ade2e5649d4f97c3dd6f7aea200)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/pegasus/Documents/llvm-project/build/bin

Hmm, this sounds like a regression in clang, then, so I would suggest reporting it to the LLVM developers...

SailorStu commented 6 months ago

Reducing VLAN_MAX_DEPTH from 10 to 2 (QinQ) is a workaround. Do we really need 10 of these iterations unrolled?

tohojo commented 6 months ago

Stuart Macdonald @.***> writes:

Reducing VLAN_MAX_DEPTH from 10 to 2 (QinQ) is a workaround. Do we really need 10 of these iterations unrolled?

Hmm, maybe not; but it's still odd that this suddenly starts happening when it has worked fine before... :/

Gloway17 commented 5 months ago

I also had this problem, but when I changed the clang version to 17, it was solved.

huhager commented 2 months ago

I face the same error using:

Ubuntu clang version 18.1.3 (1ubuntu1)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

Workaround VLAN_MAX_DEPTH 2 compiles