NVIDIA / cccl

CUDA Core Compute Libraries
Other
951 stars 119 forks source link

`volatile atomics` should include `.mmio` in their lowering to uphold what CUDA C++ promises about `volatile` #1613

Open jrhemstad opened 2 months ago

jrhemstad commented 2 months ago

volatile atomics should include .mmio in their lowering to uphold what CUDA C++ promises about volatile.

Originally posted by @gonzalobg in #1424

wmaxey commented 2 months ago

@gonzalobg @griwes

Here's a topic up for discussion: volatile atomic_ref<T> goes against the standard, however it appears that atomic_ref<volatile T> is allowable simply by omission. Would this be sufficient for exposing MMIO?

volatile atomic already serves its purpose for this as the volatile qualifier isn't shallow. I don't think we need to add any extra behavior there as it should end up on any volatile codepaths.

gonzalobg commented 2 months ago

atomic_ref is allowable simply by omission. Would this be sufficient for exposing MMIO?

Yes, but see both https://cplusplus.github.io/LWG/issue4069 and https://cplusplus.github.io/LWG/issue3508 .

wmaxey commented 1 month ago

atomic_ref is allowable simply by omission. Would this be sufficient for exposing MMIO?

Yes, but see both https://cplusplus.github.io/LWG/issue4069 and https://cplusplus.github.io/LWG/issue3508 .

Ah perfect. Thanks for the references. I would much rather implement according to 4069 as selectively stripping and adding CV qualifiers on the user API would be a nightmare.