Repository navigation
hip flashnext: parallel n-gram gather, release weight pages after upload - #1611
Conversation
|
Thanks — the gather rewrite reads well, and the byte-for-byte tests against the old search are exactly what we want. Two things before this can leave draft: could you add a short description with before/after resident memory and gather (or prefill) time on a real checkpoint? And #1615 contains this whole diff plus the MADV_RANDOM advice — is 1615 meant to replace this one, or to stack on it? Either is fine, we just want to land one path. |
|
Thanks. #1615 is meant to stack on this one, not replace it: it contains this commit plus one more (the The receipt in the description has the real-checkpoint numbers (
I also pushed a |
|
Thanks @gilby. We reviewed this independently: every ask from our last review is answered, by commit and receipt, and other GPUs and families are unchanged. We have no AMD GPU, so your gfx1151 receipts carry the device side. It lands now. We marked it ready, since GitHub won't merge a draft. It's gated and queued, and we've written the changelog line. |
|
Yeah, I shouldn't have the strix halo either and should have bought another dgx spark instead. Hopefully we can help catch it up to what its real potential should be. It's where my models go to die or as a back up node while testing on the rest of my fleet. My agent is finishing up this and collecting all the receipts. This post by a real human. |
022017d to
3df3107
Compare
|
Thanks @ashhart. #1611 conflicted with main in It also needed a fix that main's newer CUDA code forced: On the rebased head, gfx1151: |
|
A correction to my last comment: I wrote that I have no CUDA GPU, which is wrong for this project, and the CUDA commit (
That covers the two CUDA callers of |
|
Thanks @gilby. Rebasing this on current main hit a semantic conflict: this PR gives |
3df3107 to
05d69ab
Compare
05d69ab to
ba178cf
Compare
The prompt's n-gram gather copied each id's rows one at a time on the host. Rows now locate the shard by division when the shard sizes allow it and split the ids across up to eight threads into disjoint staging rows, same bytes. After every weight is on the device the checkpoint's pages are dropped from the mapping and the page cache, except the n-gram table spans a gather still reads. Fixes ashhart#1606
77611e3 to
f28fb5c
Compare
|
Thank you @gilby. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes. |
|
Thanks @gilby! This is in TensorFold 1.2.2, out now: https://github.com/ashhart/TensorFold/releases/tag/v1.2.2 |
What this changes
Two parts of the HIP Flash Next host path for the n-gram tables: the gather splits a chunk's ids across up to eight threads (shard located by division when the shard sizes are a remainder run, search otherwise), and after upload the checkpoint's weight pages are dropped from the mapping and page cache except the n-gram spans a gather still reads (
Checkpoint.releaseExcept). Same bytes. Fixes #1606. Happy to split the two parts into separate pull requests if preferred.Receipt
7c068895plus this change,tensorfold-native 1.1.8built withzig build native-hip -Dhip-arch=gfx1151, Ubuntu archive HIP 7.1 (clang 21), AMD Ryzen AI MAX+ 395 with Radeon 8060Sgfx1151(128 GB unified memory). CheckpointTensorFold/Qwen3.8-Flash-Next-MLX-4bit-MTPrevision2b170fa6.--parallel 1 --context 131072 --prompt-cache-gib 0, base and candidate on the same machine.tools/bench_concurrent.py --tokens 256 --reps 3 --temperatures 0 --levels 1,4 --alone --serialevery cellalone3/3 and 12/12 equal,serialequal, 0 failed;token_sha256ofbench_openai,bench_concurrentand bothbench_cacheprompts identical to the base build.tools/bench_openai.py --tokens 256 --reps 3 --temperatures 0, median tok/s code / chat: base 50.03 / 43.93, this change 49.90 / 43.86.tools/bench_cache.py --require-cold --tokens 16on public 7,377- and 29,364-token arrays, first cold requestttft_s: 7,377 tokens 48.44 -> 28.55 s, 29,364 tokens 108.97 -> 105.80 s. Later cold requests in the same process are unchanged (22.45 / 22.33 -> 22.52 / 22.34 s at 7,377): the first-request gain is the load no longer leaving about 29 GiB of weight pages in the page cache for the first prompt to reclaim (page cache after load 31.5 GiB -> 2.8 GiB, device usage unchanged). Host gather alone on synthetic 29.8 GiB shards: 4,096 ids 1.75x, 16,384 ids 2.2-2.5x, 65,536 ids 2.27x faster.zig build test -Dhip=true --summary all165/167 passed, 2 skipped, 0 failed (identical on the base);zig build hip-kernel-test15/15 steps; new tests: shard location over every id of uneven shards, gather equality against the previous row-at-a-time gather (single and multi-threaded, repeated and boundary ids, refusals), span coverage, andreleaseExceptkeeping its spans readable; mutating the shard location makes them fail.python3 tools/zig/lean_check.py425 problems on base and change (inherited);git diff --checkclean.releasegains a scratch allocator argument, updated at its one other caller in radio); other AMD chips; overlapping the next chunk's gather with the current chunk (needs a second staging region and graph/arena ordering changes; left out).Checklist
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo.SUMMARYline is in the receipt. (No kernel change.)