Skip to content

Studio: extend the ROCm MIOpen cutoff and Qwen-Image-2.1 query chunking beyond gfx1151 - #320

Closed
danielhanchen wants to merge 1 commit into
mainfrom
mirror-pr-12471
Closed

danielhanchen wants to merge 1 commit into
mainfrom
mirror-pr-12471

Conversation

@danielhanchen

Copy link
Copy Markdown
Owner

Three recent AMD fixes for Qwen-Image-2.1 turn on automatically only on Strix Halo (gfx1151), because that was the only GPU they had been tested on. @LeoBorcherding has since tested all three on a discrete Radeon AI PRO R9700 (RDNA 4, gfx1201). Based on his results and upstream evidence, this PR enables two of them on more Radeon GPUs.

Fix Before After Measured on Added without a measurement
MIOpen search cutoff (#12359): avoids a multi-minute first VAE decode gfx1151 RDNA 3, 3.5 and 4 gfx1151, gfx1201 Other RDNA 3, 3.5 and 4
Attention query chunking (#12335): speeds up large generations gfx1151 gfx1151, gfx1200, gfx1201 gfx1151, gfx1201 gfx1200
Vision eager attention (#12360): fixes blank reference-image results gfx1151 Unchanged gfx1151, gfx1201 (no bug) None

Each section gives the change, Leo's R9700 measurement, the reasoning for anything enabled beyond that measurement, and what stays excluded. His runs used Windows 11, PyTorch 2.11 / ROCm 7.13, and main at 364a42f0, with the existing environment overrides forcing each path on and off.

MIOpen search cutoff (#12359)

Change. MIOPEN_SEARCH_CUTOFF=1 now defaults on when every visible GPU is gfx110*, gfx115* or gfx120*, instead of only gfx1151. Explicit environment values still win, including 0.

Measured. From the #12359 test, with empty MIOpen caches and one clean run per side:

First 1024² generation Unset =1
VAE decode 400.0 s 33.5 s
Full render 411.0 s 45.9 s

Images differ by at most 2/255, consistent with the variation between stock runs.

Beyond the measurement. The rest of RDNA 3, 3.5 and 4 is included because the cause is not specific to one GPU. ROCm 7.13 ships no system find databases for any of them, so every first convolution search starts cold. AMD itself sets the cutoff for its cold diffusion benchmarks on Navi31, Navi48 and Strix Halo.

Excluded. Hosts with any other architecture keep MIOpen's default:

  • CDNA ships tuned databases. A related naive-solver skip, MIOPEN_NAIVE_DISABLE_IF_ALT, cost 18.8% throughput on MI355X.
  • gfx1250 is an Instinct part, which is why the prefixes are not a bare gfx12.
  • RDNA 2 ships a database and has no measurement.

The cutoff can discard the only applicable solver and fail a convolution. This risk already applies to the gfx1151 default, and MIOPEN_SEARCH_CUTOFF=0 opts out.

Attention query chunking (#12335)

Change. Automatic 512-row query chunking now covers gfx1200 and gfx1201 as well as gfx1151. The shape and backend guards and the UNSLOTH_QWEN_IMAGE_ROCM_QUERY_CHUNKING overrides are unchanged. The arch is now read with _props_gfx_arch, as the MIOpen and vision gates already do.

Measured. From the #12335 test, four runs per side in alternating order:

1536², 4 steps, transformer forward Off, median (range) On, median (range)
Warm 13.41 s (13.19 to 13.49) 11.64 s (11.37 to 12.26)
Cold 19.36 s (18.91 to 19.76) 17.63 s (17.22 to 17.71)
Peak allocation 14.90 GiB 14.90 GiB

Outputs differ by at most 17/255, against 2/255 between stock runs, so chunking changes the numerics slightly.

Beyond the measurement. gfx1200 is included because AOTriton 0.11.2b gives it gfx1201's tuning database and kernel pack, so it runs the same attention kernels.

Excluded. gfx1100, the other RDNA 3 and 3.5 GPUs, and CDNA stay opt-in until they are measured.

Vision eager attention (#12360)

Unchanged. In the #12360 test, native vision SDPA stayed finite on the R9700 with a 1024² reference, with the same speed and memory as eager attention.

Validation

All 237 tests across the MIOpen cutoff, query chunking, diffusion speed and vision attention suites pass. Gate coverage includes mixed hosts, excluded architectures and explicit overrides.

This commit was not run on AMD hardware. gfx1200, discrete RDNA 3 and Linux RDNA 4 remain untested.


Mirror of unslothai/unsloth#12471 by @oobabooga, opened for review only.
Do not merge here. Fixes agreed on this mirror must be applied to the source PR.
Source description digest at mirror time: 3e1040750f5b

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 2, 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-02T07:33:42.679748Z 23e7614 Manual request
🔒 Security Review ✅ Completed 2026-10-02T07:32:56.398853Z 23e7614 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.

@danielhanchen

Copy link
Copy Markdown
Owner Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 23e7614145

ℹ️ 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".

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.

2 participants