Repository navigation
[unified-memory] Name the fused KV translate for what it computes (7/7) - #40331
Conversation
5151029 to
47b9fad
Compare
47b9fad to
4218b64
Compare
4218b64 to
f326ac4
Compare
bee7c91 to
d509377
Compare
2a6115c to
d794024
Compare
|
/rerun-group unified memory |
|
/rerun-group unified-memory |
|
⛔ Known groups: ⛔ Known groups: |
|
Results for 🚀 🚀 🚀 🚀 🚀 🚀 |
…putes `write_loc_to_kernel_ids` now serves every KV translate, reads as well as writes, and returns physical ids. Rename it `translate_token_ids` (kernel `translate_token_ids_kernel`, block `TRANSLATE_TOKEN_IDS_BLOCK`), with its kernel-registry entry, callers, test classes and the strided GPU test file. Pure rename.
…as they are The kernel's argument comments still said `loc` is a 1-D int64 tensor of widened ids; it is 1-D or a strided `(rows, cols)` view, int32 or int64, and widened only under DCP. `_row_col_strides` handled a 0-d tensor that the strided path, where both tensors are at least 1-D, never sees. The allocator docstrings that called the translate's result "kernel-facing" or "dense" now call it what it is, the physical id.
…or physical ids `translate_write_loc_for_kernel` returns physical ids and `_assert_kernel_id_bound` bounds them; with the kernel-facing and physical id spaces now the same, call them `translate_write_loc` and `_assert_physical_id_bound`, and say "physical" in the bound's message.
- translate_token_ids_kernel: under out_width, `out` is a packed 1-D buffer of W lanes, not shaped like `loc`. - test_unified_mla_gpu_parity.py still gave the page-major formula kernel_id(t) = (t//ps)*(ps*L) + t%ps for what the unified pool receives; under the token-major views it receives the token's own id. - test_inkling_unified.py said re-running full->swa on the rebound out_cache_loc indexes past the swa v2p table and trips a device assert. A full physical page number is a valid swa virtual page, so the map silently resolves it to an unrelated token's swa slot.
Under the token-major views the id a kernel indexes the per-layer views with is the physical token id, and the identifiers now say so. The comments, docstrings and two unified-memory error messages still called it "kernel-facing"; they now say "physical". Sites that state the equivalence on purpose, that describe a historical bug, or where the word means something else (the Mamba checkpoint pool, the communicator) are left alone.
d794024 to
dfb0dac
Compare
7/7 — name the fused KV translate for what it computes
Base: #40330 (6/7). 5 commits, 28 files, +119/−121.
After 6/7 one kernel serves every KV translate, reads and writes alike, and the kernel-facing
and physical id spaces are the same. The names still said otherwise. This PR renames, with no
behaviour change:
write_loc_to_kernel_ids/write_loc_to_kernel_id_kernel/WRITE_LOC_BLOCKtranslate_token_ids/translate_token_ids_kernel/TRANSLATE_TOKEN_IDS_BLOCKtranslate_write_loc_for_kernel(sub-allocator and composites)translate_write_loc_assert_kernel_id_bound_assert_physical_id_boundtest_write_loc_to_kernel_ids_strided.pytest_translate_token_ids_strided.pyThe kernel registry entry, callers and tests follow. The kernel's argument comments now
describe its real inputs (1-D or strided
(rows, cols), int32 or int64, widened under DCP), anunreachable 0-d branch goes, and the allocator docstrings say "physical" where they said
"kernel-facing".
Comments follow the identifiers: every comment, docstring and unified-memory error message
that called these ids "kernel-facing" now says "physical". Left alone are the sites that
state the equivalence on purpose, one that describes a historical bug, and two where the
word means something else (the Mamba checkpoint pool, the communicator). Three
descriptions that were wrong are corrected: the kernel's
outunderout_width, theparity test's page-major formula, and the inkling test's account of a re-translated loc.
The first commit is a scripted mechanical rename; the next two are comments and the two
identifier renames; the last two are the corrections and the comment sweep, each
droppable on its own.
Validation
The stack is rebased onto main 047be72; every PR's own diff is unchanged file for file.
Unit and GPU tests on the H200, this head against that main, over every non-e2e test file the stack
touches plus
unit/mem_cache,cp,dcp,unit/layers/attention,kernels/ops/memoryandkernels/ops/kvcache: no failure at this head that main does not also have; the extra passes are thestack's own tests. The server-launching multi-GPU files under
cp/anddcp/error the same way onboth sides on a one-GPU run.
End to end at this head on the H200, unified memory against a baseline on the same model and flags
(GSM8K 5-shot, n=200):
Before the rebase, at d509377 — the whole stack — each admitted SM100 backend was run with
unified memory against a baseline on the same model, flags and box (B200, GSM8K 5-shot, n=100):
No write was refused by the physical write-loc check and no device-side assert fired. trtllm_mha
without cuda graphs decodes about 7% slower under unified memory, from the translate launches
an eager step adds.
The commits added since that head fix static-pool write doors, tests and comments; none changes a
unified-memory read or write path.
CI States
Latest PR Test (Base): ⏳ Run #36944919905
Latest PR Test (Extra): ⏳ Run #36944919686
Latest PR Test (AMD ROCm 10): ⏳ Run #36944919884