Add a no_ibv

This commit is contained in:
Angelos Katharopoulos
2025-11-20 12:35:37 -08:00
parent b9b78b1059
commit 5d7e6a0642
3 changed files with 31 additions and 3 deletions

View File

@@ -1,2 +1,8 @@
target_sources(mlx PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/ibv.cpp)
target_link_libraries(mlx PRIVATE rdma)
if(MLX_BUILD_CPU
AND ${CMAKE_SYSTEM_NAME} MATCHES "Darwin"
AND MACOS_SDK_VERSION GREATER_EQUAL 26.2)
target_sources(mlx PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/ibv.cpp)
target_link_libraries(mlx PRIVATE rdma)
else()
target_sources(mlx PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/no_ibv.cpp)
endif()

View File

@@ -1077,7 +1077,9 @@ class IBVGroup : public GroupImpl {
};
bool is_available() {
return true;
if (__builtin_available(macOS 26.2, *)) {
return true;
}
}
std::shared_ptr<GroupImpl> init(bool strict /* = false */) {

View File

@@ -0,0 +1,20 @@
// Copyright © 2025 Apple Inc.
#include "mlx/distributed/ibv/ibv.h"
namespace mlx::core::distributed::ibv {
using GroupImpl = mlx::core::distributed::detail::GroupImpl;
bool is_available() {
return false;
}
std::shared_ptr<GroupImpl> init(bool strict /* = false */) {
if (strict) {
throw std::runtime_error("Cannot initialize ibv distributed backend.");
}
return nullptr;
}
} // namespace mlx::core::distributed::ibv