Skip to content

Studio INT8 attention: read ROCm through is_rocm_torch, skip the dispatch fixture without diffusers - #17737

Merged
danielhanchen merged 1 commit into
mainfrom
int8-attention-rocm-gate
Nov 14, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
int8-attention-rocm-gate

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

Two failures from #17718 (INT8 attention kernel for diffusion DiTs) that show up in the backend CPU job, now that test_diffusion* runs in its own shard:

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

tests/test_diffusion_int8_attention.py  (4 errors at setup)
    _active_backend: ModuleNotFoundError: No module named 'diffusers'
  1. prefetch_fix() in diffusion_int8_attention_triton.py decides "NVIDIA build of torch" with torch.version.hip is None. AMD SDK / Radeon wheels leave torch.version.hip unset and only carry rocm in torch.__version__, so on those builds the NVIDIA sm_8x prefetch patch would be installed on an AMD device. The guard is right and the read is a real bug. diffusion_int8_attention.py already uses is_rocm_torch; the Triton module now does too.
  2. The _active_backend fixture imports diffusers.models.attention_dispatch directly. The test bodies already skip without diffusers through _h3(), but the fixture runs first, so the tests error at setup instead of skipping. It now uses pytest.importorskip.

Testing

  • test_diffusion_rocm_tag_detect.py: fails on main (the raw read above), passes here.
  • With diffusers, unsloth_zoo and trl hidden from import (the backend job's environment), test_diffusion_int8_attention.py and test_diffusion_rocm_tag_detect.py: 4 errors on main, all pass or skip here.
  • With diffusers installed: the INT8 attention tests pass as before.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 14, 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-14T08:23:22.501216Z 0d2c559 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.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 0d2c5594fb

ℹ️ 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 a27351e into main Nov 14, 2026
@danielhanchen
danielhanchen deleted the int8-attention-rocm-gate branch November 14, 2026 10:25
danielhanchen added a commit that referenced this pull request Nov 14, 2026
…nt the diffusion shard (#17736)

## Summary

Follow-up to #17723, which moved `test_diffusion*` into its own `(Python
3.13, diffusion)` backend shard. Two things went red once that shard ran
(seen on a staging run against current main):

1. `Repo tests (CPU, studio)` and `workflow-trigger lint`:

   ```

tests/studio/test_backend_ci_parallel_isolation.py::test_the_command_scan_sees_the_parallel_run_and_the_serial_steps
AssertionError: expected fourteen parallel pytest runs, four shards of
the backend matrix and ten of repo-cpu-tests ... assert 15 == 14
   ```

That test pins the number of parallel pytest runs on purpose, so a new
shard has to be stated there. #17723 updated
`test_ci_backend_pytest_shards.py` but missed this one. My mistake.

2. `(Python 3.13, diffusion)`: five tests in
`studio/backend/tests/test_diffusion_lm_studio.py` fail with
`PackageNotFoundError: No package metadata was found for unsloth_zoo`:
   - `test_frame_relay_throttles_and_never_raises_into_the_sampler`
- `test_frame_relay_sends_zero_based_steps_and_honours_stop_sequences`
   - `test_frame_relay_cuts_frames_at_the_first_eos`
   - `test_diffusion_eos_ids_match_the_sampler_cut`
-
`test_chat_diffusion_load_refuses_an_unmarked_model_and_keeps_the_token_boundary`

They import `core.inference.inference`, which imports `unsloth`, and the
backend job installs neither `unsloth_zoo` nor `trl`. They only passed
in the old a-f shard because an earlier file on the same worker
(`test_audio_chat_load.py`, `test_chat_prompt_bos.py`) had already
imported that module with its own `unsloth` stubs and left it cached. In
a shard of only `test_diffusion*` files that never happens. So these
tests have depended on xdist scheduling since #13593; the split only
made it deterministic.

## Change

- `tests/studio/test_backend_ci_parallel_isolation.py`: 15 parallel
runs, 5 backend shards.
- `studio/backend/tests/test_diffusion_lm_studio.py`: a small
`inference_mod` fixture the five tests now take.
- When `unsloth_zoo` is installed, or the module is already imported, it
returns the real module. Nothing changes there.
- Otherwise it stubs `unsloth` and `unsloth.chat_templates` (the same
two names the other backend tests stub) through `monkeypatch`, and also
drops the freshly imported `core.inference.inference`. So no later test
inherits a module bound to these stubs.
- The tests keep running in the backend job instead of being skipped
there.

## Testing

- Locally, with `diffusers`, `unsloth_zoo` and `trl` hidden from import
(the backend job's environment): `test_diffusion_lm_studio.py`,
`test_diffusion_int8_attention.py` and
`test_diffusion_rocm_tag_detect.py` on their own. The five tests fail on
main with the same error and pass here. They also pass with the real
packages installed.
- The same files in one process, before and after
`test_audio_chat_load.py` and `test_chat_prompt_bos.py`: 78 passed, 33
skipped in both orders.
- Every test that reads `studio-backend-ci.yml` (15 files): 341 passed,
3 skipped. The isolation test fails on main.
- `test_backend_tests_stub_heavy_imports.py` and
`test_sibling_imported_tests_import_their_helpers_top_level.py`: pass.

The other failures on the new shard come from #17718 and are fixed in
#17737.
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