Repository navigation
Studio video: read the hosted int8 ConvRot DiT as W8A8 on ROCm for an explicit int8 pick - #18903
Merged
Merged
Conversation
… explicit int8 pick An explicit int8 LTX-2.5 load on ROCm quantised the dense DiT shards weight-only at load: ROCm seeds no torchao checkpoint, the hosted native read was wired for offloaded CUDA plans only, and native_int8_act keeps ROCm weight-only unless UNSLOTH_NATIVE_INT8_ACT=1. On ROCm RDNA, an explicit int8 pick for a family with rdna_explicit_w8a8 evidence (LTX-2.5) now plans the hosted INT8 ConvRot safetensors instead of the dense shards and reads it as native W8A8 Linears, resident or offloaded. AUTO, CUDA and every other family are unchanged. Kill switch UNSLOTH_ROCM_VIDEO_HOSTED_INT8=0 (UNSLOTH_NATIVE_INT8_ACT=0 also restores it).
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Member
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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
added a commit
that referenced
this pull request
Nov 23, 2026
…ted int8 DiT (#18958) ## Summary On Windows ROCm (gfx1151, Strix Halo), an explicit int8 pick for LTX-2.5 cannot load at all. Studio refuses it at the unified-memory guard: ``` 'ltx-2.5' needs about 73 GB of memory for its weights, but only about 61 GB is usable on this device (of the 77 GB currently free, after reserving room for the operating system) ``` #18903 added a route that reads the hosted `LTX-2.5-INT8-ConvRot.safetensors` DiT (25.11 GB) as native W8A8 Linears on ROCm RDNA, instead of loading the dense bf16 shards and quantising them at load. On Windows that route never engages, and the guard would refuse it even if it did. Root cause (two independent gaps, both on the explicit int8 hosted read path): 1. The source check that commits the hosted file in place of the dense shards (`VideoBackend._denoiser_prequant_verified`) asks `restricted_prequant_load_supported()`, which needs the torchao pickle allowlist. On Windows ROCm torchao is a stub, so `_register_prequant_safe_globals()` always answers False and the check refuses. The native read itself (`load_native_from_hosted`) reads the safetensors file with `safetensors` and builds native Linears; it never touches torchao. 2. The memory plan prices the denoiser at the dense bf16 size (`components[0] * dtype_scale`) unless a torchao seed is planned. The hosted native read is not a torchao seed, so it was priced at 42 GB of bf16 DiT instead of the 25.11 GB file it actually reads. On a unified-memory APU that sends every explicit int8 LTX-2.5 load to the refusal. ## Changes All in `studio/backend/core/inference/video.py`: - `_denoiser_prequant_verified(..., native_hosted=True)` (only the commit of the native hosted read passes it): when torchao cannot deserialize a checkpoint but the family's hosted int8 file is ConvRot safetensors (not a torchao pickle), the check accepts it and only counts `.safetensors` names. `_denoiser_prequant_hub_files` and `_denoiser_prequant_cached_repo` take an optional `readable` filter for that; without it they behave exactly as before. A torchao seed still needs torchao. - `_video_hosted_read_dit_gb()`: when an explicit int8 ROCm RDNA load has the hosted int8 file staged in place of the dense shards (the same `_video_rocm_hosted_scheme` gate the read uses), the plan prices the DiT at the family's hosted file size (`prequant_resident_gb_by_scheme`, 25.11 GB for LTX-2.5). The existing companion, worker and overhead margins are unchanged. - If the hosted read then does not happen (no hits, or the build is discarded as not matching), the load re-plans at the dense bf16 size and runs the unified-memory guard again before any dense shard is loaded. A dense load is never priced below its dense size. - Kill switch `UNSLOTH_VIDEO_HOSTED_INT8_FIT=0` restores the previous behaviour (torchao-gated source check, dense price). The existing `UNSLOTH_ROCM_VIDEO_HOSTED_INT8=0` and `UNSLOTH_NATIVE_INT8_ACT=0` switches still turn the whole hosted read off. Not changed: the guard itself (`diffusion_memory.py`), Auto (never takes the hosted read on ROCm), dense loads, CUDA (the pricing requires the ROCm RDNA explicit int8 gate), pickle families such as Wan2.2 A14B, and the image loaders. ## Tests - `tests/test_video_hosted_int8_fit.py` (new, CPU): the torchao-free source check (stubbed torchao commits the ConvRot safetensors file; a pickle-only repo, a torchao seed and the kill switch still refuse; a real torchao keeps the old filter), the pricing gate (ROCm explicit int8 with the hosted file planned prices 25.11 GB; Auto, off, fp8, GGUF, Wan A14B, CUDA, stored-precision checkpoints and every kill switch keep the dense price), the dense re-guard wiring, and the guard arithmetic on the failing host (80 GB total / 77 GB free reproduces "needs about 73 GB ... only about 61 GB usable"; the hosted DiT plan fits). - Related CPU suites, head: `test_video_hosted_int8_fit.py`, `test_video_rocm_hosted_int8.py`, `test_diffusion_flux3_rdna_shared_quant.py`, `test_diffusion_rocm_tag_detect.py`, `test_video_hosted_int8_offload.py`, `test_video_native_hosted.py`, `test_video_offline_load.py`, `test_video_ltx25_prequant.py`, `test_video_prequant.py`, `test_video_prequant_safetensors_twins.py`, `test_video_backend.py`, `test_diffusion_unified_load_override.py`, `test_diffusion_memory_rocm_apu_reserve.py`: 908 passed, 19 skipped. ## gfx1151 Windows results Windows 11 gfx1151 (Radeon 8060S, torch 2.11.0+rocm7.14.0, HIP 7.14), Studio installed with the head tree's Windows installer, base = merge base 22f1d70, head = base + this patch, same job and runner, LTX-2.5 512x320x17, 8 steps, one clip per arm. Studio downloads what it loads, no HF token on the runner. | arm | base | head | |---|---|---| | explicit int8 | refused: "needs about 63 GB ... only about 61 GB is usable" | loads (offload none, quant int8), renders, 30.8 s/clip | | explicit int8, `UNSLOTH_VIDEO_HOSTED_INT8_FIT=0` | refused (63 GB) | refused (63 GB), same log lines as base | | Auto | refused (63 GB) | refused (63 GB) | | dense (`off`) | refused (63 GB) | refused (63 GB) | Head explicit int8 log: ``` video.denoiser_prequant: this install cannot deserialize a torchao checkpoint, but the hosted int8 safetensors file is read as native Linears without torchao video.native_hosted: pricing the ltx-2.5 DiT at the hosted int8 file (25.11 GB) instead of the dense bf16 shards (42.00 GB): ... diffusion.prequant: fingerprint verified (480 of 480 quantized weights, full, md5-canonical-v2) diffusion.native_quant: int8 W8A8 on cuda:0 runs the RDNA Triton kernels video.native_hosted: read 480 int8 ConvRot layers of transformer from the hosted checkpoint as native Linears in 18.1 s (no dense shards, no runtime quantise) ``` - A separate single-cell run on another runner gave the same outcome (37.4 s/clip on that runner, peak 50.1 GiB device memory over idle, 34.0 GiB torch peak allocated); its frames are a coherent clip. - With the int8 text encoder now auto-selected the base estimate is 63 GB (it was 73 GB with the bf16 encoder); either way it is over the 61 GB budget, and the head estimate with the hosted DiT is under it. - Auto and dense stay refused: the guard is unchanged for them, and the kill switch reproduces the base behaviour exactly. ## Not covered - Linux gfx1151 was not rerun on hardware; there torchao is real, so the source-check change does not apply, and the pricing change only lowers the estimate for the same hosted read #18903 already measured. - CUDA, discrete ROCm cards and other RDNA generations were not run. CUDA is excluded by construction (the pricing needs the ROCm RDNA explicit int8 gate); a discrete RDNA card can now plan the int8 DiT resident where the dense price offloaded it, which was not measured. - Clip quality was not scored against a bf16 reference on Windows (bf16 does not fit this device); #18903 measured LPIPS for the same read on Linux. - The dense re-plan after a hosted miss is covered by CPU tests only; no hardware run forced a miss. - Image families are untouched (separate change).
3 tasks done
danielhanchen
added a commit
that referenced
this pull request
Nov 23, 2026
…strips (#18995) ## Summary Two follow-ups on merged ROCm work, found while re-checking the gfx1151 int8 and VAE changes: 1. #18903 (and the FLUX.3 explicit W8A8 row before it) turned an explicit int8 pick into W8A8 on every RDNA3 / RDNA4 card, but only gfx1151 was ever measured. The W8A8 rows now apply only on gfx1151; other RDNA cards keep the weight-only explicit int8 build they used before. 2. #18854's VAE upsample fold on gfx1151 ran one whole-map transposed conv at 1024 px, which doubled the full-map decode peak (1.55 -> 3.10 GiB in that PR's own table) while `full_map_decode_mib`, the estimate the admission check uses, has no term for it. ROCm now folds strip by strip, the shape the 2048 px decode already used with its peak unchanged. A decoder whose strip decode failed also no longer re-runs the fold in its retry. ## Changes - `diffusion_transformer_quant.py`: `rdna_explicit_w8a8_reason` also needs the target card's own gfx arch, read by its ordinal through `rocm_bf16._device_gfx_arch`, to be in `RDNA_EXPLICIT_W8A8_ARCHS = {"gfx1151"}`. That covers: - FLUX.3 Klein explicit int8 (image); - LTX-2.5 explicit int8 through `rdna_video_explicit_w8a8_reason`, both the resident hosted read (`_video_rocm_hosted_scheme`) and the offloaded native build (`_video_int8_act`). The RDNA W8A8 kernels still accept every gfx11xx / gfx12xx card (`_ROCM_FUSED_W8A8_ARCH`), and the weight-only compiled explicit int8 tier (`rdna_explicit_int8_reason`) is unchanged on all of them. gfx1100 / gfx1101 / gfx1201 and an unreadable arch lose only the unmeasured W8A8 switch. AUTO (`rdna_auto_w8a8_reason`) is not touched here. - `diffusion_vae_strips.py`: - `_fold_full_max(x)`: on ROCm the fold's whole-map limit is one strip (`strip_elems`), so MIOpen's transposed conv runs per strip with a bounded workspace. CUDA keeps `FOLD_FULL_MAX_ELEMS`. - `full_map_decode`: a decoder whose strip decode failed retries, and keeps decoding, on the torch ops without the fold, so a failing fold does not run twice before the tiles take over. The fold is not tied to the portable mode itself, because ROCm and no-Triton hosts run every strip decode in portable mode and must keep the fold. - Tests: - `test_diffusion_flux3_rdna_shared_quant.py` and `test_video_rocm_hosted_int8.py` check the arch gate: gfx1151 on, gfx1100 / gfx1101 / gfx1201 / "" off, the arch read by the target ordinal, and an unreadable arch treated as off. The video test covers the resident spec and the offloaded spec. - `test_diffusion_vae_upsample_fold.py` covers the ROCm strip limit and the fold call count per strip, and checks that a portable decode keeps the fold while the failed-decoder retry drops it. - The existing RDNA fixtures pin the arch to gfx1151. ## Results (gfx1151, ROCm 7.13, torch 2.11) Base = main 1446c1d, head = base + this branch, same runner and job, Linux ROCm 7.13. FLUX.2 VAE (`unsloth/flux-3-image-klein`), whole-map strip decode (`full_map_decode`), bf16, fixed latents. Fresh process per arm, fold off / on in ABBA order, decode time is the median of 3 decodes after a warm one. Peak is `max_memory_allocated` above what was allocated before the decodes. Estimate is the tree's own `full_map_decode_mib`. | px | arm | base s | head s | base peak MiB | head peak MiB | estimate MiB | |---|---|---|---|---|---|---| | 1024 | fold off | 2.506 | 2.509 | 1409 | 1409 | 2322 | | 1024 | fold on | 2.372 | **2.289** | 2997 | **1427** | 2322 | | 2048 | fold off | 11.380 | 11.442 | 3370-3497 | 3370 | 4682 | | 2048 | fold on | 10.535 | 10.539 | 3388 | 3388 | 4682 | - Base's 1024 px fold peak (2997 MiB) is above its own estimate (2322 MiB), which is the under-pricing this fixes. Head's is 1427 MiB, within 18 MiB of the fold-off peak. - Fold speedup over fold off is unchanged or better: 1024 px 1.056x -> 1.096x, 2048 px 1.080x -> 1.086x. At 1024 px the strip fold is also faster than the whole-map fold measured inside the head tree (2.289 vs 2.384 s). - The fold still runs: 12 fold calls per run in both trees. The head runs 104 transposed convs (strips) where base ran 12. - Output: the fold-off images are byte-identical between base and head. Base's whole-map fold re-run inside the head tree is byte-identical to base. The head strip fold against the base whole-map fold differs only at rounding (max abs 0.031, PSNR 66.6 dB), closer than fold against no fold (64.8 dB, the tolerance #18854 shipped with). - LTX-2.5 explicit int8 (512x320, 17 frames, 8 steps): both arms log `read 480 int8 ConvRot layers of transformer from the hosted checkpoint as native Linears`, 15.83 / 15.93 s per clip, and the clips are byte-identical. The gate still allows gfx1151. ## Not covered - gfx1100 / gfx1101 / gfx1201: no such runner was available, so the refusal on those archs is proven on CPU only (the gate's arch read is mocked per arch). - Windows ROCm: not run here. The arch gate is platform-neutral. The VAE strip fold matches the 2048 px shape that #18854 measured on Windows 7.14. - CUDA: unchanged by construction. The arch gate sits behind `_rocm_cuda`, and `_fold_full_max` returns the old limit on non-ROCm devices. Not rerun on hardware. ## Test plan - [x] `tests/test_diffusion_flux3_rdna_shared_quant.py`, `tests/test_video_rocm_hosted_int8.py`, `tests/test_video_hosted_int8_fit.py`, `tests/test_diffusion_vae_upsample_fold.py`, `tests/test_diffusion_vae_strips.py`, `tests/test_diffusion_vae_full_map.py`, `tests/test_diffusion_vae_tiling.py` pass - [x] `tests/test_diffusion_native_quant.py`, `tests/test_diffusion_vae_tiling_general.py`: one pre-existing failure each, which fails the same way on main - [x] gfx1151 hardware run, base (main) vs head: VAE criteria CONFIRMED (defect at base, cleared at head), LTX-2.5 NO_REGRESSION (byte-identical)
danielhanchen
added a commit
that referenced
this pull request
Nov 23, 2026
… explicit int8 pick (FLUX.3 Klein, Qwen-Image-2.1) (#18951) ## Summary On ROCm (gfx1151), an explicit int8 pick for FLUX.3 Klein or Qwen-Image-2.1 downloaded the dense bf16 transformer shards and quantised them at load into the native W8A8 ConvRot build. The family's hosted `*-INT8-ConvRot.safetensors` already holds that build: the same 228 / 224 layers, the same g256 rotation, per-row int8 codes and float32 scales. This PR reads the hosted file as native W8A8 Linears for that pick, the same way #18903 does for LTX-2.5 video. Generation speed and VRAM do not change. Warm loads take about half as long, the DiT download is about half the size, and host RSS is lower. Root cause: 1. The image planner returned early on any host without the torchao dense path (`dense_transformer_supported`), so ROCm never seeded a hosted denoiser and always kept the dense shards. 2. The seed loader (`denoiser_prequant_pipe_kwargs`) only knew the torchao reader, which ROCm cannot use. 3. The shared hosted reader (`load_native_from_hosted`) refused FLUX.3's file, which stores `norm_q` / `norm_k` as float32. A bf16 `from_pretrained` also keeps those in float32 (`_keep_in_fp32_modules`). ## Changes - `diffusion_rocm_hosted_int8.py` (new): `rocm_image_hosted_int8_reason()` qualifies a load only when all of these hold: - the request is an explicit int8 pick; - the card is a ROCm RDNA card on the compiled int8 tier (`rdna_explicit_int8_reason`); - the family has a hosted int8 ConvRot file; - the family's runtime build would already be W8A8 (`rdna_explicit_w8a8` or `rdna_auto_w8a8`, or `UNSLOTH_NATIVE_INT8_ACT=1`). The hosted file is W8A8 only; - the target card's own gfx arch, read by its ordinal through `rocm_bf16._device_gfx_arch`, is a measured arch (`ROCM_IMAGE_HOSTED_INT8_ARCHS = {"gfx1151"}`). The RDNA W8A8 kernels accept every gfx11xx / gfx12xx card, but only gfx1151 has speed and quality numbers, so gfx1100 / gfx1101 / gfx1201 and an unreadable arch keep quantising the dense shards at load. CUDA never asks for an arch. `load_rocm_hosted_transformer()` accepts only the ConvRot safetensors file and reads it through `load_native_from_hosted`. The planner's source probe, the download plan and the resolver share one ConvRot-only candidate list (`rocm_convrot_source`), so a mirror holding only the plain int8 file cannot make the plan pick one file and the load another. - `diffusion.py`: - On a host without the torchao path, `_pipeline_planned_denoiser_scheme` now asks `_rocm_hosted_int8_seed` instead of returning None. That helper applies the same gates as the load's compiled RDNA int8 tier (pipeline, no forced offload, a compiling speed tier, `compile_eligible`), takes hosted repo sources only, and requires a resident plan. - The loader asks those gates again before it keeps the seed. A compile probe recorded after planning drops the seed and restores the dense shards. - `diffusion_denoiser_prequant.py`: on such a host the seed goes through the native reader. A refusal returns `{}`, which already restores the dense shards and re-plans at bf16. - `diffusion_native_hosted.py`: - New `keep_fp32` opt-in (image caller only) that allows float32 where the class keeps it, as the pickle reader already does. The video callers keep the strict bf16 rule. - New `tag` argument so the image log lines read `diffusion.rocm_hosted_int8:`. The default output is unchanged. - When the caller passes `base`, the reader now refuses a checkpoint whose header `base_model_id` is missing or names another base, even with `UNSLOTH_PREQUANT_HEADER_PROBE=0`. This also applies to the video reads (#18903 and #18958 pass `base = fam.base_repo` for LTX-2.5). It does not change them for the official file, whose header carries `Lightricks/LTX-2.5-Diffusers` (a test checks LTX-2.5's own base against that value); a checkpoint baked for another base is now refused there too, which is the intended behaviour. - Kill switch `UNSLOTH_ROCM_IMAGE_HOSTED_INT8=0` (checked before any host query); `UNSLOTH_NATIVE_INT8_ACT=0` also keeps the old path. - Z-Image is not turned on. Its explicit int8 on RDNA is weight-only, and the hosted file is W8A8. Measured W8A8 is 11% faster but further from bf16 (LPIPS 0.018 to 0.023, against 0.012 for weight-only), so it stays weight-only. With `UNSLOTH_NATIVE_INT8_ACT=1` it reads the hosted file (measured below). - MiniMax-H3-Image is untouched. Its family has no runtime ConvRot spec and `supports_torch_compile=False`, so it never reaches the compiled RDNA int8 tier. - Tests: `tests/test_diffusion_rocm_hosted_int8.py` (new, 56 cases) covers the gates, the measured-arch gate (gfx1151 / gfx1100 / gfx1101 / gfx1201 / unknown, read by the target ordinal), kill switches, Auto, CUDA, weight-only and unsupported families, local overrides, non-ConvRot files, the planner and the seed. `tests/test_video_native_hosted.py` gets cases for the float32 opt-in, the base check and LTX-2.5's official header. CUDA is unchanged by construction. Every new branch sits behind `not dense_transformer_supported(target)` plus `rdna_explicit_int8_reason`, which requires a ROCm device. The video callers of the shared reader keep their float32 rule; the only change for them is the base check above. ## Results (gfx1151, ROCm 7.13, torch 2.11, 1024x1024) Base = merge base d480a0a, head = base + this patch, same runner and job, fresh process per cell, 4 cells per arm in ABBA order. FLUX.3 Klein ran 16 steps, Qwen-Image-2.1 12 steps, Z-Image Turbo 8 steps. LPIPS (alex) and PSNR are against the bf16 DiT image of the same run, scored on CPU. | family / arm | s/image base / head | VRAM over idle (GiB) b / h | host RSS (GiB) b / h | warm load s b / h | LPIPS vs bf16 b / h | PSNR vs bf16 (dB) b / h | |---|---|---|---|---|---|---| | FLUX.3 Klein bf16 DiT (reference) | 23.79 / - | 24.70 / - | 16.6 / - | 21.7 / - | 0 | inf | | FLUX.3 Klein Auto | 23.79 / 23.80 | 24.70 / 24.70 | 16.7 / 16.7 | 21.4 / 21.6 | 0 / 0 | inf / inf | | FLUX.3 Klein explicit int8 | 23.79 / **23.75** | 20.50 / 20.50 | 17.8 / **17.0** | 50.4 / **28.8** | 0.0013 / 0.0024 | 44.1 / 38.8 | | FLUX.3 Klein int8, kill switch | 23.78 / 23.81 | 20.50 / 20.50 | 17.8 / 17.8 | 50.6 / 51.4 | 0.0012 / 0.0013 | 44.7 / 44.1 | | Qwen-Image-2.1 bf16 DiT (reference) | 32.97 / - | 34.88 / - | 18.4 / - | 29.5 / - | 0 | inf | | Qwen-Image-2.1 Auto | 31.79 / 31.78 | 28.43 / 28.45 | 19.8 / 19.8 | 59.0 / 58.8 | 0.0716 / 0.0716 | 27.5 / 27.5 | | Qwen-Image-2.1 explicit int8 | 31.77 / **31.75** | 28.43 / 28.44 | 19.8 / **18.5** | 59.5 / **33.5** | 0.0716 / **0.0033** | 27.5 / **42.6** | | Qwen-Image-2.1 int8, kill switch | 31.77 / 31.78 | 28.43 / 28.44 | 19.8 / 19.8 | 59.8 / 58.2 | 0.0716 / 0.0716 | 27.5 / 27.5 | | Z-Image Turbo bf16 (reference) | 19.38 / - | 29.07 / - | 20.4 / - | 24.2 / - | 0.004 (repeat spread) | 41.5 | | Z-Image Turbo int8 (weight-only, unchanged) | 19.96 / 19.85 | 23.53 / 23.54 | 19.4 / 19.2 | 37.5 / 38.0 | 0.012 / 0.012 | 36.0 / 36.2 | | Z-Image Turbo int8, `UNSLOTH_NATIVE_INT8_ACT=1` | 17.80 / 17.64 | 23.56 / 23.56 | 18.9 / **16.6** | 57.1 / **29.5** | 0.018 / 0.023 | 33.9 / 33.0 | - Every head int8 cell logs the hosted read, for example `diffusion.rocm_hosted_int8: read 228 int8 ConvRot layers of transformer from the hosted checkpoint as native Linears in 7.2 s`. FLUX.3 also logs `228 native int8 Linears on the ROCm RDNA W8A8 kernels share one rotation + act quant per block`, so the fused shared quant still engages. No head cell fell back. - Download for the int8 DiT: 6.44 GB for FLUX.3 instead of 11.10 GB of dense shards, and 7.26 GB for Qwen-Image-2.1 instead of 14.23 GB. The first head load per family fetched the file cold (86.8 s and 259.6 s); the warm loads are in the table. - Kill switch and Auto images are byte-identical to base on every cell: - Qwen-Image-2.1: kill switch and Auto all share the base explicit-int8 MD5. - FLUX.3 Auto keeps the bf16 MD5. - FLUX.3 explicit int8 alternates between the same two MD5s on base and kill-switch head (process-to-process nondeterminism present on base too). - Z-Image weight-only int8 shows the same two MD5s on both arms. - The hosted codes are not bit-identical to the codes quantised at load. FLUX.3 moves from 0.0013 to 0.0024 LPIPS against bf16, both negligible. Qwen-Image-2.1 moves much closer to bf16 (0.0716 to 0.0033). - Qwen-Image-2.1 Auto also builds the runtime W8A8 here (`rdna_auto_w8a8`) and would see the same quality gain from the hosted file. AUTO is left unchanged in this PR. One prompt per family was measured. ## Not covered - Windows ROCm: the hosted source needs torchao's safetensors helpers, which the Windows ROCm torchao stub does not provide, so this route stays off there (the dense path runs as before). That exclusion comes from the source check, not an explicit platform gate. - Other RDNA cards (gfx1100 / gfx1101 / gfx1201): not measured, so the route is gated off there; widen `ROCM_IMAGE_HOSTED_INT8_ARCHS` per arch once a card is measured. - The large table above was measured on the first two commits. The final head was confirmed on gfx1151 in a second run, one cell per arm, base d480a0a vs head (the head is the code at c26b54d; the last commit only adds a test): - FLUX.3 Klein explicit int8 logs `read 228 int8 ConvRot layers of transformer from the hosted checkpoint as native Linears in 8.4 s`; Qwen-Image-2.1 logs `read 224 ... in 6.8 s`. No base cell reads the hosted file. - s/image base / head: FLUX.3 int8 23.31 / 23.25, Qwen-Image-2.1 int8 31.37 / 31.65. - Qwen-Image-2.1 kill switch and Auto: byte-identical to base (same MD5 as base explicit int8). - FLUX.3 kill switch: the head image has the MD5 of the base explicit int8 cell. Base itself alternates between two MD5s from process to process (its int8 and kill-switch cells differ while running the same code). - FLUX.3 Auto: same resolved route on both arms (transformer_quant off, same speed steps), 23.32 / 23.25 s/image. The images are not byte-identical in this single pair (PSNR 56 dB). Each process compiled the DiT locally (the cache bundles differ by a few KB), and the bf16 cells of the earlier run also showed an occasional outlier MD5. - CUDA was not rerun on hardware. It is covered by construction and the CPU tests. - Quality is one prompt and seed per family. ## Test plan - [x] `python -m pytest tests/test_diffusion_rocm_hosted_int8.py tests/test_video_native_hosted.py` (56 + 15 passed) - [x] Related suites (`test_diffusion_pipeline_prequant.py`, `test_video_hosted_int8_offload.py`, `test_diffusion_backend.py`, `test_video_backend.py` and others): head and base fail the same test IDs (pre-existing), no new failures - [x] The real hosted files for FLUX.3 Klein, Qwen-Image-2.1 and Z-Image read on CPU through the image reader: all accepted, every quantised layer W8A8 and rotated - [x] gfx1151 hardware run, base vs head, 77 cells - [x] gfx1151 final-head run: NO_REGRESSION, hosted read logged on both families, kill switch and Auto on the base route
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On ROCm (gfx1151), an explicit int8 pick for LTX-2.5 quantised the dense bf16 denoiser shards at load and ran them weight-only, even though
unsloth/LTX-2.5-FP8hosts a ready int8 ConvRot DiT. This PR reads that hosted file as native W8A8 Linears for an explicit int8 pick on ROCm RDNA, resident or offloaded.Root cause:
LTX-2.5-INT8-ConvRot.safetensorsread only ran on offloaded plans.native_int8_actkeeps ROCm weight-only, but the hosted file is W8A8 only, so it could not be used there.Changes
diffusion_transformer_quant.py:rdna_video_explicit_w8a8_reason()returns the family's measured reason only for an EXPLICIT int8 request on a ROCm RDNA card. Auto is never changed. Kill switchUNSLOTH_ROCM_VIDEO_HOSTED_INT8=0;UNSLOTH_NATIVE_INT8_ACT=0still keeps weight-only.video.py:_video_int8_act()turns W8A8 on for that case;_video_rocm_hosted_scheme()/_video_rocm_hosted_spec()route a resident explicit int8 ROCm load through the existing hosted read (video.native_hosted) instead of the dense shards plus runtime quantise. Every helper returns None on any doubt, so the old path runs.video_families.py: LTX-2.5 carries therdna_explicit_w8a8row with the measured numbers.tests/test_video_rocm_hosted_int8.py(35 CPU cases: routing, kill switches, Auto untouched, CUDA untouched, other families untouched); one assertion intest_diffusion_flux3_rdna_shared_quant.pyupdated for the new row.CUDA is unchanged by construction: every new branch requires a ROCm device plus the existing RDNA explicit int8 gate (
rdna_explicit_int8_reason), and CUDA keeps its existing hosted read for offloaded plans.Results (gfx1151, ROCm 7.13, torch 2.11, 512x320x17, 8 steps, 4 repeats per arm, ABBA order)
Base = merge base 9df665c, head = base + this patch, same runner and seed. LPIPS (alex) and PSNR are per-frame means against the same platform's bf16 DiT clip.
UNSLOTH_ROCM_VIDEO_HOSTED_INT8=0Not covered
Test plan
python -m pytest tests/test_video_rocm_hosted_int8.py tests/test_diffusion_flux3_rdna_shared_quant.py(41 passed, 5 skipped)