llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.3k stars 11.68k forks source link

llvm testsuite doesn't compile with -Oz #94537

Open hiraditya opened 4 months ago

hiraditya commented 4 months ago

Using -Oz.cmake

$ cmake -DCMAKE_C_COMPILER=/usr/local/llvm-project/build/bin/clang-19 -C ../cmake/caches/Oz.cmake .. && make -j32 -k

[ 59%] Building CXX object SingleSource/UnitTests/Matrix/AMXINT8/CMakeFiles/Matrix-AMXINT8-t_gemm_bf16.dir/t_gemm_bf16.cpp.o
[ 59%] Linking CXX executable Matrix-AMXINT8-t_gemm_bf16
[ 59%] Built target Matrix-AMXINT8-t_gemm_bf16
[ 59%] Building CXX object SingleSource/UnitTests/Matrix/AMXINT8/CMakeFiles/Matrix-AMXINT8-t_gemm_int8.dir/t_gemm_int8.cpp.o
error: _Z13inner_productPiS_S_iii: Failed to config tile register, please define the shape earlier
1 error generated.
make[2]: *** [SingleSource/UnitTests/Matrix/AMXINT8/CMakeFiles/Matrix-AMXINT8-t_gemm_int8.dir/build.make:76: SingleSource/UnitTests/Matrix/AMXINT8/CMakeFiles/Matrix-AMXINT8-t_gemm_int8.dir/t_gemm_int8.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:42285: SingleSource/UnitTests/Matrix/AMXINT8/CMakeFiles/Matrix-AMXINT8-t_gemm_int8.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
llvmbot commented 3 months ago

@llvm/issue-subscribers-backend-x86

Author: AdityaK (hiraditya)

Using -Oz.cmake $ cmake -DCMAKE_C_COMPILER=/usr/local/llvm-project/build/bin/clang-19 -C ../cmake/caches/Oz.cmake .. && make -j32 -k ```log [ 59%] Building CXX object SingleSource/UnitTests/Matrix/AMXINT8/CMakeFiles/Matrix-AMXINT8-t_gemm_bf16.dir/t_gemm_bf16.cpp.o [ 59%] Linking CXX executable Matrix-AMXINT8-t_gemm_bf16 [ 59%] Built target Matrix-AMXINT8-t_gemm_bf16 [ 59%] Building CXX object SingleSource/UnitTests/Matrix/AMXINT8/CMakeFiles/Matrix-AMXINT8-t_gemm_int8.dir/t_gemm_int8.cpp.o error: _Z13inner_productPiS_S_iii: Failed to config tile register, please define the shape earlier 1 error generated. make[2]: *** [SingleSource/UnitTests/Matrix/AMXINT8/CMakeFiles/Matrix-AMXINT8-t_gemm_int8.dir/build.make:76: SingleSource/UnitTests/Matrix/AMXINT8/CMakeFiles/Matrix-AMXINT8-t_gemm_int8.dir/t_gemm_int8.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:42285: SingleSource/UnitTests/Matrix/AMXINT8/CMakeFiles/Matrix-AMXINT8-t_gemm_int8.dir/all] Error 2 make: *** [Makefile:136: all] Error 2 ```
fhahn commented 3 months ago

cc @LuoYuanke @XinWang10 @yubingex007-a11y

There's another AMX codegen crash, similar to https://github.com/llvm/llvm-project/issues/90954. When I filed https://github.com/llvm/llvm-project/issues/90954 building the same file would non-deterministically fail with either the error from https://github.com/llvm/llvm-project/issues/90954 or the error in this issue

fhahn commented 3 months ago

This also raises the question if anybody is building & running those tests with a CPU that enables AMX. If not, should we remove the tests?

phoebewang commented 3 months ago

We have more complicated tests as well as these running internally. These tests are used to catch bugs from community as demonstrated well by https://github.com/llvm/llvm-project/issues/90954. So I think we indeed need these tests.

This should be an unrelated issue. The AMX programming model has some constraints. Maybe the optimizations with Oz result in cases cannot be handled. I'll take a look when I got some buffer.

fhahn commented 3 months ago

@phoebewang fair point, I think one issue is that https://github.com/llvm/llvm-project/issues/90954 at least has been an issue for a while time without anyone finding it. Would be great if the tests could be actively monitored, ideally with an upstream build bot to prevent this in the future. Breaking building the test-suite is quite inconvenient for contributors unfortunately.

hiraditya commented 3 months ago

Can we at least disable it by default until the issue has been fixed?

phoebewang commented 3 months ago

@phoebewang fair point, I think one issue is that #90954 at least has been an issue for a while time without anyone finding it. Would be great if the tests could be actively monitored, ideally with an upstream build bot to prevent this in the future. Breaking building the test-suite is quite inconvenient for contributors unfortunately.

I'm surprised there isn't one build bot monitoring it. But seems true, because I didn't receive a failure report after that patch. I took a look at the test patch again, it is a compilation only test, but requires an exactly "skylake-avx512" target. I think that's the reason why it's not being monitored. We should relax this requirement. We have this machine internally, but it has a longer period before the patch landed internally then trigger it.

Can we at least disable it by default until the issue has been fixed?

Yeah, we may change to skip the Oz option firstly.