Skip to content

Commit 37c768d

Browse files
pciolkoszmiscco
andauthored
[CUDAX] Remove caching allocator and non-async memory resources from async_buffer tests (NVIDIA#4563)
* Remove non-async resources from async_buffer tests * Always fix the format issues first * Add missing device accessible testcase --------- Co-authored-by: Michael Schellenberger Costa <miscco@nvidia.com>
1 parent 65c0373 commit 37c768d

File tree

12 files changed

+95
-224
lines changed

12 files changed

+95
-224
lines changed

cudax/test/containers/async_buffer/access.cu

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,15 @@
2323
#include "helper.h"
2424
#include "types.h"
2525

26-
C2H_TEST("cudax::async_buffer access",
27-
"[container][async_buffer]",
28-
c2h::type_list<cuda::std::tuple<cuda::mr::host_accessible>,
29-
cuda::std::tuple<cuda::mr::host_accessible, cuda::mr::device_accessible>>)
26+
#if _CCCL_CUDACC_AT_LEAST(12, 6)
27+
using test_types = c2h::type_list<cuda::std::tuple<cuda::mr::host_accessible>,
28+
cuda::std::tuple<cuda::mr::device_accessible>,
29+
cuda::std::tuple<cuda::mr::host_accessible, cuda::mr::device_accessible>>;
30+
#else
31+
using test_types = c2h::type_list<cuda::std::tuple<cuda::mr::device_accessible>>;
32+
#endif
33+
34+
C2H_TEST("cudax::async_buffer access", "[container][async_buffer]", test_types)
3035
{
3136
using TestT = c2h::get<0, TestType>;
3237
using Env = typename extract_properties<TestT>::env;

cudax/test/containers/async_buffer/assign.cu

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,15 @@
2323
#include "helper.h"
2424
#include "types.h"
2525

26-
C2H_TEST("cudax::async_buffer assign",
27-
"[container][async_buffer]",
28-
c2h::type_list<cuda::std::tuple<cuda::mr::host_accessible>,
29-
cuda::std::tuple<cuda::mr::device_accessible>,
30-
cuda::std::tuple<cuda::mr::host_accessible, cuda::mr::device_accessible>>)
26+
#if _CCCL_CUDACC_AT_LEAST(12, 6)
27+
using test_types = c2h::type_list<cuda::std::tuple<cuda::mr::host_accessible>,
28+
cuda::std::tuple<cuda::mr::device_accessible>,
29+
cuda::std::tuple<cuda::mr::host_accessible, cuda::mr::device_accessible>>;
30+
#else
31+
using test_types = c2h::type_list<cuda::std::tuple<cuda::mr::device_accessible>>;
32+
#endif
33+
34+
C2H_TEST("cudax::async_buffer assign", "[container][async_buffer]", test_types)
3135
{
3236
using TestT = c2h::get<0, TestType>;
3337
using Env = typename extract_properties<TestT>::env;
@@ -224,6 +228,7 @@ C2H_TEST("cudax::async_buffer assign",
224228
CUDAX_CHECK(equal_range(buf));
225229
}
226230
}
231+
stream.sync();
227232

228233
#if 0 // Implement exceptions
229234
# if _CCCL_HAS_EXCEPTIONS()

cudax/test/containers/async_buffer/capacity.cu

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,15 @@
2222
#include "helper.h"
2323
#include "types.h"
2424

25-
C2H_TEST("cudax::async_buffer capacity",
26-
"[container][async_buffer]",
27-
c2h::type_list<cuda::std::tuple<cuda::mr::host_accessible>,
28-
cuda::std::tuple<cuda::mr::device_accessible>,
29-
cuda::std::tuple<cuda::mr::host_accessible, cuda::mr::device_accessible>>)
25+
#if _CCCL_CUDACC_AT_LEAST(12, 6)
26+
using test_types = c2h::type_list<cuda::std::tuple<cuda::mr::host_accessible>,
27+
cuda::std::tuple<cuda::mr::device_accessible>,
28+
cuda::std::tuple<cuda::mr::host_accessible, cuda::mr::device_accessible>>;
29+
#else
30+
using test_types = c2h::type_list<cuda::std::tuple<cuda::mr::device_accessible>>;
31+
#endif
32+
33+
C2H_TEST("cudax::async_buffer capacity", "[container][async_buffer]", test_types)
3034
{
3135
using TestT = c2h::get<0, TestType>;
3236
using Env = typename extract_properties<TestT>::env;

cudax/test/containers/async_buffer/comparison.cu

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,16 @@
1818
#include "helper.h"
1919
#include "types.h"
2020

21+
#if _CCCL_CUDACC_AT_LEAST(12, 6)
22+
using test_types = c2h::type_list<cuda::std::tuple<cuda::mr::host_accessible>,
23+
cuda::std::tuple<cuda::mr::device_accessible>,
24+
cuda::std::tuple<cuda::mr::host_accessible, cuda::mr::device_accessible>>;
25+
#else
26+
using test_types = c2h::type_list<cuda::std::tuple<cuda::mr::device_accessible>>;
27+
#endif
28+
2129
// TODO: only device accessible resource
22-
C2H_TEST("cudax::async_buffer comparison",
23-
"[container][async_buffer]",
24-
c2h::type_list<cuda::std::tuple<cuda::mr::host_accessible>,
25-
cuda::std::tuple<cuda::mr::device_accessible>,
26-
cuda::std::tuple<cuda::mr::host_accessible, cuda::mr::device_accessible>>)
30+
C2H_TEST("cudax::async_buffer comparison", "[container][async_buffer]", test_types)
2731
{
2832
using TestT = c2h::get<0, TestType>;
2933
using Env = typename extract_properties<TestT>::env;

cudax/test/containers/async_buffer/constructor.cu

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,15 @@
2323
#include "helper.h"
2424
#include "types.h"
2525

26-
C2H_TEST("cudax::async_buffer constructors",
27-
"[container][async_buffer]",
28-
c2h::type_list<cuda::std::tuple<cuda::mr::host_accessible>,
29-
cuda::std::tuple<cuda::mr::device_accessible>,
30-
cuda::std::tuple<cuda::mr::host_accessible, cuda::mr::device_accessible>>)
26+
#if _CCCL_CUDACC_AT_LEAST(12, 6)
27+
using test_types = c2h::type_list<cuda::std::tuple<cuda::mr::host_accessible>,
28+
cuda::std::tuple<cuda::mr::device_accessible>,
29+
cuda::std::tuple<cuda::mr::host_accessible, cuda::mr::device_accessible>>;
30+
#else
31+
using test_types = c2h::type_list<cuda::std::tuple<cuda::mr::device_accessible>>;
32+
#endif
33+
34+
C2H_TEST("cudax::async_buffer constructors", "[container][async_buffer]", test_types)
3135
{
3236
using TestT = c2h::get<0, TestType>;
3337
using Env = typename extract_properties<TestT>::env;

cudax/test/containers/async_buffer/conversion.cu

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,15 @@
2222
#include "test_resources.h"
2323
#include "types.h"
2424

25-
C2H_TEST("cudax::async_buffer conversion",
26-
"[container][async_buffer]",
27-
c2h::type_list<cuda::std::tuple<cuda::mr::host_accessible>,
28-
cuda::std::tuple<cuda::mr::device_accessible>,
29-
cuda::std::tuple<cuda::mr::host_accessible, cuda::mr::device_accessible>>)
25+
#if _CCCL_CUDACC_AT_LEAST(12, 6)
26+
using test_types = c2h::type_list<cuda::std::tuple<cuda::mr::host_accessible>,
27+
cuda::std::tuple<cuda::mr::device_accessible>,
28+
cuda::std::tuple<cuda::mr::host_accessible, cuda::mr::device_accessible>>;
29+
#else
30+
using test_types = c2h::type_list<cuda::std::tuple<cuda::mr::device_accessible>>;
31+
#endif
32+
33+
C2H_TEST("cudax::async_buffer conversion", "[container][async_buffer]", test_types)
3034
{
3135
using TestT = c2h::get<0, TestType>;
3236
using Env = typename extract_properties<TestT>::env;

cudax/test/containers/async_buffer/copy.cu

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,15 @@
2222
#include "helper.h"
2323
#include "types.h"
2424

25-
// TODO: only device accessible resource
26-
C2H_TEST("cudax::async_buffer make_async_buffer",
27-
"[container][async_buffer]",
28-
c2h::type_list<cuda::std::tuple<cuda::mr::host_accessible>,
29-
cuda::std::tuple<cuda::mr::device_accessible>,
30-
cuda::std::tuple<cuda::mr::host_accessible, cuda::mr::device_accessible>>)
25+
#if _CCCL_CUDACC_AT_LEAST(12, 6)
26+
using test_types = c2h::type_list<cuda::std::tuple<cuda::mr::host_accessible>,
27+
cuda::std::tuple<cuda::mr::device_accessible>,
28+
cuda::std::tuple<cuda::mr::host_accessible, cuda::mr::device_accessible>>;
29+
#else
30+
using test_types = c2h::type_list<cuda::std::tuple<cuda::mr::device_accessible>>;
31+
#endif
32+
33+
C2H_TEST("cudax::async_buffer make_async_buffer", "[container][async_buffer]", test_types)
3134
{
3235
using TestT = c2h::get<0, TestType>;
3336
using Env = typename extract_properties<TestT>::env;

cudax/test/containers/async_buffer/helper.h

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -137,31 +137,6 @@ constexpr bool equal_range(const Range1& range1, const Range2& range2)
137137
}
138138
}
139139

140-
struct fake_async_pinned_memory_resource : cudax::legacy_pinned_memory_resource
141-
{
142-
using legacy_pinned_memory_resource::legacy_pinned_memory_resource;
143-
144-
void* allocate_async(size_t size, size_t alignment, [[maybe_unused]] ::cuda::stream_ref stream)
145-
{
146-
return allocate(size, alignment);
147-
}
148-
149-
void* allocate_async(size_t size, [[maybe_unused]] ::cuda::stream_ref stream)
150-
{
151-
return allocate(size);
152-
}
153-
154-
void deallocate_async(void* ptr, size_t size, size_t alignment, [[maybe_unused]] ::cuda::stream_ref stream)
155-
{
156-
return deallocate(ptr, size, alignment);
157-
}
158-
159-
void deallocate_async(void* ptr, size_t size, [[maybe_unused]] ::cuda::stream_ref stream)
160-
{
161-
return deallocate(ptr, size);
162-
}
163-
};
164-
165140
// helper class as we need to pass the properties in a tuple to the catch tests
166141
template <class>
167142
struct extract_properties;
@@ -171,16 +146,13 @@ struct extract_properties<cuda::std::tuple<Properties...>>
171146
{
172147
using env = cudax::env_t<other_property, Properties...>;
173148
using async_buffer = cudax::async_buffer<int, Properties...>;
174-
using resource =
175-
caching_resource<cuda::std::conditional_t<cuda::mr::__is_host_device_accessible<Properties...>,
149+
using resource = cuda::std::conditional_t<cuda::mr::__is_host_accessible<Properties...>,
176150
#if _CCCL_CUDACC_AT_LEAST(12, 6)
177-
cudax::pinned_memory_resource,
151+
cudax::pinned_memory_resource,
178152
#else
179-
fake_async_pinned_memory_resource,
153+
void,
180154
#endif
181-
cuda::std::conditional_t<cuda::mr::__is_host_accessible<Properties...>,
182-
host_memory_resource<int>,
183-
cudax::device_memory_resource>>>;
155+
cudax::device_memory_resource>;
184156
using iterator = cudax::heterogeneous_iterator<int, Properties...>;
185157
using const_iterator = cudax::heterogeneous_iterator<const int, Properties...>;
186158

cudax/test/containers/async_buffer/iterators.cu

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,15 @@
2424
#include "helper.h"
2525
#include "types.h"
2626

27-
C2H_TEST("cudax::async_buffer iterators",
28-
"[container][async_buffer]",
29-
c2h::type_list<cuda::std::tuple<cuda::mr::host_accessible>,
30-
cuda::std::tuple<cuda::mr::device_accessible>,
31-
cuda::std::tuple<cuda::mr::host_accessible, cuda::mr::device_accessible>>)
27+
#if _CCCL_CUDACC_AT_LEAST(12, 6)
28+
using test_types = c2h::type_list<cuda::std::tuple<cuda::mr::host_accessible>,
29+
cuda::std::tuple<cuda::mr::device_accessible>,
30+
cuda::std::tuple<cuda::mr::host_accessible, cuda::mr::device_accessible>>;
31+
#else
32+
using test_types = c2h::type_list<cuda::std::tuple<cuda::mr::device_accessible>>;
33+
#endif
34+
35+
C2H_TEST("cudax::async_buffer iterators", "[container][async_buffer]", test_types)
3236
{
3337
using TestT = c2h::get<0, TestType>;
3438
using Env = typename extract_properties<TestT>::env;

cudax/test/containers/async_buffer/properties.cu

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,15 @@
2121
#include "helper.h"
2222
#include "types.h"
2323

24-
C2H_TEST("cudax::async_buffer properties",
25-
"[container][async_buffer]",
26-
c2h::type_list<cuda::std::tuple<cuda::mr::host_accessible>,
27-
cuda::std::tuple<cuda::mr::device_accessible>,
28-
cuda::std::tuple<cuda::mr::host_accessible, cuda::mr::device_accessible>>)
24+
#if _CCCL_CUDACC_AT_LEAST(12, 6)
25+
using test_types = c2h::type_list<cuda::std::tuple<cuda::mr::host_accessible>,
26+
cuda::std::tuple<cuda::mr::device_accessible>,
27+
cuda::std::tuple<cuda::mr::host_accessible, cuda::mr::device_accessible>>;
28+
#else
29+
using test_types = c2h::type_list<cuda::std::tuple<cuda::mr::device_accessible>>;
30+
#endif
31+
32+
C2H_TEST("cudax::async_buffer properties", "[container][async_buffer]", test_types)
2933
{
3034
using TestT = c2h::get<0, TestType>;
3135
using Buffer = typename extract_properties<TestT>::async_buffer;

0 commit comments

Comments
 (0)