summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Mazare <laurent.mazare@gmail.com>2024-11-29 09:01:34 +0100
committerGitHub <noreply@github.com>2024-11-29 09:01:34 +0100
commitb52c2c60508325431df5e05eca9801060fdbcc1c (patch)
tree3c4abef254a33030977bed923fa2ac9e560eebec
parent4f59ed38b08b84ed9c52e53f2692a2fc1888f30b (diff)
downloadcandle-b52c2c60508325431df5e05eca9801060fdbcc1c.tar.gz
candle-b52c2c60508325431df5e05eca9801060fdbcc1c.tar.bz2
candle-b52c2c60508325431df5e05eca9801060fdbcc1c.zip
Clippy fixes for the cuda feature. (#2650)
-rw-r--r--candle-core/src/cuda_backend/mod.rs20
-rw-r--r--candle-core/src/quantized/cuda.rs2
2 files changed, 11 insertions, 11 deletions
diff --git a/candle-core/src/cuda_backend/mod.rs b/candle-core/src/cuda_backend/mod.rs
index 37fef507..2cd97c18 100644
--- a/candle-core/src/cuda_backend/mod.rs
+++ b/candle-core/src/cuda_backend/mod.rs
@@ -255,7 +255,7 @@ impl Map1 for Powf {
}
struct FastReduce<'a>(&'a [usize], ReduceOp);
-impl<'a> Map1Any for FastReduce<'a> {
+impl Map1Any for FastReduce<'_> {
fn f<T: DeviceRepr + WithDType + ValidAsZeroBits, W: Fn(CudaSlice<T>) -> S>(
&self,
src: &CudaSlice<T>,
@@ -350,7 +350,7 @@ impl<U: UnaryOpT> Map1 for U {
}
struct IndexSelect<'a>(&'a CudaStorage, &'a Layout, usize);
-impl<'a> Map1 for IndexSelect<'a> {
+impl Map1 for IndexSelect<'_> {
fn f<T: DeviceRepr + WithDType + ValidAsZeroBits>(
&self,
src: &CudaSlice<T>,
@@ -410,7 +410,7 @@ impl<'a> Map1 for IndexSelect<'a> {
}
struct Gather<'a>(&'a CudaStorage, &'a Layout, usize);
-impl<'a> Map1 for Gather<'a> {
+impl Map1 for Gather<'_> {
fn f<T: DeviceRepr + WithDType + ValidAsZeroBits>(
&self,
src: &CudaSlice<T>,
@@ -461,7 +461,7 @@ impl<'a> Map1 for Gather<'a> {
}
struct IndexAdd<'a>(&'a CudaStorage, &'a Layout, usize);
-impl<'a> Map2InPlace for IndexAdd<'a> {
+impl Map2InPlace for IndexAdd<'_> {
fn f<T: DeviceRepr + WithDType + ValidAsZeroBits>(
&self,
dst: &mut CudaSlice<T>,
@@ -509,7 +509,7 @@ impl<'a> Map2InPlace for IndexAdd<'a> {
}
struct ScatterAdd<'a>(&'a CudaStorage, &'a Layout, usize);
-impl<'a> Map2InPlace for ScatterAdd<'a> {
+impl Map2InPlace for ScatterAdd<'_> {
fn f<T: DeviceRepr + WithDType + ValidAsZeroBits>(
&self,
dst: &mut CudaSlice<T>,
@@ -554,7 +554,7 @@ impl<'a> Map2InPlace for ScatterAdd<'a> {
}
struct Conv1D<'a>(&'a crate::conv::ParamsConv1D);
-impl<'a> Map2 for Conv1D<'a> {
+impl Map2 for Conv1D<'_> {
fn f<T: DeviceRepr + WithDType + ValidAsZeroBits>(
&self,
inp: &CudaSlice<T>,
@@ -595,7 +595,7 @@ impl<'a> Map2 for Conv1D<'a> {
}
struct Conv2D<'a>(&'a crate::conv::ParamsConv2D);
-impl<'a> Map2 for Conv2D<'a> {
+impl Map2 for Conv2D<'_> {
fn f<T: DeviceRepr + WithDType + ValidAsZeroBits>(
&self,
inp: &CudaSlice<T>,
@@ -660,7 +660,7 @@ impl Map1 for Col2Im1D {
}
struct ConvTranspose1D<'a>(&'a crate::conv::ParamsConvTranspose1D);
-impl<'a> Map2 for ConvTranspose1D<'a> {
+impl Map2 for ConvTranspose1D<'_> {
fn f<T: DeviceRepr + WithDType + ValidAsZeroBits>(
&self,
inp: &CudaSlice<T>,
@@ -709,7 +709,7 @@ impl<'a> Map2 for ConvTranspose1D<'a> {
}
struct ConvTranspose2D<'a>(&'a crate::conv::ParamsConvTranspose2D);
-impl<'a> Map2 for ConvTranspose2D<'a> {
+impl Map2 for ConvTranspose2D<'_> {
fn f<T: DeviceRepr + WithDType + ValidAsZeroBits>(
&self,
inp: &CudaSlice<T>,
@@ -850,7 +850,7 @@ impl Map1 for UpsampleNearest2D {
}
struct WhereCond<'a>(&'a CudaStorage, &'a Layout);
-impl<'a> Map2 for WhereCond<'a> {
+impl Map2 for WhereCond<'_> {
fn f<T: DeviceRepr + WithDType + ValidAsZeroBits>(
&self,
t: &CudaSlice<T>,
diff --git a/candle-core/src/quantized/cuda.rs b/candle-core/src/quantized/cuda.rs
index 3c24c0e5..1a3d72c0 100644
--- a/candle-core/src/quantized/cuda.rs
+++ b/candle-core/src/quantized/cuda.rs
@@ -36,7 +36,7 @@ pub const CUDA_DEQUANTIZE_BLOCK_SIZE: usize = 256;
pub const MATRIX_ROW_PADDING: usize = 512;
fn ceil_div(p: usize, q: usize) -> usize {
- (p + q - 1) / q
+ p.div_ceil(q)
}
fn pad(p: usize, q: usize) -> usize {