From b4478fa30fe31ac70c0cf8373beebc144ff07094 Mon Sep 17 00:00:00 2001 From: laurent Date: Tue, 27 Aug 2024 09:55:36 +0200 Subject: [PATCH 1/2] Update cudarc to 0.12. --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index efd39165ab..54ae266d1d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,7 +43,7 @@ candle-onnx = { path = "./candle-onnx", version = "0.6.1" } candle-transformers = { path = "./candle-transformers", version = "0.6.1" } clap = { version = "4.2.4", features = ["derive"] } criterion = { version = "0.5.1", default-features=false } -cudarc = { version = "=0.11.6", features = ["std", "cublas", "cublaslt", "curand", "driver", "nvrtc", "f16", "cuda-version-from-build-system", "dynamic-linking"], default-features=false } +cudarc = { version = "0.12.0", features = ["std", "cublas", "cublaslt", "curand", "driver", "nvrtc", "f16", "cuda-version-from-build-system", "dynamic-linking"], default-features=false } fancy-regex = "0.13.0" gemm = { version = "0.17.0", features = ["wasm-simd128-enable"] } hf-hub = "0.3.0" From af87a1d4eec473ddefe3c63da167ae8b900b5064 Mon Sep 17 00:00:00 2001 From: laurent Date: Tue, 27 Aug 2024 10:04:44 +0200 Subject: [PATCH 2/2] Some cudnn tweaks. --- candle-core/src/cuda_backend/cudnn.rs | 4 ++-- candle-core/src/cuda_backend/mod.rs | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/candle-core/src/cuda_backend/cudnn.rs b/candle-core/src/cuda_backend/cudnn.rs index 0c149cd0d0..d604863d35 100644 --- a/candle-core/src/cuda_backend/cudnn.rs +++ b/candle-core/src/cuda_backend/cudnn.rs @@ -1,6 +1,6 @@ use crate::WithDType; use cudarc; -use cudarc::cudnn::safe::{Conv2dForward, Cudnn}; +use cudarc::cudnn::safe::{ConvForward, Cudnn}; use cudarc::driver::{CudaSlice, CudaView, DeviceRepr, ValidAsZeroBits}; use std::cell::RefCell; use std::collections::HashMap; @@ -87,7 +87,7 @@ pub(crate) fn launch_conv2d< cudarc::cudnn::sys::cudnnTensorFormat_t::CUDNN_TENSOR_NCHW, [params.b_size as i32, params.c_out as i32, h_out, w_out], )?; - let conv2d = Conv2dForward { + let conv2d = ConvForward { conv: &conv, x: &x, w: &w, diff --git a/candle-core/src/cuda_backend/mod.rs b/candle-core/src/cuda_backend/mod.rs index 7edad3d409..07bb1785dd 100644 --- a/candle-core/src/cuda_backend/mod.rs +++ b/candle-core/src/cuda_backend/mod.rs @@ -174,6 +174,7 @@ impl Map1 for Im2Col1D { } } +#[allow(unused)] struct Im2Col { h_k: usize, w_k: usize, @@ -183,6 +184,7 @@ struct Im2Col { } impl Im2Col { + #[allow(unused)] fn hw_out(&self, h: usize, w: usize) -> (usize, usize) { let h_out = (h + 2 * self.padding - self.dilation * (self.h_k - 1) - 1) / self.stride + 1; let w_out = (w + 2 * self.padding - self.dilation * (self.w_k - 1) - 1) / self.stride + 1;