Skip to content

Commit

Permalink
Properly uglify all qualifiers in product headers
Browse files Browse the repository at this point in the history
  • Loading branch information
miscco committed Jul 11, 2023
1 parent 25b7a06 commit 14834e3
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 103 deletions.
20 changes: 10 additions & 10 deletions libcudacxx/codegen/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ int main() {
out << " : \"memory\"); }\n";
}
for(auto& cv: cv_qualifier) {
out << "template<class _Type, typename _CUDA_VSTD::enable_if<sizeof(_Type)==" << sz/8 << ", int>::type = 0>\n";
out << "template<class _Type, _CUDA_VSTD::__enable_if_t<sizeof(_Type)==" << sz/8 << ", int> = 0>\n";
out << "_LIBCUDACXX_DEVICE void __atomic_load_cuda(const " << cv << "_Type *__ptr, _Type *__ret, int __memorder, " << scopenametag(s.first) << ") {\n";
out << " uint" << sz << "_t __tmp = 0;\n";
out << " NV_DISPATCH_TARGET(\n";
Expand Down Expand Up @@ -176,7 +176,7 @@ int main() {
out << " : \"memory\"); }\n";
}
for(auto& cv: cv_qualifier) {
out << "template<class _Type, typename cuda::std::enable_if<sizeof(_Type)==" << sz/8 << ", int>::type = 0>\n";
out << "template<class _Type, _CUDA_VSTD::__enable_if_t<sizeof(_Type)==" << sz/8 << ", int> = 0>\n";
out << "_LIBCUDACXX_DEVICE void __atomic_store_cuda(" << cv << "_Type *__ptr, _Type *__val, int __memorder, " << scopenametag(s.first) << ") {\n";
out << " uint" << sz << "_t __tmp = 0;\n";
out << " memcpy(&__tmp, __val, " << sz/8 << ");\n";
Expand Down Expand Up @@ -237,7 +237,7 @@ int main() {
}
for(auto& cv: cv_qualifier) {
if(rmw.first == "compare_exchange") {
out << "template<class _Type, typename cuda::std::enable_if<sizeof(_Type)==" << sz/8 << ", int>::type = 0>\n";
out << "template<class _Type, _CUDA_VSTD::__enable_if_t<sizeof(_Type)==" << sz/8 << ", int> = 0>\n";
out << "_LIBCUDACXX_DEVICE bool __atomic_compare_exchange_cuda(" << cv << "_Type *__ptr, _Type *__expected, const _Type *__desired, bool, int __success_memorder, int __failure_memorder, " << scopenametag(s.first) << ") {\n";
out << " uint" << sz << "_t __tmp = 0, __old = 0, __old_tmp;\n";
out << " memcpy(&__tmp, __desired, " << sz/8 << ");\n";
Expand Down Expand Up @@ -273,26 +273,26 @@ int main() {
out << "}\n";
}
else {
out << "template<class _Type, typename cuda::std::enable_if<sizeof(_Type)==" << sz/8;
out << "template<class _Type, _CUDA_VSTD::__enable_if_t<sizeof(_Type)==" << sz/8;
if(rmw.first == "exchange") {
out << ", int>::type = 0>\n";
out << ", int> = 0>\n";
out << "_LIBCUDACXX_DEVICE void __atomic_exchange_cuda(" << cv << "_Type *__ptr, _Type *__val, _Type *__ret, int __memorder, " << scopenametag(s.first) << ") {\n";
out << " uint" << sz << "_t __tmp = 0;\n";
out << " memcpy(&__tmp, __val, " << sz/8 << ");\n";
}
else {
if(type.first == "f")
out << " && cuda::std::is_floating_point<_Type>::value, int>::type = 0>\n";
out << " && _CUDA_VSTD::is_floating_point<_Type>::value, int> = 0>\n";
else if (rmw.first == "fetch_max" || rmw.first == "fetch_min") {
if(type.first == "u")
out << " && cuda::std::is_integral<_Type>::value && cuda::std::is_unsigned<_Type>::value, int>::type = 0>\n";
out << " && _CUDA_VSTD::is_integral<_Type>::value && _CUDA_VSTD::is_unsigned<_Type>::value, int> = 0>\n";
else if(type.first == "s")
out << " && cuda::std::is_integral<_Type>::value && cuda::std::is_signed<_Type>::value, int>::type = 0>\n";
out << " && _CUDA_VSTD::is_integral<_Type>::value && _CUDA_VSTD::is_signed<_Type>::value, int> = 0>\n";
}
else if (type.first == "u")
out << " && cuda::std::is_integral<_Type>::value, int>::type = 0>\n";
out << " && _CUDA_VSTD::is_integral<_Type>::value, int> = 0>\n";
else
out << ", int>::type = 0>\n";
out << ", int> = 0>\n";
out << "_LIBCUDACXX_DEVICE _Type __atomic_" << rmw.first << "_cuda(" << cv << "_Type *__ptr, _Type __val, int __memorder, " << scopenametag(s.first) << ") {\n";
out << " _Type __ret;\n";
if(type.first == "f" && sz == 32)
Expand Down
4 changes: 2 additions & 2 deletions libcudacxx/include/cuda/memory_resource
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ using _Filtered_vtable = typename _Filtered<_Properties...>::_Filtered_vtable::_
template <class _Vtable>
struct _Alloc_base
{
static_assert(cuda::std::is_base_of_v<_Alloc_vtable, _Vtable>, "");
static_assert(_CUDA_VSTD::is_base_of_v<_Alloc_vtable, _Vtable>, "");

_Alloc_base(void* __object_, const _Vtable* __static_vtabl_) noexcept
: __object(__object_)
Expand All @@ -457,7 +457,7 @@ protected:
template <class _Vtable>
struct _Async_alloc_base : public _Alloc_base<_Vtable>
{
static_assert(cuda::std::is_base_of_v<_Async_alloc_vtable, _Vtable>, "");
static_assert(_CUDA_VSTD::is_base_of_v<_Async_alloc_vtable, _Vtable>, "");

_Async_alloc_base(void* __object_, const _Vtable* __static_vtabl_) noexcept
: _Alloc_base<_Vtable>(__object_, __static_vtabl_)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <cstddef>
#include <stddef.h>
#else
#define offsetof(type, member) (cuda::std::size_t)((char*)&(((type *)0)->member) - (char*)0)
#define offsetof(type, member) (_CUDA_VSTD::size_t)((char*)&(((type *)0)->member) - (char*)0)
#endif // _LIBCUDACXX_COMPILER_NVRTC

_LIBCUDACXX_BEGIN_NAMESPACE_STD
Expand Down
Loading

0 comments on commit 14834e3

Please sign in to comment.