| 1 | // SPDX-License-Identifier: Apache-2.0 |
| 2 | // SPDX-FileCopyrightText: Copyright contributors to the vLLM project |
| 3 | |
| 4 | // AMX-FP8 is reported at CPUID leaf 0x1E, subleaf 1, EAX[4]. |
| 5 | #if defined(__x86_64__) || defined(_M_X64) |
| 6 | #include <cpuid.h> |
| 7 | |
| 8 | bool runtime_has_amx_fp8() { |
| 9 | unsigned int eax = 0, ebx = 0, ecx = 0, edx = 0; |
| 10 | if (__get_cpuid_max(0, nullptr) < 0x1e) return false; |
| 11 | if (__get_cpuid_count(0x1e, 1, &eax, &ebx, &ecx, &edx)) { |
| 12 | return (eax >> 4) & 1u; |
| 13 | } |
| 14 | return false; |
| 15 | } |
| 16 | |
| 17 | bool cpu_has_amx_fp8() { return runtime_has_amx_fp8(); } |
| 18 | #else |
| 19 | bool cpu_has_amx_fp8() { return false; } |
| 20 | #endif |