Skip to content

Pin CUDA availability in the step graph capture-stream release test - #15015

Merged
danielhanchen merged 1 commit into
mainfrom
ci-offload-step-graph-cuda-probe
Oct 23, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
ci-offload-step-graph-cuda-probe

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

studio/backend/tests/test_diffusion_offload_step_graphs.py::test_releasing_an_offloaded_step_graph_frees_its_capture_stream_workspace fails in Backend CI (Python 3.13, a-k), for example on #15005, with assert [] == [1, 2]. It fails on a clean main every time when run on its own.

Cause

#14777 routed GraphedForward._release through release_cached_outside_capture. That flush runs synchronize, the cuBLAS workspace clear and empty_cache only when torch.cuda.is_available(). The test patched _cuda_clearCublasWorkspaces and empty_cache but not the availability probe. On a CPU runner it therefore passed only when an earlier test on the same xdist worker had installed the CUDA spoof, and otherwise recorded no calls.

The product is right: there is nothing to flush without CUDA. The test was depending on ambient state.

Fix

The test now also patches torch.cuda.is_available (True) and torch.cuda.synchronize (no-op). Its assertion is unchanged: the cuBLAS clear and then empty_cache run only when the handle owned a capture-stream placement.

Verification

  • The file: 15 passed, 15 skipped. Before, it was 1 failed in isolation on every commit back to ae3dc79.
  • Sabotage check: making _release pass clear_cublas = False fails the test.

#14777 made the flush run only where torch.cuda.is_available(). The test patched the cuBLAS clear and empty_cache but not the probe, so on a CPU runner it passed only when an earlier test in the worker had installed the CUDA spoof. Patch is_available and synchronize alongside them.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-23T18:13:06.377077Z c00f274 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: c00f274ecd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit f2ecfe1 into main Oct 23, 2026
0 of 31 checks passed
@danielhanchen
danielhanchen deleted the ci-offload-step-graph-cuda-probe branch October 23, 2026 18:21
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