Skip to content

fix(#4621): QK-norm models take the FP16 batched prefill when it fits (D3-SPLIT B, stacked on #4620) - #4624

Closed
noahgift wants to merge 7 commits into
ec/3715-lambda-cellsfrom
ec/4621-fit-and-chat-kv
Closed

noahgift wants to merge 7 commits into
ec/3715-lambda-cellsfrom
ec/4621-fit-and-chat-kv

Conversation

@noahgift

@noahgift noahgift commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

D3-SPLIT B of #4620: QK-norm models take the FP16 batched prefill when it fits (root 2)

Stacked on #4620 (A), and C (ec/4621-chat-session-kv, apr chat device KV) is stacked on this PR. The base branch is ec/3715-lambda-cells, so ci.yml does not run here. It runs once A merges and this PR retargets to main. The mutant cap is verified in that run.

What changes

Evidence

  • Mutants on this diff (vs A, as CI counts them): 58 (gpu_profile 17, mod.rs 29, resident.rs 12). Cap is 60.
  • Intel @451bc77c52 (--features cuda --lib): 17910 passed, 6 failed, 76 ignored. All 6 failures are device or ptxas tests (test_new_device_0, test_num_devices, test_cov002_cuda_likely_available, test_cuda_executor_new, gemm_bt_tiled_ptx_…, every_emitted_kernel_assembles), and intel has no NVIDIA driver (nvidia-smi fails), so they say nothing about this diff. fmt --check passes.
  • clippy --features cuda -D warnings: 2 borrow_deref_ref errors at cuda/executor/residual.rs:314,343, already on main (from perf(qwen35-cuda): DP4A requant staleness (#4258) + argmax first-of-ties (#4259) + allocation-free decode plumbing (#4215) — replaces #4322 #4332 #4439), outside this diff. The receipt ec ran on the B files alone (resident:: pmat3477 fit_check gpu_profile) is 40/40.
  • Device red/green for root 2: handoff/3715-fix-ec.md (ec, combined binary apr-fix4). The tensor-walk refactor of the resident estimate has not been re-measured on a device.

Refs #4621, Refs #3715. This PR does not close #4621: C closes it when it merges last.

Agent: aprender-e6 (split owner; code by aprender-ec)

🤖 Generated with Claude Code

noahgift and others added 2 commits September 29, 2026 05:38
… (root 2)

Qwen3-family models were forced onto the serial prefill by
disable_fp8_for_qk_norm (#3413/#3483); serial scales super-linearly and the
1.7B 20k cell ran past 600 s. They now keep FP8 off but take the FP16 batched
prefill, which #4620 made chunked. A model whose weights + FP16 cache + KV +
prefill reserve exceed free VRAM keeps serial (Qwen3-8B on 24 GB, which OOMed
into a CPU fallback without this check); BATCHED_PREFILL=1 still overrides.

The resident estimate walks the projection tensors themselves (bytes and
in x out elements) instead of a dims formula, so it cannot drift from the model.

Stacked on #4620. Refs #3715
Agent: aprender-ec
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nto B

Agent: aprender-e6
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@noahgift

Copy link
Copy Markdown
Member Author

quorum-review (AD-04): NOT agreed (auto_merge: checked=true was_armed=false disarmed=false)

{
 "ticket": "PMAT-4621",
 "head": "451bc77c528822417a53b25190d7670dadd813eb",
 "width": 3,
 "executor": "agy",
 "agreed": false,
 "auto_merge": {
  "checked": true,
  "was_armed": false,
  "disarmed": false,
  "note": "auto-merge not armed"
 },
 "lanes": [
  {
   "lane": 1,
   "verdict": "PASS",
   "findings": 2
  },
  {
   "lane": 2,
   "verdict": "FAIL",
   "findings": 1
  },
  {
   "lane": 3,
   "verdict": "NO-VERDICT",
   "findings": 0
  }
 ]
}

@noahgift

Copy link
Copy Markdown
Member Author

quorum-review (AD-04): NOT agreed (auto_merge: checked=true was_armed=false disarmed=false)

{
 "ticket": "PMAT-4621",
 "head": "451bc77c528822417a53b25190d7670dadd813eb",
 "width": 3,
 "executor": "agy",
 "agreed": false,
 "auto_merge": {
  "checked": true,
  "was_armed": false,
  "disarmed": false,
  "note": "auto-merge not armed"
 },
 "lanes": [
  {
   "lane": 1,
   "verdict": "FAIL",
   "findings": 3
  },
  {
   "lane": 2,
   "verdict": "FAIL",
   "findings": 3
  },
  {
   "lane": 3,
   "verdict": "PASS",
   "findings": 0
  }
 ]
}

Agent: aprender-e6
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@noahgift

Copy link
Copy Markdown
Member Author

quorum-review (AD-04): three PASS — agreed (auto_merge: checked=true was_armed=false disarmed=false)

{
 "ticket": "PMAT-4621",
 "head": "1c97bea00e1f42564a6c1eeadb3a254c6ecd8e2f",
 "width": 3,
 "executor": "agy",
 "agreed": true,
 "auto_merge": {
  "checked": true,
  "was_armed": false,
  "disarmed": false,
  "note": "auto-merge not armed"
 },
 "lanes": [
  {
   "lane": 1,
   "verdict": "PASS",
   "findings": 2
  },
  {
   "lane": 2,
   "verdict": "PASS",
   "findings": 0
  },
  {
   "lane": 3,
   "verdict": "PASS",
   "findings": 1
  }
 ]
}

noahgift and others added 2 commits September 29, 2026 08:13
…igh, haiku-4-5) at 1c97bea (#4624, D3-SPLIT B)

Agent: aprender-e6
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…) into B

Agent: aprender-e6
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@noahgift

Copy link
Copy Markdown
Member Author

quorum-review (AD-04): NOT agreed (auto_merge: checked=true was_armed=false disarmed=false)

{
 "ticket": "PMAT-4621",
 "head": "dcee3dd3ae9286ad88a1a7f4311c126000dccb4a",
 "width": 3,
 "executor": "agy",
 "agreed": false,
 "auto_merge": {
  "checked": true,
  "was_armed": false,
  "disarmed": false,
  "note": "auto-merge not armed"
 },
 "lanes": [
  {
   "lane": 1,
   "verdict": "PASS",
   "findings": 0
  },
  {
   "lane": 2,
   "verdict": "NO-VERDICT",
   "findings": 0
  },
  {
   "lane": 3,
   "verdict": "PASS",
   "findings": 0
  }
 ]
}

@noahgift

Copy link
Copy Markdown
Member Author

quorum-review (AD-04): NOT agreed (auto_merge: checked=true was_armed=false disarmed=false)

{
 "ticket": "PMAT-4621",
 "head": "dcee3dd3ae9286ad88a1a7f4311c126000dccb4a",
 "width": 3,
 "executor": "agy",
 "agreed": false,
 "auto_merge": {
  "checked": true,
  "was_armed": false,
  "disarmed": false,
  "note": "auto-merge not armed"
 },
 "lanes": [
  {
   "lane": 1,
   "verdict": "PASS",
   "findings": 2
  },
  {
   "lane": 2,
   "verdict": "FAIL",
   "findings": 1
  },
  {
   "lane": 3,
   "verdict": "PASS",
   "findings": 2
  }
 ]
}

Agent: aprender-e6
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@noahgift

Copy link
Copy Markdown
Member Author

quorum-review (AD-04): NOT agreed (auto_merge: checked=true was_armed=false disarmed=false)

{
 "ticket": "PMAT-4621",
 "head": "a6abbede70bb7b9d15013fd09e8c75d2341eef3b",
 "width": 3,
 "executor": "agy",
 "agreed": false,
 "auto_merge": {
  "checked": true,
  "was_armed": false,
  "disarmed": false,
  "note": "auto-merge not armed"
 },
 "lanes": [
  {
   "lane": 1,
   "verdict": "PASS",
   "findings": 2
  },
  {
   "lane": 2,
   "verdict": "FAIL",
   "findings": 3
  },
  {
   "lane": 3,
   "verdict": "PASS",
   "findings": 0
  }
 ]
}

Agent: aprender-e6
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
noahgift added a commit that referenced this pull request Sep 29, 2026
…op 11:03Z)

The tree is exactly devont/k1-kv-only (origin/main + K1 #4603, D5 #4614 and
the KV budget core). The other stack rows (#3715 serial prefill / for_session,
#3413 message, #4620, #4623, #4624) stay on their ec parents for a later PR;
nothing is deleted there. A merge, not a rebase or force-push.

Agent: aprender-00
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@noahgift

noahgift commented Oct 4, 2026

Copy link
Copy Markdown
Member Author

Closed with a pointer to #4623 (0.70.2 backlog, aprender-78): this PR's #4621 fix (QK-norm models take the FP16 batched prefill, root 2) is carried by #4623 as cd324d0. Measured: crates/aprender-serve/src/cuda/executor/layers/prefill.rs and crates/aprender-serve/src/gguf/cuda/resident.rs are byte-identical on both heads. The three further commits on this branch (596b6bb, 6cac047, 17f499b) change the mutants gate. They belong to the mutants workstream, not to chat KV, so they are not folded into #4623. Branch ec/4621-fit-and-chat-kv is kept with them.

@noahgift noahgift closed this Oct 4, 2026
@noahgift
noahgift deleted the ec/4621-fit-and-chat-kv branch October 9, 2026 08:25
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