Skip to content

Conversation

@CodersAcademy006
Copy link

This PR adds kernel-based tests for device-side closure capture in Numba-CUDA:

  • Constants and scalar values

  • Kernel factories with closure capture

  • Read-only captures

Tests are skipped under cudasim due to divergent semantics, and NumPy is used as the reference oracle. The scope is intentionally limited to safe, well-defined CUDA closure semantics (no mutable captures, late binding, or nested closures).

This continues the systematic porting of CPU-side tests to CUDA, directly contributing to issue #515.

…osure capture: constants, scalars, kernel factories, and read-only captures. Skips under cudasim. NumPy is used as the reference. Scope is intentionally limited to safe, well-defined CUDA closure semantics.
@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 comprehensive CUDA closure capture tests covering constants, scalars, boolean flags, kernel factories, and multiple constant capture scenarios. All previously identified critical issues (missing SPDX header, weak test assertions, undefined kernel variable, and missing kernel launch) have been resolved.

  • Test structure follows established patterns in the repository
  • Properly skips tests under cudasim where closure semantics differ
  • Uses NumPy as reference oracle for validations
  • Tests are well-scoped to safe, well-defined CUDA closure semantics
  • Contributes to addressing issue Incomplete Test Coverage in Numba-CUDA #515 (incomplete test coverage)

Confidence Score: 5/5

  • Safe to merge - all previously identified critical issues have been resolved
  • The PR has been thoroughly revised to address all four critical issues from previous reviews: SPDX license header added, test assertions strengthened, kernel variable properly defined, and kernel launch added. The test implementation is solid with proper closure semantics, correct device memory management, and appropriate use of NumPy for validation.
  • No files require special attention

Important Files Changed

Filename Overview
numba_cuda/numba/cuda/tests/test_closure.py New test file adding comprehensive closure capture tests for CUDA kernels - all previously reported issues have been fixed

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>
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>
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>
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