From 459fc905529d8b410403793795b73719fd5328d6 Mon Sep 17 00:00:00 2001 From: Hiroshi Shinaoka Date: Fri, 17 Jul 2026 10:25:59 +0900 Subject: [PATCH 1/4] Align cudarc features with CUDA 12.8 runtime --- Cargo.toml | 10 +++++----- crates/cubecl-cuda/tests/cudarc_feature_contract.rs | 12 ++++++++++++ 2 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 crates/cubecl-cuda/tests/cudarc_feature_contract.rs diff --git a/Cargo.toml b/Cargo.toml index 79216152e..4c9e81909 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-cuda/tests/cudarc_feature_contract.rs b/crates/cubecl-cuda/tests/cudarc_feature_contract.rs new file mode 100644 index 000000000..00cb97300 --- /dev/null +++ b/crates/cubecl-cuda/tests/cudarc_feature_contract.rs @@ -0,0 +1,12 @@ +#[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")); +} From 072cf82387ae099ce1d23efe6c0cbc68e231d9d2 Mon Sep 17 00:00:00 2001 From: Hiroshi Shinaoka Date: Fri, 17 Jul 2026 11:39:08 +0900 Subject: [PATCH 2/4] Minimize build-time cudarc features --- crates/cubecl-cuda/Cargo.toml | 2 +- crates/cubecl-cuda/tests/cudarc_feature_contract.rs | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/crates/cubecl-cuda/Cargo.toml b/crates/cubecl-cuda/Cargo.toml index 642363a38..91098e057 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 index 00cb97300..fcdd21e39 100644 --- a/crates/cubecl-cuda/tests/cudarc_feature_contract.rs +++ b/crates/cubecl-cuda/tests/cudarc_feature_contract.rs @@ -10,3 +10,13 @@ fn cudarc_uses_the_tensor4all_cuda_floor_without_fallback_detection() { 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"] }"# + )); +} From 3dc6c870af4ee576c75f1b4aa354313f1fb330c0 Mon Sep 17 00:00:00 2001 From: Hiroshi Shinaoka Date: Fri, 17 Jul 2026 12:27:27 +0900 Subject: [PATCH 3/4] Fix Rust 1.97 float literal lint --- crates/cubecl-core/src/frontend/polyfills.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/crates/cubecl-core/src/frontend/polyfills.rs b/crates/cubecl-core/src/frontend/polyfills.rs index e600fa599..38cf58a2f 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; From 659b4ececd485b80c47c201b755ce4aaf5fee4c0 Mon Sep 17 00:00:00 2001 From: Hiroshi Shinaoka Date: Fri, 17 Jul 2026 12:49:58 +0900 Subject: [PATCH 4/4] Fix Rust 1.97 workspace lints --- crates/cubecl-cpu/src/compute/runner.rs | 2 +- crates/cubecl-opt/src/analyses/mod.rs | 3 +++ crates/cubecl-opt/src/lib.rs | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/cubecl-cpu/src/compute/runner.rs b/crates/cubecl-cpu/src/compute/runner.rs index 0c67f542d..26c80c402 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-opt/src/analyses/mod.rs b/crates/cubecl-opt/src/analyses/mod.rs index 90ee54a85..bf8845dc8 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 5028ed7df..6b0e506d4 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>>,