Skip to content

GLM CUDA: skip native MTP prompt history with DFlash2 - #4695

Draft
MaverickKB wants to merge 1 commit into
ashhart:mainfrom
MaverickKB:codex/glm-dflash2-prefill-history
Draft

MaverickKB wants to merge 1 commit into
ashhart:mainfrom
MaverickKB:codex/glm-dflash2-prefill-history

Conversation

@MaverickKB

Copy link
Copy Markdown
Contributor

What this changes

GLM CUDA prefills the checkpoint's native MTP attention history even when an external DFlash2 drafter is active. DFlash2 builds its context from target-layer taps. This skips the unused native-head forward pass in the chunked and batched prompt paths. A worker using its native MTP drafter continues to absorb the prompt rows.

Checks on this head

  • Head commit: 47ad19970d6d8ce86c6d0cd52723a014d7947194.
  • Lean checker: 165 findings on main, 165 on this head, zero new (tools/zig/lean_check.py and tools/zig/lean_new.py).
  • Tests: zig build test-glm-prompts-host --summary all, 8 passed, 0 failed, 0 skipped. Running the same assertions against main gave 7 passed and 1 failed. The DFlash2 pass expected zero native history rows for a three-token prompt and found two. The native-drafter positive control still accumulates 1,024 native history rows for a 1,025-token prompt. The fixture also compares each DFlash2 slot's context to independent ingestion on both emulated ranks.
  • Formatting: zig fmt --check zig/glm_prompt_host.zig zig/src/families/glm/cuda_engine.zig zig/src/families/glm/cuda_prompts.zig and git diff --check passed.
  • CI: awaiting upstream checks on this draft.
  • Not run: full host matrix, device tests or isolated upstream GPU benchmarks. The host fixture runs the actual batched prompt workflow with recording device operations.

Receipt

  • Main against branch: the failing host case described above changes from two unneeded MTP history rows to zero. The target's commit, token draw, DFlash2 ingest, prompt scoring and snapshot format keep their existing paths. The engine-level drafter selection applies on both TP ranks. A request with draft: false on a DFlash2 worker still uses target decoding.
  • Boxes it reaches: GLM CUDA workers loading an external DFlash2 drafter, for both single and batched prompt passes.
  • New switch: n/a. The existing engine drafter selects the path.
  • Environment: base/head above; Zig 0.17.0; arm64 macOS CPU recording fixture. The fixture loads no checkpoint or CUDA driver. This PR is limited to CUDA; Metal, HIP, XPU and the application are outside its code paths.
  • Device evidence: the two guards have run together on a downstream TensorFold 1.3.4 GLM-5.3-Flash EXL3 server with two GB10 GPUs. The downstream deployment contains other changes, so it does not isolate the performance or token-level effects of this patch.
  • Exactness: host coverage for prompt state, native MTP retention and DFlash2 context. Same-head GPU token_sha against "draft": false, fresh versus resumed prompts, and concurrent versus solo remain pending.
  • Same-machine main/head comparison: pending. The available TP=2 machine is serving traffic. This draft makes no request for project hardware.
  • Decode speed before/after: unmeasured. There is no decode-path edit.
  • Cold prompt speed before/after: unmeasured. The outstanding gate is cache-disabled 2k/8k/32k/64k cold TTFT at one stream and the widest admitted concurrency, on the same main/head setup. No wall-clock speedup is claimed.
  • Licence of new weights or drafter: n/a. Uses the existing loaded drafter.

Checklist

  • One behavior, main base and exact receipt head identified.
  • Strengthened regression fails on main, passes on this head, and runs without a GPU.
  • No measurements or history in code comments.
  • Source and commit use public identities and contain no private paths.
  • Existing lane rounds and draft settings remain in use.
  • GPU token equality for drafted, resumed and concurrent requests.
  • No precision, weight format, kernel or reduction-order change.
  • Isolated cold-prefill and decode performance at one stream and widest concurrency.

This branch has not been deployed

No deployments
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