Skip to content

test(cuda.core): simplify the OOM probe's context handling and artifact naming - #3551

Merged
juenglin merged 1 commit into
NVIDIA:mainfrom
juenglin:oom-probe-simplify
Nov 24, 2026
Merged

juenglin merged 1 commit into
NVIDIA:mainfrom
juenglin:oom-probe-simplify

Conversation

@juenglin

Copy link
Copy Markdown
Contributor

Description

Follow-up to #3543, implementing the design review posted after it merged.

  • An OOM without a current context no longer borrows device 0's primary context. It gets a one-line note, and the full report waits for the next OOM that has a context. The diagnostics hook never changes context state. This removes the borrow and restore paths, the second report, and append mode.
  • The artifact is named after the --junitxml file (junit-core-oom-diagnostics.txt beside junit-core.xml), which is unique per pytest invocation. This replaces the exclusive-create retry loop with a plain write.

Net: +135/-284 in cuda_core/tests/helpers/oom_diagnostics.py and cuda_core/tests/test_helpers.py.

Checklist

  • I have read the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

…ct naming

Follow-up to NVIDIA#3543. Instead of borrowing device 0's primary context when no context is current, note the OOM once and probe at the next one that has a context, so the diagnostics never change context state. Name the artifact after the --junitxml file, which is unique per pytest invocation, instead of picking an unused name.
@juenglin juenglin added this to the cuda.core 1.4.0 milestone Nov 24, 2026
@juenglin juenglin added test Improvements or additions to tests cuda.core Everything related to the cuda.core module labels Nov 24, 2026
@juenglin juenglin self-assigned this Nov 24, 2026
@copy-pr-bot

copy-pr-bot Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

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.

@juenglin

Copy link
Copy Markdown
Contributor Author

/ok to test 4449cef

@jpascucci-nv jpascucci-nv 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.

Sol 6.1 high has no actionable findings.

@juenglin
juenglin marked this pull request as ready for review November 24, 2026 16:35
@coderabbitai

coderabbitai Bot commented Nov 24, 2026

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • OOM diagnostics no longer create or borrow a device context when none is already active. The first OOM in that situation is noted, and diagnostics remain available if a later OOM occurs with an active context.
    • Diagnostic reports now use a fixed filename based on the JUnit output path. If writing the artifact fails, the report remains available in the returned text.
  • Tests
    • Updated coverage for context handling, report capture, and diagnostic artifact paths.

OOM diagnostics now probe only an already-current context. A contextless OOM produces a note and does not prevent a later context-backed OOM from being captured. The recorder writes one report to a JUnit-derived artifact path and summarizes whether a probe occurred.

Changes: OOM diagnostics

Layer / File(s) Summary
Current-context probing
cuda_core/tests/helpers/oom_diagnostics.py, cuda_core/tests/test_helpers.py
run_probe returns a no-context snapshot when no context is current. Classification and logging report that result. The primary-context borrowing test is replaced by a test that checks no context becomes current.
Artifact path selection
cuda_core/tests/helpers/oom_diagnostics.py, cuda_core/tests/test_helpers.py
Artifact paths use the resolved JUnit filename with an OOM diagnostics suffix, or the default filename under the root path when JUnit output is not configured. Tests check both naming patterns.
Delayed OOM capture and reporting
cuda_core/tests/helpers/oom_diagnostics.py, cuda_core/tests/test_helpers.py
The recorder notes a contextless OOM without closing the capture latch. A later context-backed OOM writes one report. The terminal summary reports the captured OOM and artifact status, or states that no probe occurred.

Possibly related PRs

Suggested reviewers: andy-jost

Change: Other

Merge Risk: Minimal · up to 4449c

This change simplifies OOM diagnostics in the CUDA Core test helpers. They now probe only an already-current context and write one report next to the JUnit file. The changes are limited to test-support code and show no concrete merge-blocking risk.

Security architecture risk: Low · up to 4449c

OOM diagnostics no longer switch CUDA contexts. The remaining risk is limited to test diagnostics: runs that share an output path can overwrite each other’s reports. The standard CI commands use different paths for the two CUDA Core suites.

Retained concerns

  • Low · reliability · inferred: Replacing exclusive creation with a fixed-path write removes isolation between reports from separate pytest runs that share the default root-directory filename or resolve to the same JUnit-derived path. A later write can replace an earlier report, and an interrupted write can leave it truncated. The recorder lock protects only one process. This affects preservation and attribution of failure evidence, not production CUDA state.
Security review details

Trust Boundaries and Controls

  • observed — The filesystem write runs with the pytest process’s permissions at a destination derived from the runner’s JUnit option or pytest root directory. The recorder lock is not a filesystem ownership control across processes.

Resilience and Maintainability Implications

  • observed — The standard CI commands give the main CUDA Core suite and its Cython suite distinct JUnit stems, so those two suite invocations derive different diagnostics filenames.
- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between a79afd0 and 4449cef.

Files selected for processing: 2

  • cuda_core/tests/helpers/oom_diagnostics.py
  • cuda_core/tests/test_helpers.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.

@juenglin
juenglin enabled auto-merge (squash) November 24, 2026 16:51
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor
Doc Preview CI
Preview removed because the pull request was closed or merged.

@juenglin
juenglin merged commit 4f6799e into NVIDIA:main Nov 24, 2026
127 checks passed
github-actions Bot pushed a commit that referenced this pull request Nov 25, 2026
Removed preview folders for the following PRs:
- PR #3499
- PR #3524
- PR #3543
- PR #3544
- PR #3546
- PR #3551
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 test Improvements or additions to tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants