mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #2021] [Bug]: gfx1151: a 4K prompt stays under STRATA_PF_SWITCH_MIN_T=4096 (its chunk is 4,095 tokens) and is ~16% slower #804
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#804
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @libratechw on GitHub (Oct 12, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/2021
What happened
docs/STRIX_HALO.mdsection 5 setsSTRATA_PF_SWITCH_MIN_T=4096, so that prompts shorter than 4,096 tokens keep the default numerics. A prompt of 4,096 tokens (what the benchmarks call "4K") is read as a chunk of 4,095 tokens, so it is below the threshold. The hyper-connection and padding switches, and the dense GEMM that goes with them, then stay off for it, and the dense projections run hipBLASLt solutions that are not intools/hip/gfx1151-hipblaslt-100401.txt(Cijk_..._HSS_..._MT96x96x32; 26% of the GPU time of a 4K prompt in a rocprofv3 trace, againstpfg::kernel_bk64when the switches are on).Measured on one server, 4 requests of the same 4K prompt in a row (UD-Q4_K_XL,
STRATA_PF_FUSED=1 STRATA_PF_FUSED_KQ=1, the section 5 switches, onlySTRATA_PF_SWITCH_MIN_Tchanged), prompt tok/s:STRATA_PF_SWITCH_MIN_TI know
4096was chosen to keep the 1.0-1.9K prompts of the test set on the default output (b6b7a87d); the code default is 0 (every chunk). So this is not a request to change the number. The question is which of these you would want:I have no preference between them, and I can make the change in whichever form you pick.
Strata version, GPU, OS
v0.1.43 · Radeon 8060S (Ryzen AI Max+ 395, gfx1151) · Linux 7.0, ROCm 7.14.1
Engine log
Not attached: it is the same on every start. The rocprofv3 traces (4096 against 2048) are available on request.
🤖 Generated with Claude Code
@Niko1221 commented on GitHub (Oct 12, 2026):
Thank you for the rocprofv3 trace and the three-way table; it is a clear case. Your reading is right:
STRATA_PF_SWITCH_MIN_Tcompares the length of the prompt chunk, and a 4,096-token prompt is read as a chunk of 4,095 tokens, so with 4096 the switches stay off for it. It is not a bug in the comparison (the threshold is documented as a chunk length, and the code default is 0 = every chunk), so we are not changing the code or any default for it in 0.1.43.1; nothing on CUDA or the gfx12 defaults depends on it.Of your three options, we would take the note in section 5 of docs/STRIX_HALO.md (a 4K prompt is a 4,095-token chunk, so use
STRATA_PF_SWITCH_MIN_T=4095or 2048 if you want it above the threshold, with the rounding-level difference stated). A PR with that note would be welcome. A lower number in the section-5 recipe, or comparing the whole prompt's length, changes which prompts take the rounding-level path, so that needs your first-token KL for 2048 and 4095 against the default, as for #2020, before we decide it; please post it here when you have it.@libratechw commented on GitHub (Oct 13, 2026):
Thank you. The first-token KL you asked for, against the default engine (no section-5 switches), 8 natural-text prompts of 1.5K, 2,048, 3K, 4,095, 4,096, 4.5K, 6K and 8K tokens, gfx1151, the section-5 switches with only
STRATA_PF_SWITCH_MIN_Tchanged (STRATA_PF_FUSED=1, plusSTRATA_PF_FUSED_KQ=1for the K-quant model):STRATA_PF_SWITCH_MIN_TPer prompt, the 2048 row differs from the other two only where a chunk is between 2,048 and 4,095 tokens (the 3K, 4,095 and 4,096 prompts: IQ4_XS 0.0025 / 0.0082 / 0.0075 at 4096 and 0.0013 / 0.0051 / 0.0003 at 2048). The top token is the same in all 8 prompts for all three rows; the one prompt that differs from the default (6K) differs under all of them, so it comes from the other switches. Putting those chunks on the switches does not move them farther from the default than they already are.
One correction to the premise:
4095does not turn the switches on for a 4,096-token prompt in the default configuration. The 4096 and 4095 rows are identical. I moved the threshold across a 4,096-token prompt (UD-IQ4_XS,--spec 4,--prefill 16384): the switches are on at 4089 and off at 4090, so its chunk is 4,089 tokens. The reason is ingenerate.cpp: with the prompt cache (default 6) the prompt is read in two parts, cut at the last<|im_start|>(turn_at), and the last token is read alone (cuts = {..., turn_at, n - 1}). The new turn's header is 7 tokens with reasoning off (<|im_start|>,assistant, newline,<think>, blank line,</think>, blank line; I counted them with the tokenizer), so the big chunk is n - 7. With--prompt-cache 0there is noturn_atand the chunk is n - 1: on at 4095, off at 4096, as in your reading and the trace of this issue. The header depends on the template and the reasoning mode, so the offset can differ for other requests.So a value below the chunk of the shortest prompt you want is the safe advice, such as 2048.
I will open a PR with the note for section 5 next (the chunk-not-prompt reading, 2048 as the suggested value, these KL numbers). Whether to change the recipe's 4096 is yours to decide from the table.
</think>the model quotes inside a code block in its reasoning still ends the reasoning, and the turn's tool call is lost (follow-up to #1526) #1121@Niko1221 commented on GitHub (Nov 5, 2026):
Thanks for taking the time to report this.
Strata has changed a lot since this was opened, and 0.2.11 is out now, so many older reports no longer apply. We're closing issues older than a week that have had no new reports in the last week. Closed here does not mean rejected.
To reopen it takes about two minutes:
/reopen. A check runs and either reopens the issue or lists what is still missing.The rules are in CONTRIBUTING.md.