Skip to content

coverage: add cuda.core tests for host, launcher cluster, strided layout, program-cache, and DLPack utils#2168

Open
rluo8 wants to merge 2 commits into
NVIDIA:mainfrom
rluo8:main
Open

coverage: add cuda.core tests for host, launcher cluster, strided layout, program-cache, and DLPack utils#2168
rluo8 wants to merge 2 commits into
NVIDIA:mainfrom
rluo8:main

Conversation

@rluo8

@rluo8 rluo8 commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Description

Tests covered:

File New tests Target source
test_host.py repr for all three Host forms; pickle/copy round-trip preserves the singleton via __reduce__ _host.py
test_launcher.py thread-block-cluster cc gate (accept ≥9.0 / reject <9.0, Device mocked); cluster branch of _to_native_launch_config _launch_config.pyx
test_program_cache.py FileStream size-cap __delitem__/clear, entry-path iteration with missing/stray dirs, tmp-size accounting, touch_atime fallback + swallowed open/fstat failures utils/_program_cache/_file_stream.py
test_strided_layout.py validation/error paths: dense_like, repr-with-offset, min/max offset, broadcast_to, unsqueezed, repacked pack/unpack, max_compatible_itemsize _layout.pyx
test_utils.py as_tensor_map kwargs assembly; DLPack export round-trip over all NumPy-native dtypes + scalar/zero-volume shapes; versioned/unversioned capsule deleters; from_dlpack TypeError→unversioned fallback; CAI device-pointer/stream-ordering; DLPack C-exchange-API helpers _memoryview.pyx

Coverage impact

Measured with paired full-coverage runs (no-patch baseline vs this patch):

Scope Before After Δ
cuda/core/ overall 79.81% 81.84% +2.03% (−213 missed)
_memoryview.pyx 65.82% 85.73% +19.92%
_host.py 83.64% 100.00% +16.36%
_launch_config.pyx 77.46% 91.55% +14.08%
_layout.pyx 89.59% 96.23% +6.64%
_file_stream.py 84.51% 90.49% +5.99%

Testing

  • Full local run on py314: all added tests pass.
  • Cross-platform on local GPU runners: Linux x64 + Windows x64, green.
  • Additionally verified on a B100 windows + Tesla T4 host.

@github-actions github-actions Bot added the cuda.core Everything related to the cuda.core module label Jun 5, 2026
@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown

@leofang leofang added CI/CD CI/CD infrastructure P1 Medium priority - Should do labels Jun 5, 2026
@leofang leofang added this to the cuda.core v1.1.0 milestone Jun 5, 2026
@rluo8 rluo8 requested review from mdboom and rwgk June 8, 2026 01:05

@rwgk rwgk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I glanced through manually and asked GPT-5.5 to do a full review. This looks solid to me. Great to see that our coverage numbers are getting significantly better.

@rwgk rwgk added the PR review get-together Mark PRs you'd like the team to review at the weekly PR review get-together. label Jun 8, 2026

@mdboom mdboom left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@rluo8: Thanks for this. It's really nice to see coverage improve.

These all look fine to me except the ones in test_utils.py. Rather than holding the rest of this up, could you remove those changes, and the submit test_utils.py alone as it's on PR? I'll comment on what I think could be improved there.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

FYI, I mentioned in our team sync today. _StridedLayout is currently not exposed to the public, so all of these complexity is not touching the public API surface. In the near future we'll need to discuss if we still want to keep this object in cuda.core since in addition to maintenance burden it also adds to performance overhead (of creating StridedMemoryView), and if we decide to remove it all of these tests will be deleted right away.

As a result, I would recommend to not expand the tests here, although I don't feel strongly (since this file is already awfully long, before this PR).

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

Labels

CI/CD CI/CD infrastructure cuda.core Everything related to the cuda.core module P1 Medium priority - Should do PR review get-together Mark PRs you'd like the team to review at the weekly PR review get-together.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants