Skip to content

Commit

Permalink
Guard resource_ref and friends behind feature flag
Browse files Browse the repository at this point in the history
We still have some questions about the final design, so we want to keep them behind a feature flag.
  • Loading branch information
miscco committed Apr 30, 2024
1 parent 41301ce commit 14b9bf4
Show file tree
Hide file tree
Showing 38 changed files with 46 additions and 14 deletions.
2 changes: 2 additions & 0 deletions libcudacxx/docs/extended_api/memory_resource.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

The `<cuda/memory_resource>` header provides a standard C++ interface for *heterogeneous*, *stream-ordered* memory allocation tailored to the needs of CUDA C++ developers. This design builds off of the success of the [RAPIDS Memory Manager (RMM)](https://github.com/rapidsai/rmm) project and evolves the design based on lessons learned. `<cuda/memory_resource>` is not intended to replace RMM, but instead moves the definition of the memory allocation interface to a more centralized home in CCCL. RMM will remain as a collection of implementations of the `cuda::mr` interfaces.

We are still experimenting with the design, so for now the contents of `<cuda/memory_resource>` are only available if `LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE` is defined.

At a high level, the header provides:

1. the [`cuda::get_property`] infrastructure to tag a user defined type with a given property;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# pragma system_header
#endif // no system header

#if !defined(_CCCL_COMPILER_MSVC_2017)
#if !defined(_CCCL_COMPILER_MSVC_2017) && defined(LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE)

# if !defined(_CCCL_CUDA_COMPILER_NVCC) && !defined(_CCCL_CUDA_COMPILER_NVHPC)
# include <cuda_runtime_api.h>
Expand Down Expand Up @@ -186,6 +186,6 @@ _LIBCUDACXX_END_NAMESPACE_CUDA_MR

# endif // _CCCL_STD_VER >= 2014

#endif // !_CCCL_COMPILER_MSVC_2017
#endif // !_CCCL_COMPILER_MSVC_2017 && LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE

#endif //_CUDA__MEMORY_RESOURCE_CUDA_MANAGED_MEMORY_RESOURCE_H
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# pragma system_header
#endif // no system header

#if !defined(_CCCL_COMPILER_MSVC_2017)
#if !defined(_CCCL_COMPILER_MSVC_2017) && defined(LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE)

# if !defined(_CCCL_CUDA_COMPILER_NVCC) && !defined(_CCCL_CUDA_COMPILER_NVHPC)
# include <cuda_runtime_api.h>
Expand Down Expand Up @@ -159,6 +159,6 @@ _LIBCUDACXX_END_NAMESPACE_CUDA_MR

# endif // _CCCL_STD_VER >= 2014

#endif // !_CCCL_COMPILER_MSVC_2017
#endif // !_CCCL_COMPILER_MSVC_2017 && LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE

#endif //_CUDA__MEMORY_RESOURCE_CUDA_MEMORY_RESOURCE_H
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# pragma system_header
#endif // no system header

#if !defined(_CCCL_COMPILER_MSVC_2017)
#if !defined(_CCCL_COMPILER_MSVC_2017) && defined(LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE)

# if !defined(_CCCL_CUDA_COMPILER_NVCC) && !defined(_CCCL_CUDA_COMPILER_NVHPC)
# include <cuda_runtime.h>
Expand Down Expand Up @@ -187,6 +187,6 @@ _LIBCUDACXX_END_NAMESPACE_CUDA_MR

# endif // _CCCL_STD_VER >= 2014

#endif // !_CCCL_COMPILER_MSVC_2017
#endif // !_CCCL_COMPILER_MSVC_2017 && LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE

#endif //_CUDA__MEMORY_RESOURCE_CUDA_PINNED_MEMORY_RESOURCE_H
4 changes: 2 additions & 2 deletions libcudacxx/include/cuda/__memory_resource/get_property.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# pragma system_header
#endif // no system header

#if !defined(_CCCL_COMPILER_MSVC_2017)
#if !defined(_CCCL_COMPILER_MSVC_2017) && defined(LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE)

# include <cuda/std/__concepts/same_as.h>
# include <cuda/std/__type_traits/remove_const_ref.h>
Expand Down Expand Up @@ -130,6 +130,6 @@ _LIBCUDACXX_END_NAMESPACE_CUDA

# endif // _CCCL_STD_VER >= 2014

#endif // !_CCCL_COMPILER_MSVC_2017
#endif // !_CCCL_COMPILER_MSVC_2017 && LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE

#endif //_CUDA__MEMORY_RESOURCE_GET_PROPERTY_H
4 changes: 2 additions & 2 deletions libcudacxx/include/cuda/__memory_resource/properties.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#include <cuda/std/cstddef>

#if !defined(_CCCL_COMPILER_MSVC_2017)
#if !defined(_CCCL_COMPILER_MSVC_2017) && defined(LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE)

# if _CCCL_STD_VER >= 2014

Expand Down Expand Up @@ -67,6 +67,6 @@ _LIBCUDACXX_END_NAMESPACE_CUDA_MR

# endif // _CCCL_STD_VER >= 2014

#endif // !_CCCL_COMPILER_MSVC_2017
#endif // !_CCCL_COMPILER_MSVC_2017 && LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE

#endif //_CUDA__MEMORY_RESOURCE_PROPERTIES_H
4 changes: 2 additions & 2 deletions libcudacxx/include/cuda/__memory_resource/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# pragma system_header
#endif // no system header

#if !defined(_CCCL_COMPILER_MSVC_2017)
#if !defined(_CCCL_COMPILER_MSVC_2017) && defined(LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE)

# include <cuda/__memory_resource/get_property.h>
# include <cuda/std/__concepts/all_of.h>
Expand Down Expand Up @@ -80,6 +80,6 @@ _LIBCUDACXX_END_NAMESPACE_CUDA_MR

# endif // _CCCL_STD_VER >= 2014

#endif // !_CCCL_COMPILER_MSVC_2017
#endif // !_CCCL_COMPILER_MSVC_2017 && LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE

#endif //_CUDA__MEMORY_RESOURCE_RESOURCE_H
4 changes: 2 additions & 2 deletions libcudacxx/include/cuda/__memory_resource/resource_ref.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# pragma system_header
#endif // no system header

#if !defined(_CCCL_COMPILER_MSVC_2017)
#if !defined(_CCCL_COMPILER_MSVC_2017) && defined(LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE)

# include <cuda/__memory_resource/get_property.h>
# include <cuda/__memory_resource/resource.h>
Expand Down Expand Up @@ -390,6 +390,6 @@ _LIBCUDACXX_END_NAMESPACE_CUDA_MR

# endif // _CCCL_STD_VER >= 2014

#endif // !_CCCL_COMPILER_MSVC_2017
#endif // !_CCCL_COMPILER_MSVC_2017 && LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE

#endif //_CUDA__MEMORY_RESOURCE_RESOURCE_REF_H
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// UNSUPPORTED: c++03, c++11
// UNSUPPORTED: msvc-19.16
// UNSUPPORTED: nvrtc
#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE

#include <cuda/memory_resource>
#include <cuda/std/cassert>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// UNSUPPORTED: c++03, c++11
// UNSUPPORTED: msvc-19.16
// UNSUPPORTED: nvrtc
#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE

#include <cuda/memory_resource>
#include <cuda/std/cassert>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// UNSUPPORTED: c++03, c++11
// UNSUPPORTED: msvc-19.16
// UNSUPPORTED: nvrtc
#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE

#include <cuda/memory_resource>
#include <cuda/std/type_traits>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// UNSUPPORTED: c++03, c++11
// UNSUPPORTED: msvc-19.16
// UNSUPPORTED: nvrtc
#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE

#include <cuda/memory_resource>
#include <cuda/std/cassert>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// UNSUPPORTED: c++03, c++11
// UNSUPPORTED: msvc-19.16
// UNSUPPORTED: nvrtc
#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE

#include <cuda/memory_resource>
#include <cuda/std/cassert>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// UNSUPPORTED: c++03, c++11
// UNSUPPORTED: msvc-19.16
// UNSUPPORTED: nvrtc
#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE

#include <cuda/memory_resource>
#include <cuda/std/type_traits>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// UNSUPPORTED: c++03, c++11
// UNSUPPORTED: msvc-19.16
// UNSUPPORTED: nvrtc
#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE

#include <cuda/memory_resource>
#include <cuda/std/cassert>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// UNSUPPORTED: c++03, c++11
// UNSUPPORTED: msvc-19.16
// UNSUPPORTED: nvrtc
#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE

#include <cuda/memory_resource>
#include <cuda/std/cassert>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// UNSUPPORTED: c++03, c++11
// UNSUPPORTED: msvc-19.16
// UNSUPPORTED: nvrtc
#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE

#include <cuda/memory_resource>
#include <cuda/std/type_traits>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// UNSUPPORTED: c++03, c++11
// UNSUPPORTED: msvc-19.16
// UNSUPPORTED: nvrtc
#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE
// cuda::forward_property

#include <cuda/memory_resource>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// UNSUPPORTED: c++03, c++11
// UNSUPPORTED: msvc-19.16
// UNSUPPORTED: nvrtc
#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE

// cuda::get_property

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// UNSUPPORTED: c++03, c++11
// UNSUPPORTED: msvc-19.16
// UNSUPPORTED: nvrtc
#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE

// cuda::has_property, cuda::has_property_with

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// UNSUPPORTED: c++03, c++11
// UNSUPPORTED: msvc-19.16
// UNSUPPORTED: nvrtc
#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE

// cuda::mr::async_resource_ref properties

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// UNSUPPORTED: c++03, c++11
// UNSUPPORTED: msvc-19.16
// UNSUPPORTED: nvrtc
#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE

// cuda::mr::async_resource_ref construction

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// UNSUPPORTED: c++03, c++11
// UNSUPPORTED: msvc-19.16
// UNSUPPORTED: nvrtc
#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE

// cuda::mr::resource_ref properties

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// UNSUPPORTED: c++03, c++11
// UNSUPPORTED: msvc-19.16
// UNSUPPORTED: nvrtc
#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE

// cuda::mr::async_resource_ref equality

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// UNSUPPORTED: c++03, c++11
// UNSUPPORTED: msvc-19.16
// UNSUPPORTED: nvrtc
#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE

// cuda::mr::async_resource_ref equality

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// UNSUPPORTED: c++03, c++11
// UNSUPPORTED: msvc-19.16
// UNSUPPORTED: nvrtc
#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE

// cuda::mr::resource_ref properties

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// UNSUPPORTED: c++03, c++11
// UNSUPPORTED: msvc-19.16
// UNSUPPORTED: nvrtc
#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE

// cuda::mr::async_resource_ref properties

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// UNSUPPORTED: c++03, c++11
// UNSUPPORTED: msvc-19.16
// UNSUPPORTED: nvrtc
#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE

// cuda::mr::async_resource

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// UNSUPPORTED: c++03, c++11
// UNSUPPORTED: msvc-19.16
// UNSUPPORTED: nvrtc
#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE

// cuda::mr::async_resource_with

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// UNSUPPORTED: c++03, c++11
// UNSUPPORTED: msvc-19.16
// UNSUPPORTED: nvrtc
#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE

// cuda::mr::resource

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// UNSUPPORTED: c++03, c++11
// UNSUPPORTED: msvc-19.16
// UNSUPPORTED: nvrtc
#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE

// cuda::mr::resource_with

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// UNSUPPORTED: c++03, c++11
// UNSUPPORTED: msvc-19.16
// UNSUPPORTED: nvrtc
#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE

// cuda::mr::resource_ref properties

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// UNSUPPORTED: c++03, c++11
// UNSUPPORTED: msvc-19.16
// UNSUPPORTED: nvrtc
#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE

// cuda::mr::resource_ref construction

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// UNSUPPORTED: c++03, c++11
// UNSUPPORTED: msvc-19.16
// UNSUPPORTED: nvrtc
#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE

// cuda::mr::resource_ref properties

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// UNSUPPORTED: c++03, c++11
// UNSUPPORTED: msvc-19.16
// UNSUPPORTED: nvrtc
#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE

// cuda::mr::resource_ref equality

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// UNSUPPORTED: c++03, c++11
// UNSUPPORTED: msvc-19.16
// UNSUPPORTED: nvrtc
#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE

// cuda::mr::resource_ref equality

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// UNSUPPORTED: c++03, c++11
// UNSUPPORTED: msvc-19.16
// UNSUPPORTED: nvrtc
#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE

// cuda::mr::resource_ref properties

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// UNSUPPORTED: c++03, c++11
// UNSUPPORTED: msvc-19.16
// UNSUPPORTED: nvrtc
#define LIBCUDACXX_ENABLE_EXPERIMENTAL_MEMORY_RESOURCE

// cuda::mr::resource_ref properties

Expand Down

0 comments on commit 14b9bf4

Please sign in to comment.