cuda-python icon indicating copy to clipboard operation
cuda-python copied to clipboard

Reorganize graph tests and add device-side launch support

Open Andy-Jost opened this issue 1 month ago • 5 comments

Summary

This PR reorganizes the graph tests into a new tests/graph/ subdirectory, adds a public Graph.handle property, and introduces tests for device-side graph launch.

Closes #1331

Changes

Test Reorganization

  • Create new tests/graph/ subdirectory following the pattern of tests/memory_ipc/
  • Break apart test_graph.py into logical groupings:
    • test_basic.py: basic graph construction and topology tests
    • test_conditional.py: conditional node tests (if, if-else, switch, while)
    • test_advanced.py: child graphs, update, stream lifetime
    • test_options.py: debug print, complete options, build mode
  • Incorporate test_graph_mem.py (renamed to test_capture_alloc.py)
  • Add shared kernel compilation helpers in tests/helpers/graph_kernels.py

API Addition

  • Add Graph.handle property to expose the underlying CUgraphExec handle
  • Follows the existing pattern of Stream.handle and Event.handle
  • Forward-compatible with future RAII handle refactoring

Device-Side Graph Launch Tests

  • Add test_device_launch.py with tests for device-side graph launch
  • Uses cudaGraphLaunch() from device code via cudaStreamGraphTailLaunch
  • Requires Hopper (sm_90+) architecture
  • Uses cuda.pathfinder.find_nvidia_header_directory() to locate libcudadevrt.a

Test Coverage

  • 58 tests total in tests/graph/
  • All tests pass on Hopper (H200)
  • Device launch tests skip on pre-Hopper architectures

Andy-Jost avatar Jan 16 '26 21:01 Andy-Jost

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.

copy-pr-bot[bot] avatar Jan 16 '26 21:01 copy-pr-bot[bot]

/ok to test 6e30c531b293c44d3d45a4e4df3f22c377efe5ec

Andy-Jost avatar Jan 16 '26 21:01 Andy-Jost

/ok to test 5c637332f

Andy-Jost avatar Jan 16 '26 22:01 Andy-Jost

/ok to test da6205cc2

Andy-Jost avatar Jan 16 '26 22:01 Andy-Jost

Doc Preview CI :---: |

:rocket: View preview at
https://nvidia.github.io/cuda-python/pr-preview/pr-1512/
|
https://nvidia.github.io/cuda-python/pr-preview/pr-1512/cuda-core/
|
https://nvidia.github.io/cuda-python/pr-preview/pr-1512/cuda-bindings/
|
https://nvidia.github.io/cuda-python/pr-preview/pr-1512/cuda-pathfinder/

|

Preview will be ready when the GitHub Pages deployment is complete.

github-actions[bot] avatar Jan 16 '26 22:01 github-actions[bot]

/ok to test 5711044498da128582c7e8fc1794d59a93320069

Andy-Jost avatar Jan 20 '26 18:01 Andy-Jost

/ok to test acb0c979e54e75c0ab5c32d36e8d3c187dc3e21b

Andy-Jost avatar Jan 22 '26 19:01 Andy-Jost