Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/details/__config
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ 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
#define _LIBCPP_HAS_CLOCK_API_EXTERNAL
#ifndef _LIBCUPP_HAS_TREE_BARRIER
# define _LIBCPP_HAS_NO_TREE_BARRIER
#endif
Expand Down
78 changes: 19 additions & 59 deletions include/simt/chrono
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ THE SOFTWARE.
#ifndef _SIMT_CHRONO
#define _SIMT_CHRONO

#ifndef __CUDACC_RTC__
#include <chrono>
#endif //__CUDACC_RTC__

#include "ctime"
#include "type_traits"
#include "ratio"
Expand All @@ -38,63 +34,27 @@ THE SOFTWARE.

#include "../details/__config"

#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 <chrono>
#endif //__CUDACC_RTC__

#define _LIBCUDACXX_USE_CUDA_CLOCK

#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<system_clock> 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<seconds>(__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 <class _Duration>
using sys_time = time_point<system_clock, _Duration>;
using sys_seconds = sys_time<seconds>;
using sys_days = sys_time<days>;

#endif

}

_LIBCPP_END_NAMESPACE_STD
#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

Expand Down
12 changes: 12 additions & 0 deletions include/simt/type_traits
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ THE SOFTWARE.
#ifndef _SIMT_TYPE_TRAITS
#define _SIMT_TYPE_TRAITS

#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 <type_traits>
#endif //__CUDACC_RTC__
Expand All @@ -35,4 +41,10 @@ THE SOFTWARE.

#include "../../libcxx/include/type_traits"

#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
2 changes: 1 addition & 1 deletion libcxx
Submodule libcxx updated 3 files
+6 −0 include/__config
+73 −27 include/chrono
+16 −0 include/ratio