Repository navigation
Conversation
The FP8 latent cache's chunk kernels read each tile one byte at a time after the previous tile's math, so the load never overlapped it and cold prompts ran 3 to 5% slower than with the BF16 cache. Tile t + 2's codes and row scales now come one 8-byte load a unit at the top of tile t and wait in registers; after the tile's math they decode with the same per-element arithmetic into the BF16 tile in one 16-byte store a unit. Rows stay byte-identical, cold prompts are 4.4 to 4.6% faster at 8k to 64k tokens on two GB10, and the kernels' register records follow the new measured counts.
Records what the FP8 code prefetch was measured on: two GB10 at TP=2 on FP4-Local with --kv-cache fp8, base main against base plus the kernel commit. The teacher-forced rows are byte-identical to main's and to the FP8 qualification's, the exactness suites pass, cold prompts run 4.4 to 4.6% faster from 8k to 64k tokens over alternated launches, and both register records are current under nvcc 13.0 and 13.3; the raw results, logs, tools and checksums are kept with it.
The checklist asks for no slowdown at the widest admitted stream count, so the receipt adds four alternated launches at --parallel 4 (bench_concurrent, greedy and sampled, drafted), where the head is 1.6 to 4.7% faster in every cell with the same replies, and the GB10 contract summary, whose gates and controls pass and whose limit lines fail only for want of nvcc 13.5 records.
|
Thanks @laudney, this is a careful change and a well-built receipt. Thank you for the alternated base/head launches, and for listing the #3064 resolution up front. I read the kernel line by line against main, and I agree it keeps every byte:
Both receipt tables reproduce exactly from the committed results ( Must fix:
Optional:
CI is still pending at
|
The repository ignores *.log, so the 16 client and server logs of the c4 launches never reached the previous commit although SHA256SUMS lists them; they are now force-added like the other launches', and c4_compare.py also checks the replies' token sha256 from c4.json, where they live, so the README's reply claim reproduces from the committed files.
|
@ashhart Thanks for the line-by-line read. Head is now
Description updated (stack, head, fresh-export check). CI pending at this head. |
|
@laudney, we applied the series to main and read the kernel against the byte-identical claim: the prefetch Nothing to change from us. The #3064 overlap is named with a resolution either way, and the recipe's "3 to 5% The next step on our side is the device run your receipt sets up: main against this branch on GB10, both with
|
|
Sorry @laudney, and thank you for this careful work. We've decided to remove every lossy feature from TensorFold, the FP8 latent cache (
|
--kv-cache fp8on FP4-Local, TP=2 on two GB10, base5c82ef28a6against this, alternated base, head, head, base"draft": falsedecode, two prompts (tok/s)bd27f57e…bd27f57e…(byte-identical)From 8,192 tokens up, and in every 4-stream cell, every head launch beats every base launch. The FP8 cache's cold prompts are now as fast as the BF16 cache's (
glm-kv-fp8-3a56d4ebmeasured 5.69 / 22.88 / 45.84 s for BF16 on an earlier binary).What this changes
With
--kv-cache fp8, GLM's chunk kernels (tf_glm_chunks_16_fp8for decode windows,tf_glm_chunks_32_fp8for prompt chunks) turn each 32-key tile of E4M3 codes back into the BF16 shared tile that the BF16 path's tensor-core math reads. They read the codes one byte at a time after the previous tile's math, so the load never overlapped it, which is why the FP8 cache was 3 to 5% slower on cold prompts (#3432, and this comment). Now tile t + 2's codes and row scale come in one 8-byte load a unit of eight at the top of tile t and wait in registers through the tile's math; after it they decode with the same per-element arithmetic (E4M3 to half to float, times the scale, rounded to BF16) into the tile in one 16-byte store a unit. The 32-head form uses 101,120 of the 101,376 shared bytes a block can opt into, so the codes cannot be staged in shared memory; registers rise instead (sm_121: 64 to 126 and 130 to 159, no spills), and shared memory still allows one block an SM, as before. Nothing else changes: not the BF16 path, the shared MLA image or any other kernel (base against head, only these two ofglm_glue's 48 kernels change resources on any of the five SMs).c8c848d001), four commits:62ccb16cca(the kernel and its two register records),a21687b403(the receipt),219f9dfa18(its 4-stream A/B and GPU contract summary) andb977db0d86(the 4-stream launches' 16 logs, which.gitignorehad kept out, and the reply-hash check intools/c4_compare.py). Independent of docs: GLM FP8 latent cache diagnostics on FP4-Local at TP=2 on two GB10 #3432; once both land, the recipe's "3 to 5% slower cold prompts" (added there) no longer holds, and I will update whichever lands second.atc overlap --json(ATC 0.9.4):complete: false(pullFilesUnavailable), so I listed every open pull request that changes one of this one's code files and merge-tested each against this head and againstmain(git merge-tree). One conflict is new: @gilp456's draft glm cuda: support explicitly paged FP8 KV #3064 (explicit FP8 pages) edits the same FP8 lines ofchunks_wide's tile load and adds records toglm_kv_pending.zig. Resolution for whichever lands second: glm cuda: support explicitly paged FP8 KV #3064's page and row offsets (page,row,scale_at) move intofetch_fp8's address and scale reads, and both record lists keep their lines. The other nine (glm cuda: EXL3 mcg experts at any whole-bit width, mixed by projection #2094, ricursive: Ripple-65B-Preview on native CUDA (NVFP4) #2302, Ling-3.1-flash on CUDA, on one or two GB10s #2340, ricursive: Ripple-65B-Preview's DFlash2 drafter on native CUDA #2475, ricursive: load Ripple's EXL3 packs through main's shared EXL3 code #2514, ricursive: serve Ripple-65B on two GB10s with up to 1M tokens of context #2522, ricursive: speed up Ripple-65B on two GB10s #2523, qwen3_5 cuda: the GDN kernels read the state, its rollback copy and the log through a stream's state table (#2444 P3) #2620, qwen3_5 cuda: a pool lane's state as pieces on any whole pages of its lease, no run (#2444 P3, Q3) #2939) give the same result against this head as againstmain.Checks on this head
b977db0d86.tools/pr_check.py --base upstream/main: 341 on the base and 341 on this head, 0 new. Its two advisory warnings: the documentation address192.0.2.1in the receipt'stools/fl-env.sh, and the CHANGELOG line.zig build test-kernel-contract: 32/32 steps, 205/205 tests passed.git diff --check upstream/mainclean;sha256sum -c SHA256SUMSin the receipt passes and covers every file there, checked on a fresh export of the pushed branch (171 of 171). Kernel limits and the GPU contract are below.Receipt
docs/receipts/glm-kv-fp8-load-5c82ef28/has every table, the raw results, both ranks' logs and memory receipts, and the tools.tools/kvload_compare.pyprints the table from the committed results).--kv-cache fp8(whole windows, the only place FP8 runs; explicit pages refuse it).5c82ef28a6, head that plus62ccb16cca's change (rebased since onc8c848d001, whose changes touch no GLM, CUDA or contract file); Zig 0.17.0, nvcc 13.5 for sm_121, NCCL 2.30.7, driver 580.178.04; two GB10 (128 GB) at TP=2 over a direct RoCE link;nvidia/GLM-5.3-Flash-FP4-Localat76348ddb2be2e35e39ecfc00e75dc07703f4f3d5.5aaa4528,0d8280fe,eba1e4d8);bench_concurrent.py --levels 1,2,4 --temperatures 0,1 --reps 3 --alone --serial: 84 and 30 equal, 0 not; resume four ways equal to cold; one reply sha256 a prompt size across all four speed launches.openai_aligned.py nodraft(the 1.1.5-era receipt's),"draft": false, 256 tokens, 5 reps: +0.9 and +1.1%; drafted decode after each cold prompt +0.3 to +1.3%. At 4 streams, the widest admitted (bench_concurrent.py --levels 4 --tokens 256 --reps 3 --temperatures 0,1, drafted, alternated base, head, head, base): aggregate +2.0 to +4.5%, steady +1.6 to +4.7% across code and chat, greedy and sampled; the greedy replies have one sha256 across all four launches.bench_cache.py --require-cold --tokens 256, the median of the three cold requests of each launch: −1.4% at 2k, −4.4 to −4.6% at 8k to 64k. The teacher-forced runs agree: 302 s against 306 s.Kernel contract, only when a GPU kernel is new or changed
glm_glue tf_glm_chunks_16_fp8andtf_glm_chunks_32_fp8change, and their records inglm_kv_pending.zig(nvcc 13.0) andmeasurements/pending_133.zig(nvcc 13.3) take the new counts.tf-cuda-test kernel-contract-limitsover fatbins of every image for sm_80, 86, 89, 120 and 121: with nvcc 13.0, both kernels' records current on all five SMs (the run's 18 stale records are all other images':flashnext_mtp,exl3_experts,qwen35); with nvcc 13.3, current on all five (its 834 stale records are all other kernels'). The receipt'slimits/has the lines, andcuobjdump -res-usageof base against head for everyglm_gluekernel.SUMMARYline and exit status: CUDA on GB10, head build:SUMMARY 652 kernels: 652 pass gates 1-4, 0 fail, 8 known findings; 419 controls: 419 red as planted, 0 missed; 918 limit problems, exit 1. The limit problems all come from the build's nvcc 13.5, which has no records: their live lines read(recorded 0, 0)or another compiler's counts, unchanged kernels such astf_glm_lat_write_fp8andtf_glm_router_tileamong them (limits/contract-nvcc-13.5.txt). The records this PR edits are checked with nvcc 13.0 and 13.3 above.Checklist
The title and description match the head commit, including the receipt and the stack.
New tests fail before the change, pass after it, and skip cleanly without their dependency. (n/a: no tests change; the byte-identical rows and the exactness suites are the check)
Comments and docstrings are one line. No measurements or history in the source.
No personal data, machine names, internal hosts or local paths in the diff or its commits. No AI attribution lines.
Every token still goes through the lane rounds. No serial path, and nothing that needs drafts off.
Drafted output equals
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo.No precision traded for speed. If the bits change, the description says which sums change and why. (The bits do not change.)
Decode and prompt processing are no slower than main at one stream and the widest admitted; with
--drafter, no slower than without it, greedy and sampled