Isomorphism is a platform-agnostic C++ math wrapper that unifies MLX (Apple Silicon) and SYCL (oneMKL/PC) backends. It acts as a routing layer, translating high-level tensor operations into highly optimized native calls for the active hardware, ensuring seamless performance across disparate architectures.
By using Isomorphism, you write your mathematical logic once using a Domain Specific Language (DSL) and deploy it anywhere without worrying about the underlying silicon.
The recommended way to install Isomorphism on macOS is via Homebrew. This ensures all backend dependencies, like MLX, are correctly configured.
# 1. Install MLX for macOS compatibility
brew install mlx
# 2. Tap the custom Isomorphism repository
brew tap c0rmac/homebrew-isomorphism
# 3. Install the library
brew install isomorphism
Once installed, you can integrate Isomorphism into your project using CMake. The package exports a clean target that handles all include paths and backend-specific linking automatically.
Add the following to your CMakeLists.txt:
# 1. Locate the Isomorphism package
find_package(isomorphism REQUIRED)
# 2. Your executable
add_executable(my_app main.cpp)
# 3. Link the Isomorphism target
# This automatically handles include paths and backend dependencies (like MLX/SYCL)
target_link_libraries(my_app PRIVATE isomorphism::isomorphism)
#include <isomorphism/math.hpp>
#include <isomorphism/tensor.hpp>
namespace iso = isomorphism;
int main() {
// Operations are automatically routed to the active backend (MLX or SYCL)
iso::Tensor a = iso::math::full({3, 3}, 1.0f, DType::Float32);
iso::Tensor b = iso::math::eye(3, DType::Float32);
// Perform a batched matrix multiplication
iso::Tensor result = iso::math::matmul(a, b);
// Explicitly execute the computation graph
iso::math::eval(result);
return 0;
}
include/isomorphism/: Contains the public API and hardware-agnostic DSL headers.src/backends/mlx/: Implementation files for the Apple Silicon backend using the MLX framework.src/backends/sycl/: Implementation files for the PC/Linux backend using SYCL and oneMKL.This project is licensed under the MIT License.