Skip to content
Merged
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
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,15 @@ tracel-llvm = { version = "20.1.4-6", features = ["mlir-helpers"] }
### For development, if you uncomment, don't forget do to it in `crates/cubecl-cpu/Cargo.toml` [build-dependencies] too to avoid race conditions during build
# tracel-llvm = { path = "../tracel-llvm/crates/tracel-llvm", features = ["mlir-helpers"] }

cudarc = { version = "0.19.0", features = [
cudarc = { version = "0.19.0", default-features = false, features = [
"std",
"driver",
"runtime",
"nvrtc",
"nccl",
"fallback-dynamic-loading",
"cuda-version-from-build-system",
"fallback-latest",
], default-features = false } # CubeCL-CUDA
"dynamic-loading",
"cuda-12080",
] } # CubeCL-CUDA

# CubeCL-SPIR-V
rspirv = { package = "tracel-rspirv", version = "0.12.1" }
Expand Down
16 changes: 8 additions & 8 deletions crates/cubecl-core/src/frontend/polyfills.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub mod set_polyfill {
#[cube]
pub fn erf<F: Float, N: Size>(x: Vector<F, N>) -> Vector<F, N> {
let erf = erf_positive(x.abs());
select_many(x.less_than(Vector::new(F::new(0.0))), -erf, erf)
select_many(x.less_than(Vector::new(F::new(0.0_f32))), -erf, erf)
}

/// An approximation of the error function: <https://en.wikipedia.org/wiki/Error_function#Numerical_approximations>
Expand All @@ -38,13 +38,13 @@ pub fn erf<F: Float, N: Size>(x: Vector<F, N>) -> Vector<F, N> {
/// > All of these approximations are valid for x ≥ 0. To use these approximations for negative x, use the fact that erf x is an odd function, so erf x = −erf(−x).
#[cube]
fn erf_positive<F: Float, N: Size>(x: Vector<F, N>) -> Vector<F, N> {
let p = Vector::new(F::new(0.3275911));
let a1 = Vector::new(F::new(0.2548296));
let a2 = Vector::new(F::new(-0.28449674));
let a3 = Vector::new(F::new(1.4214137));
let a4 = Vector::new(F::new(-1.453152));
let a5 = Vector::new(F::new(1.0614054));
let one = Vector::new(F::new(1.0));
let p = Vector::new(F::new(0.3275911_f32));
let a1 = Vector::new(F::new(0.2548296_f32));
let a2 = Vector::new(F::new(-0.28449674_f32));
let a3 = Vector::new(F::new(1.4214137_f32));
let a4 = Vector::new(F::new(-1.453152_f32));
let a5 = Vector::new(F::new(1.0614054_f32));
let one = Vector::new(F::new(1.0_f32));

let t = one / (one + p * x);
let tmp = ((((a5 * t + a4) * t) + a3) * t + a2) * t + a1;
Expand Down
2 changes: 1 addition & 1 deletion crates/cubecl-cpu/src/compute/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ impl Debug for CpuKernel {

impl Debug for KernelRunner {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:?}", &self.workers)
write!(f, "{:?}", self.workers)
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/cubecl-cuda/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ pretty_assertions = { workspace = true }
test-log = { workspace = true, features = ["trace"] }

[build-dependencies]
cudarc = { workspace = true }
cudarc = { version = "0.19.0", default-features = false, features = ["std", "driver", "dynamic-loading", "cuda-12080"] }
22 changes: 22 additions & 0 deletions crates/cubecl-cuda/tests/cudarc_feature_contract.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#[test]
fn cudarc_uses_the_tensor4all_cuda_floor_without_fallback_detection() {
let manifest = include_str!("../../../Cargo.toml");
let normalized = manifest.split_whitespace().collect::<Vec<_>>().join(" ");

assert!(normalized.contains(
r#"cudarc = { version = "0.19.0", default-features = false, features = [ "std", "driver", "runtime", "nvrtc", "nccl", "dynamic-loading", "cuda-12080", ] }"#
));
assert!(!normalized.contains("fallback-dynamic-loading"));
assert!(!normalized.contains("cuda-version-from-build-system"));
assert!(!normalized.contains("fallback-latest"));
}

#[test]
fn cudarc_build_dependency_only_enables_build_script_requirements() {
let manifest = include_str!("../Cargo.toml");
let normalized = manifest.split_whitespace().collect::<Vec<_>>().join(" ");

assert!(normalized.contains(
r#"[build-dependencies] cudarc = { version = "0.19.0", default-features = false, features = ["std", "driver", "dynamic-loading", "cuda-12080"] }"#
));
}
3 changes: 3 additions & 0 deletions crates/cubecl-opt/src/analyses/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
mod base;
pub mod dominance;
// The range analysis is implemented for index-bound optimization but is not
// wired into the active pass pipeline yet.
#[allow(dead_code)]
pub mod integer_range;
pub mod liveness;
pub mod post_order;
Expand Down
1 change: 1 addition & 0 deletions crates/cubecl-opt/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ pub struct Optimizer {
/// Root scope to allocate variables on
pub root_scope: Scope,
/// The `CubeDim` used for range analysis
#[allow(dead_code)]
pub(crate) cube_dim: CubeDim,
pub(crate) transformers: Vec<Rc<dyn IrTransformer>>,
pub(crate) processors: Rc<Vec<Box<dyn Processor>>>,
Expand Down
Loading