Skip to content

Latest commit

 

History

History

burn-cpu

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Burn CPU Backend

Burn CubeCL CPU backend

Current Crates.io Version Documentation license

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-cpu vs burn-flex

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.

Usage Example

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.