Skip to content

Studio diffusion: read ROCm through is_rocm_torch in the int8 GEMM and VAE canvas gates - #17681

Merged
danielhanchen merged 1 commit into
mainfrom
fix/diffusion-rocm-tag-gates
Nov 13, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
fix/diffusion-rocm-tag-gates

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

Two checks fail on main (7bf13f2) and on every PR based on it. The (Python 3.13, a-f) and (Python 3.13, rest) shards show them on staging runs:

studio/backend/tests/test_diffusion_rocm_tag_detect.py::test_no_diffusion_or_video_gate_reads_version_hip_directly
E   AssertionError: use core.inference.rocm_bf16.is_rocm_torch(torch): AMD SDK / Radeon wheels leave torch.version.hip unset.
    Raw reads: {'diffusion_torchao_patches.py': [66], 'diffusion_vae_canvas.py': [296]}

studio/backend/tests/test_small_host_dense_denoiser.py::test_qkv_fusion_skips_a_mapped_denoiser[True]
core/inference/diffusion_small_host.py:863: in prepare_streamed_encoder_
E   ModuleNotFoundError: No module named 'diffusers'

Both reproduce locally on main (the second with diffusers blocked).

ROCm gates (#17613, #17595)

The lint is right, and both reads are real bugs on AMD SDK / Radeon wheels, which leave torch.version.hip unset and carry the ROCm tag only in torch.__version__:

Mapped denoiser test (#17667)

test_qkv_fusion_skips_a_mapped_denoiser[True] maps the denoiser through prepare_streamed_encoder_, which uses diffusers.hooks.apply_layerwise_casting. The backend test shards do not install diffusers. The bit-for-bit test in the same file already guards on it with pytest.importorskip("diffusers.hooks").

Change

  • diffusion_torchao_patches.py: keep_transposed now uses _is_rocm_torch(torch), a small helper that calls rocm_bf16.is_rocm_torch.
  • unsloth/import_fixes.py: _make_safe_int_mm must stay AST-identical to the Studio copy (test_studio_copy_matches_unsloth_import_fixes). It gets the same call, plus its own _is_rocm_torch with the same tag-aware check, so whichever copy patches torchao first behaves the same.
  • diffusion_vae_canvas._is_rocm(): calls is_rocm_torch(torch), with no raw fallback.
  • test_small_host_dense_denoiser.py: the mapped case calls pytest.importorskip("diffusers.hooks"), like its sibling. The unmapped case still runs everywhere.

Guards

  • test_vae_canvas_graph_replicas_see_a_tag_only_rocm_wheel and test_vae_canvas_rocm_check_does_not_fall_back_on_a_cuda_build in test_diffusion_rocm_tag_detect.py.
  • test_a_tag_only_rocm_wheel_keeps_the_row_major_copy in test_torchao_int_mm_transposed.py, next to the existing torch.version.hip case.

Testing

  • test_diffusion_rocm_tag_detect.py, test_torchao_int_mm_transposed.py, test_torchao_intmm_patch_wiring.py, test_small_host_dense_denoiser.py: 33 passed, 4 skipped (CUDA-only cases).
  • Sabotage: with main's three source files and these tests, 3 fail (the lint, the VAE canvas tag-only case, the int8 tag-only case).
  • With diffusers blocked: main's test_qkv_fusion_skips_a_mapped_denoiser[True] fails with the CI error; here it skips and [False] passes.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 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-13T14:19:01.263171Z 7268f67 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. Can't wait for the next one!

Reviewed commit: 7268f67977

ℹ️ 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 8a7750d into main Nov 13, 2026
@danielhanchen
danielhanchen deleted the fix/diffusion-rocm-tag-gates branch November 13, 2026 14:20
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