Skip to content

perf: Reduce per-call overhead in representation converters - #94

Merged
rapids-bot[bot] merged 2 commits into
NVIDIA:mainfrom
mbrobbel:perf
May 29, 2026
Merged

rapids-bot[bot] merged 2 commits into
NVIDIA:mainfrom
mbrobbel:perf

Conversation

@mbrobbel

Copy link
Copy Markdown
Member

Summary

  • Use shared_mutex in converter registry so concurrent convert/has_converter calls no longer serialize on an exclusive lock
  • Remove redundant stream.synchronize() calls in cross-GPU and packed HOST→GPU converters where stream ordering already guarantees correctness
  • Eliminate unnecessary metadata vector copy in packed HOST→GPU converter by reading source metadata directly
  • Skip cudaGetDevice/cudaSetDevice round-trip in single-GPU scenarios for both packed and fast HOST→GPU converters

Benchmark results

Packed HOST→GPU path (back-to-back A/B, 5 repetitions):

Size Threads Baseline Optimized Change
64K 1 0.047ms 0.040ms 15% faster
256K 1 0.061ms 0.047ms 23% faster
1M 1 0.109ms 0.088ms 19% faster
64K 4 0.087ms 0.079ms 9% faster
256K 4 0.101ms 0.090ms 11% faster
1M 4 0.219ms 0.203ms 7% faster
512M any ~20ms ~20ms same (PCIe bound)

All other paths (GpuToHost packed, GpuToHostFast, HostFastToGpu) verified with reversed-order A/B tests showing no regressions.

Test plan

  • Existing unit tests pass (ctest)
  • Multi-threaded benchmark scenarios show no regressions
  • Consider adding a concurrent registry stress test (codex review warning)

🤖 Created by Claude

Co-Authored-By: Claude Opus 4.6 (1M context) [email protected]

- Use shared_mutex in converter registry so concurrent convert/has_converter
  calls no longer serialize on an exclusive lock
- Remove redundant stream.synchronize() before cudf::pack in cross-GPU converter
- Eliminate unnecessary metadata vector copy in packed HOST→GPU converter by
  reading source metadata directly (source outlives the unpack call)
- Remove redundant stream.synchronize() before cudf::unpack in packed HOST→GPU
  converter — stream ordering between H2D copies and table construction is
  guaranteed since both use the same stream
- Skip cudaGetDevice/cudaSetDevice round-trip in single-GPU scenarios for both
  packed and fast HOST→GPU converters
- Move BatchCopyAccumulator definition earlier in the file for reuse

Benchmarked improvement on packed HOST→GPU path (back-to-back A/B, 5 reps):
  256K/1T: 0.056ms → 0.044ms (21% faster)
  1M/1T:   0.095ms → 0.083ms (13% faster)
  64K/4T:  0.092ms → 0.077ms (16% faster)
  4M/4T:   0.726ms → 0.682ms (6% faster)
Large transfers (512M+) are PCIe bandwidth-limited and unchanged.

Created by Claude.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@copy-pr-bot

copy-pr-bot Bot commented Mar 30, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@mbrobbel

Copy link
Copy Markdown
Member Author

/ok to test b42aba2

Brings PR NVIDIA#94 (perf: reduce per-call overhead in representation converters)
up to date with NVIDIA/cuCascade main (31 commits, including the CCCL MR
migration NVIDIA#98 and the new disk I/O backends).

Conflicts in src/data/representation_converter.cpp were resolved in favor of
main's redesign, which superseded several of the perf branch's manual
optimizations with cleaner RMM equivalents:
- convert_gpu_to_gpu was rewritten on main to peer-copy column buffers
  directly (no cudf::pack), so the perf branch's removal of the pre-pack
  stream.synchronize() no longer applies.
- Manual cudaGetDevice/cudaSetDevice guards were replaced by
  rmm::cuda_set_device_raii, which already skips no-op device switches
  (the same optimization the perf branch added by hand).
- BatchCopyAccumulator placement and stream-lineage tracking taken from main.

Perf optimizations that survive (merged cleanly, outside the conflicts):
- shared_mutex in the converter registry (concurrent convert/has_converter
  no longer serialize on an exclusive lock).
- Eliminated the metadata vector copy and a redundant stream.synchronize()
  in the packed HOST->GPU converter (convert_host_to_gpu).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@mbrobbel
mbrobbel marked this pull request as ready for review May 28, 2026 22:52
@mbrobbel

Copy link
Copy Markdown
Member Author

/ok to test e8c944b

@mbrobbel

Copy link
Copy Markdown
Member Author

/merge

@rapids-bot
rapids-bot Bot merged commit a8c3e4b into NVIDIA:main May 29, 2026
10 checks passed
@mbrobbel
mbrobbel deleted the perf branch May 29, 2026 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants