版本发布 8
# Summary Burn `0.21.0` brings 4 months of improvements that make the framework significantly faster and more reliable across the board. The gains span distributed workflows for training large models all the way down to small-model inference, where the reduced framework overhead becomes especially noticeable. We rethought our distributed computing stack around differentiable collective operations. Kernel selection is now more reliable thanks to better autotuning and a new validation layer, and a project-level `burn.toml` file lets you tweak those internals (and many others) without recompiling. A reworked device handle reduces framework overhead, and a new `burn-dispatch` crate simplifies backend selection while paving the way for faster compile times. The release also ships `burn-flex`, a lightweight eager CPU backend for WebAssembly and embedded targets that replaces `burn-ndarray`. Finally, we added early off-policy reinforcement learning support and a fresh round of kernel work on GEMV, top-k, and FFT. For more details, [check out the release post on our website](https://burn.dev/blog/release-0.21.0). # Changelog **Breaking** We've introduced a couple of breaking changes with this release. The affected areas are detailed in the sections below. ## `burn-dataset` cache directory To respect platform conventions, we switched from using a hardcoded `~/.cache` directory root for downloaded artifacts. | Platform | Path | |----------|------| | Linux | `$XDG_CACHE_HOME` or `~/.cache` | | macOS | `~/Library/Caches` | | Windows | `{FOLDERPATH_LOCAL_APPDATA}` | For Linux users without `$XDG_CACHE_HOME` configured, this change has no effect. The cache directory is still `~/.cache`. ## Interface Changes `TensorData::shape` now stores a `Shape` instead of a `Vec<usize>`. Existing binary records using `BinFileRecorder` or `BinBytesRecorder` are no not forward-compatible and must be converted before upgrading. ```rust static STATE_ENCODED: &[u8] = include_bytes!("model.bin"); let model: Model<B> = Model::new(&Default::default()); // Old format can still be loaded before upgrade, but must be re-saved in a forward-compatible format. let record = BinBytesRecorder::<FullPrecisionSettings, &'static [u8]>::default() .load(STATE_ENCODED, &Default::default()) .expect("Failed to decode state"); let model = model.load_record(record); model.save_file("model.mpk", &NamedMpkFileRecorder::<FullPrecisionSettings>::new()).unwrap(); ``` The module derive macro has been improved, and the `Ignored<T>` wrapper is now deprecated. For fields that should not considered modules, use `#[module(skip)]` instead. ```diff pub struct Conv1d<B: Backend> { - pub padding: Ignored<PaddingConfig1d>, + #[module(skip)] + pub padding: PaddingConfig1d, } ``` We added support for explicit asymmetric padding. If you were using explicit padding, you must now specify the same value for all pairs. Note that `PaddingConfig3d` does not support asymmetric padding yet. ```diff // Symmetric (left, right) - PaddingConfig1d::Explicit(1) + PaddingConfig1d::Explicit(1, 1) // Symmetric (top, left, bottom, right) - PaddingConfig2d::Explicit(1, 1) + PaddingConfig2d::Explicit(1, 1, 1, 1) ``` The `Gelu` activation module can now be configured with tanh approximation. This only affects code that instantiated `Gelu` directly. ```diff - let activation = Gelu; + let activation = Gelu::new(); // or Gelu::default() ``` The position-wise feed-forward module now has a configurable activation function. To keep it backwards compatible with previously saved records, the field is marked as `#[module(skip)]`. ```diff #[derive(Module, Debug)] pub struct PositionWiseFeedForward<B: Backend> { // ... - /// GELU activation function. - pub gelu: Gelu, + /// Activation function. + #[module(skip)] + pub activation: Activation<B>, } ``` The `Shape` fields are now private and some methods have been renamed. `ShapeError` has been renamed to `MetadataError`. ```diff - let b = tensor.shape().dims[0]; + let b = tensor.shape()[0] - if let Err(ShapeError::RankMismatch{...}) = lhs.broadcast(&rhs) { + if let Err(MetadataError::RankMismatch{...}) = lhs.broadcast(&rhs) { - let shape = shape.swap(1, 2).unwrap(); + let shape = shape.swapped(1, 2).unwrap(); - let shape = shape.permute(&[0, 2, 1, 3]).unwrap(); + let shape = shape.permuted(&[0, 2, 1, 3]).unwrap(); ``` The boolean data type was expanded to include its storage type. ```diff match bool_tensor.dtype() { - DType::Bool => todo!(), + DType::Bool(BoolStore::Native) => todo!(), + DType::Bool(BoolStore::U8) => todo!(), + DType::Bool(BoolStore::U32) => todo!(), _ => unreachable!(), } ``` `powf` is no longer supported for `Int` tensors, as it previously relied on incorrect implicit truncation. These operations are now only available for `Float` tensors. ```diff - let tensor_i = tensor_int.powf(tensor_float); + let tensor_f = tensor_int.float().powf(tensor_float); - let tensor_i = tensor_int.powf_scalar(scalar_float); + let tensor_f = tensor_int.float().powf_scalar(scalar_float); ``` Backend tensor creation and conversion ops now take an explicit output dtype. This removes backend-specific dtype inference and ensures consistent behavior across backends. (Backend implementors only.) ```diff impl BoolTensorOps<Self> for MyBackend { - fn bool_empty(shape: Shape, device: &Device<Self>) -> BoolTensor<Self> { + fn bool_empty(shape: Shape, device: &Device<Self>, dtype: BoolDType) -> BoolTensor<Self> { // use `dtype` instead of inferring internally } - fn bool_into_int(tensor: BoolTensor<Self>) -> IntTensor<Self> { + fn bool_into_int(tensor: BoolTensor<Self>, out_dtype: IntDType) -> IntTensor<Self> { // use `dtype` instead of inferring internally } } ``` Associated types were moved from `Backend` to `BackendTypes`. Prefer the type aliases (`Device<B>`, `FloatTensor<B>`, etc.) to avoid type resolution issues. ```diff impl BoolTensorOps<Self> for MyBackend { - fn bool_empty(shape: Shape, device: &<Self as Backend>::Device, dtype: BoolDType)) -> <Self as Backend>::BoolTensorPrimitive { + fn bool_empty(shape: Shape, device: &Device<Self>, dtype: BoolDType) -> BoolTensor<Self> { } } ``` ## Module & Tensor - Feat/device policy (#4373) @laggui - Implement basic RNN module (#4460) @aditya0by0 - Add deg2rad and rad2deg (#4462) @softmaximalist - Implement median tensor operation (#4454) @softmaximalist - Add Selu activation function (#4439) @antimora - Add CELU activation function (#4441) @antimora - Add Elu activation function (#4438) @antimora - Add BiGru (bidirectional GRU) module (#4442) @antimora - Add ThresholdedRelu activation function (#4440) @antimora - Add Softsign activation function (#4437) @antimora - [Breaking] Add configurable activation and layer_norm_eps to transformer layers (#4410) @antimora - [Breaking] Add asymmetric padding support for conv and pool operations (#4263) @antimora - Implement HardShrink, SoftShrink and Shrink Activations (#4556) @aditya0by0 - feat: add align_corners support to InterpolateOptions (#4518) @antimora - feat: support padding on arbitrary dimensions (#4507) @antimora - feat: enhance attention() with scale, attn_bias, softcap, and is_causal (#4476) @antimora - feat: Introduce Lanczos3 interpolation method (#4601) @ovr - Add HannWindow operator to burn-tensor (#4631) @walkinggo - [Breaking] Remove int powf and make powi numeric op (#4646) @laggui - [Breaking] Add bool store dtype + remove bool elem from fusion (#4649) @laggui - [Breaking] Use device settings to provide output dtype (#4653) @laggui - feat: add categorical sampling for tensors (#4655) @majiayu000 - Add HammingWindow operator to burn-tensor (#4698) @RunjiaChen - Fix: make module cloning efficient for CPU devices (#4703) @antimora - feat: support cross-kind tensor casting via .cast() (#4713) @antimora - Add `FloatInfo` for dtype-aware precision info (#4721) @antimora - Fix `unsqueeze_dims` panic (#4755) @softmaximalist - Fix unsqueeze_dims panic on duplicate sorted axes (#4764) @antimora - feat(burn-nn): add native LocalResponseNorm module (#4765) @jcwal1516 - Add det (determinant) tensor operation (#4813) @softmaximalist - Add Blackman window function to signal module (#4842) @softmaximalist - Add STFT/ISTFT and thread n through FFT backend trait (#4835) @antimora - Add linear op to ModuleOps for fused matmul+bias (#4747) @antimora - Add native impementations for scatter_nd / gather_nd; provide autodiff for assign & add (#4709) @cu9hue - Fix conv x-backward padding_out bug (#4806) @antimora - Extract float math ops in a new trait (#4891) @skewballfox - `linalg::lu`: Improve numerical handling and small perf cleanup (#4902) @softmaximalist - Adding complex to complex FFT implementation (#4903) @RunjiaChen - add autodiff for scatter_nd min/max/mul (#4909) @cu9hue - fix: conv_transpose x-backward output size (#4916) @SAY-5 - Change pwff activation to #[module(skip)] for backward compat (stateless) (#4929) ## Datasets & Training - Implement SSIM vision metric (#4396) @softmaximalist - add KLDivLoss and batch_mean in reduction (#4399) @donjuanplatinum - Fix cubek matmul stage size (#4435) @laggui - Implement the PSNR vision metric (#4379) @softmaximalist - Implement Mean(L(P) Norm Error)Loss (#4341) @softmaximalist - Feature flag + Tests for RL in burn-rl and burn-train (#4470) @Charles23R - Burn rl (#4447) @Charles23R - add AMSgrad support for Adam/AdamW (#4388) @donjuanplatinum - add LBFGS optimizer (#4471) @donjuanplatinum - Add SequenceOutput struct for sequence prediction outputs (#4474) @softmaximalist - fix: OptimSharded strategy validation device mismatch (#4527) @Dreaming-Codes - Implement CTC loss (#4529) @softmaximalist - Add Smooth L1 loss (#4547) @softmaximalist - Implements: LPIPS matrics for Image quality (#4403) @koreaygj - feat: Implements DISTS metric (#4574) @koreaygj - Add multi-scale SSIM for image quality assessment (#4555) @softmaximalist - Add Gram Matrix Loss for vision tasks (#4595) @softmaximalist - Add evaluator summary (#4578) @laggui - Fix cosine scheduler record in composed scheduler (#4617) @laggui - Implement RNNT loss (#4623) @cong-or - feat: add FID vision metric (#4644) @cong-or - Add Adan optimizer implementation with tests (#4651) @sepcnt - [Breaking] Split `TrainingStrategy` to decouple the `DistributedBackend` requirement (#4710) @laggui - Fix `CrossEntropyLoss` with probabilities (#4829) @laggui ## Backends - More explicit global dtype support (#4400) @laggui - opt(burn-cubecl): Optimized tensors by default (#4402) @wingertge - Add device dtype usage (#4404) @laggui - Attention: add autotune gate (#4554) @louisfd - Attention autotune (#4552) @louisfd - Attention: remove default impl and implement for all backends (#4544) @louisfd - Add native sign unary ops for CubeCL float and int (#4513) @yash27-lab - [Feat] Global backend `Dispatch` (#4508) @laggui - allow flash attention with causal (#4509) @louisfd - Perf: Improve fusion score (#4511) @nathanielsimard - Dispatch autodiff checkpointing strategy support (#4629) @laggui - Selector/attention (#4648) @louisfd - update cubek and fix vecmat autotune (#4682) @louisfd - update cubek and cubecl (#4699) @louisfd - update cubek & fix gemv autotune (#4726) @louisfd - Feat/add rfft (#4707) @Sublime12 - Feat/add irfft (#4719) @Sublime12 - Feat/implement fusion for rfft (#4735) @Sublime12 - Feat/implement fusion for irfft (#4736) @Sublime12 - Add burn-flex CPU backend (#4761) @antimora - burn-flex: enable f16 tests and fix mean overflow, grid_sample and quantization (#4769) @antimora - Add softmax and layer_norm backend trait hooks (#4797) @antimora - burn-flex: implement softmax and layer_norm backend op (#4805) @antimora - Matmul selection (#4773) @nathanielsimard - Add native dispatch overrides and native tch ops for softmax, layer_norm (#4834) @antimora - [Breaking] Split Associated Types from Backend into BackendTypes (#4868) @skewballfox - Add ctc_loss backend trait hook + tch and cubecl impls (#4819) @antimora - Update CubeK: tile matmul refactor (#4901) @louisfd - Add argtopk for Cubecl backend (#4900) @Sublime12 - Add fusion integration for argtopk (#4904) @Sublime12 - Add cubecl integration to topk (#4906) @Sublime12 - Fusion tests (#4872) @nathanielsimard - Enable & fix cubecl tests w/ fusion (#4917) @laggui ### Bug Fixes - Fix reduce line size parallel and mean accumulator precision (#4467) @laggui - fix: default to single device strat when only 1 device (#4463) @Charles23R - fix: use all dilation entries in `max_pool2d_with_indices_backward` (#4466) @fcasal - Fix cubek matmul stage size (#4435) @laggui - fix: Fix interpolate with NHWC input (#4363) @wingertge - fix: Actually implement conv backwards ops for `burn-fusion`/`burn-router` (#4360) @wingertge - Fix memory growth: use GraphLocator::remove_entry for orphan cleanup (#4342) @jnamika - fix: Bool from_data_dtype panics on GPU backends (#4551) @antimora - fix: resolve macOS build and test failures (#4545) @antimora - Fix too many kernels (#4505) @nathanielsimard - Fix quantization non-contiguous input (#4498) @laggui - fix overflow in int_abs_elem for i64 min value (#4486) @Olexandr88 - Fix: create multiple elemwise fused block (#4497) @nathanielsimard - Fix fusion cumulative op inputs (#4621) @laggui - Fix dispatch autodiff feature propagation (#4592) @laggui - Fix `conv2d_weight_backward` w/ strided channels and unit spatial dims (#4591) @laggui - Fix(lpips): load ImageNet backbone weights for pretrained models (#4557) @koreaygj - Fix tch int_zeros dtype in sync (#4664) @laggui - Fix fusion kernel vector_size mismatch on f16 output writes (#4675) @AdrianEddy - Fix fusion consistency checks and binding estimation (#4695) @nathanielsimard - Fix attention_fallback NaN for fully-masked rows (#4697) @antimora - fix output in attention tuner (#4702) @louisfd - fix: use integer arithmetic for nearest-neighbor coordinate scaling (#4687) @wkrettek - Fix cubecl cuda all-reduce + remove useless check in distributed server (#4720) @Charles23R - Fix fusion scalar broadcasting in `write_output_aligned` (#4741) @laggui - Fix quantization tests and flaky tolerance (#4743) @laggui - Fix select_assign OOB (#4760) @nathanielsimard - Fix burn-flex bool binary ops to broadcast operands (#4775) @antimora - Fix burn-flex attention rejecting broadcasted mask/bias (#4777) @antimora - fix(ndarray): grouped conv SIMD clamp + regressions (#4727) @dnvt - Fix autotune context, remove unsafe code (#4781) @ArthurBrussee - Fix cubecl cross product on non-last dimension (#4850) @dschulmeist - Fix burn-flex to_contiguous fast path for prefix views (#4856) @antimora - Fix burn-flex sum_dim reading contiguous storage on transposed input (#4861) @antimora - Fix burn-flex argmax NaN ordering; tighten expand; precise erf (#4859) @antimora - Fix fusion reduce broadcasted when multi block local might be a view (#4867) @laggui - Fix select_assign OOB units (#4870) @laggui - Update cubecl + cubek: fix matmul, reduce WASM and vector size check on strided tensors (#4874) @laggui - Fix fusion read_quantized native type (#4923) @laggui ## Documentation & Examples - Update Burn Book: metrics and trig functions (#4413) @softmaximalist - docs: add DataframeDataset example using Polars (#4298) @SameerVers3 - doc(notebook) : add more basic operations and some examples (#4542) @Tyooughtul - Update documentation link for burn-store (#4619) @softmaximalist - Update building-blocks chapter (#4625) @softmaximalist - Update ONNX import docs for LoadStrategy and from_bytes (#4607) @antimora - Use burn-flex in docs and examples (#4841) @antimora ### Fixes - Add field docs to generated methods (#4408) @swfsql - Fix typo in dataset.md in Burn Book (#4380) @softmaximalist - Fix book guide training changes (#4340) @laggui - Fix image-classification-web links (#4536) @laggui - fix: replace ValidStep with InferenceStep in training.md (#4620) @TsaoLun ## Enhancements - Add `module.train()` to move a module back to the autodiff backend (#3975) @laggui - Perf/fusion/reduce broadcasted (#4338) @nathanielsimard - feat: Enable 64-bit indexing for kernels (#4502) @wingertge - Refactor/device handle (#4593) @nathanielsimard - All reduce backward (#4650 #4873) @Charles23R - Perf/burn fusion overhead (#4645) @nathanielsimard - Device service usage (#4839) @nathanielsimard ### Refactoring - Add `Scalar` runtime literal (#4337) @laggui - Move ONNX crates to burn-onnx repository (#4393) @antimora - chore: Update cubecl to runtime config refactor (#4489) @wingertge - chore: deprecate burn-candle backend (#4416) @antimora - Move ONNX import to `burn-onnx` crate (#4361) @laggui - [Breaking] perf: Make backing storage of `Shape` more flexible (#4516) @wingertge - refactor: Move from `CubeOption` to `Option` (#4543) @wingertge - [Breaking] refactor: Metadata type/strides refactor (#4534) @wingertge - Use shape in `TensorData` (#4603) @laggui - refactor: Vector size generic (#4624) @wingertge - refactor: View launch (#4639) @wingertge - Refactor backend tests to set device settings at initialization + use `Dispatch` (#4666) @laggui - Prep for Group Multi Optimizers (#4818) @crutcher - Cleanup OptimizerAdaptor / GradAdaptor API. (#4822) @crutcher - Remove unused M param from SimpleOptimizerMapper. (#4823) @crutcher - Move tensor tests from burn-flex to burn-backend-tests (#4812) @antimora - Fusion all reduce + refactor collective (#4803) @Charles23R - Migrate benchmarks from burn-flex to burn-backend-tests (#4853) @antimora - Migrate default test backend from NdArray to Flex (#4854) @antimora - Update cubecl: refactor toml config, fix autotune priority and fix persistent memory pool reset (#4858) @nathanielsimard - Add burn-std::config runtime configuration with fusion logging and search optimization (#4864) @nathanielsimard - Update/cubecl to client (#4866) @Charles23R - Centralize internal burn-* deps in [workspace.dependencies] (#4876) @antimora - Remove optim::optim (#4924) @crutcher ### Miscellaneous - Update zip + time (#4468) @laggui - Update cubecl wgpu v28 (#4244) @laggui - [Breaking] Use `cache_dir()` instead of hardcoded `~/.cache` path (#4372) @antimora - Make `ElementComparison` optional for dtypes (#4255) @skewballfox - Performance tweaks to the lp_norm code. (#4318) @crutcher - ensure that tensor is owned on iter_dim call (#4309) @tzemanovic - Use NodeType to point to unimplemented node (#4334) @laggui - Bump burn version 0.21 (#4333) @laggui - feat(burn-store): add ModuleAdapter chaining (#4407) @huahuadeliaoliao - Replace Vec-based TransitionBuffer with tensor-backed storage (#4504) @arferreira - Optional Ordering for NdArrayElement (#4559) @skewballfox - Move `burn-nn` module name checks in `burn-store` adapter to the test section (#4580) @softmaximalist - Expose `BurnpackError` (#4585) @AdrianEddy - Add HalfPrecisionAdapter for F32/F16 mixed-precision storage (#4594) @antimora - Improve module derive + add `#[module(skip)]` attribute (#4618) @laggui - Fix SSIM float types to f32 (#4602) @softmaximalist - Fix function arg name inconsistencies (#4626) @softmaximalist - Make Param<T> Sync for parallel model inference (#4701) @antimora - Fix flaky initializer_normal_init test (#4766) @leohenon - Add Record<(R0,)> 1-Tuple (#4825) @crutcher - Display FlexDevice as Cpu (#4857) @antimora - Fix rustls-webpki audit (#4863) @laggui - Fix `PytorchReader` bugs to load legacy files correctly (#4897) @softmaximalist - Add Clone + 'static bounds to LrScheduler::Record and derive Clone for scheduler records (#4905) @crutcher - Add ParamId::try_deserialize() (#4881) @crutcher - Use gather_nd in RNN-T gather_loss (#4895) @antimora - Re-enable fusion f16 conv + bn regression tests (#4920) @laggui - rnnt.rs: Optimize extract_log_probs and init_alpha (#4922) @softmaximalist - Fix some test tolerances (#4926) @laggui **Full Changelog:** https://github.com/tracel-ai/burn/compare/v0.20.0...v0.21.0
## What's Changed * Node to Enum-based design for type-safe IR by @antimora in https://github.com/tracel-ai/burn/pull/4019 * Ignore number_prefix advisory from tokenizers by @laggui in https://github.com/tracel-ai/burn/pull/4037 * BUG: Fixed burn version by @Marc-AnthonyG in https://github.com/tracel-ai/burn/pull/4035 * Refactor/dtype cubecl by @nathanielsimard in https://github.com/tracel-ai/burn/pull/4032 * Fix parallel spelling error. by @crutcher in https://github.com/tracel-ai/burn/pull/4046 * Refactor MetricEntry by @Charles23R in https://github.com/tracel-ai/burn/pull/4031 * Bump actions/checkout from 5 to 6 by @dependabot[bot] in https://github.com/tracel-ai/burn/pull/4047 * Refactor of burn fusion and burn cubecl fusion by @nathanielsimard in https://github.com/tracel-ai/burn/pull/4044 * update cubecl by @louisfd in https://github.com/tracel-ai/burn/pull/4045 * Cleanup autodiff unused roots by @laggui in https://github.com/tracel-ai/burn/pull/4039 * Fix autotuner by @nathanielsimard in https://github.com/tracel-ai/burn/pull/4049 * Combined PRs by @github-actions[bot] in https://github.com/tracel-ai/burn/pull/4059 * Fix floating point norm test tolerance by @laggui in https://github.com/tracel-ai/burn/pull/4061 * Add support for yolo12x model variant check by @antimora in https://github.com/tracel-ai/burn/pull/4048 * Chore: Prepare pre-release 3 by @nathanielsimard in https://github.com/tracel-ai/burn/pull/4060
## What's Changed * Add ONNX control flow operators: `If`, `Loop`, and `Scan` by @antimora in https://github.com/tracel-ai/burn/pull/3936 * Fix fusion reduce local already registered as output by @laggui in https://github.com/tracel-ai/burn/pull/4014 * Silero VAD ONNX model verification by @antimora in https://github.com/tracel-ai/burn/pull/3999 * Feat/pinned memory staging by @nathanielsimard in https://github.com/tracel-ai/burn/pull/4016 * Refactor metric logger : epoch summary and multiple entries at once by @Charles23R in https://github.com/tracel-ai/burn/pull/4017 * Fix cuda mem error by @nathanielsimard in https://github.com/tracel-ai/burn/pull/4020 * Add GaussianNoise layer by @kul-sudo in https://github.com/tracel-ai/burn/pull/4022 * Fix remainder int by @laggui in https://github.com/tracel-ai/burn/pull/4015 * Feat/optim/distributed by @nathanielsimard in https://github.com/tracel-ai/burn/pull/4018 * Cleanup quantization strategy (CPU ref, ndarray only) by @laggui in https://github.com/tracel-ai/burn/pull/4023 * chore: remove repetitive words in comment by @black5box in https://github.com/tracel-ai/burn/pull/4029 * feat: Enable tuning specialized matmul by @wingertge in https://github.com/tracel-ai/burn/pull/4026
# Summary This release marks a significant step forward in performance, reliability, and optimization, ensuring a more robust and efficient system for our users. We've expanded our CI testing suite to address multi-threading, lazy evaluation, and async execution issues, ensuring robust performance across an increasing number of supported platforms. ## Matrix Multiplication Improvements Optimized matrix multiplication kernels with specialized implementations for: - Matrix-vector (mat@vec) - Vector-matrix (vec@mat) - Inner product - Outer product And enhanced flexibility in the matrix multiplication kernel generation engine, surpassing traditional GEMM (General Matrix Multiply) approaches. For more details, including performance benchmarks, check out our [state-of-the-art multiplatform matrix multiplication post](https://burn.dev/blog/sota-multiplatform-matmul/). ## Fusion Enhancements - Improved reliability and performance of Burn Fusion through advanced optimizations. - Added support for basic dead code elimination. - Introduced a new search engine that optimally reorders operations to maximize optimization opportunities, improving resilience to tensor operation ordering. ### Multi-Threading and Memory Management - Resolved critical multi-threading issues by adopting a new approach to support multiple concurrent streams. - Burn Fusion's lazy evaluation of registered operations across concurrent streams now places greater demands on memory management. To address this: - Implemented a robust memory leak test in our CI pipeline to verify the runtime's internal state, ensuring all handles and concurrent streams are properly cleaned up in all test cases. - Fixed bugs related to premature memory deallocation, enhancing memory management stability. ## CubeCL Config By default, CubeCL loads its configuration from a TOML file (`cubecl.toml` or `CubeCL.toml`) located in your current directory or any parent directory. If no configuration file is found, CubeCL falls back to sensible defaults. A typical `cubecl.toml` file might look like this: ```toml [profiling] logger = { level = "basic", stdout = true } [autotune] level = "balanced" logger = { level = "minimal", stdout = true } [compilation] logger = { level = "basic", file = "cubecl.log", append = true } ``` Each section configures a different aspect of CubeCL: - **profiling**: Controls performance profiling and logging. - **autotune**: Configures the autotuning system, which benchmarks and selects optimal kernel parameters. - **compilation**: Manages kernel compilation logging and cache. For more info, check out the [CubeCL book](https://burn.dev/books/cubecl/advanced-usage/config). As with previous releases, this version includes various bug fixes, many internal optimizations, and backend upgrades that reinforce the framework's performance and flexibility across platforms. # Changelog **Breaking:** the default stride(s) for pooling modules now match the kernel size instead of defaulting to strides of `1`. This will affect output shapes if strides were not explicitly set. <details open> <summary> <strong><code>MaxPool2dConfig</code></strong> </summary> <br /> ```diff let pool = MaxPool2dConfig::new(kernel_size) + .with_strides([1, 1]) .with_padding(PaddingConfig2d::Same) .init(); ``` </details> <details> <summary> <strong><code>MaxPool1dConfig</code></strong> </summary> <br /> ```diff let pool = MaxPool1dConfig::new(kernel_size) + .with_stride(1) .with_padding(PaddingConfig1d::Same) .init(); ``` </details> <details> <summary> <strong><code>AvgPool2dConfig</code></strong> </summary> <br /> ```diff let pool = AvgPool2dConfig::new(kernel_size) + .with_strides([1, 1]) .with_padding(PaddingConfig2d::Same) .init(); ``` </details> <details> <summary> <strong><code>AvgPool1dConfig</code></strong> </summary> <br /> ```diff let pool = AvgPool1dConfig::new(kernel_size) + .with_stride(1) .with_padding(PaddingConfig1d::Same) .init(); ``` </details> ## Module & Tensor - Add tensor `grid::meshgrid` (#3107 #3191) @crutcher - Add scalar tensor operations (#3127) @ArthurBrussee - Orthogonal initialization (#3109) @dymat - Support importing safetensors format (#2721) @wandbrandon @antimora - Add `burn::linalg` norms (#3131) @crutcher - Extract Linear.forward to nn::functional::linear (#3147) @crutcher - Base impl of matmul for Int tensor (#3201) @crutcher - (perf) generate_mask functions optimizations (#3203) @tafia - Add CosineEmbeddingLoss module and cosine_similarity function (#3207) @antimora - Tensor::slice_fill() (#3221 #3223) @crutcher - Base impl of `tensor.slice_dim(dim, range)` (#3235) @crutcher - Support shifting pre-computed RoPE values (#3275) @laggui - Improve RoPE partial shift case (#3290) @laggui - Add `tensor.roll()` and improve `AsIndex` (renamed `IndexConversion`) (#3281) @crutcher - [Breaking] Update pooling default strides to match kernel size (#3338) @lucianyao - Add `is_finite` tensor element wise op and fix `is_close/all_close` inf (#3341) @jonboh ## Backends - [Perf] Interpolate optimizations (#3077) @wingertge - [Perf] Slice assign (#3069) @wingertge - Add multi stage conv (#3105) @wingertge - [Perf] Convolution migration to NHWC (#3090) @wingertge - Merge different convolution dimensional kernels (#3115) @wingertge - Support reduce mixed precision accumulation w/ fusion (#3132) @nathanielsimard - Update remote backend (#3175) @Cielbird - Feat/autotune optional (#3188) @nathanielsimard - cubecl unit matmul (#3214) @louisfd - Update CubeCL for client based profiling (#3222) @ArthurBrussee - Update cubecl unit matmul double buffered (#3233) @louisfd - Burn-remote to_device function (#3189) @Cielbird - Add Drop operation for fusion (#3263) @nathanielsimard - Lazy tensor downloading in burn-remote (#3276) @Cielbird - Improve specialized matmul (#3304) @louisfd - Add autotune priority (#3347 #3378) @nathanielsimard - Fix local tuner deadlock (#3384) @nathanielsimard - Fix fusion wasm unsafe input (#3385 #3386) @nathanielsimard ### Bug Fixes - Fix WASM deadlock by really properly not capturing locks (#3123) @ArthurBrussee - Fix burn-cubecl with autotune disabled (#3141) @wingertge - Fix fusion multiple reshapes (#3220) @nathanielsimard - Fix/fusion multiple streams (#3297) @nathanielsimard - Fix gather broadcasted indices in kernel impl and fusion (#3337) @laggui - Fix rand interval (#3321) @laggui - Restrict binary op lhs/rhs alias (#3349) @laggui - Fix sum fallback when atomic add is not supported (#3369) @laggui ## Documentation & Examples - Update pytorch-model.md with a new troubleshooting help (#3081) @antimora - Contributor example instructions (#3153) @AshAnand34 - Update README.md with DeepWiki badge (#3192) @antimora - Add recursion_limit macro to getting started exemples code (#3238) @Marc-AnthonyG - KaTeX for Mathematical expressions in docstrings (#3278) @BhavyeMathur - Add Metal backend support to custom-image-dataset (#3335 #3354) @TsaoLun - Add link to license in README badge (#3356) @Olexandr88 ### Fixes - Fix typo in Burn Book (#3113) @danny-burrows - fix typos (#3186) @omahs - Fix Typos in Documentation Comments (#3280) @leopardracer - Fix typo in code documentation for BurnGraph codegen (#3286) @kilavvy - Fix error messages from tensor checks for flatten (#3319) @NoVegetable - Fix broken link to burn-tch (#3365) @dbdr - Update documentation description for nonzero and nonzero_async (#3368) @catch-twenty-two ## ONNX Support - ONNX Import: switch to rank inferencing, rename shape to static_shape, decouple tensor shape info (#3037) @antimora - Restrict ONNX opset to 16 and up (#3051) @antimora - Allow Shape input type for Slice operation (#3092) @antimora - Support onnx and, or & xor nodes (#3173) @tye-singwa - Add support ONNX instance norm (#3177) @tye-singwa - Onnx ceil & round (#3225) @tye-singwa - Add support onnx group norm (#3245) @tye-singwa - Add onnx SpaceToDepth / DepthToSpace (#3277) @tye-singwa - Fix onnx topological sort check (#3284) @tye-singwa - Add onnx ArgMin node (#3285) @tye-singwa - Add support onnx size (#3301) @tye-singwa - Support flexible backend selection for import tests (#3372 #3380) @lucianyao - Fix ONNX node name sanitization and allow ai.onnx.ml domain (#3371) @antimora ## Enhancements - Replace some powf->powi (#3152) @ArthurBrussee - Improve fusion compilation speed (#3155) @nathanielsimard - Perf/remove repeat dim (#3183) @nathanielsimard - Perf: Fusion search for composed optimization (#3258) @nathanielsimard - Improve matmul selector (#3307 #3343 #3350 #3376) @nathanielsimard ### Refactoring - Refactor CubeCL slices (#3104) @nathanielsimard - CubeCL init refactor (#3128) @nathanielsimard - Refactor narrow, chunk and split (#3137) @laggui - Refactor quantization scheme (#3042) @maxtremblay - Migrated prng (random) to CubeCL (#3165 #3170) @Cielbird - Break down `test_onnx.rs` into test subdirectories (#3144) @antimora - Refactor: Move op_configuration.rs from burn-import to onnx-ir (#3126) @antimora - Fix relative cmp + debug tools (#3197) @nathanielsimard - Refactor cubecl line size matmul (#3219) @louisfd - Absolute tolerance is too tight for strict/balanced/permissive (#3242) @laggui - Fix clippy rust 1.88 and cargo run checks usage (#3325 #3320) @laggui - Remove hip os cfg flags (#3336) @laggui - Update cubecl matmul refactor / docs (#3366) @louisfd ### Miscellaneous - Fix conv2d test tolerance & disable crates cache on stable linux-std runner (#3114) @laggui - Replace run-checks scripts with command alias (#3118) @laggui - Relax tolerance transformer autoregressive test (ndarray failure) (#3143) @crutcher - Add cubecl.toml config (#3150) @nathanielsimard - Use `CUBECL_DEBUG_OPTION=profile` macos ci (#3164) @laggui - Update cubecl: sync_cube (#3163) @louisfd - Fix autotune recursive (#3161) @nathanielsimard - Bump zip dependency (#3199) @swfsql - Import `derive_new::new` for `safetensors` feat (#3205) @swfsql - Add CUDA, Vulkan and WGPU on-demand self-hosted runners (#3190 #3215 #3334 #3348 #3351 #3352) @syl20bnr - Fix: size_of import in quantization tests (#3195) @louisfd - burn-dataset: Catch import.py unsuccessful exits (#3236) @drozdziak1 - Adding image dimensions to ImageDatasetItem (#3251) @catch-twenty-two - burn-dataset: Make virtualenv optional when running importer.py (#3255) @drozdziak1 - Fix cubecl std usage (#3306) @laggui - Fix tui legend label placement (#3327) @BenFradet - Move blanket `Adaptor` impl to metrics base (#3346) @dbdr - Make metric order consistent in summaries (#3353) @dbdr - Fix cubecl `normal_respects_68_95_99_rule` (#3377) @laggui - Bump deps (#3367) @ArthurBrussee - Fix fusion rollback, disable autotune checks and other CI issues (#3362) @laggui
# Summary This release brings major upgrades in performance and platform compatibility (most notably, a new `Metal` backend via WGPU passthrough). CubeCL now powers backends for `Cuda`, `Metal`, `Rocm`, `Vulkan` and `WebGpu`. Tensor operation fusion support has been greatly expanded to optimize element-wise, reductions and matmul operations. A new compilation cache and improved autotune cache speed up repeated runs by reusing precompiled binaries and tuned kernel configurations. Data parallel training now scales better across multiple GPUs with automatic batch assignment to each worker. A new tensor slice API offers a simpler, more intuitive way to index tensors. This version also comes with broad performance gains across tensor operations, especially for reductions, matmul, and convolutions. An initial implementation of quantized matmul is now available, with further quantization improvements planned in the future. As with previous releases, this includes various bug fixes, further optimizations and enhanced documentation. Be sure to check out the new [**burn-bench**](https://github.com/tracel-ai/burn-bench) to compare performance across different versions, hardware and backends. # CubeCL Backends Burn supports `Cuda`, `Rocm`, `Vulkan`, `WebGpu`, and the newly added `Metal` backend. Each backend can be used through their respective type aliases, provided that the appropriate backend feature flag is also enabled. <details open> <summary> <strong><code>Metal</code></strong> </summary> <br /> ```toml burn = { version = "0.17.0", features = ["metal"] } ``` ```rust use burn::prelude::*; use burn::backend::wgpu::{Metal, WgpuDevice}; let tensor = Tensor::<Metal, 2>::zeros([2, 4], &WgpuDevice::default()); ``` </details> <details> <summary> <strong><code>Cuda</code></strong> </summary> <br /> ```toml burn = { version = "0.17.0", features = ["cuda"] } ``` ```rust use burn::prelude::*; use burn::backend::cuda::{Cuda, CudaDevice}; let tensor = Tensor::<Cuda, 2>::zeros([2, 4], &CudaDevice::default()); ``` </details> <details> <summary> <strong><code>Rocm</code></strong> </summary> <br /> ```toml burn = { version = "0.17.0", features = ["rocm"] } ``` ```rust use burn::prelude::*; use burn::backend::rocm::{Rocm, HipDevice}; let tensor = Tensor::<Rocm, 2>::zeros([2, 4], &HipDevice::default()); ``` </details> <details> <summary> <strong><code>Vulkan</code></strong> </summary> <br /> ```toml burn = { version = "0.17.0", features = ["vulkan"] } ``` ```rust use burn::prelude::*; use burn::backend::wgpu::{Vulkan, WgpuDevice}; let tensor = Tensor::<Vulkan, 2>::zeros([2, 4], &WgpuDevice::default()); ``` </details> <details> <summary> <strong><code>WebGpu</code></strong> </summary> <br /> ```toml burn = { version = "0.17.0", features = ["webgpu"] } ``` ```rust use burn::prelude::*; use burn::backend::wgpu::{WebGpu, WgpuDevice}; let tensor = Tensor::<WebGpu, 2>::zeros([2, 4], &WgpuDevice::default()); ``` </details> <br /> > [!WARNING] > When using one of the `wgpu` backends, you may encounter compilation errors related to recursive type evaluation. This is due to complex type nesting within the `wgpu` dependency chain. > To resolve this issue, add the following line at the top of your `main.rs` or `lib.rs` file: > ```rust > #![recursion_limit = "256"] > ``` > The default recursion limit (128) is often just below the required depth (typically 130-150) due to deeply nested associated types and trait bounds. # Data Loader and Batcher The `Batcher` trait has been updated to improve multi-device support. Previously, batcher implementations stored a device internally, which could lead to all data being loaded on the same device. The latest changes have the `DataLoader` generic over the backend, while the device is passed explicitly: ```diff -impl<B: Backend> Batcher<MyItem, MyBatch<B>> for MyBatcher<B> { +impl<B: Backend> Batcher<B, MyItem, MyBatch<B>> for MyBatcher { - fn batch(&self, items: Vec<MyItem>) -> MyBatch<B> { + fn batch(&self, items: Vec<MyItem>, device: &B::Device) -> MyBatch<B> { // The correct `device` is already provided for the batching logic to use } } ``` The device can now be set when building a data loader: ```diff let dataloader = DataLoaderBuilder::new(batcher) .batch_size(batch_size) .shuffle(seed) .num_workers(num_workers) + .set_device(device) .build(dataset); ``` This step is not required for the `Learner`, which handles the device configuration automatically. # Better Tensor Slicing & Indexing Tensor slicing now fully adopts idiomatic Rust range syntax, replacing the older `(i64, i64)` and Option tuple forms. For example: ```diff let tensor = Tensor::<B, 2>::zeros([m, n], &device); -let slice = tensor.slice([(0, -1), (0, -2)]); +let slice = tensor.slice([0..-1, 0..-2]); ``` For more complex or mixed range types, use the `s![]` macro: ```diff let tensor = Tensor::<B, 3>::zeros([b, s, d], &device); -let slice = tensor.slice([None, Some((t as i64, t as i64 + 1)), None]); +let slice = tensor.slice(s![.., t..t + 1, ..]); ``` The macro is inspired by [ndarray's s![]](https://docs.rs/ndarray/latest/ndarray/macro.s.html) (at least, by name) and helps build flexible slice patterns. ```rust use burn::prelude::*; let tensor = Tensor::<B, 4>::zeros([8, 4, 2, 3], &device); let slice = tensor.slice(s![..=4, 0..=3, .., -1]); assert_eq!(slice.dims(), [5, 4, 2, 1]); ``` # Changelog ## Module & Tensor - Feature add new one hot function meeting multi-dimensions (ranks) (#2613) @tiruka - Expand GRU support (#2704) @nwhitehead - feat: bitwise-ops-for-tensors (#2498) @quinton11 - Feat: Add PoissonNLL loss (#2765) @salvomcl - Add metric parametrized name (#2808) @laggui - Add boolean and/or to bool tensors (#2802) @wingertge - Add ATOL/RTOL defaults (#2824) @crutcher - Feat: Add tan trig function (#2854) @Msa360 - Refactor quantization schemes (#2849 #3036) @laggui @maxtremblay - Vectorize pooling for optimization (#2905) @wingertge - Feat: Add Cosh and Sinh (#2959) @Msa360 - Refactor in-memory recorder load args (#2892) @BjornTheProgrammer - Improve gradient checkpointing (#2997) @nathanielsimard - Optimize minmax (#3009) @nathanielsimard - Improve `tensor.slice(...)` to support multiple range types (#3061) @laggui ### Bug Fixes - Fix bce loss log (#2741) @laggui - Fix repeat_dim backward w/ dim size > 1 (#2777) @laggui - [Fix] `tch` upgrade (#2834) @wingertge - Check channels_in matches in convolution layers (#2944) @chlobes - Fixed GroupNorm implementation (#2945) @computer-whisperer ## Backends - Migrate to type magic autotune (#2710) @wingertge - Feat/fused matmul tune (#2726) @nathanielsimard - Feat/shared sum (#2737) @maxtremblay - Improve fusion for broadcasting, mix vectorization and reshape operation (#2773 #2833) @nathanielsimard - Fuse gather (#2793) @nathanielsimard - Feat/fuse select (#2797 #2804 #2903) @nathanielsimard - Remove from_data conversions in backends (#2783) @laggui - Feat fuse swap dims (#2801 #2877) @nathanielsimard - [Feature] reduce fuse on read (#2870) @nathanielsimard - [Feat] SIMD acceleration for ndarray backend (#2851) @wingertge - Perf/reduce fuse on write (#2937) @nathanielsimard - [metal] Add CubeCL metal compiler support (#2993) @syl20bnr - Compilation Cache (#3020) @nathanielsimard - Cubecl quantize matmul (#3022 #3030) @maxtremblay ### Bug Fixes - Fix from data fusion (#2735 #2778) @laggui @nathanielsimard - Fix constant creation in fusion to cast at compile time, not runtime (#2782) @wingertge - Fix two autotune issues on wasm (#2899) @ArthurBrussee - Fix/reduce out of bounds (#2906) @nathanielsimard - Fix fusion bug (#3031) @nathanielsimard - Fix metal backend name (#3040) @nathanielsimard - Fix matmul dynamic line size support (#3056) @nathanielsimard - Fix: matmul lower precision / flex32 (#3059) @nathanielsimard - Fix/autotune cache conflicts (#3070) @nathanielsimard ## Documentation & Examples - Wasserstein Generative Adversarial Network (#2660) @wangjiawen2013 - Add modern lstm (#2752) @wangjiawen2013 - Improve tensor docs (#2951) @PtiLuky ### Fixes - chore: fix some comments (#2717) @sunxunle - Add hardsigmoid formula and fix WGAN doc + default lr (#2706) @laggui - Fix db-pedia-infer backend (#2736) @laggui - Fixed typo in the burn book chapter advanced unit no-std. (#2731) @xmy314 - typo - correct `smp_serde` to `rmp_serde` as per crate's name in url (#2744) @cameronbraid - typo - missing `tick` which was breaking formatting (#2745) @cameronbraid - Remove autodiff from generate (#2759) @laggui - Remove empty format precision specifier (#2785) @hkBst - Update tch instructions (#2844 #2976) @laggui - Fix from_embedded and bool ops docs (#2848) @laggui - Fix tiny typo in mathematical expression (#2867) @janhohenheim - Fix typos (#2927) @crutcher - Fix/web example (#2954 #2978) @laggui - Fix: burn-book getting-started Use Declarations (#2966) @jerryshell - chore: fix comment (#3008) @tsinghuacoder ## ONNX Support - Code generation bug fix for ONNX import (#2708) @antimora - Floor Node (#2792) @akshitgaur2005 - One hot ONNX (#2784) @akshitgaur2005 - Onnx op topk (#2305) @oojo12 - Fix output elem type for `unsqueeze` and `reshape` (#2807) @christeefy - Feat/Split ONNX Import (#2568) @agelas - Refactor GatherNode to support scalar outputs. (#2828) @loloxwg - Rename dim to rank for ONNX import (#2831) @antimora - Add rank inference for tan (#2868) @Msa360 - Add Gemm (#2841) @akshitgaur2005 - Fix RandomNormalLike ONNX node output rank (#2936) @Knight-Ops - Support multiple outputs being tracked in BurnGraph during ONNX conversion (#2938) @Knight-Ops - Ignore ONNX optional node inputs/outputs (#2935) @Knight-Ops - Fix ONNX flatten to match spec (#2940) @catch-twenty-two - burn-import: add some tests for ConstantNode (#2623) @jameshiew @laggui - Update SUPPORTED-ONNX-OPS.md with the latest info (#3064) @antimora ## Enhancements - Add new burn-vision crate (#2753 #2810 #2842) @wingertge - Improve Burn compilation times (#2815 #2994) @nathanielsimard - Support training in no-std (#2830) @ivila - Perf: Speed up element and TensorData conversion (#2913) @wingertge - Feat/cubecl caching (#2902) @nathanielsimard - Improve multi-device data loading strategy (#2890 #3035) @laggui - Autotune level matmul double buffering (#2988) @nathanielsimard @louisfd ### Refactoring - Remove deprecated Data and DataSerialize (#2703) @laggui - Clean up train system metrics (#2707) @laggui - Move IR to its own crate (#2796 #2798) @laggui - Refactor burn jit => burn-cubecl (#2809) @nathanielsimard - Cleanup Tensor Registry in fusion (#2826) @nathanielsimard - Migrate conv2d to cubecl (#2908 #3018) @wingertge - Update to edition 2024 (#2931) @laggui - Update runtime names (#2909) @nathanielsimard - Migrate backend comparison (#2961) @laggui - Improve test tolerance assertions (#3024) @maxtremblay @laggui - [hip] Move burn-hip to burn-rocm and rename backend to ROCm (#3062) @syl20bnr ### Miscellaneous - Fix no default features flags + update cubecl (#2725) @laggui - Replace return with terminate (#2742) @maxtremblay - Clean up -jit suffix in feature flags and modules (#2705) @laggui - Fix types under autotune flag (#2750) @laggui - Fix BackendValues in backend-comparison after removal of jit suffix (#2756) @syl20bnr - Update cubecl (#2764) @wingertge - Fix optional burn-import dep + impl module types for isize (#2774) @laggui - Update cubecl with fix to shared_sum (#2779) @maxtremblay - feat: using rustls instead of native-tls (#2799) @ShoofLLC - bump cubecl version with dummy implementations (#2814) @maxtremblay - Add data_dir optional argument to Huggingface DataLoader to enable some manual download use cases (#2817) @Pablo1785 - Bump xtask to 1.1.9 (#2896) @syl20bnr - Fix test checks for macos (#2952) @PtiLuky - Update cargo deps (#2962) @Brooooooklyn - Add train end event (#2967) @laggui - Update cubecl bitcast -> reinterpret (#2985) @maxtremblay - Update cubecl (#2869 #2888 #2990 #2996) @louisfd - Update wgpu to v25 (#3007) @syl20bnr - update cubecl: sync full cyclic checked (#3025) @louisfd - Fix autotune measurement (#3043) @nathanielsimard
## Fixes / Improvements - Update bincode dependency (fixes #2876) @laggui - Fix TUI renderer display summary (#2967) @laggui
# Summary This release significantly enhances GPU utilization through a new tensor transaction mechanism for batched sync operations and simultaneous reads of multiple bindings for CubeCL runtimes. It also includes multiple performance optimizations like mixed precision support for matrix multiplication and convolution operations, as well as notable GEMM improvements. Backend capabilities have been expanded with a new remote backend for distributed computing, improved SPIR-V support, custom operations fusion and an experimental fused matrix multiplication. Training components have been expanded to support semantic segmentation and object detection datasets, new training metrics and improved training performance thanks to an async metric processor. As with previous releases, this version includes various bug fixes, further performance optimizations, new tensor operations and enhanced documentation. # Module & Tensor - Add warning in docstring for indices bound checks (#2462) @laggui - Add `remainder` op for tensor (#2427) @med1844 - Add float cast tensor op (#2483 #2511 #2538 #2586 #2671) @laggui - Add step learning rate scheduler (#2423) @towerpark - Add tensor split operator (#2490) @agelas - Add tensor transaction mechanism to batch multiple sync operations (#2521) @nathanielsimard - [Breaking] Make .init() method of LR schedulers return Result (#2527) @towerpark - Make optimizer state public (#2561) @ArthurBrussee - Accept function pointer or closure for freq scaling (#2634) @laggui - Change pad value w/ ElementConversion (#2653) @laggui - Add checks for even padding when kernel size is even (#2677) @laggui ## Bug Fixes - Fix unsqueeze dims with multiple trailing negative indices (#2496) @laggui - Fix one_hot implementation for Int Tensors (#2501) @maun - Fix tensor prod and prod dim containing nan values (#2515) @quinton11 - Expose ItemLazy to be able to implement for custom types (#2525) @laggui - Check nonzero stride, dilation and groups (#2540) @laggui - Module derive types should inherit visibility (#2610) @laggui - Add dropout prob check (#2695) @laggui # Backends - Add remote Backend (#2463) @nathanielsimard - Add support for custom operations fusion (#2486) @ArthurBrussee - [Breaking] Remove precision bridge (#2538) @laggui - Add fused matmul under fusion experimental feature flag (#2622 #2690) @nathanielsimard ## Bug Fixes - Prevent various OOB accesses and discontiguous buffer bugs (#2467) @wingertge - Fix autodiff memory management by verifying parent nodes' existence (#2488) @jnamika - Fix burn remote deadlock + burn fusion draining (#2492) @nathanielsimard - Remove dtype rewrite (#2528) @ArthurBrussee - Fix reduce autotune key no anchor (#2696) @nathanielsimard # Documentation & Examples - Add wgpu-spirv and hip-jit features to text-classification example (#2422) @syl20bnr - Add tensor basic ops examples (#2468) @quinton11 - Add segmentation mask to burn book (#2495) @anthonytorlucci - Add numeric tensor examples (#2514) @quinton11 - Add module mapper book examples (#2621 #2632) @laggui ## Fixes - Fix output dim in embedding nn docstring (#2452) @getumen - Fix tri mask ops return docstring (#2517) @laggui - Fix the incorrect link in contributor-books (#2583) @tiruka - Fix the broken WGSL link in the README (#2607) @korbexmachina - Fix module visitor and mapper trait definition in the book (#2609) @laggui - Fix load_file usage to keep using model (#2672) @laggui - Don't mention a fixed candle bug (#2689) @kitterion # ONNX Support - Format all type names (#2436) @samolego - Add ONNX op Random Normal Like (#2441) @tiruka - Add ONNX op Random Uniform Like (#2448) @tiruka - Infer convolution kernel shape from weight (#2544) @laggui # Enhancements - Improve ndarray tensor creation from memory (#2439) @nathanielsimard - Dont attempt naive reduction when reduce_dim is too high (#2414) @ArthurBrussee - Add more type support for burn-jit (#2454) @wingertge - Rewrite legacy `cpa` kernels (#2455) @wingertge - Implicit GEMM optimizations/bug fixes (#2499) @wingertge - Add custom NCHW to NHWC kernel for implicit GEMM (optimization) (#2530) @wingertge - Support 8-bit bool for JitBackend (#2526) @wingertge - Implicit gemm rewrite optimization (#2545) @wingertge - Fix autotune error handling (#2670) @nathanielsimard - Use float intrinsics for deform_conv2d backward, fix into_data for padded tensors (#2681) @wingertge ## Refactoring - Migrate to `cubecl` IR refactor (#2418) @wingertge - DefaultDevice should be an alias of BestAvailable (#2443) @ArthurBrussee - Replace crates by dependi (#2477) @vincentmasse - Refactor quantization tensor data representation (#2479) @laggui - Use alias for more consistent typing (#2497) @loganbnielsen - Add `QTensorOps` docs + refactor tests to simplify inputs (#2557) @laggui - Update for rust 1.83 (#2562 #2605) @laggui - Matmul + CubeCL Update (#2551) @nathanielsimard - Migrate matmul autotune to macro and fix accelerated (#2584) @wingertge - Refactor jit quantized tensor representation (#2604) @laggui - [Breaking] Fix alignment issue of TensorData bytes (#2416) @WorldSEnder - Refactor quantized bytes representation (#2627) @laggui - Update to new cubecl with improved compilation times (#2654) @nathanielsimard - Refactor unary + binary kernels (#2665) @nathanielsimard - Import code from github-device-flow crate for burnbench (#2667) @syl20bnr - Fix web examples and conflicting feature flags w/ `default-features = false` (#2691) @laggui - Use cubecl reduce w/ autotune (#2673) @maxtremblay ## Miscellaneous - Use core::error::Error for no-std (#2346) @antimora - Update deny.toml to follow the spec changes of cargo-deny (#2408) @tiruka - Add segmentation mask to ImageFolderDataset (#2426) @anthonytorlucci - Add ROC AUC metric (#2466) @vincentmasse - Async Processor: run train metrics & dashboard on another thread (#2482) @nathanielsimard - Add precision classification metric (#2293) @tsanona - Add test int one_hot and change ops docs in the book (#2519) @tsanona - Add option to request manual quit on tui (#2489) @vincentmasse - Reduce log spam (#2556) @ArthurBrussee - Add `ImageDatasetItem` image path field (#2558) @wangjiawen2013 - Fix xtask command with last version (#2566 #2582) @syl20bnr - Remove duplicate jit conv2d test (#2581) @tiruka - Relax Fn requirements for param map (#2620) @ArthurBrussee - Extend ImageFolderDataset to support import of COCO detection (#2612) @jin-eld - Add recall metric (#2518) @tsanona - Propagate audio feature flag (#2633) @laggui - Add F-score metric (#2648) @tsanona - Implement benchmark for reduce kernel (#2692) @maxtremblay
# Summary This release brings major performance improvements to tensor operations, particularly in matrix multiplication and convolution, along with experimental ROCm/HIP and SPIR-V support enabled by CubeCL runtimes. It also introduces foundational features for multi-backend compatibility and adds new quantization operations. Support for ONNX models has been expanded, with additional operators and bug fixes for better operator coverage. As with previous releases, this version includes various bug fixes, further performance optimizations, new tensor operations, and enhanced documentation. # Module & Tensor - Remove copy restriction for const generic modules (#2222) @laggui - Add deform_conv2d as implemented in torchvision (#2147) @wingertge - Add dim checks on output rank for unsqueeze and stack (#2331) @laggui - Add Softmin (#2358) @NoahSchiro - Add `round`, `floor`, `ceil` for float tensor (#2372) @med1844 - Make tensor sync (#2392) @kingwingfly - Add `tensor.one_hot` int operation (#2413) @tsanona - [Breaking] Change LR schedulers to return the initial LR at first `.step()` (#2337) @towerpark - Move LrSchedule generic to make it easier to use (#2309) @ArthurBrussee - Add quantization ops default implementation (#2125 #2275 2301) @laggui ## Bug Fixes - Avoid 0 denominator in interpolate frac (#2224) @laggui - Nonzero should return an empty vec for zero tensors (#2212) @laggui - Change ndarray mask_where implementation to correctly deal with NaNs (#2272) @laggui - Fix mask_where broadcasted input (#2381) @laggui - Make powf broadcastable (#2398) @laggui # Backends - Add candle `CudaDevice` and `MetalDevice` to avoid creating a new unique device each time (#2290) @laggui - Add fusion mix precision (#2247) @nathanielsimard - Add SPIR-V compiler backend to `burn-wgpu` (#2386) @wingertge - Add burn-hip (#2399) @syl20bnr - Add `BackendRouter` to handle multiple backends on the way to distributed (#2353 #2419) @laggui ## Bug Fixes - Fix autodiff memory leak (#2347) @nathanielsimard - Fix autodiff abs NaN when output is 0 (#2249) @AsherJingkongChen # Documentation & Examples - Add documentation for custom `cubecl` kernels, update some outdated docs (#2404) @wingertge - Add comments to burn fusion (#2130) @cBournhonesque - Improve doc for burn-tch (#2288) @kingwingfly - Improve regression example (#2405) @laggui - Create CITATION.cff (#2231) @antimora - Enable doc_auto_cfg to show feature-req-hint in docs.rs (#2271) @kingwingfly ## Fixes - Fix tensor data elem type conversion in book (#2211) @laggui - Fix target convert in batcher and align guide imports (#2215) @laggui - Fix huber loss documentation (#2232) @kingwingfly - Fix debugger settings doc in contributor book (#2223) @tiruka - Fixed raspberry pi pico example not compiling (#2220) @BjornTheProgrammer - Fixed path in book (#2262) @mehmetalianil - Fix unresolved import `regression` (#2285) @tiruka - Fix burn book links (#2303 #2327) @laggui @tiruka - Contributor Book: Fix the link of primitive types in the "Serialization" page (#2362) @towerpark - Fix simple regression batch targets (#2379) @wangjiawen2013 - Fix xtask args which are unmodified when upgrading xtask commands (#2364) @tiruka # ONNX Support - Add gather support for multi-dim indices (rank > 1) (#2199) @alteredoxide - Allow onnx-import expand op with non-const shapes (#2189) @hexd0t - Improve ONNX import tensor shape tracking (#2213) @hexd0t - Add missing output padding to conv transpose ONNX (#2216) @laggui - Fix ONNX where op for scalar inputs (#2218) @hexd0t - simplify scope tracking in burn-import (#2207) @skewballfox - Add onnx op trilu (#2323) @tiruka - Add ConvTranspose1d ONNX op (#2349) @tiruka # Enhancements - Improve slice kernel performance (#2252) @nathanielsimard - Fix burn-jit conv2d excessive loop unrolling (#2263) @AsherJingkongChen - Introduce autotuning to `conv2d` and `conv_transpose2d` with a new `im2col`/`GEMM` algorithm (#2287) @wingertge - Further data locality optimizations for implicit GEMM (#2300) @wingertge - Add utility methods to split gradients to GradientParams (#2311) @ArthurBrussee - Add bounds checking to implicit GEMM to allow arbitrary input shapes (#2354) @wingertge - Initialize accumulator to bias for implicit GEMM to save an expensive `float_add` (#2383) @wingertge ## Refactoring - Select kernel from CPA to CubeCL (#2168) @mepatrick73 - Migrate cubecl macro (#2266) @wingertge - Remove primitves const D generic (#2298) @laggui - Refactor elemwise fusion (#2344) @nathanielsimard - Refactor Adaptive Avg Pool to CubeCL (#2351) @nathanielsimard - Refactor pooling kernels (#2356) @nathanielsimard - Refactor burn-tensor: Split conv backward ops to allow conditional gradient computation (#2278) @AsherJingkongChen ## Miscellaneous - Fix panic messages being invisible in tui mode (#2226) @PaulWagener - Refactor xtask to use tracel-xtask and refactor CI workflow (#2063) @syl20bnr - Automatic minimum rust version in README (#2227) @syl20bnr - Set MSRV to 1.81 (#2388) @nathanielsimard - Don't panic when the progress is > 1.0 (#2229) @PaulWagener - Fix compile for dataset crate with vision feature (#2228) @PaulWagener - Update CI workflow for last version of setup-linux action (#2248) @syl20bnr - [CI] Fix llvmpipe, lavapipe install for valgrind and vulnerabilities (#2264) @syl20bnr - Use CliMetricsRenderer when not in a terminal (#2307) @lancelet - Update rusqlite and associated libraries (#2328) @paulirotta - Fix missing fusion feature flag @nathanielsimard - Move conv autotune under feature flag (except key) (#2330) @laggui - Add should_run for convs instead of panicking (#2403) @ArthurBrussee - Make changes for latest ratatui version (#2421) @laggui - Add Windows/WindowsIterator/WindowsDataset (#2338) @NicoZweifel