Repository navigation
v0.1.0 — Initial release
mojo-intel-gpu v0.1.0
First public release. Mojo GPU compute on Intel GPUs via Level Zero FFI.
What's working
- Level Zero FFI bindings: 16 functions covering driver init, device
discovery, context/command list creation, memory allocation/copy/fill,
SPIR-V module loading, kernel dispatch, and synchronization - Auto-detection: enumerate all Intel GPUs on the system, query
properties (vendor, device, compute caps, SLM size, subgroup sizes) - GPU context management:
IntelGPUContextwith RAII cleanup - Memory management: device/host allocation, H2D/D2D/D2H copies, fill
- Kernel management: load SPIR-V modules, set arguments, dispatch
- High-level API: similar shape to Mojo's
DeviceContext - Examples: vector_add, matrix_multiply, reduction, benchmark
- Tests: detection, context, memory, kernel, multi-GPU, bandwidth,
latency
Validated performance (Intel Arc B580)
| Metric | Min | Intel Published |
|---|---|---|
| H2D (1 MB, PCIe Gen4 x8) | 12.78 GB/s | 14.5 GB/s |
| D2H (1 MB, PCIe Gen4 x8) | 10.66 GB/s | 14.5 GB/s |
| Fill (1 MB, write) | 172 GB/s | — |
| vec_copy kernel (4 MB) | 1592 GB/s | 425 GB/s |
| Empty kernel launch (async) | 2.03 µs | 1.39 µs |
| Empty kernel + sync | 4.35 µs | — |
Requirements
- Mojo v1.0.0b1 or later
- Intel GPU (Battlemage Xe2 tested: Arc B580)
- Level Zero runtime:
intel-compute-runtime,level-zero-loader,
level-zero-headers - OpenCL C compiler:
clang,llvm-spirv(for kernel compilation)
Install
# Build from source
git clone https://github.com/andomeder/mojo-intel-gpu
cd mojo-intel-gpu
mojo package mojo_intel_gpu -o mojo_intel_gpu.mojopkg
./tools/compile_kernels.sh
# Use in your project
mojo run -I /path/to/mojo-intel-gpu your_app.mojoConda/pixi install coming soon — PR to modular-community submitted separately.
Known limitations
- SPIR-V kernels must be pre-compiled from OpenCL C (no runtime compiler
yet) - No shared LevelZeroLibrary instance (each component dlopens its own —
works on Linux via ref-counting, not optimal) - Arc A-series and Data Center GPUs untested (only B580 validated)
- Tested on Linux only
Architecture
Mojo (your code)
└─ mojo_intel_gpu package
└─ l0.loader (zero-overhead FFI via lib.call)
└─ libze_loader.so (system)
└─ Intel compute-runtime
└─ xe/i915 kernel module
└─ Intel Arc B580
Acknowledgments
- Intel for the Level Zero runtime and compute-runtime (MIT license)
- Modular for Mojo language and FFI capabilities
- MLIR community for the xevm and spirv dialects