📈 GH Trending Explorer 🎲 Surprise me

← all repos

doximity / mvcc

git clone https://github.com/doximity/mvcc.git v1.1.1 · 3d ago

Compile and run CUDA on Apple M4-M5 GPUs

+1
stars, 24h · #9,364
+~7
stars, 7 days · #10,012
+78
stars, 30 days · #6,415
78
★ total · +7% this week
10
forks · 1 open issues

Star history (as recorded here)

2026-10-20 · 77 ★ 2026-10-22 · 78 ★
LanguageC++
LicenseApache-2.0
Created2026-09-23 (29d ago)
Last push3d ago
Watchers0
OwnerOrganization

GitHub topics

gpt

Links

README excerpt
# mvcc
mvcc compiles and runs CUDA C++ on Apple silicon GPUs. It consists of an `nvcc`-compatible compiler that translates device code to Metal Shading Language, and a CUDA runtime (`libcudart`, `libcuda`, `libnccl` and `libcurand`) built on Metal 4. CUDA programs and CMake projects build and run on a Mac without source changes, within the limits described under Limitations.
No NVIDIA software is involved at build or run time. There is no CUDA toolkit, driver or `ptxas`, and no cuBLAS or other NVIDIA library.
## Requirements
- An Apple silicon Mac running macOS 26
- Xcode Command Line Tools
- Homebrew
## Install
 [code] 
To build from source instead:
 [code] 
## Usage
Use the toolkit's `nvcc` as you would NVIDIA's:
 [code] 
For a CMake project:
 [code] 
The driver accepts nvcc's command line, including the options CMake generates. Options that have no meaning on Metal are ignored, and unrecognized options are passed to the host compiler with a warning, as `nvcc -forward-unknown-to-host-compiler` does. `-arch` and `-gencode` choose the CUDA feature level that device code is compiled for (`__CUDA_ARCH__`, up to `sm_90`; `sm_89` by default), not a GPU target: Apple's compiler generates code for the GPU that is present when the program first runs. `cudaGetDeviceProperties` reports compute capability 8.9 unless `MVCC_ARCH` asks for a higher one. `mvcc --help` lists the environment variables that control the compiler.
## Examples
- `examples/qwen`: inference for Qwen3.5-35B-A3B, a mixture-of-experts language model, written as ordinary CUDA C++. It decodes at about 80 tokens/s on an M5 Pro.
- `examples/hashhunt`: a brute-force MD5 search, checked against the same search in C++.
## Limitations
- mvcc runs only on Apple silicon Macs with macOS 26. It does not bring CUDA to Intel Macs, Linux or Windows, and it does not generate code for NVIDIA GPUs.
- It implements CUDA C++ and the CUDA runtime, plus Philox4_32_10 from cuRAND (the device API in `curand_kernel.h`, and a host generator in `curand.h` / `libcurand` for that one generator). Programs that use cuBLAS, cuDNN, cuFFT, cuSPARSE, Thrust, TensorRT, or any other cuRAND generator do not build, so frameworks built on those libraries, such as PyTorch's CUDA backend, cannot use mvcc.
- Kernels must be compiled by mvcc's `nvcc`. NVRTC is not provided, PTX and cubin files cannot be loaded at run time, and the driver API covers only devices, contexts and memory.
- Texture and surface memory are not supported.
- A Mac has one GPU. `MVCC_DEVICES` presents up to 16 logical devices on it, which is enough to run multi-GPU code paths and NCCL collectives but adds no compute or memory.
- NVIDIA's debugging and profiling tools (cuda-gdb, compute-sanitizer, Nsight) cannot be used. Device-side `printf` prints nothing, and the profiler API calls do nothing.
- Apple GPUs have no fp64 hardware. fp64 arithmetic is emulated in software and is much slower than fp32.
- Tensor-core code is fast only when mvcc recovers the matri