Don't try to use NAX at run-time if kernels aren't there (#2982)

This commit is contained in:
Awni Hannun
2026-01-13 15:47:45 -08:00
committed by GitHub
parent 4160ec10f7
commit 8654b8281d
2 changed files with 6 additions and 0 deletions
+4
View File
@@ -266,6 +266,9 @@ Device& device(mlx::core::Device);
std::unique_ptr<void, std::function<void(void*)>> new_scoped_memory_pool();
inline bool is_nax_available() {
#ifdef MLX_METAL_NO_NAX
return false;
#else
auto _check_nax = []() {
bool can_use_nax = false;
if (__builtin_available(
@@ -278,6 +281,7 @@ inline bool is_nax_available() {
};
static bool is_nax_available_ = _check_nax();
return is_nax_available_;
#endif
}
} // namespace mlx::core::metal
+2
View File
@@ -164,6 +164,8 @@ if(NOT MLX_METAL_JIT)
build_kernel(steel/attn/kernels/steel_attention_nax
${STEEL_NAX_ATTN_HEADERS})
else()
target_compile_definitions(mlx PRIVATE MLX_METAL_NO_NAX)
endif()
endif()