Skip to content

Commit 863383b

Browse files
upsjyhmtsai
andcommitted
fix overflow in thread index calculation
Co-Authored-By: Yuhsiang M. Tsai <yhmtsai@gmail.com>
1 parent 6fe475c commit 863383b

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

common/matrix/csr_kernels.hpp.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ __global__ __launch_bounds__(default_block_size) void spgeam_nnz(
501501
IndexType num_rows, IndexType *nnz)
502502
{
503503
constexpr auto sentinel = device_numeric_limits<IndexType>::max;
504-
auto row = threadIdx.x + blockDim.x * blockIdx.x;
504+
auto row = threadIdx.x + blockDim.x * static_cast<size_type>(blockIdx.x);
505505
if (row >= num_rows) {
506506
return;
507507
}
@@ -544,7 +544,7 @@ __global__ __launch_bounds__(default_block_size) void spgeam(
544544
const IndexType *c_row_ptrs, IndexType *c_col_idxs, ValueType *c_vals)
545545
{
546546
constexpr auto sentinel = device_numeric_limits<IndexType>::max;
547-
auto row = threadIdx.x + blockDim.x * blockIdx.x;
547+
auto row = threadIdx.x + blockDim.x * static_cast<size_type>(blockIdx.x);
548548
if (row >= num_rows) {
549549
return;
550550
}

0 commit comments

Comments
 (0)