-
Notifications
You must be signed in to change notification settings - Fork 192
Fix structured binding support #317
Conversation
| template <class _Tp, size_t _Size> | ||
| struct tuple_size<_CUDA_VSTD::array<_Tp, _Size>> | ||
| : _CUDA_VSTD::tuple_size<_CUDA_VSTD::array<_Tp, _Size>> | ||
| {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
libcxx is failing to build due to this:
2022-09-22 06:23:19+00:00| In file included from /sw/gpgpu/libcudacxx/libcxx/src/filesystem/filesystem_common.h:14:
2022-09-22 06:23:19+00:00| /sw/gpgpu/libcudacxx/libcxx/include/array:497:12: error: explicit specialization of non-template struct 'tuple_size'
2022-09-22 06:23:19+00:00| struct tuple_size<_CUDA_VSTD::array<_Tp, _Size>>
2022-09-22 06:23:19+00:00| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2022-09-22 06:23:19+00:00| /sw/gpgpu/libcudacxx/libcxx/include/array:502:12: error: explicit specialization of non-template struct 'tuple_element'
2022-09-22 06:23:19+00:00| struct tuple_element<_Ip, _CUDA_VSTD::array<_Tp, _Size>>
2022-09-22 06:23:19+00:00| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2022-09-22 06:23:19+00:00| In file included from /sw/gpgpu/libcudacxx/libcxx/src/filesystem/operations.cpp:10:
2022-09-22 06:23:19+00:00| /sw/gpgpu/libcudacxx/libcxx/include/array:497:12: error: explicit specialization of non-template struct 'tuple_size'
2022-09-22 06:23:19+00:00| struct tuple_size<_CUDA_VSTD::array<_Tp, _Size>>
2022-09-22 06:23:19+00:00| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2022-09-22 06:23:19+00:00| /sw/gpgpu/libcudacxx/libcxx/include/array:502:12: error: explicit specialization of non-template struct 'tuple_element'
2022-09-22 06:23:19+00:00| struct tuple_element<_Ip, _CUDA_VSTD::array<_Tp, _Size>>
2022-09-22 06:23:19+00:00| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2022-09-22 06:23:19+00:00| 1 warning and 2 errors generated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But the forward declaration is like directly above. How can that fail?
| template<size_t _Ip, class... _Tp> | ||
| struct tuple_element<_Ip, _CUDA_VSTD::tuple<_Tp...>> | ||
| : _CUDA_VSTD::tuple_element<_Ip, _CUDA_VSTD::tuple<_Tp...>> | ||
| {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as other comment:
2022-09-22 06:23:19+00:00| In file included from /sw/gpgpu/libcudacxx/libcxx/include/utility:200:
2022-09-22 06:23:19+00:00| /sw/gpgpu/libcudacxx/libcxx/include/__tuple:574:12: error: explicit specialization of non-template struct 'tuple_size'
2022-09-22 06:23:19+00:00| struct tuple_size<_CUDA_VSTD::tuple<_Tp...>>
2022-09-22 06:23:19+00:00| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
2022-09-22 06:23:19+00:00| /sw/gpgpu/libcudacxx/libcxx/include/__tuple:579:12: error: explicit specialization of non-template struct 'tuple_element'
2022-09-22 06:23:19+00:00| struct tuple_element<_Ip, _CUDA_VSTD::tuple<_Tp...>>
2022-09-22 06:23:19+00:00| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
There are even worse ones That would require us to specialize depending on host library |
5b1799e to
9493cf5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The __tuple comments also apply to array.
Currently structured bindings for `cuda::std::tuple` and `cuda::std::array` was broken. The reason for that is that the standard requires, that the specializations of `tuple_size` and `tuple_element` reside in namespace std. whereas our specializations resided in namespace `cuda::std` Work around that by pulling those specializations into namespace std too. Fixes CUDA Tuple Structured Binding Declaration Broken NVIDIA#316
ea09d2d to
466facb
Compare
|
@griwes this passed internal CI and I believe your comments are addressed. Can we merge this? |
Currently structured bindings for
cuda::std::tupleandcuda::std::arraywere broken.The reason for that is that the standard requires, that the specializations of
tuple_sizeandtuple_elementreside in namespace std. whereas our specializations resided in namespacecuda::stdWork around that by pulling those specializations into namespace std too.
Fixes CUDA Tuple Structured Binding Declaration Broken #316