/home/runner/work/LabNeura/LabNeura/src/labneura/backends/common/fp16_kernel_selection.h
Line | Count | Source (jump to first uncovered line) |
1 | | #pragma once |
2 | | |
3 | | namespace labneura::detail { |
4 | | |
5 | | enum class AVX2FP16Kernel { |
6 | | SCALAR, |
7 | | F16C, |
8 | | }; |
9 | | |
10 | | // F16C is independent of AVX2: the F16C kernel is used only when it was |
11 | | // compiled into this build and the CPU and OS both report support for it. |
12 | | inline AVX2FP16Kernel select_avx2_fp16_kernel(bool f16c_compiled, |
13 | 220 | bool f16c_supported) { |
14 | 220 | return (f16c_compiled && f16c_supported) ? AVX2FP16Kernel::F16C |
15 | 220 | : AVX2FP16Kernel::SCALAR; |
16 | 220 | } |
17 | | |
18 | | // Internal test seam (not installed, not part of the public API). Defined in |
19 | | // avx2_ops_fp16.cpp, only when the AVX2 backend is built. |
20 | | bool avx2_fp16_f16c_compiled(); |
21 | | // The kernel AVX2Backend::operation_fp16 will use right now. |
22 | | AVX2FP16Kernel avx2_fp16_active_kernel(); |
23 | | // Forces the scalar fallback (never forces F16C, so it cannot run F16C code |
24 | | // on unsupported CPUs). |
25 | | void avx2_fp16_force_scalar_for_testing(bool force); |
26 | | |
27 | | } // namespace labneura::detail |