Skip to content

Studio Krea 2: detect ROCm by its version tag in the prefix flash pick - #19230

Merged
danielhanchen merged 1 commit into
mainfrom
ci/krea2-flash-gate-rocm-tag
Nov 24, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
ci/krea2-flash-gate-rocm-tag

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Problem

studio/backend/tests/test_diffusion_rocm_tag_detect.py::test_no_diffusion_or_video_gate_reads_version_hip_directly fails on main in the backend (Python 3.13, diffusion) shard, so open PRs such as #19154 inherit it:

AssertionError: use core.inference.rocm_bf16.is_rocm_torch(torch): AMD SDK / Radeon wheels leave torch.version.hip unset. Raw reads: {'diffusion_krea2_prefix_kv.py': [170]}

Cause

#19208 (Krea 2 valid key prefix without a mask) added a gate that can swap auto's cuDNN pin for CUDA native flash on the mask-free prefix call. It decided "not ROCm" with getattr(torch.version, "hip", None) is None. AMD SDK / Radeon ROCm wheels leave torch.version.hip unset and carry the tag in torch.__version__ instead. On those builds, the gate could treat a ROCm card as CUDA and force the CUDA flash backend.

The guard is right and this is a real bug in the new gate, not a stale test.

Fix

  • The gate now uses core.inference.rocm_bf16.is_rocm_torch(torch), like every other diffusion and video gate.
  • New test test_a_rocm_build_keeps_the_pin checks that a ROCm build keeps the pin for both spellings: torch.version.hip set, and only a +rocm tag in torch.__version__.

Verification

  • test_diffusion_rocm_tag_detect.py and test_diffusion_krea2_prefix_kv.py: 32 passed.
  • Main's diffusion_krea2_prefix_kv.py with this branch's tests fails both the guard and test_a_rocm_build_keeps_the_pin[None-2.9.0+rocm7.1]. The version.hip case passes on both, because main already handled it.

I could not run this on real ROCm hardware. The check is the version-tag detection, simulated by patching torch.__version__.

#19208)

The mask-free prefix call's flash pick from #19208 treated a build as CUDA
when torch.version.hip was None. AMD SDK / Radeon ROCm wheels leave it
unset and carry the tag in torch.__version__, so they could take the CUDA
flash pick, and test_no_diffusion_or_video_gate_reads_version_hip_directly
fails on main. Use core.inference.rocm_bf16.is_rocm_torch, as every other
diffusion gate does, and pin both ROCm spellings.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T09:02:21.604652Z 576669f 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. Chef's kiss.

Reviewed commit: 576669fef7

ℹ️ 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 e9cad60 into main Nov 24, 2026
13 of 38 checks passed
@danielhanchen
danielhanchen deleted the ci/krea2-flash-gate-rocm-tag branch November 24, 2026 09:04
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