Skip to content

Commit

Permalink
fix overflow in thread index calculation
Browse files Browse the repository at this point in the history
Co-Authored-By: Yuhsiang M. Tsai <yhmtsai@gmail.com>
  • Loading branch information
upsj and yhmtsai committed Dec 17, 2019
1 parent 6fe475c commit 863383b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions common/matrix/csr_kernels.hpp.inc
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ __global__ __launch_bounds__(default_block_size) void spgeam_nnz(
IndexType num_rows, IndexType *nnz)
{
constexpr auto sentinel = device_numeric_limits<IndexType>::max;
auto row = threadIdx.x + blockDim.x * blockIdx.x;
auto row = threadIdx.x + blockDim.x * static_cast<size_type>(blockIdx.x);
if (row >= num_rows) {
return;
}
Expand Down Expand Up @@ -544,7 +544,7 @@ __global__ __launch_bounds__(default_block_size) void spgeam(
const IndexType *c_row_ptrs, IndexType *c_col_idxs, ValueType *c_vals)
{
constexpr auto sentinel = device_numeric_limits<IndexType>::max;
auto row = threadIdx.x + blockDim.x * blockIdx.x;
auto row = threadIdx.x + blockDim.x * static_cast<size_type>(blockIdx.x);
if (row >= num_rows) {
return;
}
Expand Down

0 comments on commit 863383b

Please sign in to comment.