diff --git a/.upstream-tests/test/cuda/memory_resource/get_property/forward_property.pass.cpp b/.upstream-tests/test/cuda/memory_resource/get_property/forward_property.pass.cpp index fd7dcc167e..fd76c205d8 100644 --- a/.upstream-tests/test/cuda/memory_resource/get_property/forward_property.pass.cpp +++ b/.upstream-tests/test/cuda/memory_resource/get_property/forward_property.pass.cpp @@ -10,10 +10,13 @@ // UNSUPPORTED: c++03, c++11 // cuda::forward_property + +#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE + #include #include -namespace has_upstream_resource { +namespace has_upstream_resource { struct Upstream{}; __device__ Upstream upstream{}; @@ -53,7 +56,7 @@ namespace forward_property { struct prop {}; template - struct derived_plain : public cuda::forward_property, Upstream> + struct derived_plain : public cuda::forward_property, Upstream> { constexpr Upstream upstream_resource() const noexcept { return Upstream{}; } }; @@ -81,10 +84,10 @@ namespace forward_property { static_assert( cuda::has_property, prop>, ""); static_assert( cuda::has_property, prop_with_value>, ""); - struct derived_override : public cuda::forward_property + struct derived_override : public cuda::forward_property { - constexpr upstream_with_both_properties upstream_resource() const noexcept { - return upstream_with_both_properties{}; + constexpr upstream_with_both_properties upstream_resource() const noexcept { + return upstream_with_both_properties{}; } // Get called directly so needs to be annotated __host__ __device__ friend constexpr int get_property(const derived_override&, prop_with_value) { @@ -98,10 +101,10 @@ namespace forward_property { } }; - struct derived_with_converstin_upstream_resource : public cuda::forward_property + struct derived_with_converstin_upstream_resource : public cuda::forward_property { - constexpr convertible_to_upstream upstream_resource() const noexcept { - return convertible_to_upstream{}; + constexpr convertible_to_upstream upstream_resource() const noexcept { + return convertible_to_upstream{}; } }; static_assert(!cuda::has_property); @@ -110,7 +113,7 @@ namespace forward_property { using derived_no_override = derived_plain; const derived_no_override without_override{}; assert(get_property(without_override, prop_with_value{}) == 42); - + const derived_override with_override{}; assert(get_property(with_override, prop_with_value{}) == 1337); @@ -122,5 +125,5 @@ namespace forward_property { int main(int, char**) { forward_property::test_stateful(); static_assert(forward_property::test_stateful(), ""); - return 0; + return 0; } diff --git a/.upstream-tests/test/cuda/memory_resource/get_property/get_property.pass.cpp b/.upstream-tests/test/cuda/memory_resource/get_property/get_property.pass.cpp index fab8609cee..5582faa653 100644 --- a/.upstream-tests/test/cuda/memory_resource/get_property/get_property.pass.cpp +++ b/.upstream-tests/test/cuda/memory_resource/get_property/get_property.pass.cpp @@ -10,6 +10,9 @@ // UNSUPPORTED: c++03, c++11 // cuda::get_property + +#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE + #include #include @@ -44,10 +47,10 @@ static_assert( cuda::std::invocable struct prop_with_value { diff --git a/.upstream-tests/test/cuda/memory_resource/memory_resource.async_resource_ref/async_resource_ref.allocate.pass.cpp b/.upstream-tests/test/cuda/memory_resource/memory_resource.async_resource_ref/async_resource_ref.allocate.pass.cpp index 8a013ddf80..ae565b9c57 100644 --- a/.upstream-tests/test/cuda/memory_resource/memory_resource.async_resource_ref/async_resource_ref.allocate.pass.cpp +++ b/.upstream-tests/test/cuda/memory_resource/memory_resource.async_resource_ref/async_resource_ref.allocate.pass.cpp @@ -10,6 +10,9 @@ // UNSUPPORTED: c++03, c++11 // cuda::mr::async_resource_ref properties + +#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE + #include #include diff --git a/.upstream-tests/test/cuda/memory_resource/memory_resource.async_resource_ref/async_resource_ref.construction.pass.cpp b/.upstream-tests/test/cuda/memory_resource/memory_resource.async_resource_ref/async_resource_ref.construction.pass.cpp index 7d773f0377..672a4fae96 100644 --- a/.upstream-tests/test/cuda/memory_resource/memory_resource.async_resource_ref/async_resource_ref.construction.pass.cpp +++ b/.upstream-tests/test/cuda/memory_resource/memory_resource.async_resource_ref/async_resource_ref.construction.pass.cpp @@ -10,6 +10,9 @@ // UNSUPPORTED: c++03, c++11 // cuda::mr::async_resource_ref construction + +#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE + #include #include diff --git a/.upstream-tests/test/cuda/memory_resource/memory_resource.async_resource_ref/async_resource_ref.conversion.pass.cpp b/.upstream-tests/test/cuda/memory_resource/memory_resource.async_resource_ref/async_resource_ref.conversion.pass.cpp index c1da2c5a09..15a04c2b71 100644 --- a/.upstream-tests/test/cuda/memory_resource/memory_resource.async_resource_ref/async_resource_ref.conversion.pass.cpp +++ b/.upstream-tests/test/cuda/memory_resource/memory_resource.async_resource_ref/async_resource_ref.conversion.pass.cpp @@ -10,6 +10,9 @@ // UNSUPPORTED: c++03, c++11 // cuda::mr::resource_ref properties + +#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE + #include #include diff --git a/.upstream-tests/test/cuda/memory_resource/memory_resource.async_resource_ref/async_resource_ref.equality.fail.cpp b/.upstream-tests/test/cuda/memory_resource/memory_resource.async_resource_ref/async_resource_ref.equality.fail.cpp index 77b39d0cb7..1116a13e11 100644 --- a/.upstream-tests/test/cuda/memory_resource/memory_resource.async_resource_ref/async_resource_ref.equality.fail.cpp +++ b/.upstream-tests/test/cuda/memory_resource/memory_resource.async_resource_ref/async_resource_ref.equality.fail.cpp @@ -10,6 +10,9 @@ // UNSUPPORTED: c++03, c++11 // cuda::mr::async_resource_ref equality + +#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE + #include #include diff --git a/.upstream-tests/test/cuda/memory_resource/memory_resource.async_resource_ref/async_resource_ref.equality.pass.cpp b/.upstream-tests/test/cuda/memory_resource/memory_resource.async_resource_ref/async_resource_ref.equality.pass.cpp index e5ef35e98f..a4feced151 100644 --- a/.upstream-tests/test/cuda/memory_resource/memory_resource.async_resource_ref/async_resource_ref.equality.pass.cpp +++ b/.upstream-tests/test/cuda/memory_resource/memory_resource.async_resource_ref/async_resource_ref.equality.pass.cpp @@ -10,6 +10,9 @@ // UNSUPPORTED: c++03, c++11 // cuda::mr::async_resource_ref equality + +#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE + #include #include diff --git a/.upstream-tests/test/cuda/memory_resource/memory_resource.async_resource_ref/async_resource_ref.inheritance.pass.cpp b/.upstream-tests/test/cuda/memory_resource/memory_resource.async_resource_ref/async_resource_ref.inheritance.pass.cpp index 4ecbda80b8..2f6f3bf883 100644 --- a/.upstream-tests/test/cuda/memory_resource/memory_resource.async_resource_ref/async_resource_ref.inheritance.pass.cpp +++ b/.upstream-tests/test/cuda/memory_resource/memory_resource.async_resource_ref/async_resource_ref.inheritance.pass.cpp @@ -10,6 +10,9 @@ // UNSUPPORTED: c++03, c++11 // cuda::mr::resource_ref properties + +#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE + #include #include diff --git a/.upstream-tests/test/cuda/memory_resource/memory_resource.async_resource_ref/async_resource_ref.properties.pass.cpp b/.upstream-tests/test/cuda/memory_resource/memory_resource.async_resource_ref/async_resource_ref.properties.pass.cpp index d1c24b7267..73ba361686 100644 --- a/.upstream-tests/test/cuda/memory_resource/memory_resource.async_resource_ref/async_resource_ref.properties.pass.cpp +++ b/.upstream-tests/test/cuda/memory_resource/memory_resource.async_resource_ref/async_resource_ref.properties.pass.cpp @@ -10,6 +10,9 @@ // UNSUPPORTED: c++03, c++11 // cuda::mr::async_resource_ref properties + +#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE + #include #include diff --git a/.upstream-tests/test/cuda/memory_resource/memory_resource.concepts/async_resource.pass.cpp b/.upstream-tests/test/cuda/memory_resource/memory_resource.concepts/async_resource.pass.cpp index 1551e4dc44..a6245bd012 100644 --- a/.upstream-tests/test/cuda/memory_resource/memory_resource.concepts/async_resource.pass.cpp +++ b/.upstream-tests/test/cuda/memory_resource/memory_resource.concepts/async_resource.pass.cpp @@ -10,6 +10,9 @@ // UNSUPPORTED: c++03, c++11 // cuda::mr::async_resource + +#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE + #include #include diff --git a/.upstream-tests/test/cuda/memory_resource/memory_resource.concepts/async_resource_with.pass.cpp b/.upstream-tests/test/cuda/memory_resource/memory_resource.concepts/async_resource_with.pass.cpp index 967f701715..5f2210de28 100644 --- a/.upstream-tests/test/cuda/memory_resource/memory_resource.concepts/async_resource_with.pass.cpp +++ b/.upstream-tests/test/cuda/memory_resource/memory_resource.concepts/async_resource_with.pass.cpp @@ -10,6 +10,9 @@ // UNSUPPORTED: c++03, c++11 // cuda::mr::async_resource_with + +#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE + #include #include diff --git a/.upstream-tests/test/cuda/memory_resource/memory_resource.concepts/resource.pass.cpp b/.upstream-tests/test/cuda/memory_resource/memory_resource.concepts/resource.pass.cpp index bc2d7a86f7..6740350761 100644 --- a/.upstream-tests/test/cuda/memory_resource/memory_resource.concepts/resource.pass.cpp +++ b/.upstream-tests/test/cuda/memory_resource/memory_resource.concepts/resource.pass.cpp @@ -10,6 +10,9 @@ // UNSUPPORTED: c++03, c++11 // cuda::mr::resource + +#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE + #include #include diff --git a/.upstream-tests/test/cuda/memory_resource/memory_resource.concepts/resource_with.pass.cpp b/.upstream-tests/test/cuda/memory_resource/memory_resource.concepts/resource_with.pass.cpp index 75020d7899..c63f0798c8 100644 --- a/.upstream-tests/test/cuda/memory_resource/memory_resource.concepts/resource_with.pass.cpp +++ b/.upstream-tests/test/cuda/memory_resource/memory_resource.concepts/resource_with.pass.cpp @@ -10,6 +10,9 @@ // UNSUPPORTED: c++03, c++11 // cuda::mr::resource_with + +#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE + #include #include diff --git a/.upstream-tests/test/cuda/memory_resource/memory_resource.resource_ref/resource_ref.allocate.pass.cpp b/.upstream-tests/test/cuda/memory_resource/memory_resource.resource_ref/resource_ref.allocate.pass.cpp index 27a9439357..b90746c0dd 100644 --- a/.upstream-tests/test/cuda/memory_resource/memory_resource.resource_ref/resource_ref.allocate.pass.cpp +++ b/.upstream-tests/test/cuda/memory_resource/memory_resource.resource_ref/resource_ref.allocate.pass.cpp @@ -10,6 +10,9 @@ // UNSUPPORTED: c++03, c++11 // cuda::mr::resource_ref properties + +#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE + #include #include diff --git a/.upstream-tests/test/cuda/memory_resource/memory_resource.resource_ref/resource_ref.construction.pass.cpp b/.upstream-tests/test/cuda/memory_resource/memory_resource.resource_ref/resource_ref.construction.pass.cpp index 20e2b6e4a5..1374700a84 100644 --- a/.upstream-tests/test/cuda/memory_resource/memory_resource.resource_ref/resource_ref.construction.pass.cpp +++ b/.upstream-tests/test/cuda/memory_resource/memory_resource.resource_ref/resource_ref.construction.pass.cpp @@ -10,6 +10,9 @@ // UNSUPPORTED: c++03, c++11 // cuda::mr::resource_ref construction + +#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE + #include #include diff --git a/.upstream-tests/test/cuda/memory_resource/memory_resource.resource_ref/resource_ref.conversion.pass.cpp b/.upstream-tests/test/cuda/memory_resource/memory_resource.resource_ref/resource_ref.conversion.pass.cpp index 75dff8f2d5..d93430935b 100644 --- a/.upstream-tests/test/cuda/memory_resource/memory_resource.resource_ref/resource_ref.conversion.pass.cpp +++ b/.upstream-tests/test/cuda/memory_resource/memory_resource.resource_ref/resource_ref.conversion.pass.cpp @@ -10,6 +10,9 @@ // UNSUPPORTED: c++03, c++11 // cuda::mr::resource_ref properties + +#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE + #include #include diff --git a/.upstream-tests/test/cuda/memory_resource/memory_resource.resource_ref/resource_ref.equality.fail.cpp b/.upstream-tests/test/cuda/memory_resource/memory_resource.resource_ref/resource_ref.equality.fail.cpp index 0cf95c89be..8c43807797 100644 --- a/.upstream-tests/test/cuda/memory_resource/memory_resource.resource_ref/resource_ref.equality.fail.cpp +++ b/.upstream-tests/test/cuda/memory_resource/memory_resource.resource_ref/resource_ref.equality.fail.cpp @@ -10,6 +10,9 @@ // UNSUPPORTED: c++03, c++11 // cuda::mr::resource_ref equality + +#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE + #include #include diff --git a/.upstream-tests/test/cuda/memory_resource/memory_resource.resource_ref/resource_ref.equality.pass.cpp b/.upstream-tests/test/cuda/memory_resource/memory_resource.resource_ref/resource_ref.equality.pass.cpp index 6049a90e62..d4b8f4b3ea 100644 --- a/.upstream-tests/test/cuda/memory_resource/memory_resource.resource_ref/resource_ref.equality.pass.cpp +++ b/.upstream-tests/test/cuda/memory_resource/memory_resource.resource_ref/resource_ref.equality.pass.cpp @@ -10,6 +10,9 @@ // UNSUPPORTED: c++03, c++11 // cuda::mr::resource_ref equality + +#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE + #include #include diff --git a/.upstream-tests/test/cuda/memory_resource/memory_resource.resource_ref/resource_ref.inheritance.pass.cpp b/.upstream-tests/test/cuda/memory_resource/memory_resource.resource_ref/resource_ref.inheritance.pass.cpp index dd598d662b..6add9c7ad9 100644 --- a/.upstream-tests/test/cuda/memory_resource/memory_resource.resource_ref/resource_ref.inheritance.pass.cpp +++ b/.upstream-tests/test/cuda/memory_resource/memory_resource.resource_ref/resource_ref.inheritance.pass.cpp @@ -10,6 +10,9 @@ // UNSUPPORTED: c++03, c++11 // cuda::mr::resource_ref properties + +#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE + #include #include diff --git a/.upstream-tests/test/cuda/memory_resource/memory_resource.resource_ref/resource_ref.properties.pass.cpp b/.upstream-tests/test/cuda/memory_resource/memory_resource.resource_ref/resource_ref.properties.pass.cpp index 26fddacf8a..b2641f5b44 100644 --- a/.upstream-tests/test/cuda/memory_resource/memory_resource.resource_ref/resource_ref.properties.pass.cpp +++ b/.upstream-tests/test/cuda/memory_resource/memory_resource.resource_ref/resource_ref.properties.pass.cpp @@ -10,6 +10,9 @@ // UNSUPPORTED: c++03, c++11 // cuda::mr::resource_ref properties + +#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE + #include #include diff --git a/.upstream-tests/test/cuda/stream_ref/stream_ref.constructor.pass.cpp b/.upstream-tests/test/cuda/stream_ref/stream_ref.constructor.pass.cpp index 0c6a899f7a..7b77968255 100644 --- a/.upstream-tests/test/cuda/stream_ref/stream_ref.constructor.pass.cpp +++ b/.upstream-tests/test/cuda/stream_ref/stream_ref.constructor.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE + #include #include #include diff --git a/.upstream-tests/test/cuda/stream_ref/stream_ref.equality.pass.cpp b/.upstream-tests/test/cuda/stream_ref/stream_ref.equality.pass.cpp index b749db58d3..a239eb060d 100644 --- a/.upstream-tests/test/cuda/stream_ref/stream_ref.equality.pass.cpp +++ b/.upstream-tests/test/cuda/stream_ref/stream_ref.equality.pass.cpp @@ -8,6 +8,8 @@ // //===----------------------------------------------------------------------===// +#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE + #include #include diff --git a/.upstream-tests/test/cuda/stream_ref/stream_ref.get.pass.cpp b/.upstream-tests/test/cuda/stream_ref/stream_ref.get.pass.cpp index dcf8c1647c..f7b9fb606d 100644 --- a/.upstream-tests/test/cuda/stream_ref/stream_ref.get.pass.cpp +++ b/.upstream-tests/test/cuda/stream_ref/stream_ref.get.pass.cpp @@ -8,6 +8,8 @@ // //===----------------------------------------------------------------------===// +#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE + #include #include diff --git a/.upstream-tests/test/cuda/stream_ref/stream_ref.ready.fail.cpp b/.upstream-tests/test/cuda/stream_ref/stream_ref.ready.fail.cpp index fa8bcb8891..a298ac2ce5 100644 --- a/.upstream-tests/test/cuda/stream_ref/stream_ref.ready.fail.cpp +++ b/.upstream-tests/test/cuda/stream_ref/stream_ref.ready.fail.cpp @@ -8,6 +8,10 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: nvrtc + +#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE + #include #include diff --git a/.upstream-tests/test/cuda/stream_ref/stream_ref.ready.pass.cpp b/.upstream-tests/test/cuda/stream_ref/stream_ref.ready.pass.cpp index 6df56cf894..e7fd5dc59a 100644 --- a/.upstream-tests/test/cuda/stream_ref/stream_ref.ready.pass.cpp +++ b/.upstream-tests/test/cuda/stream_ref/stream_ref.ready.pass.cpp @@ -8,6 +8,8 @@ // //===----------------------------------------------------------------------===// +#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE + #include #include diff --git a/.upstream-tests/test/cuda/stream_ref/stream_ref.wait.fail.cpp b/.upstream-tests/test/cuda/stream_ref/stream_ref.wait.fail.cpp index 837d03d289..d3c9654260 100644 --- a/.upstream-tests/test/cuda/stream_ref/stream_ref.wait.fail.cpp +++ b/.upstream-tests/test/cuda/stream_ref/stream_ref.wait.fail.cpp @@ -8,6 +8,10 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: nvrtc + +#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE + #include #include diff --git a/.upstream-tests/test/cuda/stream_ref/stream_ref.wait.pass.cpp b/.upstream-tests/test/cuda/stream_ref/stream_ref.wait.pass.cpp index 26c03ca7f5..8d20775b74 100644 --- a/.upstream-tests/test/cuda/stream_ref/stream_ref.wait.pass.cpp +++ b/.upstream-tests/test/cuda/stream_ref/stream_ref.wait.pass.cpp @@ -8,6 +8,8 @@ // //===----------------------------------------------------------------------===// +#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE + #include #include diff --git a/include/cuda/memory_resource b/include/cuda/memory_resource index 31a869ef6b..181770d0d3 100644 --- a/include/cuda/memory_resource +++ b/include/cuda/memory_resource @@ -31,7 +31,7 @@ concept async_resource = resource template concept has_property = resource && requires(const Resource& res, Property prop) { - get_property(res, prop); + get_property(res, prop); }; template @@ -40,11 +40,11 @@ concept property_with_value = requires { }; template -concept has_property_with = resource +concept has_property_with = resource && property_with_value && same_as && requires(const Resource& res, Property prop) { - get_property(res, prop) -> Return; + get_property(res, prop) -> Return; }; template @@ -79,12 +79,18 @@ class resource_ref { } // cuda */ // clang-format on + +#ifndef LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE +#error " is experimental and requires LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE to be defined" +#endif + #include #include #include #include + #include #if _LIBCUDACXX_STD_VER > 11 @@ -152,13 +158,13 @@ struct forward_property { _LIBCUDACXX_TEMPLATE(class _Property) (requires (!property_with_value<_Property>) _LIBCUDACXX_AND has_property<_Upstream, _Property>) _LIBCUDACXX_INLINE_VISIBILITY friend constexpr void get_property(const _Derived&, _Property) noexcept {} - + // The indirection is needed, otherwise the compiler might believe that _Derived is an incomplete type #if defined(__CUDACC__) && !defined(__NVCOMPILER) #pragma nv_exec_check_disable #endif _LIBCUDACXX_TEMPLATE(class _Property, class _Derived2 = _Derived) - (requires property_with_value<_Property> _LIBCUDACXX_AND has_property<_Upstream, _Property> _LIBCUDACXX_AND + (requires property_with_value<_Property> _LIBCUDACXX_AND has_property<_Upstream, _Property> _LIBCUDACXX_AND __has_upstream_resource<_Derived2, _Upstream>) _LIBCUDACXX_INLINE_VISIBILITY friend constexpr __property_value_t<_Property> get_property( const _Derived& __res, _Property __prop) { @@ -177,7 +183,7 @@ struct __fn { _LIBCUDACXX_TEMPLATE(class _Upstream, class _Property) (requires (!property_with_value<_Property>) _LIBCUDACXX_AND has_property<_Upstream, _Property>) _LIBCUDACXX_INLINE_VISIBILITY constexpr void operator()(const _Upstream&, _Property) const noexcept {} - + #if defined(__CUDACC__) && !defined(__NVCOMPILER) #pragma nv_exec_check_disable #endif @@ -246,7 +252,7 @@ template _LIBCUDACXX_CONCEPT async_resource_with = async_resource<_Resource> && _CUDA_VSTD::conjunction_v<_CUDA_VSTD::bool_constant>...>; #else -_LIBCUDACXX_CONCEPT async_resource_with = async_resource<_Resource> && +_LIBCUDACXX_CONCEPT async_resource_with = async_resource<_Resource> && (has_property<_Resource, _Properties> && ...); #endif @@ -512,14 +518,14 @@ private: public: // clang-format off _LIBCUDACXX_TEMPLATE(class _Resource) - (requires (!_Is_basic_resource_ref<_Resource> + (requires (!_Is_basic_resource_ref<_Resource> && (((_Alloc_type == _AllocType::_Default) && resource_with<_Resource, _Properties...>) // ||((_Alloc_type == _AllocType::_Async) && async_resource_with<_Resource, _Properties...>)))) // basic_resource_ref(_Resource& __res) noexcept : _Resource_ref_base<_Alloc_type>(&__res, &__alloc_vtable<_Alloc_type, _Resource>) , _Filtered_vtable<_Properties...>(_Filtered_vtable<_Properties...>::template _Create<_Resource>()) {} - + #if _LIBCUDACXX_STD_VER > 14 _LIBCUDACXX_TEMPLATE(class... _OtherProperties) (requires (_CUDA_VSTD::_One_of<_Properties, _OtherProperties...> && ...)) @@ -533,14 +539,14 @@ public: : _Resource_ref_base<_Alloc_type>(__ref.__object, __ref.__static_vtable) , _Filtered_vtable<_Properties...>(__ref) {} - + #if _LIBCUDACXX_STD_VER > 14 _LIBCUDACXX_TEMPLATE(class... _OtherProperties) - (requires (_Alloc_type == _AllocType::_Default) + (requires (_Alloc_type == _AllocType::_Default) && (_CUDA_VSTD::_One_of<_Properties, _OtherProperties...> && ...)) #else _LIBCUDACXX_TEMPLATE(class... _OtherProperties) - (requires (_Alloc_type == _AllocType::_Default) + (requires (_Alloc_type == _AllocType::_Default) && _CUDA_VSTD::conjunction_v<_CUDA_VSTD::bool_constant< _CUDA_VSTD::_One_of<_Properties, _OtherProperties...>>...>) #endif @@ -552,11 +558,11 @@ public: #if _LIBCUDACXX_STD_VER > 14 _LIBCUDACXX_TEMPLATE(class... _OtherProperties) - (requires(sizeof...(_Properties) == sizeof...(_OtherProperties)) + (requires(sizeof...(_Properties) == sizeof...(_OtherProperties)) && (_CUDA_VSTD::_One_of<_Properties, _OtherProperties...> && ...)) #else _LIBCUDACXX_TEMPLATE(class... _OtherProperties) - (requires (sizeof...(_Properties) == sizeof...(_OtherProperties)) + (requires (sizeof...(_Properties) == sizeof...(_OtherProperties)) && _CUDA_VSTD::conjunction_v<_CUDA_VSTD::bool_constant< _CUDA_VSTD::_One_of<_Properties, _OtherProperties...>>...>) #endif @@ -568,11 +574,11 @@ public: #if _LIBCUDACXX_STD_VER > 14 _LIBCUDACXX_TEMPLATE(class... _OtherProperties) - (requires (sizeof...(_Properties) == sizeof...(_OtherProperties)) + (requires (sizeof...(_Properties) == sizeof...(_OtherProperties)) && (_CUDA_VSTD::_One_of<_Properties, _OtherProperties...> && ...)) #else _LIBCUDACXX_TEMPLATE(class... _OtherProperties) - (requires (sizeof...(_Properties) == sizeof...(_OtherProperties)) + (requires (sizeof...(_Properties) == sizeof...(_OtherProperties)) && _CUDA_VSTD::conjunction_v<_CUDA_VSTD::bool_constant< _CUDA_VSTD::_One_of<_Properties, _OtherProperties...>>...>) #endif diff --git a/include/cuda/stream_ref b/include/cuda/stream_ref index 2d69a0bc08..b4128421c9 100644 --- a/include/cuda/stream_ref +++ b/include/cuda/stream_ref @@ -39,10 +39,15 @@ private: } // cuda */ +#ifndef LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE +#error " is experimental and requires LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE to be defined" +#endif + #include // cuda_runtime_api needs to come first // clang-format on #include + #include #include