Skip to content

Commit

Permalink
Use thread_index_type in binary-ops jit kernel.cu
Browse files Browse the repository at this point in the history
  • Loading branch information
davidwendt committed Nov 22, 2024
1 parent 2827a03 commit bbbec62
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions cpp/src/binaryop/jit/kernel.cu
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,10 @@ CUDF_KERNEL void kernel_v_v(cudf::size_type size,
TypeLhs* lhs_data,
TypeRhs* rhs_data)
{
int tid = threadIdx.x;
int blkid = blockIdx.x;
int blksz = blockDim.x;
int gridsz = gridDim.x;
auto const start = threadIdx.x + static_cast<cudf::thread_index_type>(blockIdx.x) * blockDim.x;
auto const step = static_cast<cudf::thread_index_type>(blockDim.x) * gridDim.x;

int start = tid + blkid * blksz;
int step = blksz * gridsz;

for (cudf::size_type i = start; i < size; i += step) {
for (auto i = start; i < size; i += step) {
out_data[i] = TypeOpe::template operate<TypeOut, TypeLhs, TypeRhs>(lhs_data[i], rhs_data[i]);
}
}
Expand All @@ -75,15 +70,10 @@ CUDF_KERNEL void kernel_v_v_with_validity(cudf::size_type size,
cudf::bitmask_type const* rhs_mask,
cudf::size_type rhs_offset)
{
int tid = threadIdx.x;
int blkid = blockIdx.x;
int blksz = blockDim.x;
int gridsz = gridDim.x;

int start = tid + blkid * blksz;
int step = blksz * gridsz;
auto const start = threadIdx.x + static_cast<cudf::thread_index_type>(blockIdx.x) * blockDim.x;
auto const step = static_cast<cudf::thread_index_type>(blockDim.x) * gridDim.x;

for (cudf::size_type i = start; i < size; i += step) {
for (auto i = start; i < size; i += step) {
bool output_valid = false;
out_data[i] = TypeOpe::template operate<TypeOut, TypeLhs, TypeRhs>(
lhs_data[i],
Expand Down

0 comments on commit bbbec62

Please sign in to comment.