Repository navigation
Replace cg::memcpy_async in memcpy_async transform kernel by custom implementation - #4976
Conversation
|
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. |
1198e4d to
9cb3f41
Compare
9cb3f41 to
2f0a518
Compare
| // ensures the loop below runs at least once | ||
| static_assert(policy_t::min_items_per_thread <= policy_t::max_items_per_thread); |
There was a problem hiding this comment.
Is that really at the right place?
There was a problem hiding this comment.
@gevtushenko wanted it here on a different PR.
|
@miscco I am probably going to replace this PR by a custom |
cg::memcpy_async in memcpy_async transform kernel by custom implementation
🟨 CI finished in 1h 55m: Pass: 86%/153 | Total: 3d 04h | Avg: 29m 50s | Max: 1h 20m | Hits: 79%/149644
|
| Project | |
|---|---|
| CCCL Infrastructure | |
| CCCL Packaging | |
| libcu++ | |
| +/- | CUB |
| Thrust | |
| CUDA Experimental | |
| stdpar | |
| python | |
| +/- | CCCL C Parallel Library |
| Catch2Helper |
Modifications in project or dependencies?
| Project | |
|---|---|
| CCCL Infrastructure | |
| +/- | CCCL Packaging |
| libcu++ | |
| +/- | CUB |
| +/- | Thrust |
| +/- | CUDA Experimental |
| +/- | stdpar |
| +/- | python |
| +/- | CCCL C Parallel Library |
| +/- | Catch2Helper |
🏃 Runner counts (total jobs: 153)
| # | Runner |
|---|---|
| 93 | linux-amd64-cpu16 |
| 17 | windows-amd64-cpu16 |
| 12 | linux-amd64-gpu-rtxa6000-latest-1 |
| 11 | linux-amd64-gpu-h100-latest-1 |
| 10 | linux-arm64-cpu16 |
| 7 | linux-amd64-gpu-rtx2080-latest-1 |
| 3 | linux-amd64-gpu-rtx4090-latest-1 |
886082c to
a3ef94b
Compare
miscco
left a comment
There was a problem hiding this comment.
This has become much cleaner now
|
|
||
| // pipeline the async copies before loading the head and tail elements | ||
| const unsigned int aligned_bytes_to_copy = bytes_to_copy - head_bytes - tail_bytes; | ||
| if (aligned_bytes_to_copy) |
There was a problem hiding this comment.
Could there be a contrived example where this actually becomes negative?
There was a problem hiding this comment.
It shouldn't, since bytes_to_copy is always a multiple of the block size (256) and we try to reach a value that creates 16KiB of bytes in flight. With a max occupancy of 16, that's at least 1KiB per block. I added an assertion regardless.
There was a problem hiding this comment.
Couldnt we just do
| if (aligned_bytes_to_copy) | |
| if (aligned_bytes_to_copy > 0) |
There was a problem hiding this comment.
So, this actually revealed a bug. If we have an unaligned buffer smaller than 16 bytes, head and tail byte calculations produce garbage :)
a3ef94b to
7752434
Compare
🟨 CI finished in 2h 08m: Pass: 89%/153 | Total: 3d 06h | Avg: 30m 56s | Max: 1h 50m | Hits: 69%/149800
|
| Project | |
|---|---|
| CCCL Infrastructure | |
| CCCL Packaging | |
| libcu++ | |
| +/- | CUB |
| Thrust | |
| CUDA Experimental | |
| stdpar | |
| python | |
| CCCL C Parallel Library | |
| Catch2Helper |
Modifications in project or dependencies?
| Project | |
|---|---|
| CCCL Infrastructure | |
| +/- | CCCL Packaging |
| libcu++ | |
| +/- | CUB |
| +/- | Thrust |
| +/- | CUDA Experimental |
| +/- | stdpar |
| +/- | python |
| +/- | CCCL C Parallel Library |
| +/- | Catch2Helper |
🏃 Runner counts (total jobs: 153)
| # | Runner |
|---|---|
| 93 | linux-amd64-cpu16 |
| 17 | windows-amd64-cpu16 |
| 12 | linux-amd64-gpu-rtxa6000-latest-1 |
| 11 | linux-amd64-gpu-h100-latest-1 |
| 10 | linux-arm64-cpu16 |
| 7 | linux-amd64-gpu-rtx2080-latest-1 |
| 3 | linux-amd64-gpu-rtx4090-latest-1 |
🟩 CI finished in 1h 59m: Pass: 100%/153 | Total: 3d 18h | Avg: 35m 33s | Max: 1h 23m | Hits: 77%/173216
|
| Project | |
|---|---|
| CCCL Infrastructure | |
| CCCL Packaging | |
| libcu++ | |
| +/- | CUB |
| Thrust | |
| CUDA Experimental | |
| stdpar | |
| python | |
| CCCL C Parallel Library | |
| Catch2Helper |
Modifications in project or dependencies?
| Project | |
|---|---|
| CCCL Infrastructure | |
| +/- | CCCL Packaging |
| libcu++ | |
| +/- | CUB |
| +/- | Thrust |
| +/- | CUDA Experimental |
| +/- | stdpar |
| +/- | python |
| +/- | CCCL C Parallel Library |
| +/- | Catch2Helper |
🏃 Runner counts (total jobs: 153)
| # | Runner |
|---|---|
| 93 | linux-amd64-cpu16 |
| 17 | windows-amd64-cpu16 |
| 12 | linux-amd64-gpu-rtxa6000-latest-1 |
| 11 | linux-amd64-gpu-h100-latest-1 |
| 10 | linux-arm64-cpu16 |
| 7 | linux-amd64-gpu-rtx2080-latest-1 |
| 3 | linux-amd64-gpu-rtx4090-latest-1 |

The main goal of this PR is to become independent of cooperative groups, since they don't work on nvc++ and seem to also have issues for the python wrappers. Also, since we have more information, we may discover a few fast paths.
Next step is to replace the fallback in the UBLKCP kernel by the new memcpy_async as well, but not in this PR.
Merge first:
Benchmark on A100 shows benefits except one hickup in triad. I blame it on the GPU (I get hickups in different places on different machines).