Burn CubeCL CPU backend
This crate provides a CPU backend for Burn using CubeCL's CPU runtime. It JIT-compiles shared CubeCL kernels to native CPU code through LLVM, with kernel fusion and autotuning enabled by default. LLVM is bundled automatically, no system installation is required.
Burn has two independent CPU backends. Neither one is built on top of the other.
burn-cpu |
burn-flex |
|
|---|---|---|
| Implementation | CubeCL kernels compiled through LLVM | Hand-written Rust kernels, gemm, SIMD |
| Execution | JIT-compiled, with fusion and autotune | Eager |
| Native deps | Bundled LLVM, no system install | None (pure Rust) |
no_std / Wasm |
No | Yes |
burn feature |
cpu |
flex |
| Device constructor | Device::cpu() |
Device::flex() |
Use burn-cpu when you want the CubeCL stack (fusion, custom CubeCL kernels shared with the GPU
backends) on the CPU. Use burn-flex for a lightweight, portable CPU backend that also runs on
no_std and WebAssembly targets.
burn = { version = "0.22", features = ["cpu"] }use burn::tensor::{Device, Tensor};
let device = Device::cpu();
let tensor = Tensor::<2>::from_data([[1.0, 2.0], [3.0, 4.0]], &device);Part of the Burn deep learning framework. See the Burn Book and the API documentation.