Skip to content

Commit

Permalink
feat: add awkward_ListArray_min_range CUDA kernel
Browse files Browse the repository at this point in the history
  • Loading branch information
ManasviGoyal committed Jan 25, 2024
1 parent 24ea1cf commit c25209e
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
1 change: 1 addition & 0 deletions dev/generate-kernel-signatures.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@


cuda_kernels_impl = [
"awkward_ListArray_min_range",
"awkward_ListArray_validity",
"awkward_BitMaskedArray_to_ByteMaskedArray",
"awkward_ListArray_compact_offsets",
Expand Down
1 change: 1 addition & 0 deletions dev/generate-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,7 @@ def gencpuunittests(specdict):


cuda_kernels_tests = [
"awkward_ListArray_min_range",
"awkward_ListArray_validity",
"awkward_BitMaskedArray_to_ByteMaskedArray",
"awkward_ListArray_compact_offsets",
Expand Down
2 changes: 1 addition & 1 deletion kernel-test-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -10756,7 +10756,7 @@
},
{
"name": "awkward_ListArray_min_range",
"status": false,
"status": true,
"tests": [
{
"error": false,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE

template <typename T, typename C, typename U>
__global__ void
awkward_ListArray_min_range(T* tomin,
const C* fromstarts,
const U* fromstops,
int64_t lenstarts,
uint64_t invocation_index,
uint64_t* err_code) {
if (err_code[0] == NO_ERROR) {
int64_t thread_id = blockIdx.x * blockDim.x + threadIdx.x;
int64_t shorter = fromstops[0] - fromstarts[0];

if (thread_id >=1 && thread_id < lenstarts) {
int64_t rangeval = fromstops[thread_id] - fromstarts[thread_id];
shorter = (shorter < rangeval) ? shorter : rangeval;
atomicMin(tomin, shorter);
}
}
}

0 comments on commit c25209e

Please sign in to comment.