From 25eb5eb32ddb91c76c8e35b4ef26f39e0c354c3b Mon Sep 17 00:00:00 2001 From: ptaylor Date: Wed, 23 Oct 2019 00:09:37 -0700 Subject: [PATCH 1/5] use C++17 type_traits --- include/details/__config | 1 + include/simt/type_traits | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/include/details/__config b/include/details/__config index 9bbce7b..692c4c0 100644 --- a/include/details/__config +++ b/include/details/__config @@ -49,6 +49,7 @@ THE SOFTWARE. #define _LIBCPP_HAS_NO_INT128 #define _LIBCPP_FREESTANDING #define _LIBCPP_HAS_NO_SEMAPHORES +#define _LIBCPP_HAS_NO_IS_AGGREGATE #define _LIBCPP_HAS_NO_THREAD_CONTENTION_TABLE #define _LIBCPP_HAS_NO_THREAD_CONTENTION_STATE #define _LIBCPP_HAS_NO_PLATFORM_WAIT diff --git a/include/simt/type_traits b/include/simt/type_traits index 5e29b70..5705e6a 100644 --- a/include/simt/type_traits +++ b/include/simt/type_traits @@ -25,6 +25,10 @@ THE SOFTWARE. #ifndef _SIMT_TYPE_TRAITS #define _SIMT_TYPE_TRAITS +#define _LIBCPP_STD_VER_PREV _LIBCPP_STD_VER +#undef _LIBCPP_STD_VER +#define _LIBCPP_STD_VER 17 + #ifndef __CUDACC_RTC__ #include #endif //__CUDACC_RTC__ @@ -35,4 +39,8 @@ THE SOFTWARE. #include "../../libcxx/include/type_traits" +#undef _LIBCPP_STD_VER +#define _LIBCPP_STD_VER _LIBCPP_STD_VER_PREV +#undef _LIBCPP_STD_VER_PREV + #endif //_SIMT_TYPE_TRAITS From ec493a541441315a10529831284786111eeb0715 Mon Sep 17 00:00:00 2001 From: ptaylor Date: Wed, 23 Oct 2019 00:09:51 -0700 Subject: [PATCH 2/5] move system_clock into libcxx --- include/details/__config | 1 - include/simt/chrono | 70 +++++++--------------------------------- 2 files changed, 11 insertions(+), 60 deletions(-) diff --git a/include/details/__config b/include/details/__config index 692c4c0..1ed4d44 100644 --- a/include/details/__config +++ b/include/details/__config @@ -53,7 +53,6 @@ THE SOFTWARE. #define _LIBCPP_HAS_NO_THREAD_CONTENTION_TABLE #define _LIBCPP_HAS_NO_THREAD_CONTENTION_STATE #define _LIBCPP_HAS_NO_PLATFORM_WAIT -#define _LIBCPP_HAS_CLOCK_API_EXTERNAL #ifndef _LIBCUPP_HAS_TREE_BARRIER # define _LIBCPP_HAS_NO_TREE_BARRIER #endif diff --git a/include/simt/chrono b/include/simt/chrono index fe2204a..1384643 100644 --- a/include/simt/chrono +++ b/include/simt/chrono @@ -26,10 +26,6 @@ THE SOFTWARE. #ifndef _SIMT_CHRONO #define _SIMT_CHRONO -#ifndef __CUDACC_RTC__ - #include -#endif //__CUDACC_RTC__ - #include "ctime" #include "type_traits" #include "ratio" @@ -38,63 +34,19 @@ THE SOFTWARE. #include "../details/__config" +#define _LIBCPP_STD_VER_PREV _LIBCPP_STD_VER +#undef _LIBCPP_STD_VER +#define _LIBCPP_STD_VER 20 + +#ifndef __CUDACC_RTC__ + #include +#endif //__CUDACC_RTC__ + #include "../../libcxx/include/chrono" -_LIBCPP_BEGIN_NAMESPACE_STD - -namespace chrono { - -class _LIBCPP_TYPE_VIS system_clock -{ -public: - typedef nanoseconds duration; - typedef duration::rep rep; - typedef duration::period period; - typedef chrono::time_point time_point; - static _LIBCPP_CONSTEXPR_AFTER_CXX11 const bool is_steady = false; - - inline _LIBCPP_INLINE_VISIBILITY - static time_point now() _NOEXCEPT - { -#ifdef __CUDA_ARCH__ - uint64_t time; - asm("mov.u64 %0, %globaltimer;":"=l"(time)::); - return time_point(nanoseconds(time)); -#else - return time_point(nanoseconds( - ::std::chrono::duration_cast<::std::chrono::nanoseconds>( - ::std::chrono::system_clock::now().time_since_epoch() - ).count() - )); -#endif - } - inline _LIBCPP_INLINE_VISIBILITY - static time_t to_time_t(const time_point& __t) _NOEXCEPT - { - return time_t(duration_cast(__t.time_since_epoch()).count()); - } - inline _LIBCPP_INLINE_VISIBILITY - static time_point from_time_t(time_t __t) _NOEXCEPT - { - return time_point(seconds(__t));; - } -}; - -using steady_clock = system_clock; -using high_resolution_clock = steady_clock; - -#if _LIBCPP_STD_VER > 17 - -template -using sys_time = time_point; -using sys_seconds = sys_time; -using sys_days = sys_time; - -#endif - -} - -_LIBCPP_END_NAMESPACE_STD +#undef _LIBCPP_STD_VER +#define _LIBCPP_STD_VER _LIBCPP_STD_VER_PREV +#undef _LIBCPP_STD_VER_PREV #endif //_SIMT_CHRONO From 70528c4173767bef8b5ffa3d108b7fac1ddbcc9d Mon Sep 17 00:00:00 2001 From: ptaylor Date: Wed, 23 Oct 2019 00:14:35 -0700 Subject: [PATCH 3/5] Update libcxx --- libcxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libcxx b/libcxx index a4ace1c..2afe936 160000 --- a/libcxx +++ b/libcxx @@ -1 +1 @@ -Subproject commit a4ace1ce72e2e5376c4e3965e632357e7d55e0b6 +Subproject commit 2afe936403008372a29e44ea37c36af187964d90 From 43fc579c7af5d04d2f142498489e7a02bca3b02a Mon Sep 17 00:00:00 2001 From: ptaylor Date: Wed, 6 Nov 2019 12:29:40 -0800 Subject: [PATCH 4/5] add ifndef guards around new features --- include/simt/chrono | 20 ++++++++++++++------ include/simt/type_traits | 16 ++++++++++------ 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/include/simt/chrono b/include/simt/chrono index 1384643..db4f591 100644 --- a/include/simt/chrono +++ b/include/simt/chrono @@ -34,19 +34,27 @@ THE SOFTWARE. #include "../details/__config" -#define _LIBCPP_STD_VER_PREV _LIBCPP_STD_VER -#undef _LIBCPP_STD_VER -#define _LIBCPP_STD_VER 20 +#ifdef _LIBCUDACXX_USE_CXX20_CHRONO +# define _LIBCPP_STD_VER_PREV _LIBCPP_STD_VER +# undef _LIBCPP_STD_VER +# define _LIBCPP_STD_VER 20 +#endif //_LIBCUDACXX_USE_CXX20_CHRONO #ifndef __CUDACC_RTC__ #include #endif //__CUDACC_RTC__ +#define _LIBCUDACXX_USE_CUDA_CLOCK + #include "../../libcxx/include/chrono" -#undef _LIBCPP_STD_VER -#define _LIBCPP_STD_VER _LIBCPP_STD_VER_PREV -#undef _LIBCPP_STD_VER_PREV +#undef _LIBCUDACXX_USE_CUDA_CLOCK + +#ifdef _LIBCUDACXX_USE_CXX20_CHRONO +# undef _LIBCPP_STD_VER +# define _LIBCPP_STD_VER _LIBCPP_STD_VER_PREV +# undef _LIBCPP_STD_VER_PREV +#endif //_LIBCUDACXX_USE_CXX20_CHRONO #endif //_SIMT_CHRONO diff --git a/include/simt/type_traits b/include/simt/type_traits index 5705e6a..f6a81ab 100644 --- a/include/simt/type_traits +++ b/include/simt/type_traits @@ -25,9 +25,11 @@ THE SOFTWARE. #ifndef _SIMT_TYPE_TRAITS #define _SIMT_TYPE_TRAITS -#define _LIBCPP_STD_VER_PREV _LIBCPP_STD_VER -#undef _LIBCPP_STD_VER -#define _LIBCPP_STD_VER 17 +#ifdef _LIBCUDACXX_USE_CXX17_TYPE_TRAITS +# define _LIBCPP_STD_VER_PREV _LIBCPP_STD_VER +# undef _LIBCPP_STD_VER +# define _LIBCPP_STD_VER 17 +#endif //_LIBCUDACXX_USE_CXX17_TYPE_TRAITS #ifndef __CUDACC_RTC__ #include @@ -39,8 +41,10 @@ THE SOFTWARE. #include "../../libcxx/include/type_traits" -#undef _LIBCPP_STD_VER -#define _LIBCPP_STD_VER _LIBCPP_STD_VER_PREV -#undef _LIBCPP_STD_VER_PREV +#ifdef _LIBCUDACXX_USE_CXX17_TYPE_TRAITS +# undef _LIBCPP_STD_VER +# define _LIBCPP_STD_VER _LIBCPP_STD_VER_PREV +# undef _LIBCPP_STD_VER_PREV +#endif //_LIBCUDACXX_USE_CXX17_TYPE_TRAITS #endif //_SIMT_TYPE_TRAITS From 2fdc5c2ffc136ac0fc0fdfc6097cc39987504d0f Mon Sep 17 00:00:00 2001 From: ptaylor Date: Wed, 6 Nov 2019 12:30:17 -0800 Subject: [PATCH 5/5] update libcxx ref --- libcxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libcxx b/libcxx index 2afe936..1f4f3a4 160000 --- a/libcxx +++ b/libcxx @@ -1 +1 @@ -Subproject commit 2afe936403008372a29e44ea37c36af187964d90 +Subproject commit 1f4f3a4e4fbc2fec63807e43db251600b7ad8dc4