Skip to content

Commit 774ac0d

Browse files
Made compatible with thumbv6m-none-eabi
1 parent d770b1f commit 774ac0d

File tree

16 files changed

+5623
-18
lines changed

16 files changed

+5623
-18
lines changed

Cargo.lock

+38-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+7-4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ members = [
1616

1717
exclude = [
1818
"examples/notebook",
19+
"examples/onnx-inference-rp2040", # will cause dependency building issues otherwise
1920
# "crates/burn-cuda", # comment this line to work on burn-cuda
2021
]
2122

@@ -73,7 +74,7 @@ serde_bytes = { version = "0.11.15", default-features = false, features = [
7374
] } # alloc for no_std
7475
serde_rusqlite = "0.35.0"
7576
serial_test = "3.1.1"
76-
spin = { version = "0.9.8", features = ["mutex", "spin_mutex"] }
77+
spin = { version = "0.9.8", features = ["mutex", "spin_mutex", "portable-atomic"] }
7778
strum = "0.26.3"
7879
strum_macros = "0.26.4"
7980
syn = { version = "2.0.71", features = ["full", "extra-traits"] }
@@ -119,7 +120,7 @@ half = { version = "2.4.1", features = [
119120
"num-traits",
120121
"serde",
121122
], default-features = false }
122-
ndarray = { version = "0.15.6", default-features = false }
123+
ndarray = { version = "0.16.0", default-features = false }
123124
matrixmultiply = { version = "0.3.9", default-features = false }
124125
openblas-src = "0.10.9"
125126
blas-src = { version = "0.10.0", default-features = false }
@@ -143,9 +144,11 @@ nvml-wrapper = "0.10.0"
143144
sysinfo = "0.30.13"
144145
systemstat = "0.2.3"
145146

147+
portable-atomic-util = { version = "0.2.2", features = ["alloc"] }
148+
146149
### For the main burn branch. ###
147-
cubecl = { git = "https://github.com/tracel-ai/cubecl", default-features = false, rev = "dd274b6515f853ab1c82db410d6fc7697060f69e" }
148-
cubecl-common = { git = "https://github.com/tracel-ai/cubecl", default-features = false, rev = "dd274b6515f853ab1c82db410d6fc7697060f69e" }
150+
cubecl = { git = "https://github.com/BjornTheProgrammer/cubecl", default-features = false, rev = "d1d7dff8a6e1246b06e5acce077fb0cc2b8d5f11" }
151+
cubecl-common = { git = "https://github.com/BjornTheProgrammer/cubecl", default-features = false, rev = "d1d7dff8a6e1246b06e5acce077fb0cc2b8d5f11" }
149152
### For local development. ###
150153
# cubecl = { path = "../cubecl/crates/cubecl" }
151154
# cubecl-common = { path = "../cubecl/crates/cubecl-common" }

crates/burn-core/Cargo.toml

+4-3
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,6 @@ derive-new = { workspace = true }
116116
log = { workspace = true, optional = true }
117117
rand = { workspace = true, features = ["std_rng"] } # Default enables std
118118

119-
# Using in place of use std::sync::Mutex when std is disabled
120-
spin = { workspace = true, features = ["mutex", "spin_mutex"] }
121-
122119
# The same implementation of HashMap in std but with no_std support (only alloc crate is needed)
123120
hashbrown = { workspace = true, features = ["serde"] } # no_std compatible
124121

@@ -133,6 +130,10 @@ serde_json = { workspace = true, features = ["alloc"] } #Default enables std
133130
thiserror = { workspace = true, optional = true }
134131
regex = { workspace = true, optional = true }
135132
num-traits = { workspace = true }
133+
spin = { workspace = true } # Using in place of use std::sync::Mutex when std is disabled
134+
135+
[target.'cfg(not(target_has_atomic = "ptr"))'.dependencies]
136+
portable-atomic-util = { workspace = true }
136137

137138
[dev-dependencies]
138139
tempfile = { workspace = true }

crates/burn-core/src/module/param/running.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,14 @@ use crate::module::{
55
};
66

77
use alloc::string::ToString;
8-
use alloc::sync::Arc;
98
use alloc::vec::Vec;
109

10+
#[cfg(target_has_atomic = "ptr")]
11+
use alloc::sync::Arc;
12+
13+
#[cfg(not(target_has_atomic = "ptr"))]
14+
use portable_atomic_util::Arc;
15+
1116
use burn_common::stub::Mutex;
1217
use burn_tensor::{
1318
backend::{AutodiffBackend, Backend},

crates/burn-ndarray/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ openblas-src = { workspace = true, optional = true }
5656
rand = { workspace = true }
5757
spin = { workspace = true } # using in place of use std::sync::Mutex;
5858

59+
[target.'cfg(not(target_has_atomic = "ptr"))'.dependencies]
60+
portable-atomic-util = { workspace = true }
61+
5962
[dev-dependencies]
6063
burn-autodiff = { path = "../burn-autodiff", version = "0.14.0", default-features = false, features = [
6164
"export_tests",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
2+
rustflags = ["--cfg", "portable_atomic_critical_section"]
3+
runner = "probe-rs run --chip RP2040"
4+
# runner = "elf2uf2-rs -d -s"
5+
6+
[build]
7+
target = "thumbv6m-none-eabi" # Cortex-M0 and Cortex-M0+
8+
9+
[env]
10+
DEFMT_LOG = "debug"

0 commit comments

Comments
 (0)