| Issue |
241322
|
| Summary |
clang-22 regression: severe slowdown/infinite loop when compiling GGML's AMX target
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
amyspark
|
Compiler version:
```
clang version 22.1.3 (https://github.com/llvm/llvm-project e9846648fd6183ee6d8cbdb4502213fcf902a211)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files\Microsoft Visual Studio\18\Insiders\VC\Tools\Llvm\x64\bin
```
Offending (preprocessed) file: [mmq.cpp.zip](https://github.com/user-attachments/files/34690101/mmq.cpp.zip), from https://github.com/ggml-org/ggml/commit/cd6d2b75f5d3e4b2f3fe8e8fbc6c8b84ac80e74a
Compiler line (adjusted to remove includes and target the preprocessed file):
```
clang.exe -DGGML_AMX_INT8 -DGGML_AMX_TILE -DGGML_AVX -DGGML_AVX2 -DGGML_AVX512 -DGGML_AVX512_BF16 -DGGML_AVX512_VBMI -DGGML_AVX512_VNNI -DGGML_BACKEND_BUILD -DGGML_BACKEND_DL -DGGML_BACKEND_SHARED -DGGML_BMI2 -DGGML_F16C -DGGML_FMA -DGGML_SCHED_MAX_COPIES=4 -DGGML_SHARED -DGGML_SSE42 -DGGML_USE_CPU_REPACK -DGGML_USE_OPENMP -D_CRT_SECURE_NO_WARNINGS -D_XOPEN_SOURCE=600 -Dggml_cpu_sapphirerapids_EXPORTS -IE:/wraps/ggml/src/.. -IE:/wraps/ggml/src/. -IE:/wraps/ggml/src/ggml-cpu -IE:/wraps/ggml/src/../include -O2 -DNDEBUG -std=gnu++17 -D_DLL -D_MT -Xclang --dependent-lib=msvcrt -g -Xclang -gcodeview -msse4.2 -mf16c -mfma -mbmi2 -mavx -mavx2 -mavx512f -mavx512cd -mavx512vl -mavx512dq -mavx512bw -mavx512vbmi -mavx512vnni -mavx512bf16 -mamx-tile -mamx-int8 -Wno-error=incompatible-pointer-types -fopenmp=libomp -MD -MT src/CMakeFiles/ggml-cpu-sapphirerapids.dir/ggml-cpu/amx/mmq.cpp.obj -MF src\CMakeFiles\ggml-cpu-sapphirerapids.dir\ggml-cpu\amx\mmq.cpp.obj.d -o src/CMakeFiles/ggml-cpu-sapphirerapids.dir/ggml-cpu/amx/mmq.cpp.obj -c E:/wraps/ggml/src/ggml-cpu/amx/mmq.cpp.i
```
For some reason, between clang 19 (as shipped by Visual Studio 2022) and clang 22 (as detailed above) building the above file has become impossible. The slowdown will happen either at the clang or lld-link level, depending on whether `GGML_LTO` is enabled. While with clang 19 the compilation will be almost instantaneous, with clang 22 I've left the file to build for ~15 minutes with no signs of ending.
The specific VS 2022 version:
```
clang version 19.1.5
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\Llvm\x64\bin
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs