-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Context
Currently, Halide does not support the AMD Zen5 architecture, and the fallback mechanism is not functioning correctly. The fallback categorizes the Zen5 as Intel Sapphire Rapids. While these two architectures share many features, there are notable differences. Specifically, Zen5 does not support Intel AMX (Advanced Matrix Extensions) or AVX512-FP16.
- Sapphire Rapids features: https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html#:~:text=sapphirerapids
- Zen5 features: https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html#:~:text=znver5
When Zen4 was added (#7840), the subset/superset relationship was clear, allowing for a straightforward appending of features. In the case of Zen5, it can be simply treated as a superset of Zen4 and a subset of Sapphire Rapids with AMX and AVX512-FP16 removed. However, Zen5 also includes features that Sapphire Rapids does not have (AVX512VP2INTERSECT, PREFETCHI, etc.), and similar cases are likely to arise in the future. Therefore, it would be beneficial to make some preliminary improvements while adding support for Zen5.
Test Failure
Halide preliminarily supports AMX, and I observed that the test case correctness_tiled_matmul fails on an AMD Ryzen 9950X processor.
root@ef90f76caebd:/opt/halide/bin# ./get_host_target
x86-64-linux-avx-avx2-avx512-avx512_cannonlake-avx512_sapphirerapids-avx512_skylake-f16c-fma-sse41
root@ef90f76caebd:~/Halide/build/test/correctness# ./correctness_tiled_matmul
Running AMX matmul (signed/signed)
Illegal instruction (core dumped)If no one is currently working on this and it’s not an urgent matter, would it be okay for me to contribute? Also, if you have any specific improvement directions in mind, please let me know.