Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions crates/cubecl-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ std = [
"parking_lot",
"backtrace",
"oneshot/std",
"dep:web-time",
]
tracing = ["dep:tracing"]

Expand Down Expand Up @@ -91,6 +92,10 @@ futures-lite = { workspace = true, features = [

backtrace = { version = "0.3", optional = true, features = ["std"] }
parking_lot = { version = "0.12.5", default-features = false, optional = true }
# For std / wasm targets
web-time = { workspace = true, optional = true } # prevent panic on wasm unknown OS target
# Only for true no_std / embedded targets
embassy-time = { workspace = true }

[target.'cfg(target_has_atomic = "ptr")'.dependencies]
bytes = { workspace = true, optional = true }
Expand All @@ -110,14 +115,6 @@ bytes = { workspace = true, features = ["extra-platforms"], optional = true }
[target.'cfg(target_family = "wasm")'.dependencies]
wasm-bindgen-futures = { workspace = true }

# Default dependency for all targets
[target.'cfg(not(target_os = "none"))'.dependencies]
web-time = { workspace = true }

# Only for true no_std / embedded targets
[target.'cfg(target_os = "none")'.dependencies]
embassy-time = { workspace = true }

[build-dependencies]
cfg_aliases = { workspace = true }

Expand Down
4 changes: 2 additions & 2 deletions crates/cubecl-common/src/device/handle/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ impl<S: DeviceService> DeviceHandle<S> {
}
}

#[cfg(test)]
#[cfg(all(test, feature = "std"))]
mod tests_channel {
type DeviceHandle<S> = channel::ChannelDeviceHandle<S>;

Expand All @@ -98,7 +98,7 @@ mod tests_mutex {
include!("./tests.rs");
}

#[cfg(test)]
#[cfg(all(test, feature = "std"))]
mod tests_reentrant {
type DeviceHandle<S> = reentrant::ReentrantMutexDeviceHandle<S>;

Expand Down
3 changes: 3 additions & 0 deletions crates/cubecl-common/src/device/handle/tests.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#[cfg(not(feature = "std"))]
extern crate std;

use std::vec::Vec;

use crate::device::{Device, DeviceId, DeviceService};
Expand Down
7 changes: 3 additions & 4 deletions crates/cubecl-common/src/profile.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
use alloc::boxed::Box;
use core::fmt::Display;

#[cfg(not(target_os = "none"))]
pub use web_time::{Duration, Instant};

#[cfg(target_os = "none")]
#[cfg(not(feature = "std"))]
pub use embassy_time::{Duration, Instant};
#[cfg(feature = "std")]
pub use web_time::{Duration, Instant};

use crate::future::DynFut;

Expand Down
Loading