Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Mar 21, 2024. It is now read-only.
/libcudacxxPublic archive

Commit070697d

Browse files
authored
Fix most libcxx tests (#471)
* Use `__libcpp_is_unsigned_integer` for `<bit>`* Do not use compiler builtin in tuple swap signature* Do not try CTAD with ancient gcc* Do not test constexpr `std::allocator` as that is not implemented* Add missing `__pragma_pop` to `<optional>`* Disable flaky threading tests for libcxx* Fix `optional` libcxx tests* Fix issues with our `construct_at` performance optimization* Disable complex edge case test for clangThe tests runs into constexpr evaluation limits* Disable modules tests for clang 9 and 10* Disable invalid test where where clang has been fixed
1 parent0adfef5 commit070697d

File tree

73 files changed

+250
-105
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+250
-105
lines changed

‎include/cuda/std/detail/libcxx/include/__memory/construct_at.h‎

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ _LIBCUDACXX_BEGIN_NAMESPACE_STD
6262
_LIBCUDACXX_DISABLE_EXEC_CHECK
6363
template<class_Tp,class... _Args,class =decltype(::new(_CUDA_VSTD::declval<void*>()) _Tp(_CUDA_VSTD::declval<_Args>()...))>
6464
_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17
65-
__enable_if_t<!is_trivially_constructible_v<_Tp, _Args...> || !is_trivially_move_assignable_v<_Tp>, _Tp*>construct_at(_Tp* __location, _Args&&... __args) {
65+
__enable_if_t<!is_trivially_constructible_v<_Tp, _Args...> ||
66+
!is_trivially_move_assignable_v<_Tp>, _Tp*>
67+
construct_at(_Tp* __location, _Args&&... __args) {
6668
_LIBCUDACXX_ASSERT(__location !=nullptr,"null pointer given to construct_at");
6769
#if defined(__cuda_std__)
6870
// Need to go through `std::construct_at` as that is the explicitly blessed function
@@ -76,24 +78,31 @@ __enable_if_t<!is_trivially_constructible_v<_Tp, _Args...> || !is_trivially_move
7678
_LIBCUDACXX_DISABLE_EXEC_CHECK
7779
template<class_Tp,class... _Args,class =decltype(::new(_CUDA_VSTD::declval<void*>()) _Tp(_CUDA_VSTD::declval<_Args>()...))>
7880
_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17
79-
__enable_if_t<is_trivially_constructible_v<_Tp, _Args...> && is_trivially_move_assignable_v<_Tp>, _Tp*>construct_at(_Tp* __location, _Args&&... __args) {
81+
__enable_if_t<is_trivially_constructible_v<_Tp, _Args...> &&
82+
is_trivially_move_assignable_v<_Tp>, _Tp*>
83+
construct_at(_Tp* __location, _Args&&... __args) {
8084
_LIBCUDACXX_ASSERT(__location !=nullptr,"null pointer given to construct_at");
8185
#if defined(__cuda_std__)
8286
// Need to go through `std::construct_at` as that is the explicitly blessed function
8387
if (__libcpp_is_constant_evaluated()) {
8488
return ::std::construct_at(__location, _CUDA_VSTD::forward<_Args>(__args)...);
8589
}
86-
#endif// __cuda_std__
8790
*__location = _Tp{_CUDA_VSTD::forward<_Args>(__args)...};
8891
return __location;
92+
#else// ^^^ __cuda_std__ ^^^ / vvv !__cuda_std__ vvv
93+
// NVCC always considers construction + move assignment, other compilers are smarter using copy construction
94+
// So rather than adding all kinds of workarounds simply fall back to the correct implementation for libcxx mode
95+
return ::new (_CUDA_VSTD::__voidify(*__location))_Tp(_CUDA_VSTD::forward<_Args>(__args)...);
96+
#endif// !__cuda_std__
8997
}
9098

9199
#endif// _LIBCUDACXX_STD_VER > 17
92100

93101
_LIBCUDACXX_DISABLE_EXEC_CHECK
94102
template<class_Tp,class... _Args,class =decltype(::new(_CUDA_VSTD::declval<void*>()) _Tp(_CUDA_VSTD::declval<_Args>()...))>
95103
_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17
96-
__enable_if_t<!_LIBCUDACXX_TRAIT(is_trivially_constructible, _Tp, _Args...) || !_LIBCUDACXX_TRAIT(is_trivially_move_assignable, _Tp), _Tp*>__construct_at(_Tp* __location, _Args&&... __args) {
104+
__enable_if_t<!_LIBCUDACXX_TRAIT(is_trivially_constructible, _Tp, _Args...) || !_LIBCUDACXX_TRAIT(is_trivially_move_assignable, _Tp), _Tp*>
105+
__construct_at(_Tp* __location, _Args&&... __args) {
97106
_LIBCUDACXX_ASSERT(__location !=nullptr,"null pointer given to construct_at");
98107
#if defined(__cuda_std__) && _LIBCUDACXX_STD_VER > 17
99108
// Need to go through `std::construct_at` as that is the explicitly blessed function
@@ -107,7 +116,8 @@ __enable_if_t<!_LIBCUDACXX_TRAIT(is_trivially_constructible, _Tp, _Args...) || !
107116
_LIBCUDACXX_DISABLE_EXEC_CHECK
108117
template<class_Tp,class... _Args,class =decltype(::new(_CUDA_VSTD::declval<void*>()) _Tp(_CUDA_VSTD::declval<_Args>()...))>
109118
_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX17
110-
__enable_if_t<_LIBCUDACXX_TRAIT(is_trivially_constructible, _Tp, _Args...) && _LIBCUDACXX_TRAIT(is_trivially_move_assignable, _Tp), _Tp*>__construct_at(_Tp* __location, _Args&&... __args) {
119+
__enable_if_t<_LIBCUDACXX_TRAIT(is_trivially_constructible, _Tp, _Args...) && _LIBCUDACXX_TRAIT(is_trivially_move_assignable, _Tp), _Tp*>
120+
__construct_at(_Tp* __location, _Args&&... __args) {
111121
_LIBCUDACXX_ASSERT(__location !=nullptr,"null pointer given to construct_at");
112122
#if defined(__cuda_std__) && _LIBCUDACXX_STD_VER > 17
113123
// Need to go through `std::construct_at` as that is the explicitly blessed function

‎include/cuda/std/detail/libcxx/include/bit‎

Lines changed: 20 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -459,23 +459,11 @@ constexpr int __libcpp_popcount(unsigned long long __x) {
459459

460460
#endif// _LIBCUDACXX_COMPILER_MSVC
461461

462-
template<class_Tp>
463-
using __bitop_unsigned_integer _LIBCUDACXX_NODEBUG_TYPE = integral_constant<bool,
464-
is_integral<_Tp>::value &&
465-
is_unsigned<_Tp>::value &&
466-
_IsNotSame<__remove_cv_t<_Tp>,bool>::value &&
467-
_IsNotSame<__remove_cv_t<_Tp>,signedchar>::value &&
468-
_IsNotSame<__remove_cv_t<_Tp>,wchar_t>::value &&
469-
_IsNotSame<__remove_cv_t<_Tp>,char16_t>::value &&
470-
_IsNotSame<__remove_cv_t<_Tp>,char32_t>::value
471-
>;
472-
473-
474462
template<class_Tp>
475463
_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR
476464
_Tp__rotl(_Tp__t,unsignedint __cnt) _NOEXCEPT
477465
{
478-
static_assert(__bitop_unsigned_integer<_Tp>::value,"__rotl requires unsigned");
466+
static_assert(__libcpp_is_unsigned_integer<_Tp>::value,"__rotl requires unsigned");
479467
using __nlt = numeric_limits<_Tp>;
480468

481469
return ((__cnt % __nlt::digits) ==0) ?
@@ -488,7 +476,7 @@ template<class _Tp>
488476
_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR
489477
_Tp__rotr(_Tp__t,unsignedint __cnt) _NOEXCEPT
490478
{
491-
static_assert(__bitop_unsigned_integer<_Tp>::value,"__rotr requires unsigned");
479+
static_assert(__libcpp_is_unsigned_integer<_Tp>::value,"__rotr requires unsigned");
492480
using __nlt = numeric_limits<_Tp>;
493481

494482
return ((__cnt % __nlt::digits) ==0) ?
@@ -551,7 +539,7 @@ template<class _Tp>
551539
_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR
552540
int__countr_zero(_Tp__t) _NOEXCEPT
553541
{
554-
static_assert(__bitop_unsigned_integer<_Tp>::value,"__countr_zero requires unsigned");
542+
static_assert(__libcpp_is_unsigned_integer<_Tp>::value,"__countr_zero requires unsigned");
555543

556544
return__t ?__countr_zero_dispatch(__t) : numeric_limits<_Tp>::digits;
557545
}
@@ -619,15 +607,15 @@ template<class _Tp>
619607
_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR
620608
int__countl_zero(_Tp__t) _NOEXCEPT
621609
{
622-
static_assert(__bitop_unsigned_integer<_Tp>::value,"__countl_zero requires unsigned");
610+
static_assert(__libcpp_is_unsigned_integer<_Tp>::value,"__countl_zero requires unsigned");
623611
return__t ?__countl_zero_dispatch(__t) : numeric_limits<_Tp>::digits;
624612
}
625613

626614
template<class_Tp>
627615
_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR
628616
int__countl_one(_Tp__t) _NOEXCEPT
629617
{
630-
static_assert(__bitop_unsigned_integer<_Tp>::value,"__countl_one requires unsigned");
618+
static_assert(__libcpp_is_unsigned_integer<_Tp>::value,"__countl_one requires unsigned");
631619
return__t != numeric_limits<_Tp>::max()
632620
?__countl_zero(static_cast<_Tp>(~__t))
633621
: numeric_limits<_Tp>::digits;
@@ -638,7 +626,7 @@ template<class _Tp>
638626
_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR
639627
int__countr_one(_Tp__t) _NOEXCEPT
640628
{
641-
static_assert(__bitop_unsigned_integer<_Tp>::value,"__countr_one requires unsigned");
629+
static_assert(__libcpp_is_unsigned_integer<_Tp>::value,"__countr_one requires unsigned");
642630
return__t != numeric_limits<_Tp>::max()
643631
?__countr_zero(static_cast<_Tp>(~__t))
644632
: numeric_limits<_Tp>::digits;
@@ -681,7 +669,7 @@ template<class _Tp>
681669
_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR
682670
int__popcount(_Tp__t) _NOEXCEPT
683671
{
684-
static_assert(__bitop_unsigned_integer<_Tp>::value,"__libcpp_popcount requires unsigned");
672+
static_assert(__libcpp_is_unsigned_integer<_Tp>::value,"__libcpp_popcount requires unsigned");
685673

686674
return__popcount_dispatch(__t);
687675
}
@@ -692,15 +680,15 @@ template<class _Tp>
692680
_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR
693681
unsigned__bit_log2(_Tp__t) _NOEXCEPT
694682
{
695-
static_assert(__bitop_unsigned_integer<_Tp>::value,"__bit_log2 requires unsigned");
683+
static_assert(__libcpp_is_unsigned_integer<_Tp>::value,"__bit_log2 requires unsigned");
696684
return std::numeric_limits<_Tp>::digits -1 -__countl_zero(__t);
697685
}
698686

699687
template<class_Tp>
700688
_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR
701689
bool__has_single_bit(_Tp__t) _NOEXCEPT
702690
{
703-
static_assert(__bitop_unsigned_integer<_Tp>::value,"__has_single_bit requires unsigned");
691+
static_assert(__libcpp_is_unsigned_integer<_Tp>::value,"__has_single_bit requires unsigned");
704692
return__t !=0 && (((__t & (__t -1)) ==0));
705693
}
706694

@@ -734,7 +722,7 @@ __ceil2(_Tp __t) noexcept
734722

735723
template<class_Tp>
736724
_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR
737-
__enable_if_t<__bitop_unsigned_integer<_Tp>::value, _Tp>
725+
__enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, _Tp>
738726
rotl(_Tp__t,unsignedint __cnt)noexcept
739727
{
740728
return__rotl(__t, __cnt);
@@ -744,7 +732,7 @@ rotl(_Tp __t, unsigned int __cnt) noexcept
744732
// rotr
745733
template<class_Tp>
746734
_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR
747-
__enable_if_t<__bitop_unsigned_integer<_Tp>::value, _Tp>
735+
__enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, _Tp>
748736
rotr(_Tp__t,unsignedint __cnt)noexcept
749737
{
750738
return__rotr(__t, __cnt);
@@ -753,7 +741,7 @@ rotr(_Tp __t, unsigned int __cnt) noexcept
753741

754742
template<class_Tp>
755743
_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR
756-
__enable_if_t<__bitop_unsigned_integer<_Tp>::value,int>
744+
__enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value,int>
757745
countl_zero(_Tp__t)noexcept
758746
{
759747
return__countl_zero(__t);
@@ -762,7 +750,7 @@ countl_zero(_Tp __t) noexcept
762750

763751
template<class_Tp>
764752
_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR
765-
__enable_if_t<__bitop_unsigned_integer<_Tp>::value,int>
753+
__enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value,int>
766754
countl_one(_Tp__t)noexcept
767755
{
768756
return__countl_one(__t);
@@ -771,7 +759,7 @@ countl_one(_Tp __t) noexcept
771759

772760
template<class_Tp>
773761
_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR
774-
__enable_if_t<__bitop_unsigned_integer<_Tp>::value,int>
762+
__enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value,int>
775763
countr_zero(_Tp__t)noexcept
776764
{
777765
return__countr_zero(__t);
@@ -780,7 +768,7 @@ countr_zero(_Tp __t) noexcept
780768

781769
template<class_Tp>
782770
_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR
783-
__enable_if_t<__bitop_unsigned_integer<_Tp>::value,int>
771+
__enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value,int>
784772
countr_one(_Tp__t)noexcept
785773
{
786774
return__countr_one(__t);
@@ -789,7 +777,7 @@ countr_one(_Tp __t) noexcept
789777

790778
template<class_Tp>
791779
_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR
792-
__enable_if_t<__bitop_unsigned_integer<_Tp>::value,int>
780+
__enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value,int>
793781
popcount(_Tp__t)noexcept
794782
{
795783
return__popcount(__t);
@@ -798,31 +786,31 @@ popcount(_Tp __t) noexcept
798786

799787
template<class_Tp>
800788
_LIBCUDACXX_INLINE_VISIBILITYconstexpr
801-
__enable_if_t<__bitop_unsigned_integer<_Tp>::value,bool>
789+
__enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value,bool>
802790
has_single_bit(_Tp__t)noexcept
803791
{
804792
return__has_single_bit(__t);
805793
}
806794

807795
template<class_Tp>
808796
_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR
809-
__enable_if_t<__bitop_unsigned_integer<_Tp>::value, _Tp>
797+
__enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, _Tp>
810798
bit_floor(_Tp__t)noexcept
811799
{
812800
return__t ==0 ?0 :static_cast<_Tp>(_Tp{1} <<__bit_log2(__t));
813801
}
814802

815803
template<class_Tp>
816804
_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR
817-
__enable_if_t<__bitop_unsigned_integer<_Tp>::value, _Tp>
805+
__enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, _Tp>
818806
bit_ceil(_Tp__t)noexcept
819807
{
820808
return (__t <2) ?1 :static_cast<_Tp>(__ceil2(__t));
821809
}
822810

823811
template<class_Tp>
824812
_LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_BIT_CONSTEXPR
825-
__enable_if_t<__bitop_unsigned_integer<_Tp>::value, _Tp>
813+
__enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, _Tp>
826814
bit_width(_Tp__t)noexcept
827815
{
828816
return__t ==0 ?0 :static_cast<_Tp>(__bit_log2(__t) +1);

‎include/cuda/std/detail/libcxx/include/optional‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1610,4 +1610,8 @@ _LIBCUDACXX_END_NAMESPACE_STD
16101610

16111611
#endif// _LIBCUDACXX_STD_VER > 11
16121612

1613+
#ifndef __cuda_std__
1614+
#include<__pragma_pop>
1615+
#endif// __cuda_std__
1616+
16131617
#endif// _LIBCUDACXX_OPTIONAL

‎include/cuda/std/detail/libcxx/include/tuple‎

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,17 +1050,12 @@ tuple(allocator_arg_t, _Alloc, tuple<_Tp...>) -> tuple<_Tp...>;
10501050

10511051
template<class ..._Tp>
10521052
inline _LIBCUDACXX_INLINE_VISIBILITY
1053-
typename enable_if
1054-
<
1055-
__all<__is_swappable<_Tp>::value...>::value,
1056-
void
1057-
>::type
1058-
swap(tuple<_Tp...>&__t, tuple<_Tp...>& __u)
1059-
_NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value)
1060-
{__t.swap(__u);}
1053+
__enable_if_t<_And<__is_swappable<_Tp>...>::value,void>
1054+
swap(tuple<_Tp...>&__t, tuple<_Tp...>& __u) _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value) {
1055+
__t.swap(__u);
1056+
}
10611057

10621058
// get
1063-
10641059
template<size_t _Ip,class ..._Tp>
10651060
inline _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11
10661061
typename tuple_element<_Ip, tuple<_Tp...> >::type&

‎libcxx/test/libcxx/modules/cinttypes_exports.sh.cpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// This test fails on Windows because the underlying libc headers on Windows
1010
// are not modular
1111
// XFAIL: LIBCXX-WINDOWS-FIXME
12+
// XFAIL: clang-9, clang-10
1213

1314
// REQUIRES: modules-support
1415

‎libcxx/test/libcxx/modules/clocale_exports.sh.cpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// This test fails on Windows because the underlying libc headers on Windows
1010
// are not modular
1111
// XFAIL: LIBCXX-WINDOWS-FIXME
12+
// XFAIL: clang-9, clang-10
1213

1314
// REQUIRES: modules-support
1415
// UNSUPPORTED: c++98, c++03

‎libcxx/test/libcxx/modules/cstdint_exports.sh.cpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// This test fails on Windows because the underlying libc headers on Windows
1010
// are not modular
1111
// XFAIL: LIBCXX-WINDOWS-FIXME
12+
// XFAIL: clang-9, clang-10
1213

1314
// REQUIRES: modules-support
1415

‎libcxx/test/libcxx/modules/inttypes_h_exports.sh.cpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// This test fails on Windows because the underlying libc headers on Windows
1010
// are not modular
1111
// XFAIL: LIBCXX-WINDOWS-FIXME
12+
// XFAIL: clang-9, clang-10
1213

1314
// REQUIRES: modules-support
1415

‎libcxx/test/libcxx/modules/stdint_h_exports.sh.cpp‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// XFAIL: clang-9, clang-10
10+
911
// REQUIRES: modules-support
1012

1113
// Test that int8_t and the like are exported from stdint.h not inttypes.h

‎libcxx/test/libcxx/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
//
99
// UNSUPPORTED: libcpp-has-no-threads
1010

11-
// FLAKY_TEST.
11+
// Threading tests are notoriously flaky in libcxx mode so disable them
12+
// UNSUPPORTED: true
1213

1314
// This test uses the POSIX header <sys/time.h> which Windows doesn't provide
1415
// UNSUPPORTED: windows

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp