Skip to content

GLM CUDA: keep kept prompt states in pinned host memory (complements #1732) #1735

Closed

Description

@russellmm

GLM CUDA keeps its kept prompt states in one device arena, which gets only the memory the KV page pool leaves over
(#1510). On a discrete card that can be a fraction of a GiB, so a long conversation's state is refused and every turn
prefills the whole conversation again. #1732 addresses this by keeping prompts as the pool's own pages.

This issue is a complementary route for discrete cards: keep kept states in pinned host memory.

  • The server already has a host-cache path (host_snaps, --prompt-cache-gib sized in host memory, as Nemotron uses);
    GLM doesn't opt in.
  • With the snapshot arena in pinned host memory mapped into the device's address space, the existing
    cuMemcpyDtoDAsync keep/restore copies move a state across PCIe (~57 GB/s each way on PCIe Gen5 x16).
  • The device cache's share goes back to the KV pool.
  • Unset, nothing changes.

Where it helps most is many long conversations at once (agent sessions):

Measured on two RTX PRO 6000 Blackwell cards (96 GB) at TP=2 with Mia-AiLab/GLM-5.3-Flash-EXL3-4bpw-TensorFold
(weights 86.2 GiB a rank, 320K window):

main with TF_GLM_HOST_CACHE=1 --prompt-cache-gib 24
device prompt cache 0.5 GiB none (24 GiB per rank in host memory)
next turn of a 250K-token conversation prefills again (83 s) 0.8 s
10 interleaved conversations, 40K-200K tokens 0% of follow-up tokens resumed 74%
decode, cold 32K/64K prefill unchanged (within 0.4%)

Resumed replies are identical to fresh ones, and bench_concurrent --alone --serial passes. A pull request with the
full receipt follows.

This is the first of a few steps toward serving GLM-5.3-Flash on two 96 GB cards with system memory taking the pressure
off the KV window. Later steps would be GLM's vision tower in host memory, then live DSA latent rows in host memory for
long windows, building on the host tier in #1501/#1522. Each would be its own issue and pull request, and we'd like
maintainer guidance on the last one before starting it.

Activity

  1. russellmm commented on Oct 31, 2026

    @russellmm
    ContributorAuthor

    /atc claim

  2. added a commit that references this issue on Oct 31, 2026
    ed191b1
  3. added a commit that references this issue on Oct 31, 2026
    4a65c0c
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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions