Skip to content

Studio diffusion: latch failed fused fp16 RoPE and AdaLN launches for the load - #14583

Merged
danielhanchen merged 2 commits into
mainfrom
studio-diffusion-latch-failed-fused-launches
Oct 22, 2026
Merged

danielhanchen merged 2 commits into
mainfrom
studio-diffusion-latch-failed-fused-launches

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Problem

Follow-up to #14566, which made the fused FLUX RoPE in diffusion_rocm_fused.py turn itself off for the rest of the load after its first failed launch. Two sibling wrappers still retried a failing launch on every call, so a broken JIT / driver / PTX path paid the failed launch once per RoPE or AdaLN call for the whole render:

  • the fp16-only FLUX.2 RoPE wrapper in diffusion_flux2_rope.py
  • the opt-in fused AdaLN modulation (UNSLOTH_DIFFUSION_FUSED_ADALN=1) in diffusion_rocm_fused.py

Fix

Same latch as the fused FLUX RoPE:

  • The first launch exception sets a per-path flag; every later call skips the kernel and runs the stock path (the same stock code the exception fallback already used, so output is bit-identical).
  • One warning is logged when the latch trips. The fused FLUX RoPE latch now logs the same way.
  • uninstall() and the next load's install clear the flag, so a new load tries the kernel again.
  • AdaLN eligibility checks moved into _adaln_eligible (no behaviour change) so the latch is testable without a GPU.

Tests

  • test_a_failed_launch_disables_the_fused_path_for_the_load (test_diffusion_flux2_rope.py) and test_a_failed_adaln_launch_disables_the_fused_path_for_the_load (test_diffusion_rocm_fused.py): a raising launcher, four calls, exactly one launch attempt, stock output after the failure, re-armed after reload. Both fail on main and pass here.
  • On a real CUDA GPU with a raising AdaLN launcher: main makes 4 launch attempts in 4 calls, this branch makes 1; output equals stock in both.
  • The related diffusion suites pass on GPU (161 passed).

Not verified

  • No real ROCm / gfx1151 or T4 run with a kernel that actually fails to JIT; the failure is simulated with a raising launcher.

… the load

A failing launch of the fp16 FLUX.2 RoPE kernel or the opt-in fused AdaLN
modulation kernel was retried on every call. The first failure now turns
that fused path off for the rest of the load (stock output, bit-identical),
logs one warning, and the next load or uninstall re-arms it, matching the
fused FLUX RoPE latch.
@danielhanchen danielhanchen self-assigned this Oct 22, 2026
@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-22T01:43:01.071617Z 55f394a Manual request
🔒 Security Review ⚠️ Failed 2026-10-22T01:39:45.520905Z
We couldn’t complete this review. Comment @codex security review to try again.
79e2ba0 PR opened
ℹ️ 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

The account paying for this security review has reached its Codex usage limits. The payer can check the Codex usage dashboard. For personal accounts, using credits requires enabling “Use credits for security reviews” in Code review settings. If you do not manage the paying account, contact this repository's admins.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 55f394a1fd

ℹ️ 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 db6e309 into main Oct 22, 2026
@danielhanchen
danielhanchen deleted the studio-diffusion-latch-failed-fused-launches branch October 22, 2026 02:19
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