Skip to content

Explain why the gated-deltanet fast kernels were disabled - #8073

Merged
danielhanchen merged 2 commits into
mainfrom
fla-hopper-advice-message
Aug 7, 2026
Merged

danielhanchen merged 2 commits into
mainfrom
fla-hopper-advice-message

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Companion to unslothai/unsloth-zoo#1010, for the H100 report in #5276.

_maybe_advise_fla_install fires whenever a gated-deltanet model loads without the fast kernels, and tells the user they need "CUDA with torch >= 2.7 and triton >= 3.3". On the setup in #5276, an H100 with Triton in the fla #640 miscompile range, all three of those are satisfied, so the message points at the wrong thing and gives the user nothing to act on.

The zoo PR adds fla_unavailable_reason(), which is set only when Unsloth deliberately turned the kernels off and carries the specific cause plus the fix. This prefers it when present and keeps the existing text as the fallback. The try/except means an unsloth pinned against an older unsloth_zoo keeps working unchanged.

No behaviour change beyond the printed text; the function is still one-shot and still only fires when the fast path is genuinely unavailable.

_maybe_advise_fla_install blamed CUDA / torch >= 2.7 / triton >= 3.3, all of
which are satisfied on an H100 that hit the fla #640 Triton miscompile, so an
affected user was sent looking in the wrong place (#5276).

Prefer unsloth_zoo's fla_unavailable_reason() when it deliberately disabled the
kernels, and keep the generic text as the fallback. The try/except keeps an
unsloth pinned against an older unsloth_zoo working.

Companion to unslothai/unsloth-zoo#1010.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: d2739585d9

ℹ️ 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

Copy link
Copy Markdown
Member Author

CI note: the six red checks here are all pre-existing breakage on main, not from this PR. Evidence, since a red PR is easy to misread:

main at 2d231f884 does not contain this change (grep -c fla_unavailable_reason on unsloth/models/loader.py at that ref returns 0), and run 31141376613 on that commit fails the same five jobs with byte-identical assertions:

  • (Python 3.10 / 3.11 / 3.12 / 3.13) - four failures in tests/test_inference_status_loaded_gguf.py, all from studio/backend/routes/inference.py:8032: TypeError: models.inference.InferenceStatusResponse() got multiple values for keyword argument 'chat_template_override', surfaced as HTTPException: 500: Failed to get status. 4 failed, 17649 passed.
  • Repo tests (CPU) - assert not ['mlxRuntimeStateFrom']: the TS harness PREAMBLE is missing a stub for a newly added chat-adapter.ts import.

The sixth, Chat UI Tests, is from the Windows Unsloth UI CI workflow, which on main was success at 3c5e5ca71 and failure at both 34a709295 and 2d231f884, so it broke on main independently of this branch. Its assertion is [ui] FAIL: model picker text was identical for qwen + llama queries -- typeahead may not be filtering at tests/studio/playwright_chat_ui.py:946. That is a deterministic soft-fail, not a navigation flake, so re-running will not clear it.

None of these touch unsloth/models/loader.py. They want fixing on main, or this goes green on a re-run once main is.

Behaviour of the change itself was verified directly against the real function with stubbed probes, across all five branches (specific reason present / None / import raises / call raises / kernels still available):

  • _fla_advised = True is set before the new early return. That ordering is load-bearing: after it, the return in the reason branch would skip the one-shot flag and the note would reprint on every model load. Second call prints nothing in all five branches.
  • The broad except Exception is not just an ImportError guard. On a host with torch/torchao skew, importing unsloth_zoo.temporary_patches.utils raises a plain Exception, which a narrower except ImportError would let escape and turn an advisory print into a hard model-load failure. It does not suppress KeyboardInterrupt / SystemExit / GeneratorExit, none of which subclass Exception.
  • The import is after the model-prefix check, the availability check and the one-shot guard, so it runs at most once per process and only when a print is already committed to. fla_vendor is in sys.modules by model-load time anyway.
  • The early return skips nothing: the generic branch is a bare print(...) with nothing following it.

One scope clarification worth stating: fla_unavailable_reason() is populated only when the user opts out with UNSLOTH_DISABLE_HOPPER_FLA_BWD=1, since unslothai/unsloth-zoo#1010 keeps the fast path by default rather than disabling it. So this branch is reachable on that opt-out, not on a stock H100, and the message text is accurate for exactly that case.

@danielhanchen

Copy link
Copy Markdown
Member Author

Update now that the companion PR has landed.

Dependency satisfied. unsloth-zoo#1010 merged as bbe55bcb, so the fla_unavailable_reason() import this PR guards resolves on zoo main. I merged origin/main into the branch (e442385f7); net diff against main is unchanged at unsloth/models/loader.py only, 16 insertions.

Verified end to end against merged zoo main (zoo worktree at bbe55bcb + this branch on sys.path), simulating the affected host:

symbol present: True
is_flash_linear_attention_available(): False
--- loader printed ---
Unsloth: gated-deltanet (linear attention) fast kernels are DISABLED on this GPU
because UNSLOTH_DISABLE_HOPPER_FLA_BWD=1 is set. Triton 3.5.1 on Hopper
(H100 / H200 / H20) miscompiles flash-linear-attention's gated-delta backward
pass (fla issue #640), so training falls back to the slower pure-PyTorch path.
  To use the fast kernels with a Triton that has the fix: pip install -U "triton>=3.7.1"
  To use them on this Triton: unset UNSLOTH_DISABLE_HOPPER_FLA_BWD. Unsloth's
  bundled kernels already step around the miscompiled block size.

Instead of the old generic text, which blames CUDA / torch / triton minimums that an affected H100 actually satisfies.

The three backwards-compatible fallbacks all still print that generic text, byte-identical to each other and to today's behaviour: an older unsloth_zoo without the symbol (ImportError), the symbol present but returning None (unaffected host), and the symbol raising.

CI. Four of the six red checks went green on their own once main moved. The one remaining failure, repeated across the four Python jobs, is a Studio backend test:

FAILED studio/backend/tests/test_native_context_length.py::TestRouteCompleteness::test_status_path
E   AssertionError: No InferenceStatusResponse block with llama_backend has runtime fields

That is pre-existing on main, not from this PR. Checked out pristine origin/main at e3c73b09d (which does not contain this change) and ran the single test:

1 failed in 4.48s
tests/test_native_context_length.py:444: AssertionError: No InferenceStatusResponse block with llama_backend has runtime fields

Same assertion, same line. This PR touches only unsloth/models/loader.py and cannot reach a Studio route-completeness source scan. Everything else on the head commit is green, including all three Core matrix legs (HF=4.57.6 + TRL<1, default, latest).

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: e442385f7f

ℹ️ 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 437a75e into main Aug 7, 2026
43 of 47 checks passed
@danielhanchen
danielhanchen deleted the fla-hopper-advice-message branch August 7, 2026 08:16
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