Skip to content

Studio diffusion: free the failed group offload setup before the OOM retry - #14821

Merged
danielhanchen merged 1 commit into
mainfrom
dh/s3-diff-oom-retry-traceback
Oct 23, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
dh/s3-diff-oom-retry-traceback

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

When group offload setup ran out of memory, the pipe kept the exception, and its traceback kept the failed frames alive. Whatever those frames had allocated therefore stayed on the device through the gc.collect() and empty_cache() of the lower-residency retry that needed the room.

The stored failure is now only its type, its message and whether it was an OOM (still judged across the cause chain), and it is cleared before the retry runs.

Tests

  • test_the_setup_oom_retry_frees_what_the_failed_setup_allocated drives the real setup and retry with a failing installer that holds a 4 MiB tensor, and checks it is gone when the retry installs. test_a_stored_setup_failure_keeps_its_kind_but_not_its_traceback checks that an OOM wrapped by another error still counts as an OOM. Both fail on main.
  • Three learned-peak tests failed on any host with CUDA visible: their fake torch had no get_device_name, so a peak was recorded under one device key and looked up under another. The device name is now pinned in those tests. On a B200: 3 failed on main, 104 passed here; CPU 103 passed.
  • Diffusion memory and offload neighbours: 267 passed / 53 skipped, same as main.

Not measured: how much a real diffusers group-offload OOM retains (only the synthetic 4 MiB).

…retry

The pipe kept the setup exception, and its traceback kept the failed
frames alive, so whatever they had allocated stayed on the device through
gc.collect and empty_cache in the lower-residency retry. Store only the
type, message and OOM classification, and clear the record before the
retry runs.

Also pin the device name in three learned-peak tests whose fake torch had
no get_device_name: they keyed the record on None and the lookup on the
real card, so they failed whenever CUDA was visible.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 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-22T23:07:48.689578Z e886817 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. Keep them coming!

Reviewed commit: e886817f38

ℹ️ 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 fe80287 into main Oct 23, 2026
2 of 35 checks passed
@danielhanchen
danielhanchen deleted the dh/s3-diff-oom-retry-traceback branch October 23, 2026 03:15
danielhanchen added a commit that referenced this pull request Oct 23, 2026
… (#14885)

Two files merged without the repo formatter, so pre-commit.ci's
`ruff-format-with-kwargs` hook (which runs on all files) rewrites them
on every PR queued after:

- `studio/backend/tests/test_diffusion_learned_peaks.py` from #14821
(03:15 UTC)
- `tests/test_fp8_scale_dequant_one_pass.py` from #14886 (03:49 UTC),
folded in while this was in review

Same class as #14817, #14852 and #14878. `python
scripts/run_ruff_format.py` (the hook's entry point, `ruff==0.6.9`)
applied to those two files. Both parse to identical ASTs before and
after, `ruff check` passes, and a full run of the hook over every
tracked Python file on this branch changes nothing else.
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