Replies: 0 comments 7 replies
-
I don't think it's well defined to use
|
Beta Was this translation helpful? Give feedback.
-
Hmm. That may be correct. Foiled by nvcc again, it seems... |
Beta Was this translation helpful? Give feedback.
-
UB aside, it looks like the example doesn't work anyways: https://godbolt.org/z/GEns8K Even if it did, you wouldn't be able to use the value as a constant expression in device code. |
Beta Was this translation helpful? Give feedback.
-
I agree with the above, but this is just for satisfying an overload for now. We should figure out what the correct thing to do would be for this. I think, until there is support, that we should look at removing these constructs and associated features. |
Beta Was this translation helpful? Give feedback.
-
In our original discussions with the NVCC team, we did discuss either errataing or removing this. I think we should:
@wmaxey do you want to take point on that? |
Beta Was this translation helpful? Give feedback.
-
To be sure, this does work with trivial types. For ranges CPOs I moved to this hack #if defined(__CUDA_ARCH__)
# define _LIBCUDACXX_CPO_ACCESSIBILITY static __device__
#else
# define _LIBCUDACXX_CPO_ACCESSIBILITY
#endif However, that only works badly because the CPOs are typically stateless. The real fun starts when we need statefull clobals such as C++20 |
Beta Was this translation helpful? Give feedback.
-
Converting to discussion. This is less an issue and more an ongoing thing to think about. |
Beta Was this translation helpful? Give feedback.
-
constexpr
globals are unable to be ODR used in device code. Until device support for them is available we might need to use some workarounds or tricks.One of which is replacing
constexpr
with__constant__
. We should replace hacks like this with a define instead:https://github.com/NVIDIA/libcudacxx/blob/main/libcxx/include/tuple#L1159
Perhaps turning the above into:
Beta Was this translation helpful? Give feedback.
All reactions