Skip to content

perf(hip): Qwen prompts take the policy's prompt step on a lone RDNA 3.5 iGPU - #4207

Merged
ashhart merged 2 commits into
ashhart:mainfrom
AbrahamCete:perf/hip-qwen-prompt-step
Nov 24, 2026
Merged

ashhart merged 2 commits into
ashhart:mainfrom
AbrahamCete:perf/hip-qwen-prompt-step

Conversation

@AbrahamCete

@AbrahamCete AbrahamCete commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

On a lone RDNA 3.5 iGPU the HIP policy picks a 4,096-row prompt step (prefill_step), and Flash Next takes it (#1651). Qwen 3.5/3.6/3.8 on HIP cut a plain prompt into 1,024-row chunks whatever the policy said, so a long cold prompt on the 35B-A3B streamed the expert weights several times over. Now the engine opens with the policy's rows and a plain prompt with nothing decoding takes them. On gfx1151 the 35B-A3B's cold first token comes 9.1% to 18.4% sooner from 2,048 to 65,536 prompt tokens; the 27B's is level; decode is level; the bytes are the same however a prompt is cut.

It follows the plan on #2828:

  • Opening (engine/native.zig, new engine/prompt_rows.zig). The engine opens with @max(policy.prefill_step, policy.fill_rows) rows. Behind a GPU's larger default step, admission starts from the plain 1,024-row step, and the policy's rows come back only when their larger scratch still holds the streams admitted: Flash Next's narrows, moved to hip/policy.zig. The startup line names the rows and any fallback.
  • Chunks (hip_lanes.zig, reach). A plain prompt with nothing decoding takes the engine's prompt rows. A readout, a prompt beside decoding streams (fill_rows) and an unquantized checkpoint on rocBLAS keep their chunks.
  • Step (forward.zig). spanFor takes the step as a parameter, at most the engine's prompt rows, so a 4,096-row chunk crosses a layer in one step. span keeps SPAN.
  • Tools. tf-qwen35-test hidden --cut N opens with that step, and check --only invariants --policy prefill_step=4096 runs HIP Qwen 3.5/3.6/3.8: a prompt chunk's last layer stops at its keys, or runs only the read row's tile #2845's tail checks under a server's step.

Beyond the plan, or where it was silent; say which you want changed:

  • A prompt cache asked for by flag rides in the fallback: the next section.
  • A prefill_step given by --policy or TF_POLICY is taken as given by Qwen on HIP on every card, with no fallback; on main Qwen's HIP engine did not read it. Left alone, gfx1100 and any group of ranks keep 1,024-row chunks.
  • The larger step costs device memory: the engine's plan counts 725,094,912 bytes more (0.675 GiB) on the 35B-A3B and 838,545,408 more (0.781 GiB) on the 27B, whose first token reads level; the same at one stream and at four, at a 34,816-token window (a one-line print in scratch trees, not a peak footprint). The default prompt cache pays it. --policy prefill_step=1024 gives main's chunks and plan bytes.
  • An unquantized checkpoint keeps the 1,024-row chunk when it opens too, so its arenas do not grow; readout bounds keep their chunk; the check engine and the tools keep a 2,048-row step unless a policy says otherwise.
  • Ledger: no cell changed. Row 20 (Solo chunks) has no HIP entry for Flash Next's hip: 4096-row prompt chunks by default on the RDNA 3.5 iGPUs #1651, which this follows; say if you want one for q3.5.

Size: 292 lines (+268/-24) in 13 files, one commit, eleven new host tests.

Rebased onto #3665

#3665 landed while this was in review and conflicted in native.zig. The conflict was more than textual: with a DFlash2 drafter, served(e, d, ...) sizes each stream's tap ring from the prompt rows (6,144 rows at the 4,096-row step against 3,072), and the larger step's price here counted only its prompt scratch. So the prompt cache's claim is now weighed against each plan whole, at its own rows: the streams, the drafter's contexts and its rings (Plans.at in native.zig, settled and Opened.note moved to prompt_rows.zig). The startup line keeps #3665's drafter text and this PR's rows and fallback reason.

  • A host test, "a drafter's contexts and tap rings count with a prompt cache's claim, the larger rows' longer rings too", fails on the plain merge (expected 1024, found 4096) and passes here.
  • Without a drafter the rule is unchanged: the same rows and streams as 1e3c4ed in 72,910 host cases, and the same scratch bytes on the device.
  • On gfx1151, Qwen3.8-27B with its DFlash2 drafter, --context 34816 --parallel 4, main b112ad6 against this head: the larger step costs 1,467,691,008 bytes more, 629,145,600 of them tap rings (4 streams × 3,072 rows × 5 taps × 5,120 × 2). A cache of 4.482 GiB, inside the band only the rings explain, falls back to 1,024-row chunks and says so; 4.382 GiB keeps 4,096. No start had less room than it needed.
  • Greedy replies are token-equal, drafted and "draft": false, on main and on this head: a short code prompt (64 tokens) and a 9,000-token prompt that crosses a 4,096-row cut with the drafter on.
  • Host suites, native-hip for gfx1151, lean and fmt pass on the rebased commit; the two failing steps fail on main too.

A prompt cache asked for by flag

The prompt cache is sized after the rows, from what they leave. Weighing the streams alone, the fallback would keep 4,096 rows and refuse a --prompt-cache-gib that fits beside the 1,024-row scratch and not beside the 4,096-row one, which main serves. So that cache rides in the rule as the slots argument main gave narrows: the engine takes 1,024 rows and serves, as main does, and the startup line says why: prompts in 1024-row chunks (4096-row chunks would leave less than the prompt cache asked for). --prompt-cache-over-cap weighs nothing, and neither does the default cache.

settle asks narrows twice: with no slots (the streams alone, the plan's rule), then with the cache as slots. One call carrying the cache stops narrowing where the larger scratch costs a stream and the cache fits beside neither, and the engine would keep a 4,096-row plan larger than the room; an assertion in the streams test pins it.

On gfx1151, 35B-A3B at serve --context 34816 --parallel 4, the room pinned at 40,036,473,344 bytes by TENSORFOLD_HIP_MEMORY_LIMIT_GB=56: 4,096 rows leave 32.7672 GiB and 1,024 rows 33.4425. The rows each server opened with:

--prompt-cache-gib main this change
not given 1,024 4,096
32.517 1,024 4,096
32.767 not run 4,096
32.768 not run 1,024, naming the cache
33.105 1,024 (26,717 pages) 1,024, the same 26,717 pages, naming the cache
33.442 1,024 1,024, naming the cache
33.443 refused refused
33.105 with --prompt-cache-over-cap 1,024 4,096

At 33.443, which fits beside neither, the refusal names what 4,096 rows leave (32.77 GiB) where main names 33.44. A prefill_step=4096 given by TF_POLICY is taken whole and refuses the 33.105 cache. On the 27B, pinned the same way, a mid-band 31.173 is served by main and by this change, at 1,024 rows; its edges were not run.

Checks on this head

  • Head commit: 1e3c4ed, on main 4f3f564, both sides built from git archive trees. The checks of this section ran on this commit before one comment line in native.zig was reworded; zig fmt --check and the lean checker ran again after it, on 1e3c4ed, and the Receipt's timing runs are on 1e3c4ed.

  • Lean checker, python3 tools/zig/lean_check.py, on the base and on this head: 168 and 168, 0 new.

  • Tests run, with the command and pass, fail and skip counts (main -> this change):

    • zig build test-qwen35-hip-host -Dhip=true: 112 of 114 passed, 2 skipped -> 123 of 125 passed, 2 skipped. The 11 more are this change's.
    • zig build test test-golden -Dhip=true: exit 1 on both, with the same counts: 819 of 823 steps, 11,423 of 11,517 tests passed, 92 skipped, 2 failed. The same two fail on main and on the branch, on this machine: cli_config_test "serve --config: expand reads the file, passes other commands through and names what it cannot read" (my shell's umask 0002 makes its temp file group-writable; under umask 022 it passes) and stage_hip_test "every staged call on HIP memory equals the reference, whole and in parts" (a real-GPU test; alone on a quiet GPU it still fails, as Timeout on main and as Aborted on the branch). Both reasons were read this morning, before the cache rule.
    • zig build check-native-hip-host -Dhip=true: exit 0. Flash Next's host test binary, since narrows moved: 48 passed, 2 skipped, 0 failed.
    • zig fmt --check build.zig zig and git diff --check: clean.
  • The new tests fail before the change. On main 4f3f564 they do not compile (prompt_tail_test.zig:188:15: error: expected 8 argument(s), found 9). With a seam that leaves main's behavior alone (the rules file answering as main does, spanFor taking a step it ignores), 116 of 125 passed, 2 skipped, 7 failed:

    • opening, a lone gfx1151 at 4,096 rows while gfx1100, a group and prefill_step=1024 keep 1,024: expected 4096, found 1024
    • the fallback, like hip: 4096-row prompt chunks by default on the RDNA 3.5 iGPUs #1651's, in two tests: expected 1024, found null and expected 1024, found 4096
    • the cache: expected 1024, found 4096
    • the step: expected 4096, found 2048; the tail, a 4,096-row chunk as one step a layer: expected 1, found 2
    • reach, a plain prompt alone, a readout, a decoder's neighbour: expected 4096, found 1024

    The other four pin what must not move and pass there: a bf16 checkpoint's chunk, no cache asked for, a cache that fits beside 4,096 rows, --prompt-cache-over-cap. Before the cache rule, given settle's new signature, the cache test alone failed the same way.

  • On gfx1151, main against this change:

    • tf-qwen35-test check --only invariants: 35B-A3B 63 PASS, 0 FAIL, 1 SKIP; 27B 58 PASS, 0 FAIL, 6 SKIP; the same with --policy prefill_step=4096. HIP Qwen 3.5/3.6/3.8: a prompt chunk's last layer stops at its keys, or runs only the read row's tile #2845's twelve prompt tail lines pass in all four runs.
    • serve --context 34816 at --parallel 1 and 4, both checkpoints: the change prints prompts in 4096-row chunks and admits the streams asked for. Under TF_POLICY=prefill_step=1024 it prints 1,024-row chunks, as main does, and its plan counts main's bytes exactly in all four cells.
    • The fallback, 35B-A3B at serve --context 131072, the room pinned at 26,431,090,692 bytes by TENSORFOLD_HIP_MEMORY_LIMIT_GB=43.329: --parallel 9 is refused by both with the same message; at 8 both serve 8 streams in 1,024-row chunks, the change adding (4096-row chunks would admit fewer of the streams asked for); at 7 main serves 1,024-row chunks and the change 4,096.
    • Hidden rows are under Exactness, the prompt cache in the table above.
  • hip-kernel-contract on gfx1151 with ROCm 10.1's hipcc: exit 1 on main and on this change alike, with the same line, SUMMARY gfx1151 181 kernels: 181 pass gates 1-4, 0 fail, 2 known findings; 50 controls: 50 red as planted, 0 missed; 26 limit problems, and the same 26 FAIL limits live lines (24 relu2 stream tiles whose VGPRs differ from their records, tf_moe_combine_gate, tf_vl_resize): main's state with this toolchain. No kernel is new or changed, so the contract section is deleted.

    • Launch shapes: by rocprofv3 --kernel-trace of hidden at both cuts, a 4,096-row chunk launches none (symbol, threads and LDS bytes, what the launch records key on; never the grid) that 1,024-row chunks do not. On the 35B-A3B the routed products move from affine_wmma_item<4,4> to the recorded affine_wmma_skew<4>; the 27B launches the same 17 shapes at both cuts.
  • CI: runs on this pull request.

  • Not run, and why:

    • gfx1150, gfx1152 and gfx1153: I have only gfx1151. They take the same default, unmeasured.
    • Every other HIP card and any group of ranks: no hardware. The host test pins gfx1100 and a group at 1,024; an explicit prefill_step there never ran on a device.
    • An unquantized (bf16) or image checkpoint: none on this machine. A readout: host test only.
    • Sampled served requests, more than four streams, the 27B's cache edges, hip-kernel-contract-limits as its own step.
    • A prompt filling beside decoding streams (it keeps fill_rows, by host test), and a request arriving while a lone prompt is inside a 4,096-row chunk.
    • With the drafter (see "Rebased onto feat(hip): serve Qwen3.8-27B with its DFlash2 drafter #3665"): the streams fallback, --prompt-cache-over-cap, prefill_step by flag, the hidden-row and invariant checks, and timing.

Receipt

The timing below is on 1e3c4ed, before the rebase, which changes only the admission rule with a drafter.

  • Main against branch: main 4f3f564 against this head 1e3c4ed (ReleaseFast, gfx1151), one fresh server a run, alternated: main, head, head, main, main, head for the cold cells and main, head, head, main for decode. Each server started behind a gate: no other GPU process, the GPU at most 10% busy.

    Cold first token, seconds: tools/bench_cache.py --require-cold --tokens 16 at --context 66560 --parallel 1 --prompt-cache-gib 0, one cold request a size a server after an 8-token warm-up, the first N tokens of one real text. Each side's three servers in run order, their medians, and the change (from the unrounded times).

    Qwen3.6-35B-A3B, prompt tokens main this head medians change
    2,048 0.987 1.009 1.010 0.914 0.920 0.917 1.009 -> 0.917 -9.1%
    4,096 2.058 2.085 2.091 1.691 1.706 1.700 2.085 -> 1.700 -18.4%
    8,192 4.305 4.361 4.362 3.589 3.612 3.604 4.361 -> 3.604 -17.3%
    16,384 9.424 9.590 9.531 8.024 8.060 8.052 9.531 -> 8.052 -15.5%
    32,768 22.369 22.588 22.592 19.516 19.567 19.587 22.588 -> 19.567 -13.4%
    65,536 58.789 59.108 59.213 52.969 53.054 53.112 59.108 -> 53.054 -10.2%
    Qwen3.8-27B, prompt tokens main this head medians change
    2,048 4.743 4.727 4.724 4.733 4.704 4.735 4.727 -> 4.733 +0.1%
    4,096 9.613 9.537 9.576 9.582 9.522 9.500 9.576 -> 9.522 -0.6%
    8,192 19.605 19.602 19.718 19.589 19.492 19.530 19.605 -> 19.530 -0.4%
    16,384 41.392 41.447 41.609 41.334 41.245 41.287 41.447 -> 41.287 -0.4%
    32,768 91.928 91.713 91.990 91.360 91.110 91.211 91.928 -> 91.211 -0.8%
    65,536 218.343 218.152 218.953 217.298 217.487 217.743 218.343 -> 217.487 -0.4%

    The 27B is level. The spread inside a side is 0.2% to 0.9%; the two sides' ranges overlap at 2,048 and 4,096, and from 8,192 up every server of this head reads below every server of main. With three servers a side I claim no gain there. Against the issue's estimate at 4K-8K (9-13% on the 35B-A3B, 0.5-1.5% on the 27B): the 35B-A3B gains more, on a base that already has HIP Qwen 3.5/3.6/3.8: a prompt chunk's last layer stops at its keys, or runs only the read row's tile #2845's tail.

    Limits: one cold request a size a server (the client's first pass), three servers a side; greedy, one text, 16 reply tokens; every size at a 66,560-token window. On the 35B-A3B main's first server reads 0.6% to 2.3% faster than its other two at every size, so main's median is one of the slower pair. Only the first gate required a 1-minute load under 3; later gates saw up to 4.19, this run's own servers included.

  • Boxes it reaches: a lone RDNA 3.5 iGPU (gfx1150 to gfx1153) serving a quantized Qwen 3.5/3.6/3.8 checkpoint on HIP, by default; any HIP card where prefill_step is given by --policy or TF_POLICY.

  • New switch? No. prefill_step is the policy key Flash Next already reads (1,024; 4,096 on a lone RDNA 3.5 iGPU); Qwen on HIP now reads it too.

  • Environment: TensorFold 4f3f564 (main) and 1e3c4ed (this head); Zig 0.17.0; hipcc HIP 7.1.52801 (Ubuntu clang 21.1.8), and ROCm 10.1's hipcc (HIP 7.16.26385) for the contract and the trace; Ryzen AI Max+ 395 (Strix Halo, gfx1151), unified memory; Ubuntu 26.04.1, kernel 7.0.0-44; Qwen3.6-35B-A3B-MLX-4bit-MTP (with its MTP head) and Qwen3.8-27B-MLX-4bit (no head on HIP). The timing runs' binaries: main 4c3ab90eeb64dd73, head ccc55eabce543531 (sha256 prefixes; two builds of one commit from different scratch paths differ in sha256, which I did not look into).

  • Paths and platforms: ran HIP gfx1151 at one rank, both checkpoints (MLX 4-bit), the served default, --parallel 1 and 4, greedy. Not run: the list under Checks.

  • Exactness:

    • tf-qwen35-test hidden over real text, with the device checks above: at 8,192 and at 5,000 tokens on each checkpoint, five files are byte-equal: this change cut at 1,024, at 4,096 and whole, and main cut at 1,024 and whole.
    • Served cold prompts: one token_sha a size and checkpoint across the six servers, with 0 cached tokens in 216 of 216 rows. Main's servers print prompts in 1024-row chunks, the head's 4096-row chunks.
    • tools/bench_concurrent.py --tokens 256 --reps 3 --temperatures 0 --levels 1,4 --alone --serial at --context 4096 --parallel 4, two servers a side: the same two hashes on all four servers of a checkpoint (35B-A3B 9f2923ac14d0 and a8c28b8297b4, 27B 2cbda70e0639 and ded27583c51f), 0 failed, 0 alone or serial unequal.
    • No resumed prompt was served (--prompt-cache-gib 0). The invariants above cover resumed == fresh, solo == together and, on the 35B-A3B, drafted == serial at both steps; the prompts resumed there are 896 to 1,132 tokens, shorter than a 4,096-row chunk.
  • Main against this branch, same machine and checkpoint: the tables here. Scripts, token arrays and raw files: on request.

  • Decode speed before and after: level. tools/bench_concurrent.py as above, aggregate tok/s, each server's value (main's two, then the head's two), one run a server:

    checkpoint, cell main this head
    35B-A3B, code x1 130.6, 130.5 130.6, 130.8
    35B-A3B, code x4 257.7, 256.4 255.5, 256.5
    35B-A3B, chat x1 105.0, 104.8 104.7, 104.8
    35B-A3B, chat x4 214.0, 213.9 213.9, 213.6
    27B, code x1 14.5, 14.5 14.5, 14.5
    27B, code x4 46.3, 46.2 46.3, 46.3
    27B, chat x1 14.8, 14.8 14.8, 14.8
    27B, chat x4 45.8, 45.9 45.9, 45.9
  • Prompt speed before and after: the cold tables above.

  • Licence of any new weights or drafter: n/a.

Checklist

  • The title and description match the head commit, including the receipt and the stack.

  • New tests fail before the change, pass after it, and skip cleanly without their dependency. (Host-only tests, no dependency to skip.)

  • Comments and docstrings are one line. No measurements or history in the source.

  • No personal data, machine names, internal hosts or local paths in the diff or its commits. No AI attribution lines.

  • Every token still goes through the lane rounds. No serial path, and nothing that needs drafts off.

  • Drafted output equals "draft": false, a resumed prompt equals a fresh one, and concurrent equals solo. (No resumed prompt was served; the check's resumed == fresh lines pass at both steps.)

  • No precision traded for speed. If the bits change, the description says which sums change and why. (The bits do not change.)

  • Decode and prompt processing are no slower than main at one stream and the widest admitted; with --drafter, no slower than without it, greedy and sampled. (Greedy, at one stream and four. Not run: sampled requests, a prompt beside decoding streams, more than four streams. With --drafter: greedy replies token-equal, drafted and plain, on main and this head; its timing was not run.)

@AIFlowML

Copy link
Copy Markdown
Contributor

I ran zig build test-qwen35-hip-host check-native-hip-host test-flashnext-proposal-hip-host -Dhip=true -Dcpu=apple_m1 -j5 --summary all with Zig 0.17.0 on M5 Max. Both 1e3c4ed69 and its clean trial merge into 124052c97 passed 125 tests with two skips. In a scratch copy, ignoring the explicit prompt-cache bytes in settle made exactly the cache-fallback test fail (expected 1,024 rows, found 4,096).

For a follow-up on gfx1151, the first uncovered case I see in the receipt is a resumed request whose uncached suffix itself crosses 4,096 rows. Comparing it with the same prompt served fresh under prefill_step=4096 would extend the existing shorter resume check across the new boundary. My run exercised the host logic and compiled the HIP server with inert kernels.

Igor Lessio - AIFLOW LABS

@AbrahamCete

Copy link
Copy Markdown
Contributor Author

Thanks @AIFlowML, for the host run and for naming the gap. I ran it on gfx1151: a resumed request whose uncached suffix is longer than 4,096 rows, against the same prompt served fresh, on main 4f3f564 and on this head 1e3c4ed, with both checkpoints.

Every resumed reply equals its fresh one. In all eight cells, on Qwen3.6-35B-A3B and on Qwen3.8-27B, the resumed request's token_sha equals the fresh request's on main and on this head, and main's equals this head's. The same holds on this head with --policy prefill_step=4096 given explicitly and with no lane trace (one cell each, fresh and resumed).

serve --context 34816 --parallel 1, real text, greedy, 16 reply tokens, one new server a cell. Fresh: --prompt-cache-gib 0, 0 cached tokens in 32 of 32 requests. Resumed: --prompt-cache-gib 4; the server serves the first N1 tokens, then the first N2, which resume from the prefix's last 64-token page edge.

N1, N2 cached uncached rows of each prompt call on this head
1,500, 5,569 1,472 4,097 2,624, 1,472, 1
1,500, 5,597 1,472 4,125 2,624, 1,472, 29
6,000, 10,096 5,952 4,144 2,240, 1,856, 48
4,096, 8,200 4,032 4,168 64, 4,096, 8
1,500, 9,692 1,472 8,220 2,624, 4,096, 1,472, 28
4,100, 12,500 4,096 8,404 4,096, 4,096, 192, 20
6,000, 15,000 5,952 9,048 2,240, 4,096, 2,688, 24
6,000, 10,048 (the boundary itself) 5,952 4,096 2,240, 1,792, 64

The last column is from TF_LANE_TRACE, the same on both checkpoints: on this head a resumed suffix is cut where the prompt's position reaches a multiple of 4,096, so four of the cells run a whole 4,096-row call after a restored state. Main cuts the same suffixes at multiples of 1,024 (the fifth row in ten calls: 576, seven of 1,024, 448, 28). All 102 traced requests take the calls the cut rule gives.

Limits: greedy, one text, 16 reply tokens, one stream, the MLX 4-bit checkpoints, gfx1151 only; one run a cell. Raw files on request.

@ashhart

ashhart commented Nov 21, 2026

Copy link
Copy Markdown
Owner

Thanks @AbrahamCete. This applies cleanly to today's main and changes no kernels. In your runs the hidden states match main at every prompt cut you tried, and the resumed-prompt case you added covers a long uncached suffix.

We've queued our own paired run against main on our Strix Halo (gfx1151): cold prompt times across prompt lengths, bench_concurrent.py --alone --serial at T=0 and T=1.0, and the host invariants. We have no discrete RDNA 3 card or other gfx115x GPU, so for those we rely on your runs; discrete RDNA 3 keeps its current prompt step by default anyway. We'll post the numbers here.

  • Synthena

@AbrahamCete
AbrahamCete force-pushed the perf/hip-qwen-prompt-step branch from 1e3c4ed to 6acf6b1 Compare November 22, 2026 12:37
@AbrahamCete

Copy link
Copy Markdown
Contributor Author

Rebased onto main after #3665 landed (1e3c4ed → 6acf6b1). The conflict in native.zig needed more than a merge: with a DFlash2 drafter each stream's tap ring grows with the prompt step (6,144 rows at 4,096 against 3,072), so the prompt cache's claim is now weighed against each plan whole, the drafter's contexts and rings included. Without a drafter nothing changes.

The description has a new section, "Rebased onto #3665", with the details and the gfx1151 evidence. On the 27B with its drafter, a cache in the band only the rings explain falls back to 1,024-row chunks and says so, and greedy replies are token-equal, drafted and plain, on main and on this head. If your paired run on the Strix Halo hasn't started yet, this is the head to run.

AbrahamCete and others added 2 commits November 24, 2026 01:06
…3.5 iGPU

The HIP policy picks a 4,096-row prompt step on the RDNA 3.5 iGPUs at one
rank, and Flash Next takes it. Qwen 3.5/3.6/3.8 kept 1,024-row chunks and
2,048-row steps a layer, so a long cold prompt read the weights several
times over.

The engine now opens with the policy's rows (prompt_rows.opening), a
plain prompt with nothing decoding takes them, and a pass crosses a
layer in them (the step forward.spanFor takes). An unquantized
checkpoint on rocBLAS, a readout and a prompt beside decoding streams
keep their chunks. Where the larger step is the GPU's own default,
admission starts from the plain step and keeps the larger one only when
its scratch still holds the streams admitted, by the rule Flash Next
uses, now in hip/policy.zig. A prompt cache asked for with
--prompt-cache-gib rides as that rule's slots: where it fits beside the
plain step's scratch and not beside the larger one's, the engine keeps
the plain step and serves the cache, as it did before;
--prompt-cache-over-cap weighs nothing. With a DFlash2 drafter each step
is weighed whole, its tap rings included, which grow with the step. The
startup line names the rows taken and any fallback. A prefill_step given
by flag or TF_POLICY is taken as given on every card.

`tf-qwen35-test hidden --cut N` opens with that step, so a cut stands for
a server's chunk, and the prompt tail's invariants run in the engine's
step, so `--policy prefill_step=4096` checks the tail under a server's.

Refs ashhart#2828
@ashhart
ashhart force-pushed the perf/hip-qwen-prompt-step branch from 6acf6b1 to 18637c6 Compare November 24, 2026 01:06
@ashhart
ashhart merged commit eeda185 into ashhart:main Nov 24, 2026
2 of 12 checks passed
@ashhart

ashhart commented Nov 24, 2026

Copy link
Copy Markdown
Owner

Thank you @AbrahamCete. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes.

ashhart added a commit that referenced this pull request Nov 24, 2026
ashhart added a commit that referenced this pull request Nov 24, 2026
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.

HIP gfx1151: Qwen 3.5/3.6/3.8 prompts don't use the 4,096-row step the policy picks

3 participants