Repository navigation
Add cub::DeviceTransform - #2086
Merged
Merged
Conversation
bernhardmgruber
force-pushed
the
transform
branch
2 times, most recently
from
July 26, 2024 16:18
c48b0e8 to
02c1aff
Compare
bernhardmgruber
force-pushed
the
transform
branch
2 times, most recently
from
July 26, 2024 19:00
445a3aa to
84bb0ad
Compare
gevtushenko
reviewed
Jul 28, 2024
gevtushenko
left a comment
Collaborator
There was a problem hiding this comment.
Left a few comments. Regarding the address stability detection, I think it's a good idea to separate it into a different PR. There's no risk in merging only opt-in mechanism for Thrust.
bernhardmgruber
force-pushed
the
transform
branch
3 times, most recently
from
July 29, 2024 15:18
5ad3a62 to
6efb3d7
Compare
bernhardmgruber
force-pushed
the
transform
branch
2 times, most recently
from
July 30, 2024 09:39
c2ed3ce to
e76e241
Compare
bernhardmgruber
force-pushed
the
transform
branch
2 times, most recently
from
July 30, 2024 12:24
e39bae3 to
a414e36
Compare
bernhardmgruber
commented
Jul 30, 2024
Contributor
Author
|
I removed all the address stability detection from this PR. I will follow up on this separately. |
bernhardmgruber
force-pushed
the
transform
branch
3 times, most recently
from
August 2, 2024 22:01
5b99eb5 to
5a92ac0
Compare
bernhardmgruber
marked this pull request as ready for review
August 2, 2024 22:15
bernhardmgruber
force-pushed
the
transform
branch
from
September 6, 2024 14:51
d592a4c to
bff304d
Compare
Contributor
Author
|
Calling the < Function : _ZN3cub17CUB_200700_860_NS6detail8for_each13static_kernelINS2_12policy_hub_t12policy_350_tElNS1_9transform10dispatch_tILb0ElN4cuda3std3__45tupleIJN6thrust20THRUST_200700_860_NS6detail15normal_iteratorINSD_10device_ptrInEEEEEEESI_ZN53_INTERNAL_c645bd8d_15_babelstream1_cu_885ae364_1399973mulInlEEvRN7nvbench5stateENSM_9type_listIJT_T0_EEEEUlRKnE_12policy_hub_tIJSI_EEE28non_contiguous_fallback_op_tIJLm0EEEEEEvSR_T1_
---
> Function : _ZN3cub17CUB_200700_860_NS6detail9transform16transform_kernelIN12policy_hub_tIJN6thrust20THRUST_200700_860_NS6detail15normal_iteratorINS6_10device_ptrInEEEEEE10max_policyElZN53_INTERNAL_c645bd8d_15_babelstream1_cu_885ae364_1393953mulInlEEvRN7nvbench5stateENSG_9type_listIJT_T0_EEEEUlRKnE_SB_JPnEEEvSL_iT1_T2_DpNS2_10kernel_argIT3_EE
86c86
< /*00d0*/ IADD3 R4, P1, R2.reuse, c[0x0][0x170], RZ ; /* 0x00005c0002047a10 */
---
> /*00d0*/ IADD3 R4, P1, R2.reuse, c[0x0][0x188], RZ ; /* 0x0000620002047a10 */
88c88
< /*00e0*/ IADD3 R2, P2, R2, c[0x0][0x178], RZ ; /* 0x00005e0002027a10 */
---
> /*00e0*/ IADD3 R2, P2, R2, c[0x0][0x180], RZ ; /* 0x0000600002027a10 */
90c90
< /*00f0*/ IADD3.X R5, R0.reuse, c[0x0][0x174], RZ, P1, !PT ; /* 0x00005d0000057a10 */
---
> /*00f0*/ IADD3.X R5, R0.reuse, c[0x0][0x18c], RZ, P1, !PT ; /* 0x0000630000057a10 */
92c92
< /*0100*/ IADD3.X R3, R0, c[0x0][0x17c], RZ, P2, !PT ; /* 0x00005f0000037a10 */
---
> /*0100*/ IADD3.X R3, R0, c[0x0][0x184], RZ, P2, !PT ; /* 0x0000610000037a10 */
207c207 |
7 tasks done
gevtushenko
approved these changes
Sep 6, 2024
gevtushenko
left a comment
Collaborator
There was a problem hiding this comment.
Incredible speedups on H200. Great job!
Contributor
🟩 CI finished in 10h 16m: Pass: 100%/251 | Total: 1d 09h | Avg: 7m 57s | Max: 34m 05s | Hits: 99%/24441
|
| Project | |
|---|---|
| CCCL Infrastructure | |
| libcu++ | |
| +/- | CUB |
| Thrust | |
| CUDA Experimental | |
| pycuda | |
| CUDA C Core Library |
Modifications in project or dependencies?
| Project | |
|---|---|
| CCCL Infrastructure | |
| libcu++ | |
| +/- | CUB |
| +/- | Thrust |
| CUDA Experimental | |
| +/- | pycuda |
| +/- | CUDA C Core Library |
🏃 Runner counts (total jobs: 251)
| # | Runner |
|---|---|
| 178 | linux-amd64-cpu16 |
| 42 | linux-amd64-gpu-v100-latest-1 |
| 16 | linux-arm64-cpu16 |
| 15 | windows-amd64-cpu16 |
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR creates
cub::DeviceTransformand makes the Thrust CUDA backend use it for.thrust::transformThe new
cub::DeviceTransformalgorithm comes with a set of kernels and corresponding algorithms:fallback_for: reproduces the old behavior ofthrust::transformand just forwards to the agent ofcub::DeviceFor. This is needed for tuning and to compare against a baseline. We may want to remove thisbefore merging orin a separate PR, once we can cover all cases with better variants.prefetch: does not bitwise-copy any data, but rather prefetches the addresses before starting to pull in data for transformation. this kernel also guarantees stable parameter address to function objects. this forms the new baseline for all GPUs if we cannot copy the parameters before passing them to the function objects (thus, the ultimate baseline kernel).unrolled_staged(bikeshed name?): has two unrolled stages, once for loadingITEMS_PER_THREADelements from each input stream into registers, followed by a compute stage, that invokes the function object. Ensures the initial data fetch is large and is separate from writing, so the compiler does not detect any aliasing problems. this forms the new baseline for all GPUs if we can copy the parameters before passing them to the function objects.memcpy_async: usesmemcpy_async(requires Ampere) to start a bunch for memory loading transactions to shared memory for before crunching multiple iterations on shared memory. Register friendly algorithm and elements per threads are determined at runtime.ublkcp: same as previous but usesublkcp(requires Hopper). The setup is a bit more complex due to alignment.All kernelsThe ublkcp kernel derives their elements per thread from the target minimum number of bytes-in-flight (BIF).Onlyunrolled_stageddoes this at compile-time though. However, the unrolling seems to be beneficial over prefetching, especially on the non-data center grade GPUs. From my current understanding, we need the 4 code paths/kernels.GH200 tuning top 10
CUB babelstream fallbackfor vs. ublkcp on H200
Fixes: #2091