Repository navigation
Add address_space and is_address_from to cuda::device:: - #4797
Conversation
|
that's a nice idea. Please also check https://github.com/NVIDIA/cccl/blob/main/libcudacxx/include/cuda/__mdspan/host_device_accessor.h. The code is related to the functionality |
I am not sure if this design is good enough, I would like to get some feedback from others, too, once we agree on the design I would make a separate PR using this function instead of the intrinsics in cccl :) |
|
what about adding this functionality in |
These address spaces are PTX specific, so I would keep them device only. |
|
/ok to test 3a9036c |
π¨ CI finished in 2h 55m: Pass: 99%/183 | Total: 1d 23h | Avg: 15m 32s | Max: 1h 48m | Hits: 88%/290898
|
| Project | |
|---|---|
| CCCL Infrastructure | |
| +/- | libcu++ |
| CUB | |
| Thrust | |
| CUDA Experimental | |
| stdpar | |
| python | |
| CCCL C Parallel Library | |
| Catch2Helper |
Modifications in project or dependencies?
| Project | |
|---|---|
| CCCL Infrastructure | |
| +/- | libcu++ |
| +/- | CUB |
| +/- | Thrust |
| +/- | CUDA Experimental |
| +/- | stdpar |
| +/- | python |
| +/- | CCCL C Parallel Library |
| +/- | Catch2Helper |
πβ Runner counts (total jobs: 183)
| # | Runner |
|---|---|
| 129 | linux-amd64-cpu16 |
| 15 | windows-amd64-cpu16 |
| 12 | linux-arm64-cpu16 |
| 12 | linux-amd64-gpu-rtxa6000-latest-1 |
| 7 | linux-amd64-gpu-rtx2080-latest-1 |
| 5 | linux-amd64-gpu-h100-latest-1 |
| 3 | linux-amd64-gpu-rtx4090-latest-1 |
|
/ok to test 5754d7e |
|
/ok to test df87f75 |
|
/ok to test df87f75 |
fbusato
left a comment
There was a problem hiding this comment.
I found a good use case for this function. The only thing missing is the documentation
fbusato
left a comment
There was a problem hiding this comment.
sorry again, I have a strong feeling that the PR should be moved to cuda:: and include the following points:
- Two new enums:
device,host.devicemeans any device memory space - check host and device pointers from host.
This is aligned with host_device_accessor. Makes little sense to keep these two functionalities separated. @miscco what do you think?
I would like to once again repeat that I am against this, these memory spaces are relevant only for device code. For example, what should the value of address_space::device be? Should it be the same as address_space::global or address_space::constant? I believe we should have a different API for this functionality in cuda:: namespace. I am also curious what's other's opinion :) |
@davebayer this is also perfectly fine. I'm entirely supporting the idea of having |
|
/ok to test 018fb94 |
|
/ok to test 5572154 |
|
/ok to test 02a0dd8 |
|
/ok to test c1dba92 |
|
I am just farming those π |
|
/ok to test 4c7ebca |
π¨ CI finished in 6h 01m: Pass: 97%/187 | Total: 2d 16h | Avg: 20m 40s | Max: 6h 00m | Hits: 92%/278956
|
| Project | |
|---|---|
| CCCL Infrastructure | |
| +/- | libcu++ |
| CUB | |
| Thrust | |
| CUDA Experimental | |
| stdpar | |
| python | |
| CCCL C Parallel Library | |
| Catch2Helper |
Modifications in project or dependencies?
| Project | |
|---|---|
| +/- | CCCL Infrastructure |
| +/- | libcu++ |
| +/- | CUB |
| +/- | Thrust |
| +/- | CUDA Experimental |
| +/- | stdpar |
| +/- | python |
| +/- | CCCL C Parallel Library |
| +/- | Catch2Helper |
πβ Runner counts (total jobs: 187)
| # | Runner |
|---|---|
| 129 | linux-amd64-cpu16 |
| 15 | windows-amd64-cpu16 |
| 12 | linux-arm64-cpu16 |
| 12 | linux-amd64-gpu-rtxa6000-latest-1 |
| 11 | linux-amd64-gpu-rtx2080-latest-1 |
| 5 | linux-amd64-gpu-h100-latest-1 |
| 3 | linux-amd64-gpu-rtx4090-latest-1 |
|
Ci was stuck on the last runs with old 12.0 CTK, lets see what another merge of main brings ... |
|
/ok to test 98482d7 |
|
I tested this locally can repro the compiler hang in 12.0: Running So something in |
|
Backing out the changes to |
| # if TEST_HAS_CUDA_COMPILER() | ||
| struct MutableStruct | ||
| { | ||
| mutable int v; |
There was a problem hiding this comment.
the problem is here. It seems not correct using a mutable data member in a __grid_constant__ parameter. If we remove mutable everything works fine
There was a problem hiding this comment.
also, TEST_CUDA_COMPILER(NVCC, ==, 12, 0) seems too specific. I guess this should be generalized.
Can we merge the macro condition in a single line?
There was a problem hiding this comment.
the problem is here. It seems not correct using a
mutabledata member in a__grid_constant__parameter.
This is actually one of the points of using grid_constant. See https://docs.nvidia.com/cuda/cuda-c-programming-guide/#grid-constant
But we needn't to test the mutable data member if the compiler doesn't support grid_constant
There was a problem hiding this comment.
let me rephrase. mutable data members are allowed in __grid_constant__ parameter, but since the parameter is read-only, it has little sense to add mutable.
I would remove it entirely, without dispatching depending on the compiler
|
/ok to test c27cb82 |
π© CI finished in 1h 19m: Pass: 100%/187 | Total: 1d 08h | Avg: 10m 27s | Max: 45m 22s | Hits: 95%/292248
|
| 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: 187)
| # | Runner |
|---|---|
| 129 | linux-amd64-cpu16 |
| 15 | windows-amd64-cpu16 |
| 12 | linux-arm64-cpu16 |
| 12 | linux-amd64-gpu-rtxa6000-latest-1 |
| 11 | linux-amd64-gpu-rtx2080-latest-1 |
| 5 | linux-amd64-gpu-h100-latest-1 |
| 3 | linux-amd64-gpu-rtx4090-latest-1 |
|
@davebayer I just realized that the documentation is missing. Otherwise, no one will know about this functionality. |
This PR adds initial support for device address memory spaces and implements
cuda::device::is_address_from(mem_space, ptr)function that should replace intrinsics like__isGlobalor__isShared.