Skip to content

Add CPU-cached download memory - #360

Merged
kvark merged 2 commits into
mainfrom
perf/download-memory-rebased
Jul 26, 2026
Merged

Add CPU-cached download memory#360
kvark merged 2 commits into
mainfrom
perf/download-memory-rebased

Conversation

@kvark

@kvark kvark commented Jul 26, 2026

Copy link
Copy Markdown
Owner

No description provided.

kvark and others added 2 commits July 26, 2026 07:30
`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
kvark force-pushed the perf/download-memory-rebased branch from ac2a253 to 7d450ae Compare July 26, 2026 17:41
@kvark
kvark marked this pull request as ready for review July 26, 2026 17:53
@kvark
kvark merged commit 714a497 into main Jul 26, 2026
12 checks passed
@kvark
kvark deleted the perf/download-memory-rebased branch July 26, 2026 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant