Add CPU-cached download memory - #360
Merged
Merged
Conversation
`Shared` and `Download` are both host visible, so either can back a readback and the difference only shows up when the CPU reads what it pulled back. On this RTX 5070 it shows up rather starkly: scanning 64 MiB lands at 0.01 GB/s through a `Shared` mapping and 21 GB/s through a `Download` one, which is three orders of magnitude and about 576 ns per eight byte load - the latency of going out to the device over PCIe for each one. Copying the range into ordinary memory first does not rescue it. That is the usual way around write-combined memory, since a bulk copy uses wide loads where a scan uses one word at a time, but here it makes things worse rather than better. So there is no arrangement of the CPU side that avoids wanting a cached mapping, which is what this type asks the allocator for. The test asserts only that `Download` does not read slower than `Shared`, since on unified memory the two are the same heap and the ratio is one. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MaDekFuFvymYai37WQ7SDr
kvark
force-pushed
the
perf/download-memory-rebased
branch
from
July 26, 2026 17:41
ac2a253 to
7d450ae
Compare
kvark
marked this pull request as ready for review
July 26, 2026 17:53
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.
No description provided.