Skip to content

DFlash2 Strix-Windows carryovers: selector full-rank, watchdog fix, Phase-G skip, nvfp4 launcher - #62

Merged
AzeezIsh merged 7 commits into
mainfrom
port/dflash2-win-stranded
Sep 24, 2026
Merged

AzeezIsh merged 7 commits into
mainfrom
port/dflash2-win-stranded

Conversation

@AzeezIsh

Copy link
Copy Markdown
Contributor

Summary

Cherry-picks the 6 commits stranded on port/dflash2-strix-windows-r2 that never reached main (the port branch merged via #52 before these landed):

  • d199348ba DFlash2 selector scores the full rank and top-k the checkpoint declares
  • 58f55b936 selector parity fixture uses distinct bf16 logits
  • 48cc72f0f declare DFlash Phase-G fp8 probes expected-absent on strix-hip qwen3.8-27b
  • 73beebc31 skip Phase G lm_head FP8 quantize when the shared head is NVFP4-packed
  • ceab72f98 content-loop watchdog must not fire on lists of distinct numbers
  • 6476844de win_serve_dflash2_nvfp4.ps1 launcher (ASCII-safe for WinPS 5.1)

Plus 932492194: splits the watchdog tests out of helpers_tests.rs — the watchdog tests pushed it over the 500-LoC cap; follows the confidence_tests.rs split precedent.

All commits were runtime-validated on gfx1151 Windows (28.5 tok/s DFlash2 E2E at the port-branch head a4295fda).

Test plan

  • Selector parity fixture + watchdog tests were exercised on the port branch
  • helpers_tests.rs back to 477 LoC, new number_list_tests.rs 107 LoC
  • CI fmt/clippy/tests/file-size-cap

Generated with Devin

AzeezIsh and others added 7 commits September 24, 2026 11:50
…nt declares

The on-device DFlash2 candidate selector reduced each row's unary logits
to a top-4 list and evaluated the bilinear score over only the first 64
selector dimensions (`s_context[64]`, `tid < 64`, two-warp partial sum),
while the loader reads `selector_rank` (256) and `selector_top_k` (16)
from the drafter config and the host fallback already honours both. The
fast path therefore evaluated a cheaper selector than the trained one.

The kernel now takes `top_k`, keeps per-thread/warp/block top-k lists up
to DF2_SEL_MAX_TOP_K=16, builds the context vector over the full rank up to
DF2_SEL_MAX_RANK=256, scores one candidate per warp across the whole rank,
and orders candidates (value desc, index asc) so tie-breaks match the
engine's first-index-wins argmax rule. `Dflash2CandidateSelector::new`
fails fast when a checkpoint exceeds the caps instead of degrading; the
host fallback uses the same order. Pinned: kernel arity (10), the Rust
mirrors of the kernel caps, gb10/strix-hip copies byte-identical, and an
ignored GPU parity test against an f32 host reference.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
(cherry picked from commit 6c53de7)
…ip qwen3.8-27b

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
(cherry picked from commit 808dc30)
…s NVFP4-packed

On NVFP4-packed checkpoints the shared lm_head DenseWeight pointer
addresses PACKED bytes (e.g. nvidia/Qwen3.8-27B-NVFP4 ships lm_head.weight
as U8 [248320, 2560] — ~636 MB, not ~2.5 GB of BF16). The decode path
already guards this: the drafter's logits GEMM routes through the NVFP4
twin via w4a16, with a comment naming the exact failure — a BF16 GEMM on
packed bytes reads 4x the buffer and faults (CUDA-700 ILA).

Phase G missed that guard in two places:

1. from_weights.rs quantized lm_head_shared as BF16 unconditionally.
   With ATLAS_DFLASH_DRAFTER_FP8=1 the load crashed deterministically on
   gfx1151 — 90+ gfxhub page faults, hipErrorIllegalAddress — after all
   35 per-layer quantizes succeeded, at the lm_head launch.
2. The fp8 decode branches in batch_forward.rs and forward_block.rs fell
   back to dense_gemm_bf16_pipelined on lm_head_shared when the FP8
   mirror was absent — the same OOB read, deferred to first decode.

Fix mirrors the existing non-fp8 dispatch: skip the lm_head quantize
when lm_head_nvfp4 is Some (the packed-twin signal), and collapse the
fp8 branch into the shared dispatch — when no FP8 mirror exists the head
drafts logits through the NVFP4 twin exactly like the BF16 path. On
checkpoints whose lm_head is genuinely BF16 (no nvfp4 twin) the quantize
and the fp8 row-scaled path are unchanged.

Validated on AzeezStrix gfx1151: ATLAS_DFLASH_DRAFTER_FP8=1 now boots
clean — Phase G logs "drafter weights ready as FP8" with the lm_head
quantize skipped — and a probe request drafted via the nvfp4 fallback
(mean_na=2.583, p1=0.917, coherent output). cargo fmt clean.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
(cherry picked from commit 45791e7)
…umbers

Found on winbox serving Qwen3.8-Flash-Next-NVFP4 (2026-09-20, gfx1151;
identical logic on GB10): on the MinHeap+unittest prompt both decode arms
were cut at 641 tokens mid `values = [8, 3, 1, 6, 4, 2, 7,`.

  serial:  decode_logits_content — "Content-loop watchdog fired
           (period-2…64 repeat); rolled back to boundary, re-steering
           content_tokens=570 dropped=70 rollback=1" → rollback=2 →
           "ending response early (rollback declined)"
  MTP:     emit_step — "Content-loop watchdog fired in MTP/emit path …
           ending response"

detect_content_token_loop_normalized_with maps every numeric token to
NUMERIC_SENTINEL, so a comma-separated list of distinct numbers
normalizes to `N , N , N , …` — a period-2 anchored repeat at
NORM_MIN_REPEATS=4. Any list of ≥5 distinct numbers (test fixtures,
arrays, tables) tripped it.

Fix: a new `VocabMasks::punctuation` (token decodes to non-empty
ASCII punctuation/whitespace) lets the normalized detector learn the
matched period via detect_token_loop_period and decline when the window
is only sentinels and punctuation. A real numeric runaway (`1, 1, 1, …`)
still fires — identical tokens repeat literally, so the exact detector
catches it. `punct == None` keeps the legacy fail-open behaviour.

(cherry picked from commit 92d53d2)
helpers_tests.rs crossed the 500-LoC CI cap when the watchdog tests
landed; follows the confidence_tests.rs split precedent.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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