diff --git a/Cargo.toml b/Cargo.toml index 79216152ea..4c9e81909f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" } diff --git a/crates/cubecl-core/src/frontend/polyfills.rs b/crates/cubecl-core/src/frontend/polyfills.rs index e600fa5997..38cf58a2fa 100644 --- a/crates/cubecl-core/src/frontend/polyfills.rs +++ b/crates/cubecl-core/src/frontend/polyfills.rs @@ -29,7 +29,7 @@ pub mod set_polyfill { #[cube] pub fn erf(x: Vector) -> Vector { 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: @@ -38,13 +38,13 @@ pub fn erf(x: Vector) -> Vector { /// > 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(x: Vector) -> Vector { - 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; diff --git a/crates/cubecl-cpu/src/compute/runner.rs b/crates/cubecl-cpu/src/compute/runner.rs index 0c67f542d9..26c80c4021 100644 --- a/crates/cubecl-cpu/src/compute/runner.rs +++ b/crates/cubecl-cpu/src/compute/runner.rs @@ -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) } } diff --git a/crates/cubecl-cuda/Cargo.toml b/crates/cubecl-cuda/Cargo.toml index 642363a38a..91098e057c 100644 --- a/crates/cubecl-cuda/Cargo.toml +++ b/crates/cubecl-cuda/Cargo.toml @@ -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"] } diff --git a/crates/cubecl-cuda/tests/cudarc_feature_contract.rs b/crates/cubecl-cuda/tests/cudarc_feature_contract.rs new file mode 100644 index 0000000000..fcdd21e395 --- /dev/null +++ b/crates/cubecl-cuda/tests/cudarc_feature_contract.rs @@ -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::>().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::>().join(" "); + + assert!(normalized.contains( + r#"[build-dependencies] cudarc = { version = "0.19.0", default-features = false, features = ["std", "driver", "dynamic-loading", "cuda-12080"] }"# + )); +} diff --git a/crates/cubecl-opt/src/analyses/mod.rs b/crates/cubecl-opt/src/analyses/mod.rs index 90ee54a856..bf8845dc81 100644 --- a/crates/cubecl-opt/src/analyses/mod.rs +++ b/crates/cubecl-opt/src/analyses/mod.rs @@ -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; diff --git a/crates/cubecl-opt/src/lib.rs b/crates/cubecl-opt/src/lib.rs index 5028ed7dfe..6b0e506d44 100644 --- a/crates/cubecl-opt/src/lib.rs +++ b/crates/cubecl-opt/src/lib.rs @@ -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>, pub(crate) processors: Rc>>,