26 Commits

Author SHA1 Message Date
Guillaume Lagrange
e18a3c2e30 refactor(backends)!: remove associated element types & replace with device defaults (#5000)
* Remove multi backend router

* Remove associated element types; replaced by device defaults

* Fix wgpu devices

* Fix burn-store

* Fix cubecl backend extensions + device configs

* Missing fixes

* Fix clippy

* Fix wgpu backend feature gate in dispatch

* Fix wgpu/vulkan features for xtask tests

* Fix merge
2026-05-25 09:04:44 -04:00
Nathaniel Simard
8037309704 perf(core)!: improve compile times via opaque inner types to break dependency chain (#4977)
* Initial commit

* Improve compilation time

* Refactor device

* Device blob

* Improvements

* Autodiff fix

* Burn-std no cubecl dep

* WIP

* Autodiff

* Sanitize outside of generic

* Fix display compilation

* Clippy

* Improve device selection

* WIP

* Fix examples wip

* Fix fmt

* Cleanup

* Fmt

* Fix clippy

* Fix autodiff

* Fix test device

* Fix docs

* Fix tests

* Fmt

* Fix display

* Miri fix

* Improve comments

* Fix device

* Fix docs
2026-05-21 14:08:30 -04:00
Guillaume Lagrange
73b72bc92a refactor(extension): feature gate Tensor::from/into_primitive and add from/into_bridge w/ TensorKindId validation (#4961)
* Dispatch default_backend should not be enabled for wgpu_only

* Add extension feature with from/into primitive

* Fix usage in test

* Fix doc
2026-05-15 16:29:55 -04:00
Guillaume Lagrange
d30a82ae78 refactor(tensor): add BridgeTensor to bridge high-level tensor API with dispatch (#4958)
* Replace tensor primitive type

* Fix into_scalar calls

* Fix clippy

* Fix unused + bounds

* Fix extensions

* Rename to BridgeTensor

* Cargo fmt
2026-05-15 10:59:33 -04:00
Guillaume Lagrange
27964e0160 Refactor tensor kind traits (#4957)
* Remove generics from tensor kind traits and Elem associated type

* Move backend extension, re-export no types from burn_backend and fix into_scalar missing types

* Remove into/from primitive usage in burn-optim

* Fix backtrace

* Fix float_sort_with_indices int dtype

* Fix feature gated

* Remove dead code

* Add tensor primitive note

* Another note

* High level kind

* Working but still pub traits

* Fix into_scalar doc example

* Fix argsort out dtype

* Restrict ops traits to pub(crate)

* Add other backends for burn-vision
2026-05-14 14:02:44 -04:00
Nathaniel Simard
0c763dcd26 Refactor/isolate burn backend deps (#4954)
* Wip Tensor module moving

* WIP

* WIP

* Fix

* Fix dependencies

* Cleanup

* Fixes

* Fix docs

* Remove registered reference

* Fix refs

* set_default_dtypes is in burn-tensor

---------

Co-authored-by: Guillaume Lagrange <lagrange.guillaume.1@gmail.com>
2026-05-13 16:26:14 -04:00
Guillaume Lagrange
dbf03c516b [Breaking] Remove Tensor backend generic and add high-level Device struct (#4717)
* Remove backend generic from `Tensor` and add high-level `Device` struct

* Fix rfft

* WIP modules

* Cleanup flags

* Carry autodiff intent via checkpointing field

* Fix ctc loss test shape

* Fix imports

* Fix burn-collective & burn-communication

* Working core / nn / optim

* Removed from burn-rl

* Removed from burn-train

* Update lock

* Working mnist

* More examples

* Fix int/bool to_device with float AD device + add enumerate devices

* Working text-classification

* Fixed MultiGradientsParams usage + added gradient checkpointing to trainer

* Updated text-generation example

* Update comment

* Fix merge

* Remove backend generics from merge

* Update lock

* Remove from burn-store

* Fix burn-store dtype tests

* Remove circular dep to burn-tensor from burn-flex

* Cleanup

* Fix burn-store tests

* Fix seed

* Fix imports

* More examples

* Add `backend_extension` proc macro

* Working vision extension

* Missing merge changes

* More merge fixes

* tree

* Whoops

* Cleanup

* Not feature gated

* Fix wgpu kernel example

* Small change

* Update lock

* Cleanup

* Cargo fmt

* Clippy

* Remove burn-collective

* Cleanup

* Fix burn-store import

* Fallback to wgpu for workspace builds & blanket fusion impl

* Add `default_backend` fallback for burn-dispatch

* Gate unused var autodiff

* Fix no-std

* Refactor new tests

* Fix more tests

* Adjust ctc_loss backward f16 tolerance

* Fix test device for burn-core

* Fix test device

* Fix some docs

* Default to ndarray for now due to burn-flex CAS limitation

* Fix docs + ndarray default

* Add portable_atomic_util::Arc in burn-autodiff

* Add optim feature flag because it requires autodiff (fix no-std; not supported on all targets)

* Add Gradients high-level wrapper

* Fix types

* Fix test device

* Fix docs

* Fix burn-train auto merge

* Fix clippy

* WIP burn device override

* Fix dtype usage

* Remove test-metal

* Fix CI test flags

* Remove burn-train vision on metal

* Small note

* Missing metal feature for macos CI

* Fix docs

* Remove backend ops note

* Change set_default_dtypes to &mut self

* Fix mut device

* Fix burn-vision backend features

* Exclude burn-backend-tests from workspace tests (explicitly handled)
2026-05-13 10:03:12 -04:00
Dilshod Tadjibaev
9a0ba1d81c Centralize internal burn-* deps in [workspace.dependencies] (#4876)
Consumers now say `workspace = true` instead of repeating
`path = "../burn-X", version = "=0.21.0-pre.3"` 180+ times.

Workspace deps pin `default-features = false` because Cargo forbids
consumers from overriding `default-features` when inheriting. Consumers
that previously enabled defaults now opt in with `features = ["default"]`.
2026-04-27 08:13:24 -04:00
Genna Wingert
fce1a57211 refactor: Vector size generic (#4624) 2026-03-13 08:36:34 -04:00
Nathaniel Simard
3c6b710dca Refactor/device handle (#4593) 2026-03-11 18:46:49 -04:00
Genna Wingert
66733ae0eb refactor: Metadata type/strides refactor (#4534)
* Remove R::supported_line_sizes

* refactor: Metadata optimization

* Revert temp fix

* Rename `ShapeError` to `MetadataError`

* Cleanup

* Bump cubecl and cubek rev

* Fix doc test

* Bump cubecl rev
2026-02-19 10:07:37 -05:00
Florian Liao
51811d5563 chore: fix typos caught by xtask (#4406) 2026-01-30 07:38:12 -05:00
Genna Wingert
7b32614f16 refactor: Migrate to usize indexing (#4273)
* Migrate to `usize` indexing

* Fix merge

* Update cubecl

* Update cubek
2026-01-08 12:53:31 -05:00
Nathaniel Simard
19db09c968 Feat/error handling cubecl (#4076) 2025-11-27 11:05:09 -05:00
Nathaniel Simard
cc3ee1e0ef Chore/update dtypes (#3998) 2025-11-10 11:09:30 -05:00
Guillaume Lagrange
01912f80e2 Refactor Shape manipulations (#3845)
* Shape shape shape

* Add shape indexing/deref/as_slice...

* Add shape methods and refactor to use them

* Add shape cat + more refactor

* Add shape slice

* Cargo fmt

* More fmt

* Fix clippy

* Remove dead code

* Matmul output

* Remove comment
2025-10-09 09:37:17 -04:00
Nathaniel Simard
742e5ae1d1 Fix/autodiff/multi threads (#3793) 2025-10-03 11:38:46 -04:00
Crutcher Dunnavant
f5198e5e6f Chain lint inheritance [was: Disable new default clippy tests] (#3200) 2025-05-20 08:23:11 -04:00
Guillaume Lagrange
17e3167a70 Improve test tolerance assertions (#3024)
* wip new tolerance

* use the new assert_approx_eq

* fix or tag broken tests

* Fix more tests

* All tests pass cuda/wgpu

* Format

* Fix other modules tests tolerance

* Fix onnx import tolerances

* Remove broken comments

* Expected values are not defined with enough precision anyway

* Less strict tolerance for tch

* Fix docstring

* More tolerance

* Revert to 1e-1 abs (previous tolerance, probably set for tch)

* Tolerances againnnn

* Fix review

* relax some tolerances

---------

Co-authored-by: maxtremblay <t.maxime@pm.me>
2025-04-16 13:33:05 -04:00
Guillaume Lagrange
303a83e909 Update to edition 2024 (#2931)
* Upgrade to edition 2024

* Explicit unsafe

* Fix keywords and unnecessery ref modifiers

* Fix lifetime

* Update lock

* Cargo fmt

* Update CI prev
2025-03-20 10:28:51 -04:00
Nathaniel Simard
d9e41460ff Refactor burn jit => burn-cubecl (#2809) 2025-02-13 12:39:29 -05:00
nathaniel
3ed38cfcb9 Rename crate 2025-02-13 11:59:09 -05:00
Maxime Tremblay
29c383b87d Replace return with terminate (#2742)
* replace return with terminate

* bump cubecl

* cargo fmt
2025-01-27 09:57:28 -05:00
Genna Wingert
42e7c1f225 [Feat] 8-bit bool for JitBackend (#2526) 2024-11-29 09:21:13 -05:00
Guillaume Lagrange
9a2b841665 Add float cast op for JIT backend (#2511)
* Fix backend FloatElem docstring

* Remove elem type generic from JitTensor (float ops still using default dtype)

* Use execute_with_dtype macro for float ops

* Add cast for fusion

* Add warning for type promotion

* Add cast to backend router

* Add Primitive trait to correctly display the tensor dtype

* Fix primtiive associated type

* Fix jit bool tensor display

* Fix CI

* Fix clippy

* Whoops

* Fix candle bool tensor display

* Add shape to primitive trait

* Add primitive tests

* Rename trait to TensorMetadata

* Add missing changes to example

* Fix split from merge
2024-11-21 13:19:33 -05:00
Genna Wingert
d5e8e3185c Add documentation for custom cubecl kernels, update some outdated docs (#2404) 2024-10-25 13:22:23 -04:00