Repository navigation
Releases
Releases · andomeder/mojo-intel-gpu
v0.2.0: Mojo 1.0 stable migration
Full Changelog: v0.1.0...v0.2.0
Mojo 1.0 stable migration
This release migrates mojo-intel-gpu from Mojo 1.0.0b1 to the stable 1.0.0 compiler and updates the public API accordingly.
Changes:
- Bump Mojo requirement to
>=1.0.0and switch package output tomojo precompile/.mojoc - Migrate all FFI and pointer code to stable 1.0 APIs (
Pointer,unsafe_alloc,unsafe_free) - Add
ctx.library()accessor;Kerneland buffers now borrow the shared Level Zero library instead of each opening their own - Add
set_arg_float32/int32/uint32helpers toKernel - Add SPIR-V magic-number validation before
zeModuleCreate - Add failure-mode and stress test suites
- Remove dead
driver_getwrapper and duplicate imports - Fix build-log size read as
UInt64
Tested hardware:
- Intel Arc B580 (Battlemage Xe2)
Prereqs:
- Level Zero runtime (
libze_loader.so) - Intel GPU with Level Zero support
Migration notes:
mojo package->mojo precompile.mojopkg->.mojoc
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