NVIDIA / NVIDIA/cuBQL

memcpy DtoH in hot loop

Open
#41 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
89
Forks
24
PR merge metrics
No merged PRs in 30d

Description

Hello. Here is a flamegraph for the SM GpuBuilder

Image

As you can see, most of the time is spent doing cuMemcpyDtoHAsync_v2, and there is only one place where it does it: https://github.com/NVIDIA/cuBQL/blob/812464c6510cbfc42f455f0008d3ccff78662993/cuBQL/builder/cuda/sm_builder.h#L456 which is copying numNodes to the CPU memory, which happens in the main while loop. Is this necessary? can it be optimized?

Disclaimer: I am no expert at cuda profiling and this was obtained during a system integration test, so it's possible that it's a red herring, but if not that seems to be using a lot of our GPU time...

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in cuBQL/builder/cuda/sm_builder.h around line 456 and inspect the main while loop where numNodes is copied to CPU memory with cuMemcpyDtoHAsync_v2. Reproduce or profile the system integration test to confirm the transfer is the hot path; done means determining whether it is necessary and documenting or implementing a measured reduction in its cost.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
performance
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.