Repository navigation
Studio MiniMax-H3 video: Auto INT8 attention with a 4-step exact start on every card (restores the Ada speedup, L4 denoise -19.4%) - #19344
Conversation
…ry card (re-enables sm89) Under Auto, MiniMax-H3 video runs the first 4 denoise steps of each render on the 16-bit kernel and INT8 attention after, wherever Auto engages the kernel. This replaces the sm89-only Auto off switch from #19098. Explicit On keeps INT8 on every step; Off is unchanged. UNSLOTH_H3_INT8_EXACT_STEPS overrides the step count (0 = INT8 on every step). Denoisers with the exact start refuse CUDA graphs.
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. |
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. 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". |
…re check on the operand's card - Each denoiser keeps its own route in a flag tensor that its forward pre-hook sets through an opaque tick op (unsloth_h3::int8_exact_start_tick); the attention op reads that flag. Overlapping denoisers no longer read a process-wide boolean, and a caller compiling a function around the whole denoiser (fullgraph included) traces the hook with no graph break and no recompile per step. - The op returns V's dtype on both branches with autocast off inside it, matching its fake. - The CUDA graph capture check runs under the operand's device. - finish_h3_int8_auto (called by the H3 video load): an exact start that raises or installs on no processor takes INT8 attention off for the load, undoing any partial install.
…ver cache the loss _race_wins kept an out-of-memory loss in _LONG_VERDICTS for the life of the process, so one transient OOM in the H3 family race declined INT8 attention for every later load. The probe is now retried once after freeing the cache; a second OOM loses that call only (not cached, not persisted). [skip ci]
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! 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". |
Summary
MiniMax-H3 video under Auto now runs the first 4 denoise steps of every render on the 16-bit attention kernel and INT8 attention after, on every card where Auto engages the INT8 kernel. This replaces the sm89-only Auto off switch from #19098, so Ada cards (L4, RTX 4090, RTX 6000 Ada) get the INT8 speedup back. Explicit
int8_attention="on"keeps INT8 on every step; Off is unchanged.On L4 the denoise time goes from 315.5 s (off, what main runs on sm89 since #19098) to 254.3 s (-19.4%), 85% of the INT8-every-step speedup. On A100-40 it goes from 86.0 s to 75.0 s (-12.7%), 84% of it.
Root cause
sm89 does not drift more than other cards. #19098 flagged it only because its noise floor is tighter.
Changes
video_minimax_h3_attn.py:H3_INT8_EXACT_START_STEPS = 4,h3_int8_exact_steps()andH3Int8Gate.exact_steps.H3_INT8_AUTO_OFF_ARCHSis now empty.install_int8_exact_start(transformer, pipe, steps): routes the strided processors' INT8 calls throughunsloth_h3::int8_attention_exact_start, an opaque custom op that runs the processor's own 16-bit kernel (flash / cuDNN pinned as the processor runs it) or the INT8 kernel, chosen per call from the denoiser's own flag tensor. A forward pre-hook on the denoiser sets that flag through a second opaque op (unsloth_h3::int8_exact_start_tick) from the render's video scheduler step index, so no compiled block guards or recompiles on the step, a caller compiling a function around the whole denoiser (fullgraph included) traces it without a break, and two denoisers never read each other's route. Exact steps count from the first step the render runs, so a render that starts at a later grid point still gets 4. The op returns V's dtype on both branches (autocast off inside it), matching its fake.finish_h3_int8_auto, called by the load: if the exact start raises or installs on no processor, INT8 attention is removed for the load (never INT8 on every step under Auto) and the status says why.video.py: after Auto engages INT8 on the H3 denoiser, callsfinish_h3_int8_auto. Theint8_attentionstatus reason names the exact start, for exampleunsloth_int8 (cuda) on 52 attention modules, the first 4 denoise steps on 16-bit attention.diffusion_cuda_graph.py: the graph eligibility checks refuse a denoiser that carries_unsloth_cuda_graph_unsafe.UNSLOTH_H3_INT8_EXACT_STEPS=Noverrides the step count under Auto (0= INT8 on every step, as before Studio: keep MiniMax-H3 video Auto INT8 attention off on sm89 (audio drift past the L4 floor) #19098); a value that is not a count keeps the default with a warning.diffusion_int8_attention_dispatch.py: an out-of-memory probe in the long / family race is retried once; a second one loses that call only and is no longer cached for the life of the process (one transient OOM used to decline INT8 for every later load).Evidence
Colab, Studio at this branch, Studio defaults (960x544x124, 20 steps), the same 12 rows as #19098 (6 prompts x 2 seeds), fresh process per arm. Arms: REF (int8 off, fp32-math attention on every H3 attention call), OFF (int8 off), the cuDNN floor (off with the cuDNN kernel), INT8 every step, and exact start 2 / 4. Every candidate render engaged INT8 on 52 modules and took the exact path for 50 x K calls and INT8 for the rest; REF ran fp32 attention on every call; OFF, floor and REF never engaged INT8.
Rule fixed before running (fp32 reference)
d = metric(X vs REF) minus metric(OFF vs REF), paired bootstrap 95% CI; pass if the CI upper bound is at or below the floor |mean(cuDNN minus OFF)|.
No arm meets the rule on either card at 12 rows. Exact start 4 is indistinguishable from off against the fp32 reference on L4 (both CIs straddle 0) and misses only the frames floor bound (upper +0.015 vs 0.004). The A100 audio floor is degenerate: OFF and the cuDNN arm are on average equally far from the reference (0.003), while their paired difference spans [-0.056, +0.052], so the cuDNN kernel swap itself would fail this rule. The A100 A/A repeat of off is bit-identical, so an A/A floor is 0 there. On both cards exact start 4 is closer to the fp32 reference than INT8 on every step.
Paired against the cuDNN floor arm (scored against OFF)
metric(X vs OFF) minus metric(cuDNN vs OFF), paired 95% CI; negative = closer to off than a bf16 kernel swap.
Speed
Denoise seconds per clip, one row per arm, fresh process per arm, interleaved A B C D D C B A on one VM per card (repeats within 0.4 s):
Tests
studio/backend/tests/test_h3_int8_exact_start.py(CPU, tiny real H3 transformer):test_diffusion_int8_attention_persisted.py)test_h3_int8_auto_arch.pyis updated for the removed sm89 off switch. The new and the flipped tests fail on the merge base and pass here. The INT8 attention toggle, families and auto suites, the H3 attention suite, the CUDA graph suite and the video backend suite pass.Not covered
int8_attention="on"still runs INT8 on every step.