cuda-api-wrappers
cuda-api-wrappers copied to clipboard
Conflicting names cuda::span between cuda-api-wrappers and libcudacxx
Reproducible example.cpp:
#include <cuda/api.hpp> // from cuda-api-wrappers
#include <thrust/device_vector.h>
Using CUDA toolkit 12.5 compiled with MSVC on Windows. Error message:
[build] C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.6\include\cuda/std/__iterator/wrap_iter.h(202): warning C4099: 'cuda::span': type name first seen using 'struct' now seen using 'class' [C:\git\PhysicsBasedAnimationToolkit\build\source\PhysicsBasedAnimationToolkit_PhysicsBasedAnimationToolkit.vcxproj]
[build] C:\git\PhysicsBasedAnimationToolkit\build\vcpkg_installed\x64-windows\include\cuda\api/types.hpp(145): note: see declaration of 'cuda::span'
[build] C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.6\include\cuda/std/__iterator/wrap_iter.h(202): note: the template instantiation context (the oldest one first) is
[build] C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.6\include\cuda/std/__iterator/wrap_iter.h(43): note: while compiling class template 'cuda::std::__4::__wrap_iter'
[build] C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.6\include\cuda/std/__iterator/wrap_iter.h(202): error C2977: 'cuda::span': too many template arguments [C:\git\PhysicsBasedAnimationToolkit\build\source\PhysicsBasedAnimationToolkit_PhysicsBasedAnimationToolkit.vcxproj]
[build] C:\git\PhysicsBasedAnimationToolkit\build\vcpkg_installed\x64-windows\include\cuda\api/types.hpp(145): note: see declaration of 'cuda::span'
Culprit in cuda/std/__iterator/wrap_iter.h(202) of CUDA toolkit's libcudacxx:
template <class _Iter>
class __wrap_iter
{
// stuff ...
template <class _Tp, size_t>
friend class span;
}
When cuda-api-wrappers cuda::span is declared first, the __wrap_iter header's unqualified name lookup of span in the friend class span declaration will resolve to cuda-api-wrappers cuda::span (instead of the expected libcudacxx cuda::std::span) which has a different declaration:
template<typename T>
struct span {
// stuff ...
};
I think on the NVIDIA side, they could just namespace-qualify that friend class span declaration. I don't see why libcudacxx would need a device-code specific cuda::span, since the cuda::std::span should be sufficient already (I don't see why spans would not remain host-device agnostic), but just in case, wondering if we can do something on the cuda-api-wrappers side as well?