Skip to content

Preserve the CUDA default stream in DSA wrappers - #355

Closed
kunlunl wants to merge 1 commit into
NVIDIA:developfrom
kunlunl:codex/fix-sm90-default-stream
Closed

Preserve the CUDA default stream in DSA wrappers#355
kunlunl wants to merge 1 commit into
NVIDIA:developfrom
kunlunl:codex/fix-sm90-default-stream

Conversation

@kunlunl

@kunlunl kunlunl commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

What

Use torch.cuda.get_stream_from_external() when entering a caller-supplied CUDA stream.

Why

torch.cuda.ExternalStream(0) does not preserve the legacy default-stream handle. It produces a different pooled stream, so PyTorch setup or copy operations performed inside the wrapper can race a CuTe kernel launched on stream 0.

get_stream_from_external() preserves both the zero default-stream handle and nonzero external stream handles.

Validation

Run on an H100 (SM90) with PyTorch 2.12, CUDA 13.2, and cuDNN Frontend built from current develop:

  • New stream-identity regression on unpatched develop: failed as expected because the active handle was nonzero.
  • Same regression with this change: 1 passed.
  • Complete test/python/fe_api/dsa suite: 22 passed.

Signed-off-by: kunlunl <kunlunl@nvidia.com>
@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 42e7fb12-345d-4ef0-a97a-a957983ac8fb

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@kunlunl

kunlunl commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #354, which now contains this fix as a separate signed-off commit and passed the combined H100 DSA validation (3 targeted regressions and 24/24 DSA tests).

@kunlunl kunlunl closed this Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant