Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions mlx/backend/metal/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be better to positively define MLX_METAL_NAX instead when NAX is present?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well this is the minimum edit distance version since there is one path in the cmake that we want to turn off the NAX support for but multiple in the cmake that we want it on for.

Over time I think this makes more sense as by default we will want to build to support neural accelerators... but I'm not so attached to it.. I can rearrange it if needed.

return false;
#else
auto _check_nax = []() {
bool can_use_nax = false;
if (__builtin_available(
Expand All @@ -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 changes: 2 additions & 0 deletions mlx/backend/metal/kernels/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Loading