coverage: add cuda.core tests for graph, IPC, launcher, program, and DLPack - #2728
coverage: add cuda.core tests for graph, IPC, launcher, program, and DLPack#2728rluo8 wants to merge 6 commits into
Conversation
…DLPack Signed-off-by: Rui Luo <[email protected]>
1dab946 to
21f1913
Compare
|
|
Looks mostly fine to me, but I think @Andy-Jost may want to review the graph stuff. |
| src = np.arange(6, dtype=np.int32) | ||
| view = StridedMemoryView.from_array_interface(src) | ||
| assert view.is_device_accessible is False | ||
| assert view.device_id == init_cuda.device_id |
There was a problem hiding this comment.
This asserts the current-device value, but the StridedMemoryView docstring says device_id "is -1 for CPU tensors", and the DLPack import path already returns -1 for kDLCPU. _smv_from_array_interface is the outlier: it sets buf.device_id = handle_return(driver.cuCtxGetDevice()).
Recommend fixing the source in this PR with a one-liner (buf.device_id = -1 in _smv_from_array_interface) and changing this assertion to assert view.device_id == -1. That way the new test pins the documented behavior rather than the inconsistency.
| @pytest.mark.agent_authored(model="gpt-5.6-sol") | ||
| def test_nvvm_options_reject_each_unsupported_flag(kwargs): | ||
| """Every NVVM-unsupported option is rejected, named, and reported alone.""" | ||
| # This table mirrors _prepare_nvvm_options_impl's rejection list one-for-one. |
There was a problem hiding this comment.
use_bundled_headers landed in _prepare_nvvm_options_impl's rejection list yesterday (#2753), so the table is one short of one-for-one. Recommend adding {"use_bundled_headers": True} to the parametrize list (after include_path, matching the source order) so the comment stays true.
Andy-Jost
left a comment
There was a problem hiding this comment.
Looks good overall. I just found two issues that need to be corrected.
Description
Adds focused unit tests across
cuda.core, targeting input-validation branches, error paths, and object-lifecycle behavior that were previously uncovered. All tests are real-path: host-only tests exercise pure helpers / argument validation directly, and GPU-required tests use the existing fixtures and skips. No production changes.Measured effect on
cuda/core/line coverage: about +1.65%, +208 lines. Largest gains in_program.pyx,graph/_subclasses.pyx,_memory/_ipc.pyx,_memoryview.pyx,_kernel_arg_handler.pyx, andgraph/_graph_builder.pyx.Note that the coverage numbers are for
cuda/core/only, combined across local systems with Linux, Windows, H800, B10, and B100.graph/test_graph_builder.pyjointype check;__cuda_stream__after close; capture guards (end_building/debug_dot_print/callback/create_condition/embed/if_then); factory-onlyGraphBuilder/Graph;close()ends an active capturegraph/test_graph_definition.pyAllocNodereconstructsmemory_typefrom the driver via a pred walk (CUDA_ERROR_NOT_SUPPORTEDskip)graph/test_graph_definition_lifetime.py_create_from_driverfor memcpy / event record / event wait / freegraph/test_graph_node_update.pyExecutableGraphNode; executable-noderepr; clustered/cooperativeupdatereject; ctypes host-callbackreprmemory_ipc/test_errors.pyfrom_allocation_handle;ForkingPicklerfd dup; registry dedup of repeated imports (Linux)test_launcher.pyprepare_numpy_argfallback (kernel readback);CUgraphConditionalHandlepacked as uint64test_memory.pyBuffer()forbidden; context-manager close; abstractMemoryResourcestubs;copy_to()without a memory resourcetest_optional_dependency_imports.pytest_program.pydefine_macroerror; each NVVM-unsupported option; NVRTCas_bytessequence flags; debug temp-write fallback;use_libdeviceresolves__nv_sintest_utils.py.view();view(dtype=)itemsize mismatchtest_utils_dlpack.pystream=None; versioned readonly; malformed dtype; C-exchange API NULL/scalar/device-accessible cases