Skip to content

Commit

Permalink
Fixing overflow in expanded distances (#365)
Browse files Browse the repository at this point in the history
Closes rapidsai/cuml#4289

Authors:
  - Corey J. Nolet (https://github.com/cjnolet)

Approvers:
  - Dante Gama Dessavre (https://github.com/dantegd)

URL: #365
  • Loading branch information
cjnolet authored Oct 27, 2021
1 parent ccba252 commit 091cfdf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cpp/include/raft/sparse/distance/detail/bin_distance.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions cpp/include/raft/sparse/distance/detail/l2_distance.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;

Expand Down

0 comments on commit 091cfdf

Please sign in to comment.