From 5e840ba0ac9f50d1bd490c409ec785858b43ddc1 Mon Sep 17 00:00:00 2001 From: nathaniel Date: Thu, 28 Nov 2024 11:26:48 -0500 Subject: [PATCH 1/3] Fix CI --- crates/cubecl-core/src/codegen/execution.rs | 2 +- crates/cubecl-core/src/compute/kernel.rs | 1 - crates/cubecl-core/src/frontend/container/array/launch.rs | 2 +- .../cubecl-core/src/frontend/container/sequence/launch.rs | 4 ++-- crates/cubecl-core/src/frontend/container/tensor/launch.rs | 4 ++-- .../cubecl-core/src/frontend/element/float/tensor_float.rs | 6 +++--- crates/cubecl-cpp/src/shared/instruction.rs | 2 +- crates/cubecl-linalg/src/lib.rs | 2 ++ 8 files changed, 12 insertions(+), 11 deletions(-) diff --git a/crates/cubecl-core/src/codegen/execution.rs b/crates/cubecl-core/src/codegen/execution.rs index e76a6d984..a3bf3d63b 100644 --- a/crates/cubecl-core/src/codegen/execution.rs +++ b/crates/cubecl-core/src/codegen/execution.rs @@ -162,7 +162,7 @@ where } } -impl<'h, 'a, 'b, 'c, K, R, E1, E2, E3> Execution<'h, K, R, (&'a [E1], &'b [E2], &'c [E3])> +impl Execution<'_, K, R, (&[E1], &[E2], &[E3])> where K: Kernel + 'static, R: Runtime, diff --git a/crates/cubecl-core/src/compute/kernel.rs b/crates/cubecl-core/src/compute/kernel.rs index 3cb41db0e..018c7013c 100644 --- a/crates/cubecl-core/src/compute/kernel.rs +++ b/crates/cubecl-core/src/compute/kernel.rs @@ -7,7 +7,6 @@ use cubecl_runtime::ExecutionMode; /// A kernel, compiled in the target language pub struct CompiledKernel { /// The name of the kernel entrypoint. - /// For example /// /// ```text diff --git a/crates/cubecl-core/src/frontend/container/array/launch.rs b/crates/cubecl-core/src/frontend/container/array/launch.rs index 05d4f0178..7e95d1ba8 100644 --- a/crates/cubecl-core/src/frontend/container/array/launch.rs +++ b/crates/cubecl-core/src/frontend/container/array/launch.rs @@ -64,7 +64,7 @@ pub enum ArrayArg<'a, R: Runtime> { }, } -impl<'a, R: Runtime> ArgSettings for ArrayArg<'a, R> { +impl ArgSettings for ArrayArg<'_, R> { fn register(&self, launcher: &mut KernelLauncher) { launcher.register_array(self) } diff --git a/crates/cubecl-core/src/frontend/container/sequence/launch.rs b/crates/cubecl-core/src/frontend/container/sequence/launch.rs index acf603e12..6f8cb42c7 100644 --- a/crates/cubecl-core/src/frontend/container/sequence/launch.rs +++ b/crates/cubecl-core/src/frontend/container/sequence/launch.rs @@ -12,7 +12,7 @@ pub struct SequenceArg<'a, R: Runtime, T: LaunchArg> { pub values: Vec>, } -impl<'a, R: Runtime, T: LaunchArg> Default for SequenceArg<'a, R, T> { +impl Default for SequenceArg<'_, R, T> { fn default() -> Self { Self::new() } @@ -72,7 +72,7 @@ impl LaunchArg for Sequence { } } -impl<'a, R: Runtime, T: LaunchArg> ArgSettings for SequenceArg<'a, R, T> { +impl ArgSettings for SequenceArg<'_, R, T> { fn register(&self, launcher: &mut crate::prelude::KernelLauncher) { self.values.iter().for_each(|arg| arg.register(launcher)); } diff --git a/crates/cubecl-core/src/frontend/container/tensor/launch.rs b/crates/cubecl-core/src/frontend/container/tensor/launch.rs index 8ab07b5dd..734237fad 100644 --- a/crates/cubecl-core/src/frontend/container/tensor/launch.rs +++ b/crates/cubecl-core/src/frontend/container/tensor/launch.rs @@ -36,7 +36,7 @@ pub struct TensorHandleRef<'a, R: Runtime> { pub runtime: PhantomData, } -impl<'a, R: Runtime> core::fmt::Debug for TensorHandleRef<'a, R> { +impl core::fmt::Debug for TensorHandleRef<'_, R> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { writeln!( f, @@ -153,7 +153,7 @@ impl<'a, R: Runtime> TensorArg<'a, R> { } } -impl<'a, R: Runtime> ArgSettings for TensorArg<'a, R> { +impl ArgSettings for TensorArg<'_, R> { fn register(&self, launcher: &mut KernelLauncher) { launcher.register_tensor(self) } diff --git a/crates/cubecl-core/src/frontend/element/float/tensor_float.rs b/crates/cubecl-core/src/frontend/element/float/tensor_float.rs index 74814db77..3c0e149b2 100644 --- a/crates/cubecl-core/src/frontend/element/float/tensor_float.rs +++ b/crates/cubecl-core/src/frontend/element/float/tensor_float.rs @@ -3,7 +3,7 @@ use core::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Sub, SubAssign}; use half::f16; use num_traits::{NumCast, ToPrimitive}; use serde::Serialize; -use std::{mem::transmute, num::NonZero}; +use std::num::NonZero; use crate::{ ir::{Elem, FloatKind, Item}, @@ -34,7 +34,7 @@ impl tf32 { #[inline] #[must_use] pub const fn from_bits(bits: u32) -> tf32 { - tf32(unsafe { transmute::(bits) }) + tf32(f32::from_bits(bits)) } /// Constructs a [`tf32`] value from a 32-bit floating point value. @@ -64,7 +64,7 @@ impl tf32 { #[inline] #[must_use] pub const fn to_bits(self) -> u32 { - unsafe { transmute(self.0) } + self.0.to_bits() } /// Converts a [`tf32`] value into an [`f32`] value. diff --git a/crates/cubecl-cpp/src/shared/instruction.rs b/crates/cubecl-cpp/src/shared/instruction.rs index 47f2e50ce..e8d9b0e83 100644 --- a/crates/cubecl-cpp/src/shared/instruction.rs +++ b/crates/cubecl-cpp/src/shared/instruction.rs @@ -777,7 +777,7 @@ struct EnsureBoolArg<'a, V: Display, D: Dialect> { elem: &'a Elem, } -impl<'a, V: Display, D: Dialect> Display for EnsureBoolArg<'a, V, D> { +impl Display for EnsureBoolArg<'_, V, D> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { if self.elem != &Elem::Bool { write!(f, "bool({})", self.var) diff --git a/crates/cubecl-linalg/src/lib.rs b/crates/cubecl-linalg/src/lib.rs index 22e1a6607..be5412d78 100644 --- a/crates/cubecl-linalg/src/lib.rs +++ b/crates/cubecl-linalg/src/lib.rs @@ -1,3 +1,5 @@ +#![allow(clippy::manual_div_ceil)] + /// Contains matmul kernels and Cube components pub mod matmul; From 3800c8eb0a63ffbcdded08971a173fe51060ddd7 Mon Sep 17 00:00:00 2001 From: nathaniel Date: Thu, 28 Nov 2024 11:34:56 -0500 Subject: [PATCH 2/3] Fix prev --- .../src/frontend/element/float/tensor_float.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/crates/cubecl-core/src/frontend/element/float/tensor_float.rs b/crates/cubecl-core/src/frontend/element/float/tensor_float.rs index 3c0e149b2..7f9f85e62 100644 --- a/crates/cubecl-core/src/frontend/element/float/tensor_float.rs +++ b/crates/cubecl-core/src/frontend/element/float/tensor_float.rs @@ -1,9 +1,12 @@ +#![allow(clippy::transmute_int_to_float)] // Not yet stable in previous version. To be removed when + // prev=1.83. + use bytemuck::{Pod, Zeroable}; use core::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Sub, SubAssign}; use half::f16; use num_traits::{NumCast, ToPrimitive}; use serde::Serialize; -use std::num::NonZero; +use std::{mem::transmute, num::NonZero}; use crate::{ ir::{Elem, FloatKind, Item}, @@ -34,7 +37,7 @@ impl tf32 { #[inline] #[must_use] pub const fn from_bits(bits: u32) -> tf32 { - tf32(f32::from_bits(bits)) + tf32(unsafe { transmute::(bits) }) } /// Constructs a [`tf32`] value from a 32-bit floating point value. @@ -64,7 +67,7 @@ impl tf32 { #[inline] #[must_use] pub const fn to_bits(self) -> u32 { - self.0.to_bits() + unsafe { transmute(self.0) } } /// Converts a [`tf32`] value into an [`f32`] value. From 627f337b8062f3b48bdec55ce08b5207ea5ce17c Mon Sep 17 00:00:00 2001 From: nathaniel Date: Thu, 28 Nov 2024 11:38:01 -0500 Subject: [PATCH 3/3] Fix stable --- crates/cubecl-core/src/frontend/element/float/tensor_float.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/cubecl-core/src/frontend/element/float/tensor_float.rs b/crates/cubecl-core/src/frontend/element/float/tensor_float.rs index 7f9f85e62..d638f97ea 100644 --- a/crates/cubecl-core/src/frontend/element/float/tensor_float.rs +++ b/crates/cubecl-core/src/frontend/element/float/tensor_float.rs @@ -1,5 +1,5 @@ #![allow(clippy::transmute_int_to_float)] // Not yet stable in previous version. To be removed when - // prev=1.83. +#![allow(clippy::transmute_float_to_int)] // prev=1.83. use bytemuck::{Pod, Zeroable}; use core::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Sub, SubAssign};