Skip to content

perf: prefer copy bandwidth over compute overlap for large batch memcpys - #4

Open
felipeblazing wants to merge 3 commits into
base/v26.06.01from
perf/memcpy-prefer-bandwidth
Open

perf: prefer copy bandwidth over compute overlap for large batch memcpys#4
felipeblazing wants to merge 3 commits into
base/v26.06.01from
perf/memcpy-prefer-bandwidth

Conversation

@felipeblazing

Copy link
Copy Markdown
Owner

cudf::detail::memcpy_batch_async unconditionally passed
cudaMemcpyFlagPreferOverlapWithCompute. That flag caps device-to-device
throughput at ~470 GB/s on GB300 regardless of copy size, while the default
flag reaches ~3.2 TB/s -- a 6.8x gap on the multi-GB buffer copies behind
cudf::concatenate's for_each_concatenate path.

The flag is not useless: for batches of small buffers the driver fuses the
copies far more effectively with it (213 GB/s vs 40 GB/s for 256 x 64 KiB), so
dropping it outright regresses the small-copy IO paths by up to 5x. Measured
crossover is ~1 MiB per copy and is nearly independent of the batch count, so
select on the mean bytes per copy with a 2 MiB threshold.

Host-device copies measured insensitive to the flag (within 1% pinned and
pageable at every size), so this only changes device-to-device behavior.

Also returns early on an empty batch, which the mean computation requires.

Co-Authored-By: Claude Opus 5 noreply@anthropic.com

cudf::detail::memcpy_batch_async unconditionally passed
cudaMemcpyFlagPreferOverlapWithCompute. That flag caps device-to-device
throughput at ~470 GB/s on GB300 regardless of copy size, while the default
flag reaches ~3.2 TB/s -- a 6.8x gap on the multi-GB buffer copies behind
cudf::concatenate's for_each_concatenate path.

The flag is not useless: for batches of small buffers the driver fuses the
copies far more effectively with it (213 GB/s vs 40 GB/s for 256 x 64 KiB), so
dropping it outright regresses the small-copy IO paths by up to 5x. Measured
crossover is ~1 MiB per copy and is nearly independent of the batch count, so
select on the mean bytes per copy with a 2 MiB threshold.

Host-device copies measured insensitive to the flag (within 1% pinned and
pageable at every size), so this only changes device-to-device behavior.

Also returns early on an empty batch, which the mean computation requires.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@wence-

wence- commented Aug 14, 2026

Copy link
Copy Markdown

Have you benchmarked this crossover point on other hardware?

@bdice

bdice commented Aug 14, 2026

Copy link
Copy Markdown

@felipeblazing Let's sweep this on a few different types of hardware (suggesting L4, DGX Spark, H100, B200, RTX PRO 6000 Blackwell for decent coverage of various memory types) and file a PR upstream to cuDF.

edit: I am working on that.

@bdice

bdice commented Aug 16, 2026

Copy link
Copy Markdown

I filed an issue here and will fix this in cuDF, rapidsmpf, and RMM. NVIDIA#23674

@bdice

bdice commented Aug 21, 2026

Copy link
Copy Markdown

@felipeblazing @mike-wendt Since I see new commits here, I just wanted to let you know that I merged fixes for this in cudf, rapidsmpf, and RMM. It'll be in 26.10.

NVIDIA#23675
rapidsai/rapidsmpf#1152
rapidsai/rmm#2511

@mike-wendt

Copy link
Copy Markdown

Thanks @bdice for the heads up, I will defer to @felipeblazing for next steps. I was just getting our fork of cudf in a place where it can build and test to make patched versions of libcudf while we wait for these patches to reach upstream

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.

4 participants