Skip to content

Give the single-row decode harness the real _decode_graphs helpers - #15182

Merged
danielhanchen merged 1 commit into
mainfrom
ci-decode-graphs-harness
Oct 25, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
ci-decode-graphs-harness

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

tests/utils/test_single_row_cached_attention.py errors on all 64 cases on main since #15171 (K/V straight into the cache slot, opt-in CUDA-graph decode). That fails the Core (HF=...) legs on unrelated PRs, for example #15176 and #15178:

AssertionError: Qwen3Attention_fast_forward_inference now reads ['_decode_attention_core', '_decode_graphs']; give the harness a CPU stand-in for each

The harness lifts LlamaAttention_fast_forward_inference and Qwen3Attention_fast_forward_inference out of their files with ast, and refuses to run if they read a global it does not provide. #15171 moved the cache and scratch buffer setup into unsloth/models/_decode_graphs.py (alloc_decode_buffers, resize_decode_buffers) and added the captured-step branch that calls _decode_attention_core. The product is fine. The guard did what it is meant to do and asked for stand-ins.

Change

  • _decode_graphs: the real module, loaded by file path. Its top level is torch and the standard library only. ENABLED is forced to False, because graph replay is CUDA-only. The test keeps running the real alloc_decode_buffers / resize_decode_buffers instead of a copy.
  • _decode_attention_core: a stand-in that raises if called. It is only reached from a captured decode step, which this CPU harness never enters, so reaching it would mean graph mode leaked in.

Verification

  • On main: 64 errors. With this change: 64 passed. It also passes with UNSLOTH_DECODE_CUDA_GRAPHS=1 set.
  • Sabotage 1: writing the wrong V rows in _decode_graphs.alloc_decode_buffers gives 56 failures. The real helper is what the test exercises.
  • Sabotage 2: skipping qwen3's 2D padding mask conversion in the decode function gives 8 failures. The masking checks the file was written for still bite.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-25T01:41:57.679958Z cfb7d53 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. You're on a roll.

Reviewed commit: cfb7d53ee3

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

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