Repository navigation
Pinned staging pool: 4 GiB cache, classes up to 1 GiB, LRU eviction - #47
Open
AdvaitTahilyani wants to merge 7 commits into
Open
AdvaitTahilyani wants to merge 7 commits into
AdvaitTahilyani wants to merge 7 commits into
Conversation
CNUM_GPU_STAGE_MB capped the pinned host blocks kept for reuse at 512 MB. An operation whose staged messages in flight exceed the cap pays a cudaMallocHost and a cudaFreeHost for every block past it (~35 ms per 64 MB block). einsum -n 800 on 4 GPUs with CUDA IPC off stages 4.7 GiB per iteration: 140 s of a 300 s run per process went to cudaMallocHost, and the run took over 1.6 s per iteration against 0.63 s with a large cap. On 16 GPUs (4 nodes) the same program took 84.5 s with the new default and 110.5 s with the old cap, one run each. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The pool's largest class was 256 MB, so a staged message of 256 MB to 1 GiB (ct_msg_max_bytes) got no pinned block and went through CkDeviceBuffer, which blocks the PE for about a second per GiB. Across two nodes a single 512 MB or 1 GiB message ran at 0.27 GiB/s; with classes up to 1 GiB and the marshalled staged path it runs at 2.2 GiB/s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A block freed into a full cache was unpinned itself, while the cache kept blocks of sizes nothing used any more. A program that moved on to another message size after filling the cache (an einsum phase leaves 4 GiB of 64 MB blocks) then paid a cudaMallocHost and a cudaFreeHost per message. A freed block now evicts cached blocks of the size classes allocated the longest ago. Measured with the zero-copy staged path (where both sides hold pinned blocks): an n=12000 transpose after an einsum phase took 842-900 ms without the eviction and 40-68 ms with it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three small changes to the pinned host pool used for staged GPU messages (cross-host, or same-host without CUDA IPC). Split out of the zero-copy work in #48 because they help the existing marshalled path on their own.
1. Cache up to 4 GiB of blocks by default (was 512 MB,
CNUM_GPU_STAGE_MB). An operation whose staged messages in flight exceed the cap pays acudaMallocHostand acudaFreeHostfor every block past it (~35 ms per 64 MB block). einsum-n 800on 4 GPUs withCNUM_GPU_IPC=0stages 4.7 GiB per iteration: 140 s of a 300 s run per process went tocudaMallocHost, and it took over 1.6 s per iteration against 0.63 s with a large cap. On 4 nodes × 4 GPUs the same program took 110.5 s with the old cap and 84.5 s with the new default (one run each).2. Size classes up to 1 GiB (was 256 MB). A staged message of 256 MB to 1 GiB (
ct_msg_max_bytes) got no pinned block and fell toCkDeviceBuffer, which blocks the PE for about a second per GiB. One message at a time between 2 processes on 2 nodes, ofi (GiB/s):3. Evict the least recently used size classes when the cache is full. A block freed into a full cache used to be unpinned itself while the cache kept blocks of sizes nothing used any more, so a program that moved to another message size after filling the cache (an einsum phase leaves 4 GiB of 64 MB blocks) pinned and unpinned a block per message. Measured with #48's zero-copy path (both sides hold pinned blocks): an n=12000 transpose after an einsum phase took 842–900 ms without the eviction, 40–68 ms with it.
The "after" numbers come from the zero-copy build run with
CNUM_GPU_ZC=0, which is this pool with the old marshalled path; all on the older integration treescale-int, not on this stack head.Validated. nc and GPU (netlrts-cuda) builds; GPU runs: covered by the validation of the top of this stack (#48), whose
CNUM_GPU_IPC=0run goes through this pool for every cross-process message.Known limits.
🤖 Generated with Claude Code