Skip to content

Conversation

@CodersAcademy006
Copy link

This PR adds kernel-based tests for device-side execution of common Python builtins (abs, min, max, bool) on supported dtypes. The tests are:

  • Skipped under cudasim to avoid simulator/Python semantic mismatches

  • Compared against NumPy as the ground truth

  • Focused on CUDA-safe, well-defined builtins only

  • This improves CUDA test parity and references issue Incomplete Test Coverage in Numba-CUDA #515.

…NVIDIA#515)

Adds kernel-based tests for device-side execution of common Python builtins (abs, min, max, bool) on supported dtypes. Tests are skipped under cudasim and use NumPy as the ground truth. This improves CUDA test parity and references issue NVIDIA#515.
@copy-pr-bot
Copy link

copy-pr-bot bot commented Jan 20, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 20, 2026

Greptile Summary

Adds device-side CUDA tests for Python builtins (abs, min, max, bool) to improve test parity with Numba (issue #515).

  • Tests correctly skip execution under cudasim to avoid semantic mismatches
  • Proper edge case coverage including NaN propagation in floating-point operations
  • Helper method _launch_1d validates all array sizes match before kernel launch
  • Tests compare against NumPy as ground truth using appropriate assertion methods

All previously identified concerns are style-related (extra blank lines, bounds check consistency patterns) and have been documented in prior review threads. The implementation is functionally correct and adds valuable test coverage.

Confidence Score: 4/5

  • Safe to merge with minor style improvements already noted in previous review
  • The PR adds comprehensive test coverage for CUDA builtins (abs, min, max, bool) with proper edge case handling including NaN values. All previously identified issues are style-related (extra blank lines, bounds check patterns) and don't affect correctness. The _launch_1d helper validates array sizes before kernel launch, ensuring safe execution.
  • No files require special attention - all concerns are minor style issues

Important Files Changed

Filename Overview
numba_cuda/numba/cuda/tests/test_builtins.py New test file for CUDA builtin functions - all previously identified style issues have been addressed, tests are well-structured with proper NaN handling

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, 3 comments

Edit Code Review Agent Settings | Greptile

CodersAcademy006 and others added 2 commits January 21, 2026 11:10
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

CodersAcademy006 and others added 3 commits January 21, 2026 11:43
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

CodersAcademy006 and others added 3 commits January 21, 2026 11:45
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
- Remove defensive bounds checking from kernels (trust Python validation)
- Add explicit size validation in _launch_1d helper (fail loud)
- Replace CPU zero allocation with direct device_array_like/device_array
- Remove redundant cuda.synchronize() (copy_to_host implicitly syncs)
- Add test_min_float_edge_cases for NaN and signed zero handling
- Improve test efficiency and compiler correctness verification
…uplicate test_abs_int definition\n- Use only if i < out.size: in min_kernel and max_kernel (Python enforces size)
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, 4 comments

Edit Code Review Agent Settings | Greptile

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant