perf(memory): cache large pinned allocations in small_pinned_host_memory_resource - #185
Open
kevkrist wants to merge 3 commits into
Open
perf(memory): cache large pinned allocations in small_pinned_host_memory_resource#185kevkrist wants to merge 3 commits into
kevkrist wants to merge 3 commits into
Conversation
…ory_resource Requests above the slab range previously paid a raw cudaHostAlloc / cudaFreeHost on every call; cuDF's parquet reader makes these constantly and the frees stall query execution. Serve them instead from per-bucket free lists with the same event-ordered reuse discipline as the slab path, capped at 256 MiB (constructor-tunable) with oldest-first eviction and purge-and-retry on allocation failure. Requests whose bucket exceeds the cap allocate at exact size and bypass the cache. Event pools are keyed per device so records always land on the owning context; when no event can be recorded, the large path frees instead of caching and the slab path synchronizes the freeing stream before recycling, closing a pre-existing unordered-reuse window.
Author
Sirius TPC-H SF1000 performance (GB300)
Against Sirius's current cuCascade pin ( |
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.
Summary
Requests above the 8 KB slab range currently pay a raw
cudaHostAlloc/cudaFreeHoston every call. cuDF's parquet reader makes these allocations constantly, and the frees stall query execution — on a GB10 running TPC-H through Sirius,cudaFreeHostalone accounted for 0.65 s inside a 1.9 s query window.This serves >8 KB requests from per-bucket (power-of-two) free lists with the same event-ordered reuse discipline the slab path already uses, capped at 256 MiB (constructor-tunable) with oldest-first eviction and purge-and-retry on allocation failure. Requests whose bucket exceeds the cap allocate at exact size and bypass the cache. Event pools are keyed per device so records always land on the owning context; when no event can be recorded, the large path frees instead of caching and the slab path synchronizes the freeing stream before recycling — the latter closes a pre-existing unordered-reuse window in the slab path.
Measured on TPC-H SF50 (Sirius, single GB10): pinned alloc/free pairs during query execution drop from 264 to 21 cold-start fills, and total hot runtime across the 22 queries improves by 13.9%.
Testing
cucascade_tests "[small_pinned]": 22 cases (10 new) covering bucket rounding, cache-hit reuse, cap accounting and eviction order, exact-size never-cacheable behavior, event ordering on a real stream, and destructor cleanup with a populated cache.