Skip to content

cuda: opt-in pinned staging for DeviceBuffer.download - #2200

Closed
ashhart wants to merge 4 commits into
mainfrom
lead/pinned-download
Closed

ashhart wants to merge 4 commits into
mainfrom
lead/pinned-download

Conversation

@ashhart

@ashhart ashhart commented Nov 5, 2026

Copy link
Copy Markdown
Owner

Opt-in pinned staging for DeviceBuffer.download (#2102). With TF_CUDA_PINNED_DOWNLOAD=1, a download copies into one reused pinned buffer per driver and context, then into the caller's slice. Copies over 64 MiB go in 64 MiB pieces. A failed copy hands its buffer to the existing copy_source quarantine. With the switch unset, or any value but exactly 1, the call is main's unchanged line.

This doesn't claim to fix the fault. The issue has no deterministic reproducer, so the host tests prove the path, not the cure. The fake-driver tests cover the destination pointer, reuse, growth, the pieces, one buffer per context and quarantine after a failed copy.

Limits

The reporter's fork saw 10 misses in 60 runs with pageable memory and 0 in 100 with a pinned bounce; a run on a GB10 with this switch would be the real check.

@ashhart
ashhart force-pushed the lead/pinned-download branch from 96aafce to 6f1404c Compare November 5, 2026 03:55
@ashhart

ashhart commented Nov 5, 2026

Copy link
Copy Markdown
Owner Author

Closing this: it duplicates @shuuul's #2103, which was open first and is the better fix. It stages only on integrated devices, so discrete cards keep their direct copies, and it counts the bounce in memory.usage. I should have checked for an open PR before starting this one. #2102 goes forward through #2103.

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