mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #5432] [Engine] Do not force WindowInvariant CPU experts on DFlash2 windows when MTP fallback is loaded #5423
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#5423
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?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/5432
Author: @bsorensen110
Created: 11/6/2026
Status: 🔄 Open
Base:
main← Head:fix/mtp-window-invariant-dflash2📝 Commits (1)
e6609ae[verified] fix(spec): do not force WindowInvariant CPU experts when DFlash2 overrides MTP📊 Changes
3 files changed (+17 additions, -3 deletions)
View changed files
📝
include/strata/spec/window_rule.hpp(+5 -0)📝
src/program/generate.cpp(+8 -3)📝
src/spec/window_rule_test.cpp(+4 -0)📄 Description
Problem and result
When DFlash2 runs with the MTP layer loaded beside it as the fallback (
--draft auto/use_mtp == truewithreq_df2 == trueinserveorspec_uses_df2 == trueingenerate) andSTRATA_SPEC_PROB=1is enabled (including ongfx12wherearch_defaults.cppsetsSTRATA_SPEC_PROB=1),mtp_q_applies(include/strata/spec/window_rule.hpp:35) correctly omits the MTP proposal distributionsqon DFlash2 verify windows (!df2_active). However, the immediately followingdecode_pool_fnselection (src/program/generate.cpp:18858in theserveloop andsrc/program/generate.cpp:20650in the CLI loop) andgated_proposal(src/program/generate.cpp:17550) evaluateduse_mtp && mtp.prob()without checking!req_df2/!spec_uses_df2.As a result, every DFlash2 verify window with an MTP fallback loaded forced CPU expert misses onto
invariant_win_pool_fn/drive_pool_multi_invariant(NativeArithmetic::WindowInvariant, which setssingleton_iq = trueand runs 1-token reference kernels per row instead of the multi-token grouped AVX2/AVX-512 IQ kernels) even though DFlash2 uses deterministic point-mass candidates (mtp_q_applies == false).This change adds
strata::spec::mtp_window_invariant_applies(bool use_mtp, bool df2_active, bool mtp_prob)ininclude/strata/spec/window_rule.hppand gatesgated_proposaland bothdecode_pool_fnsites on it, keeping multi-token grouped CPU expert kernels active whenever DFlash2 is the active drafter.Related discussion
None.
Approach
include/strata/spec/window_rule.hpp:39-42: Addmtp_window_invariant_applies(bool use_mtp, bool df2_active, bool mtp_prob)returninguse_mtp && !df2_active && mtp_prob, alongsidemtp_q_applies.src/program/generate.cpp:17550, 18858, 20650: Gategated_proposalanddecode_pool_fn(bothserveandgenerateloops) throughstrata::spec::mtp_window_invariant_applies(...)using the request/session DFlash2 flag (req_df2inserve,spec_uses_df2ingenerate).src/spec/window_rule_test.cpp:105-108: Add unit test assertions covering all four(use_mtp, df2_active, mtp_prob)states ofmtp_window_invariant_applies.use_mtp && !df2_active && mtp.prob()), greedy decoding, or DFlash2-only runs without MTP loaded (--draft-fallback none).Validation
Tested on revision
e6609ae52(based onmain54828c7ef, Strata 0.2.10 / engine 0.1.57) on Linux (7.3.1-1-cachyos-server, AMD Radeon AI PRO R9700gfx120132 GB VRAM, 128 GB RAM).Passed:
g++ -std=c++20 -O2 -Iinclude src/spec/window_rule_test.cpp -o window_rule_test && ./window_rule_testone6609ae52:window_rule_test: ok(all 22 checks pass, including the 4 newmtp_window_invariant_appliescases).54828c7ef: for(use_mtp=true, df2_active=true, mtp_prob=true), the prior inline conditionuse_mtp && mtp_probreturnedtrue(selectinginvariant_win_pool_fnwhilemtp_q_applies(true, true, true, false, false, 4)returnedfalse);mtp_window_invariant_applies(true, true, true)returnsfalse.cmake --build build-hip --target window_rule_test spec_prob_test spec_admission_test strata -j16and CTestwindow_rule_test,spec_prob_test,spec_admission_test: 3/3 pass (0failures).Failed:
Not run:
include/strata/spec/window_rule.hppandsrc/program/generate.cppare shared across CUDA and HIP).Limits
qlists, as intended bymtp_q_applies).df2_active == false) andSTRATA_SPEC_PROB=1is active on a sampled request (temperature >= 0.05),mtp_window_invariant_appliesstill returnstrueso prefix-invariant CPU expert arithmetic is preserved for MTP rejection sampling.Reproduction
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.