Repository navigation
chore(pflash): drop env switches, /props fields and code PFlash no longer reads - #863
Conversation
davide221
left a comment
There was a problem hiding this comment.
Code review
Found 1 issue.
Copy to agent
Use the copy button in the top-right corner of the block, then paste into your agent.
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
Repository: Luce-Org/lucebox
Reviewed commit: 8839603ec2bf880f85baf46570177024de347f08
Verify the findings against the current code, run relevant checks for any fixes, and explain any findings you reject.
<file name="optimizations/pflash/pflash/dflash_client.py">
<violation number="1" line="105" end_line="106">
fa_window no longer reaches the spawned daemon; default is 2048, not 0
`DflashClient` spawns `test_dflash` (the binary `bench_niah_cpp.py` and the README use as the daemon). The old code forced `LUCE_FA_WINDOW=0` in the child env, which `test_dflash.cpp:706-708` reads to override `g_fa_window`. This PR replaces that with a `--fa-window=N` argv flag, but `test_dflash`'s argument loop (server/test/unit/test_dflash.cpp:813-986) has no `--fa-window` case — only `--fa-window` exists on `luce_server`/`server_main.cpp:730` — so the flag is silently ignored. Meanwhile `g_fa_window` defaults to **2048** (test_dflash.cpp:163), not 0, and the client no longer sets the env var. Result: the daemon runs with a 2048-token sliding window on full-attention layers, so NIAH needles more than 2048 tokens back cannot be retrieved and the benchmark's `--fa-window 0` default is a no-op. This also contradicts the new docstring claim that "unset keeps the daemon default 0 = full attention, as before". Fix: keep setting `LUCE_FA_WINDOW` in `env_overrides` (or add `--fa-window` parsing to `test_dflash`).
<suggestion>
env_overrides = {
"LUCE_KV_TQ3": "1" if (kv_tq3 if kv_tq3 is not None else True) else "0",
}
if fa_window is not None:
env_overrides["LUCE_FA_WINDOW"] = str(fa_window)
</suggestion>
</violation>
</file>
Issue overview
- fa_window no longer reaches the spawned daemon; default is 2048, not 0 · confirmed (
optimizations/pflash/pflash/dflash_client.py:105-106)
Reviewed 8839603e · 2 candidate issues checked, kept at ≥70% confidence · add the code-review label to review again
| if fa_window is not None: | ||
| cmd.append(f"--fa-window={fa_window}") |
There was a problem hiding this comment.
fa_window no longer reaches the spawned daemon; default is 2048, not 0 · confirmed
DflashClient spawns test_dflash (the binary bench_niah_cpp.py and the README use as the daemon). The old code forced LUCE_FA_WINDOW=0 in the child env, which test_dflash.cpp:706-708 reads to override g_fa_window. This PR replaces that with a --fa-window=N argv flag, but test_dflash's argument loop (server/test/unit/test_dflash.cpp:813-986) has no --fa-window case — only --fa-window exists on luce_server/server_main.cpp:730 — so the flag is silently ignored. Meanwhile g_fa_window defaults to 2048 (test_dflash.cpp:163), not 0, and the client no longer sets the env var. Result: the daemon runs with a 2048-token sliding window on full-attention layers, so NIAH needles more than 2048 tokens back cannot be retrieved and the benchmark's --fa-window 0 default is a no-op. This also contradicts the new docstring claim that "unset keeps the daemon default 0 = full attention, as before". Fix: keep setting LUCE_FA_WINDOW in env_overrides (or add --fa-window parsing to test_dflash).
Checked (92%): dflash_client.py:105-106 now passes --fa-window=N to test_dflash, but test_dflash.cpp's argv loop (lines 813-986) has no --fa-window case, so it is silently ignored; g_fa_window defaults to 2048 (test_dflash.cpp:163) and is only overridden by the LUCE_FA_WINDOW env var (test_dflash.cpp:706-708) that this PR removed from env_overrides. bench_niah_cpp.py:31 defaults --fa-window to 0, so the daemon now always runs with a 2048-token sliding window, breaking NIAH needles beyond 2048 tokens and contradicting the new docstring at dflash_client.py:66.
| if fa_window is not None: | |
| cmd.append(f"--fa-window={fa_window}") | |
| env_overrides = { | |
| "LUCE_KV_TQ3": "1" if (kv_tq3 if kv_tq3 is not None else True) else "0", | |
| } | |
| if fa_window is not None: | |
| env_overrides["LUCE_FA_WINDOW"] = str(fa_window) |
…nger reads The Qwen3.5-0.8B scorer (Luce-Org#746) replaced the Qwen3-0.6B drafter, whose forward ran the FlashPrefill sparse kernels. What only that drafter read stayed behind and still read as PFlash configuration. - /props pflash drops bsa_enabled, bsa_alpha and lm_head_fix: PFlash reads none of them (LUCE_FP_ALPHA and LUCE_LM_HEAD_FIX have no reader at all; LUCE_FP_USE_BSA only picks Gemma 4's sliding-window prefill launcher). Removing fields is a breaking change, so props_schema goes to 3 with a changelog entry. - src/pflash_ggml_adapter.{h,cpp} registered the FlashPrefill kernel as the ggml sparse flash-attention op, which no graph builds; it goes with test_flash_attn_sparse and its CI wiring. Gemma 4 still calls the FlashPrefill kernels directly. - optimizations/pflash: DflashClient stops setting LUCE_LM_HEAD_FIX (no reader) and keeps LUCE_FA_WINDOW, which test_dflash reads (it has no --fa-window flag); bench_niah_cpp drops --bsa/--alpha. - Scripts stop setting LUCE_FP_USE_BSA/LUCE_FP_ALPHA for Qwen and drafter runs (phase_split_dual_gpu --pflash-alpha/--pflash-use-bsa, laguna_pflash_niah, the quality A/B arms; quality_ab_simple's bsa_on arm was identical to baseline). - Docs: ENVIRONMENT.md and variables.md drop variables with no reader (LUCE_FP_ALPHA, LUCE_FP_CHUNK_S, LUCE_FP_NOPE_TAIL, LUCE_FP_SKIP_PREWARM, LUCE_FP_DEBUG_LAYER0, LUCE_PFLASH_K_TYPE, LUCE_LM_HEAD_FIX). The PFlash README and SPEC_PREFILL.md describe the current scorer, label the 10.4x table as PFlash v1 (SPEC_PREFILL credited it to the 0.8B drafter), and stop listing the FlashPrefill switches as PFlash tunables. Co-Authored-By: Claude Opus 5.5 <[email protected]>
8839603 to
8d0e172
Compare
…lash DeltaNet ladder branch Clean 3-way merge against the tested Luce-Org#850 head: Luce-Org#851 changes and the main-side changes (Luce-Org#876 sampler seeding, Luce-Org#863 PFlash cleanup) are both kept exactly. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rg#850, Luce-Org#876, Luce-Org#863) into kvflash turn checkpoints branch Clean 3-way merge against the tested Luce-Org#851 head: Luce-Org#852 changes and the main-side changes are both kept exactly. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Why
#746 replaced the Qwen3-0.6B drafter, whose forward ran the FlashPrefill sparse kernels (BSA on CUDA, rocWMMA on HIP), with the Qwen3.5-0.8B scorer. The new scorer runs blocks 0–14 on the qwen35 graph (Gated DeltaNet plus ggml flash-attention) and scores with block 15's Q/K attention mass. The switches and code only the old drafter read were left behind, still presented as PFlash configuration. In a recent report on an R9700,
fp_use_bsa = ONin the banner was read as "BSA runs on ROCm", and the 30x scorer speedup was nearly attributed to it.What goes
/propspflash.bsa_alpha,pflash.lm_head_fixLUCE_FP_ALPHAandLUCE_LM_HEAD_FIXhave no reader/propspflash.bsa_enabledLUCE_FP_USE_BSAonly picks Gemma 4's sliding-window prefill launcher, so it isn't PFlash statesrc/pflash_ggml_adapter.{h,cpp},test_flash_attn_sparse, its CI wiringDflashClientLUCE_LM_HEAD_FIXenv,lm_head_fixargLUCE_FA_WINDOWstays:test_dflashreads only the env var (it has no--fa-windowflag) and defaults to 2048, so the client keeps setting it, 0 whenfa_windowis unsetbench_niah_cpp --bsa/--alpha,phase_split_dual_gpu --pflash-alpha/--pflash-use-bsa,laguna_pflash_niahdefaults, quality A/BLUCE_FP_USE_BSAarmsquality_ab_simple'sbsa_onarm was identical tobaselineENVIRONMENT.md/variables.md:LUCE_FP_ALPHA,LUCE_FP_CHUNK_S,LUCE_FP_NOPE_TAIL,LUCE_FP_SKIP_PREWARM,LUCE_FP_DEBUG_LAYER0,LUCE_PFLASH_K_TYPE,LUCE_LM_HEAD_FIXqwen3_graph.cpp/qwen3_drafter.cpp)props_schemagoes to 3. The props spec counts a removed field as a breaking change, so the schema is bumped with a changelog entry inprops-endpoint.mdandopenapi-props.yaml. Nothing inluce_boxreads the three fields.PFlash docs. The PFlash README and
SPEC_PREFILL.mdnow describe the current scorer and selection instead of BSA and alpha. The 10.4x RTX 3090 table is labelled as PFlash v1;SPEC_PREFILL.mdhad credited it to the 0.8B drafter. TheLUCE_FP_*switches are no longer listed as PFlash tunables.Kept:
LUCE_FP_USE_BSAand its PFlash-on default, because Gemma 4 still uses them.LUCE_FP_PROFILE/LUCE_FP_DUMP_COUNTS/LUCE_FP_HIP_ROW, which the FlashPrefill kernels read.FLASH_ATTN_SPARSEop in the vendored ggml.Overlap with #861. The server still sets
LUCE_FP_ALPHA/LUCE_FA_WINDOWwhen PFlash is on, and the banner still printsfp_use_bsa/fp_alpha. #861 removes both, so this PR leaves those lines alone and the two merge independently.Tests
luce_server,test_server_unit) on main 32a3137;test_server_unit0 failures. Theprops_schemaassertions are updated to 3.ci.ymlparses.🤖 Generated with Claude Code