Skip to content

coverage: expand resource, cache, and DLPack regression coverage - #3060

Open
rluo8 wants to merge 2 commits into
NVIDIA:mainfrom
rluo8:fix/core-test-coverage
Open

rluo8 wants to merge 2 commits into
NVIDIA:mainfrom
rluo8:fix/core-test-coverage

Conversation

@rluo8

@rluo8 rluo8 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Description

Expand cuda.core regression coverage with 35 new tests and additional cases in existing tests.

  • Extend graph-node reconstruction coverage for device memcpy, managed allocations, and peer-access metadata; validate invalid adjacency removal and kernel-node updates.
  • Cover managed-buffer validation, closed-buffer guards, VMM input validation, and stream workqueue resource metadata.
  • Exercise program-cache key generation, optional compiler discovery, disappearing cache entries, and file-permission handling.
  • Add DLPack coverage for CUDA-host/managed stream handling, dtype-width validation, missing ml_dtypes, and C exchange API exception propagation.
  • Cover NVVM compilation with a log sink, the NVRTC bundled-header version boundary, system-event validation, and kernel/array object behavior.

Changes are limited to tests and test comments.

Validation

  • All added tests passed on supported local test systems with Blackwell, Hopper, and Ampere GPUs.
  • Capability-dependent tests were skipped where unsupported.
  • All pre-commit checks passed.

Signed-off-by: Rui Luo <ruluo@nvidia.com>
@github-actions github-actions Bot added the cuda.core Everything related to the cuda.core module label Oct 9, 2026
@rluo8 rluo8 self-assigned this Oct 9, 2026
@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: NVIDIA/cuda-python/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 858510e7-574f-428a-b3ca-89b40c5cc4ff

📥 Commits

Reviewing files that changed from the base of the PR and between a94c136 and 2fe1140.


📒 Files selected for processing (7)
  • cuda_core/tests/graph/test_graph_definition_lifetime.py
  • cuda_core/tests/memory/test_managed_ops.py
  • cuda_core/tests/test_green_context.py
  • cuda_core/tests/test_module.py
  • cuda_core/tests/test_program.py
  • cuda_core/tests/test_tensor_map.py
  • cuda_core/tests/test_utils_dlpack.py

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.



📝 Summary

Summary by CodeRabbit

  • Tests
    • Expanded coverage for CUDA graph reconstruction and node lifetimes, managed memory, context resources, system events, and input validation.
    • Added checks for program compilation and caching, kernel behavior, tensor maps, opaque arrays, and DLPack interoperability.
    • Verified error handling and object behavior across additional edge cases, including closed buffers, invalid arguments, and cache failures.

Walkthrough

This PR expands cuda_core tests across graph behavior, memory and resource APIs, program compilation and caching, kernel and array APIs, and DLPack validation. It adds checks for invalid inputs, closed objects, version gates, and filesystem race conditions.

Changes

Graph API Tests

Layer / File(s) Summary
Graph node reconstruction
cuda_core/tests/graph/test_graph_definition_lifetime.py
Reconstruction cases cover host and device memcpy nodes and allocation nodes with peer access or managed memory. Tests apply capability and build-version gates.
Graph mutation and kernel-node lifecycle
cuda_core/tests/graph/test_graph_definition_mutation.py, cuda_core/tests/graph/test_graph_node_update.py
Tests check invalid adjacency removal, operations after source-node destruction, and updates to cooperative definition nodes.

Memory API Tests

Layer / File(s) Summary
Managed-buffer attributes
cuda_core/tests/memory/test_managed_ops.py
Tests check invalid values for the accessed-by set and attribute queries after buffer closure. Fixture comments describe coverage across both buffer sources.
Allocation argument validation
cuda_core/tests/test_memory.py
A test checks that modify_allocation rejects a non-Buffer argument with TypeError.

CUDA Context and Resource Tests

Layer / File(s) Summary
SM discovery and workqueue resources
cuda_core/tests/test_green_context.py
Tests compare preferred co-scheduled SM discovery with native driver results and check primary-context stream workqueue properties against the device resource.

System Event Tests

Layer / File(s) Summary
Event argument validation
cuda_core/tests/system/test_system_events.py
Tests check the exceptions raised for an invalid event type and a non-container argument.

Program Compilation and Cache Tests

Layer / File(s) Summary
Compilation and version-boundary behavior
cuda_core/tests/test_program.py
Tests check NVVM compilation with a log sink and the NVRTC 13.2/13.3 bundled-headers boundary.
Program cache-key inputs
cuda_core/tests/test_program_cache.py
Tests cover NVVM source normalization and fingerprint failures, PTX linker-selection failures, and cold nvJitLink imports.
File cache race and error paths
cuda_core/tests/test_program_cache.py
Tests cover cache operations under filesystem errors and concurrent file disappearance, including size accounting and eviction.

Kernel Object Tests

Layer / File(s) Summary
Kernel identity and representation
cuda_core/tests/test_module.py
Tests compare kernels by handle, check hashing and inequality, and verify the representation prefix.

Tensor Map and Opaque Array Tests

Layer / File(s) Summary
Tensor-map and opaque-array validation
cuda_core/tests/test_tensor_map.py, cuda_core/tests/test_texture_surface.py
The tensor-map host-view test supplies an explicit interleave value. Opaque-array tests check format rejection, representation fields, and copy argument types.

DLPack Tests

Layer / File(s) Summary
Capsule, dtype, and shape validation
cuda_core/tests/test_utils_dlpack.py
Tests cover CUDA-host and CUDA-managed producer capsules, missing ml_dtypes behavior, and dtype lane-width shape validation.
C export error propagation
cuda_core/tests/test_utils_dlpack.py
Tests check BufferError propagation from managed-tensor and borrowed-DLTensor export entry points.

Suggested reviewers: seberg


Priority: ⬇️ Low

Change: Other

Merge Risk: 🟡 Moderate · up to 2fe11

A VMM-capable test run may fail because its expected error text does not match the implementation. Resolve that mismatch before merging; the texture-surface assertions may also need less wording-sensitive checks.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: NVIDIA/cuda-python/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 0978b463-1b3d-4ef9-bdec-31e3dbe79d35
📥 Commits

Reviewing files that changed from the base of the PR and between a2b1e31 and a94c136.

📒 Files selected for processing (13)
  • cuda_core/tests/graph/test_graph_definition_lifetime.py
  • cuda_core/tests/graph/test_graph_definition_mutation.py
  • cuda_core/tests/graph/test_graph_node_update.py
  • cuda_core/tests/memory/test_managed_ops.py
  • cuda_core/tests/system/test_system_events.py
  • cuda_core/tests/test_green_context.py
  • cuda_core/tests/test_memory.py
  • cuda_core/tests/test_module.py
  • cuda_core/tests/test_program.py
  • cuda_core/tests/test_program_cache.py
  • cuda_core/tests/test_tensor_map.py
  • cuda_core/tests/test_texture_surface.py
  • cuda_core/tests/test_utils_dlpack.py

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

Comment thread cuda_core/tests/test_memory.py
Comment thread cuda_core/tests/test_texture_surface.py
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

@rluo8
rluo8 requested review from Andy-Jost and mdboom October 9, 2026 11:02
@rparolin rparolin added this to the cuda.core 1.3.0 milestone Oct 9, 2026
@rparolin rparolin added the P0 High priority - Must do! label Oct 9, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cuda.core Everything related to the cuda.core module P0 High priority - Must do!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants