From 091cfdfe5b65242848355a4aca6af157aafee4bd Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Wed, 27 Oct 2021 16:49:31 -0400 Subject: [PATCH] Fixing overflow in expanded distances (#365) Closes https://github.com/rapidsai/cuml/issues/4289 Authors: - Corey J. Nolet (https://github.com/cjnolet) Approvers: - Dante Gama Dessavre (https://github.com/dantegd) URL: https://github.com/rapidsai/raft/pull/365 --- cpp/include/raft/sparse/distance/detail/bin_distance.cuh | 2 +- cpp/include/raft/sparse/distance/detail/l2_distance.cuh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cpp/include/raft/sparse/distance/detail/bin_distance.cuh b/cpp/include/raft/sparse/distance/detail/bin_distance.cuh index e6dd1331ae..3f8c32a20b 100644 --- a/cpp/include/raft/sparse/distance/detail/bin_distance.cuh +++ b/cpp/include/raft/sparse/distance/detail/bin_distance.cuh @@ -54,7 +54,7 @@ __global__ void compute_binary_warp_kernel(value_t *__restrict__ C, const value_t *__restrict__ R_norms, value_idx n_rows, value_idx n_cols, expansion_f expansion_func) { - value_idx tid = blockDim.x * blockIdx.x + threadIdx.x; + std::size_t tid = blockDim.x * blockIdx.x + threadIdx.x; value_idx i = tid / n_cols; value_idx j = tid % n_cols; diff --git a/cpp/include/raft/sparse/distance/detail/l2_distance.cuh b/cpp/include/raft/sparse/distance/detail/l2_distance.cuh index e7ac78b80a..f06a15215c 100644 --- a/cpp/include/raft/sparse/distance/detail/l2_distance.cuh +++ b/cpp/include/raft/sparse/distance/detail/l2_distance.cuh @@ -64,7 +64,7 @@ __global__ void compute_euclidean_warp_kernel( value_t *__restrict__ C, const value_t *__restrict__ Q_sq_norms, const value_t *__restrict__ R_sq_norms, value_idx n_rows, value_idx n_cols, expansion_f expansion_func) { - value_idx tid = blockDim.x * blockIdx.x + threadIdx.x; + std::size_t tid = blockDim.x * blockIdx.x + threadIdx.x; value_idx i = tid / n_cols; value_idx j = tid % n_cols; @@ -85,7 +85,7 @@ __global__ void compute_correlation_warp_kernel( const value_t *__restrict__ R_sq_norms, const value_t *__restrict__ Q_norms, const value_t *__restrict__ R_norms, value_idx n_rows, value_idx n_cols, value_idx n) { - value_idx tid = blockDim.x * blockIdx.x + threadIdx.x; + std::size_t tid = blockDim.x * blockIdx.x + threadIdx.x; value_idx i = tid / n_cols; value_idx j = tid % n_cols;