This repository has been archived by the owner on Mar 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #172 from NVIDIA/bugfix/abi_breaking_changes
Fix issues in the library that require an ABI break. This introduces ABI version 4.
- Loading branch information
Showing
7 changed files
with
217 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
.upstream-tests/test/std/numerics/complex.number/complex/abi_latest.pass.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
// <cuda/std/complex> | ||
|
||
// template<class T> | ||
// class complex | ||
// { | ||
// public: | ||
// typedef T value_type; | ||
// ... | ||
// }; | ||
|
||
#include <cuda/std/complex> | ||
#include <cuda/std/type_traits> | ||
|
||
#include "test_macros.h" | ||
|
||
template <class T> | ||
__host__ __device__ void | ||
test() | ||
{ | ||
typedef cuda::std::complex<T> C; | ||
|
||
static_assert(sizeof(C) == (sizeof(T)*2), "wrong size"); | ||
static_assert(alignof(C) == (alignof(T)*2), "misaligned"); | ||
} | ||
|
||
int main(int, char**) | ||
{ | ||
test<float>(); | ||
test<double>(); | ||
// CUDA treats long double as double | ||
// test<long double>(); | ||
|
||
return 0; | ||
} |
44 changes: 44 additions & 0 deletions
44
.upstream-tests/test/std/numerics/complex.number/complex/abi_v3.pass.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
// <cuda/std/complex> | ||
|
||
// template<class T> | ||
// class complex | ||
// { | ||
// public: | ||
// typedef T value_type; | ||
// ... | ||
// }; | ||
|
||
#define _LIBCUDACXX_CUDA_ABI_VERSION 3 | ||
|
||
#include <cuda/std/complex> | ||
#include <cuda/std/type_traits> | ||
|
||
#include "test_macros.h" | ||
|
||
template <class T> | ||
__host__ __device__ void | ||
test() | ||
{ | ||
typedef cuda::std::complex<T> C; | ||
|
||
static_assert(sizeof(C) == (sizeof(T)*2), "wrong size"); | ||
static_assert(alignof(C) == (alignof(T)), "misaligned"); | ||
} | ||
|
||
int main(int, char**) | ||
{ | ||
test<float>(); | ||
test<double>(); | ||
// CUDA treats long double as double | ||
// test<long double>(); | ||
|
||
return 0; | ||
} |
91 changes: 91 additions & 0 deletions
91
...ests/test/std/utilities/time/time.duration/time.duration.literals/literals.abiv3.pass.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
// UNSUPPORTED: c++98, c++03, c++11 | ||
// <cuda/std/chrono> | ||
|
||
#pragma nv_diag_suppress declared_but_not_referenced | ||
#pragma nv_diag_suppress set_but_not_used | ||
|
||
#define _LIBCUDACXX_CUDA_ABI_VERSION 3 | ||
|
||
#include <cuda/std/chrono> | ||
#include <cuda/std/type_traits> | ||
#include <cuda/std/cassert> | ||
|
||
#include "test_macros.h" | ||
template <typename T> | ||
__host__ __device__ | ||
constexpr bool unused(T &&) {return true;} | ||
|
||
int main(int, char**) | ||
{ | ||
using namespace cuda::std::literals::chrono_literals; | ||
|
||
// long long ABI v3 check | ||
{ | ||
constexpr auto _h = 3h; | ||
constexpr auto _min = 3min; | ||
constexpr auto _s = 3s; | ||
constexpr auto _ms = 3ms; | ||
constexpr auto _us = 3us; | ||
constexpr auto _ns = 3ns; | ||
|
||
unused(_h); | ||
unused(_min); | ||
unused(_s); | ||
unused(_ms); | ||
unused(_us); | ||
unused(_ns); | ||
|
||
static_assert(cuda::std::is_same< decltype(_h.count()), cuda::std::chrono::hours::rep >::value, ""); | ||
static_assert(cuda::std::is_same< decltype(_min.count()), cuda::std::chrono::minutes::rep >::value, ""); | ||
static_assert(cuda::std::is_same< decltype(_s.count()), cuda::std::chrono::seconds::rep >::value, ""); | ||
static_assert(cuda::std::is_same< decltype(_ms.count()), cuda::std::chrono::milliseconds::rep >::value, ""); | ||
static_assert(cuda::std::is_same< decltype(_us.count()), cuda::std::chrono::microseconds::rep >::value, ""); | ||
static_assert(cuda::std::is_same< decltype(_ns.count()), cuda::std::chrono::nanoseconds::rep >::value, ""); | ||
|
||
static_assert ( cuda::std::is_same<decltype(3h), cuda::std::chrono::hours>::value, "" ); | ||
static_assert ( cuda::std::is_same<decltype(3min), cuda::std::chrono::minutes>::value, "" ); | ||
static_assert ( cuda::std::is_same<decltype(3s), cuda::std::chrono::seconds>::value, "" ); | ||
static_assert ( cuda::std::is_same<decltype(3ms), cuda::std::chrono::milliseconds>::value, "" ); | ||
static_assert ( cuda::std::is_same<decltype(3us), cuda::std::chrono::microseconds>::value, "" ); | ||
static_assert ( cuda::std::is_same<decltype(3ns), cuda::std::chrono::nanoseconds>::value, "" ); | ||
} | ||
|
||
// long double ABI v3 check | ||
{ | ||
constexpr auto _h = 3.0h; | ||
constexpr auto _min = 3.0min; | ||
constexpr auto _s = 3.0s; | ||
constexpr auto _ms = 3.0ms; | ||
constexpr auto _us = 3.0us; | ||
constexpr auto _ns = 3.0ns; | ||
|
||
unused(_h); | ||
unused(_min); | ||
unused(_s); | ||
unused(_ms); | ||
unused(_us); | ||
unused(_ns); | ||
|
||
using cuda::std::ratio; | ||
using cuda::std::milli; | ||
using cuda::std::micro; | ||
using cuda::std::nano; | ||
|
||
static_assert(cuda::std::is_same< decltype(_h.count()), cuda::std::chrono::duration<long double, ratio<3600>>::rep >::value, ""); | ||
static_assert(cuda::std::is_same< decltype(_min.count()), cuda::std::chrono::duration<long double, ratio< 60>>::rep >::value, ""); | ||
// static_assert(cuda::std::is_same< decltype(s.count()), cuda::std::chrono::duration<long double >::rep >::value, ""); | ||
static_assert(cuda::std::is_same< decltype(_ms.count()), cuda::std::chrono::duration<long double, milli>::rep >::value, ""); | ||
static_assert(cuda::std::is_same< decltype(_us.count()), cuda::std::chrono::duration<long double, micro>::rep >::value, ""); | ||
static_assert(cuda::std::is_same< decltype(_ns.count()), cuda::std::chrono::duration<long double, nano>::rep >::value, ""); | ||
} | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters