Skip to content

Windows gfx1151: DFlash2 NVFP4 serve exits with generic Failed to build model before API bind #61

Closed

Description

@ElderOrb

Environment

  • Host: native Windows 11 on AMD Strix Halo / gfx1151
  • Atlas worktree: port/dflash2-strix-windows-r2
  • Commit: a4295fda6acf7040f988c68537632a9bff2a6271
  • Windows HIP SDK used for both build and run: C:\Program Files\AMD\ROCm\7.1
  • Target: nvidia/Qwen3.8-27B-NVFP4 (local snapshot, 21.95 GB)
  • DFlash drafter: incoai/Qwen3.8-27B-DFlash2 (local snapshot, 3.85 GB)
  • No other spark.exe or llama-server.exe process was loaded during the run.
  • Pre-launch UMA snapshot: 98,128 MB dedicated UMA; WDDM use about 1.28 GiB; 21.75 GiB free system RAM.

Build

Built strictly through the in-tree Windows entry point:

powershell -NoProfile -ExecutionPolicy Bypass -File scripts\strix-windows\first_run.ps1 -Phase build

Preflight passed: MSVC 2022 Build Tools, HIP SDK C:\Program Files\AMD\ROCm\7.1\, Cargo 1.93.1, and GPU gfx1151.

The release build completed in 2m22s, compiled 115/115 unique Windows-HIP kernels, and staged amdhip64_7.dll, amd_comgr_3.dll, hiprtc0701.dll, plus the cuda.dll/nvcuda.dll HIP shims.

spark.exe SHA-256:

BC6E6013F6B547301347408DCB1F6C2DB4243F523090E1D75DD0295CDC839477

Serve recipe

Used the branch-provided ASCII PowerShell 5.1 launcher, not a local port:

scripts\strix-windows\win_serve_dflash2_nvfp4.ps1

It includes the intended long-context DFlash2 controls:

  • ATLAS_DFLASH_CTX_WINDOW=SeqLen
  • --dflash-window-size 0 (full prefix)
  • --enable-prefix-caching
  • --disable-thinking
  • DFlash gamma, target/draft paths, SSM checkpoints, and memory utilization

Invocation:

$env:HIP_PATH = 'C:\Program Files\AMD\ROCm\7.1'
.\scripts\strix-windows\win_serve_dflash2_nvfp4.ps1 `
  -BindHost 127.0.0.1 -Port 8096 -SeqLen 49152 -Util 0.80 `
  -Gamma 8 -SsmSlots 24 -SsmInterval 128 `
  -ModelDir C:\Users\ai\models\hf\nvidia\Qwen3.8-27B-NVFP4 `
  -DraftDir C:\Users\ai\models\hf\incoai\Qwen3.8-27B-DFlash2

The launcher defaults to C:\TheRock\10.0.0 when HIP_PATH is unset. This machine has the build-compatible HIP SDK at the path above, so HIP_PATH was set explicitly to match the build runtime.

Observed behavior

The process gets substantially into construction:

Selected kernel target: (gfx1151, qwen3.8-27b, nvfp4) (115 modules)
DFlash: resolving drafter 'C:\Users\ai\models\hf\incoai\Qwen3.8-27B-DFlash2'
DFlash drafter store: 81 tensors, 3848808960 bytes
DFlash: target layer capture indices = [5, 19, 33, 47, 61]
Layer construction: 17.24 GB consumed (86.56 GB free -> 69.31 GB free) across 64 layers
KV cache: ... 36522 blocks x 16 tok/block = 584352 max KV tokens

It then exits before binding http://127.0.0.1:8096. No request can be made, so no Hermes benchmark was started.

The only failure text emitted is:

Error: Failed to build model
backend drop reclaimed 3302 allocation(s) that no owner released - expected if a load was abandoned part-way, otherwise an unregistered owner

There is no preceding HIP/driver allocation failure, unresolved-kernel lookup, panic backtrace, or more specific inner error in the launcher log. The checkpoint vision encoder is also instantiated; this branch has no --disable-vision or ATLAS_DISABLE_VISION control, so I did not add an unreviewed bypass.

Question

What additional logging or environment flag should be enabled to expose the inner model-construction error on this native Windows/HIP gfx1151 path? Is there a required runtime/layout condition for the DFlash2 NVFP4 launcher that differs from the first_run.ps1 -Phase build HIP 7.1 output?

Activity

  1. AzeezIsh commented on Sep 24, 2026

    @AzeezIsh
    Contributor

    Reproduced on our gfx1151 winbox at the exact commit (a4295fda, port/dflash2-strix-windows-r2), same script/params. This is a memory-budgeting bug in the serve path, not a kernel or config problem — and the Caused by: chain does print (it likely interleaved below your paste):

    Failure point: SsmSnapshotPool::new inside TransformerModel::new — cuMemAlloc_v2 status 2 requesting ~96 MB with ~2.4 GB free.

    Why: at --max-seq-len 49152 the KV budget math leaves no room for post-KV allocations:

    Phase Bytes
    pre-KV fixed (weights, drafter, ctx-window buffers, vision) 58.2 GB
    inference reserve 4.3 GB
    KV pool (sized to fill util × total budget) 9.1 GB @ util 0.80
    post-KV, unbudgeted: SSM snapshot pool (auto-raised 24→32 slots = 4.8 GB) + drafter ctx + workspaces ~20 GB

    util × total caps KV sizing, but everything allocated after KV (SSM snapshot pool, drafter ctx window, selector buffers) draws from total × (1−util) with nothing reserved — on an 89.5 GB GPU at util 0.80 that's ~18 GB and it isn't enough. util 0.75 also fails (KV shrinks to 4.6 GB but ~22 GB headroom still falls short).

    Notably: the same profile (seq 49152, util 0.90) boots and serves on the sibling ctx-carry branch on this exact box — because that branch's context-carry buffers are accounted pre-KV (74.5 GB pre-KV vs 58.2 GB here), so KV sized smaller and the 4.8 GB snapshot pool fit. Same hardware, same params — the difference is where the buffers land in the budget, not capacity.

    Workaround for testing right now: the validated profile is win_serve_dflash2.ps1 (SeqLen 8192, slots 20, util 0.80) — that's the config we measured 28.5 tok/s on. For the nvfp4 long-context script on your 107.9 GB box, -SeqLen 32768 (halves snapshot slots 32→16 and ctx buffers) or -Util 0.75 should get you past construction.

    The real fix (ours): either reserve estimated post-KV allocations in the budget math before sizing KV, or move SsmSnapshotPool/drafter-ctx allocation ahead of KV sizing so they're counted in used_so_far — the carry-branch ordering effectively does this. I'll open a follow-up PR for that plus a safer default SeqLen in the nvfp4 script.

  2. AzeezIsh commented on Sep 25, 2026

    @AzeezIsh
    Contributor

    Fix merged to main (f6401c69b, PR #63) — SSM state/snapshot/ring pools now allocate before the KV budget snapshot so they're counted in used_so_far instead of consuming unbudgeted headroom after KV sizing.

    End-to-end check on our 89.5 GB winbox with the fix build (8ae7b228 = main + fix):

    • util 0.80 / seq 49152: the serve now refuses cleanly and upfront — No memory left for KV cache: total GPU = 89.5 GB, util 80% → budget 71.6 GB, but 73.0 GB already consumed + 4.3 GB inference reserve = 77.3 GB committed — instead of the mid-construction cuMemAlloc status 2. The accounting is honest now: SSM pools show up in the pre-KV figure (73.0 vs the old 58.2 GB).
    • On this 89.5 GB box, seq-49152 needs util ≥ ~0.87 (we run the same profile at 0.90 successfully on the carry branch — footprint is what it is; the fix makes the budget truthful, not smaller).
    • On your 107.9 GB box, the exact profile you ran should now boot at util 0.80: budget 86.3 GB vs ~77.3 GB committed → ~9 GB KV headroom.

    Related: a Windows ST-995 leg on the carry branch just completed at this profile — overall 84.02 / normalized 76.34 (n=995). The normalized gap vs GB10-main's 86.26 is under investigation; prefix-caching multi-turn correctness on DFlash is the prime suspect — that serve ran --enable-prefix-caching.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions