| 106 | } |
| 107 | |
| 108 | int vector_kernel_level() |
| 109 | { |
| 110 | #if defined(__x86_64__) |
| 111 | // The bf16/fp16 reduce kernels are compiled with target("avx512bw") and use |
| 112 | // _mm512_* conversions; the fp32 kernels only use 256-bit AVX. Executing an |
| 113 | // unsupported ISA level faults, and the fault surfaces downstream as a hang |
| 114 | // once the peers block on the shm synchronization flags. |
| 115 | if (__builtin_cpu_supports("avx512bw")) return 2; |
| 116 | if (__builtin_cpu_supports("avx2")) return 1; |
| 117 | return 0; |
| 118 | #else |
| 119 | // The arm64/riscv ports have no runtime ISA probe, so keep the pre-guard |
| 120 | // behavior of always enabling them; stricter gating for their optional |
| 121 | // extensions (e.g. riscv +v/+zvfh) is left to those ports' maintainers. |
| 122 | return 2; |
| 123 | #endif |
| 124 | } |
| 125 | |
| 126 | PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) |
| 127 | { |
nothing calls this directly
no outgoing calls
no test coverage detected