Skip to content

Commit b9a6446

Browse files
authored
Fix buffer docs (#8127)
1 parent d36cdc5 commit b9a6446

File tree

2 files changed

+74
-1
lines changed

2 files changed

+74
-1
lines changed

docs/cudax/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ However, any feature within this library has important use cases and we encourag
1919

2020
Specifically, ``cudax`` provides:
2121
- :ref:`asynchronous host<->device byte-wise mdspan copy <cudax-copy-bytes>`
22-
- :ref:`uninitialized storage <libcudacxx-containers-uninitialized-buffer>`
22+
- :ref:`uninitialized storage <libcudacxx-containers-uninitialized-async-buffer>`
2323
- :ref:`an owning type erased memory resource <libcudacxx-memory-resource-any-async-resource>`
2424
- :ref:`stream-ordered memory resources <libcudacxx-memory-resource-async>`
2525
- :ref:`graph functionality <cudax-graph>`

libcudacxx/include/cuda/__container/buffer.h

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,16 @@ buffer<_Tp, _FirstProperty, _RestProperties...> make_buffer(
735735
return __res;
736736
}
737737

738+
//! @brief Creates a buffer by copying from \p __source, using the default properties of \p __mr
739+
//! @param __stream The stream used for allocation and copy.
740+
//! @param __mr The memory resource used for allocation.
741+
//! @param __source The source buffer to copy from.
742+
//! @param __env The environment providing additional configuration.
743+
# ifdef _CCCL_DOXYGEN_INVOKED
744+
template <class _Tp, class _Resource, class... _SourceProperties, class _Env = ::cuda::std::execution::env<>>
745+
auto make_buffer(
746+
stream_ref __stream, _Resource&& __mr, const buffer<_Tp, _SourceProperties...>& __source, const _Env& __env = {});
747+
# else // ^^^ _CCCL_DOXYGEN_INVOKED ^^^ / vvv !_CCCL_DOXYGEN_INVOKED vvv
738748
_CCCL_TEMPLATE(class _Tp, class _Resource, class... _SourceProperties, class _Env = ::cuda::std::execution::env<>)
739749
_CCCL_REQUIRES(::cuda::mr::synchronous_resource<::cuda::std::decay_t<_Resource>>
740750
_CCCL_AND ::cuda::mr::__has_default_queries<::cuda::std::decay_t<_Resource>>)
@@ -748,6 +758,7 @@ auto make_buffer(
748758

749759
return __res;
750760
}
761+
# endif // _CCCL_DOXYGEN_INVOKED
751762

752763
// Empty buffer make function
753764
_CCCL_TEMPLATE(
@@ -761,6 +772,14 @@ make_buffer(stream_ref __stream, _Resource&& __mr, const _Env& __env = {})
761772
return buffer<_Tp, _FirstProperty, _RestProperties...>{__stream, ::cuda::std::forward<_Resource>(__mr), __env};
762773
}
763774

775+
//! @brief Creates an empty buffer using the default properties of \p __mr
776+
//! @param __stream The stream used for allocation.
777+
//! @param __mr The memory resource used for allocation.
778+
//! @param __env The environment providing additional configuration.
779+
# ifdef _CCCL_DOXYGEN_INVOKED
780+
template <class _Tp, class _Resource, class _Env = ::cuda::std::execution::env<>>
781+
auto make_buffer(stream_ref __stream, _Resource&& __mr, const _Env& __env = {});
782+
# else // ^^^ _CCCL_DOXYGEN_INVOKED ^^^ / vvv !_CCCL_DOXYGEN_INVOKED vvv
764783
_CCCL_TEMPLATE(class _Tp, class _Resource, class _Env = ::cuda::std::execution::env<>)
765784
_CCCL_REQUIRES(::cuda::mr::synchronous_resource<::cuda::std::decay_t<_Resource>>
766785
_CCCL_AND ::cuda::mr::__has_default_queries<::cuda::std::decay_t<_Resource>> _CCCL_AND
@@ -770,6 +789,7 @@ auto make_buffer(stream_ref __stream, _Resource&& __mr, const _Env& __env = {})
770789
using __buffer_type = __buffer_type_for_props<_Tp, typename ::cuda::std::decay_t<_Resource>::default_queries>;
771790
return __buffer_type{__stream, ::cuda::std::forward<_Resource>(__mr), __env};
772791
}
792+
# endif // _CCCL_DOXYGEN_INVOKED
773793

774794
_CCCL_BEGIN_NAMESPACE_ARCH_DEPENDENT
775795

@@ -789,6 +809,16 @@ buffer<_Tp, _FirstProperty, _RestProperties...> make_buffer(
789809
return __res;
790810
}
791811

812+
//! @brief Creates a buffer of \p __size elements initialized to \p __value, using the default properties of \p __mr
813+
//! @param __stream The stream used for allocation and initialization.
814+
//! @param __mr The memory resource used for allocation.
815+
//! @param __size The number of elements.
816+
//! @param __value The value to initialize elements with.
817+
//! @param __env The environment providing additional configuration.
818+
# ifdef _CCCL_DOXYGEN_INVOKED
819+
template <class _Tp, class _Resource, class _Env = ::cuda::std::execution::env<>>
820+
auto make_buffer(stream_ref __stream, _Resource&& __mr, size_t __size, const _Tp& __value, const _Env& __env = {});
821+
# else // ^^^ _CCCL_DOXYGEN_INVOKED ^^^ / vvv !_CCCL_DOXYGEN_INVOKED vvv
792822
_CCCL_TEMPLATE(class _Tp, class _Resource, class _Env = ::cuda::std::execution::env<>)
793823
_CCCL_REQUIRES(::cuda::mr::synchronous_resource<::cuda::std::decay_t<_Resource>>
794824
_CCCL_AND ::cuda::mr::__has_default_queries<::cuda::std::decay_t<_Resource>>)
@@ -802,6 +832,7 @@ auto make_buffer(
802832
__stream, __res.__unwrapped_begin(), __size, __value);
803833
return __res;
804834
}
835+
# endif // _CCCL_DOXYGEN_INVOKED
805836

806837
_CCCL_END_NAMESPACE_ARCH_DEPENDENT
807838

@@ -818,6 +849,15 @@ make_buffer(stream_ref __stream, _Resource&& __mr, size_t __size, ::cuda::no_ini
818849
__stream, ::cuda::std::forward<_Resource>(__mr), __size, ::cuda::no_init, __env};
819850
}
820851

852+
//! @brief Creates a buffer of \p __size uninitialized elements, using the default properties of \p __mr
853+
//! @param __stream The stream used for allocation.
854+
//! @param __mr The memory resource used for allocation.
855+
//! @param __size The number of elements.
856+
//! @param __env The environment providing additional configuration.
857+
# ifdef _CCCL_DOXYGEN_INVOKED
858+
template <class _Tp, class _Resource, class _Env = ::cuda::std::execution::env<>>
859+
auto make_buffer(stream_ref __stream, _Resource&& __mr, size_t __size, ::cuda::no_init_t, const _Env& __env = {});
860+
# else // ^^^ _CCCL_DOXYGEN_INVOKED ^^^ / vvv !_CCCL_DOXYGEN_INVOKED vvv
821861
_CCCL_TEMPLATE(class _Tp, class _Resource, class _Env = ::cuda::std::execution::env<>)
822862
_CCCL_REQUIRES(::cuda::mr::synchronous_resource<::cuda::std::decay_t<_Resource>>
823863
_CCCL_AND ::cuda::mr::__has_default_queries<_Resource>)
@@ -826,6 +866,7 @@ auto make_buffer(stream_ref __stream, _Resource&& __mr, size_t __size, ::cuda::n
826866
using __buffer_type = __buffer_type_for_props<_Tp, typename ::cuda::std::decay_t<_Resource>::default_queries>;
827867
return __buffer_type{__stream, ::cuda::std::forward<_Resource>(__mr), __size, ::cuda::no_init, __env};
828868
}
869+
# endif // _CCCL_DOXYGEN_INVOKED
829870

830871
// Iterator range make function
831872
_CCCL_TEMPLATE(class _Tp,
@@ -844,6 +885,16 @@ make_buffer(stream_ref __stream, _Resource&& __mr, _Iter __first, _Iter __last,
844885
__stream, ::cuda::std::forward<_Resource>(__mr), __first, __last, __env};
845886
}
846887

888+
//! @brief Creates a buffer from the iterator range `[__first, __last)`, using the default properties of \p __mr
889+
//! @param __stream The stream used for allocation and copy.
890+
//! @param __mr The memory resource used for allocation.
891+
//! @param __first The start of the input sequence.
892+
//! @param __last The end of the input sequence.
893+
//! @param __env The environment providing additional configuration.
894+
# ifdef _CCCL_DOXYGEN_INVOKED
895+
template <class _Tp, class _Resource, class _Iter, class _Env = ::cuda::std::execution::env<>>
896+
auto make_buffer(stream_ref __stream, _Resource&& __mr, _Iter __first, _Iter __last, const _Env& __env = {});
897+
# else // ^^^ _CCCL_DOXYGEN_INVOKED ^^^ / vvv !_CCCL_DOXYGEN_INVOKED vvv
847898
_CCCL_TEMPLATE(class _Tp, class _Resource, class _Iter, class _Env = ::cuda::std::execution::env<>)
848899
_CCCL_REQUIRES(
849900
::cuda::mr::synchronous_resource<::cuda::std::decay_t<_Resource>>
@@ -853,6 +904,7 @@ auto make_buffer(stream_ref __stream, _Resource&& __mr, _Iter __first, _Iter __l
853904
using __buffer_type = __buffer_type_for_props<_Tp, typename ::cuda::std::decay_t<_Resource>::default_queries>;
854905
return __buffer_type{__stream, ::cuda::std::forward<_Resource>(__mr), __first, __last, __env};
855906
}
907+
# endif // _CCCL_DOXYGEN_INVOKED
856908

857909
// Initializer list make function
858910
_CCCL_TEMPLATE(
@@ -867,6 +919,16 @@ make_buffer(stream_ref __stream, _Resource&& __mr, ::cuda::std::initializer_list
867919
__stream, ::cuda::std::forward<_Resource>(__mr), __ilist, __env};
868920
}
869921

922+
//! @brief Creates a buffer from \p __ilist, using the default properties of \p __mr
923+
//! @param __stream The stream used for allocation and copy.
924+
//! @param __mr The memory resource used for allocation.
925+
//! @param __ilist The initializer_list being copied into the buffer.
926+
//! @param __env The environment providing additional configuration.
927+
# ifdef _CCCL_DOXYGEN_INVOKED
928+
template <class _Tp, class _Resource, class _Env = ::cuda::std::execution::env<>>
929+
auto make_buffer(
930+
stream_ref __stream, _Resource&& __mr, ::cuda::std::initializer_list<_Tp> __ilist, const _Env& __env = {});
931+
# else // ^^^ _CCCL_DOXYGEN_INVOKED ^^^ / vvv !_CCCL_DOXYGEN_INVOKED vvv
870932
_CCCL_TEMPLATE(class _Tp, class _Resource, class _Env = ::cuda::std::execution::env<>)
871933
_CCCL_REQUIRES(::cuda::mr::synchronous_resource<::cuda::std::decay_t<_Resource>>
872934
_CCCL_AND ::cuda::mr::__has_default_queries<::cuda::std::decay_t<_Resource>>)
@@ -876,6 +938,7 @@ auto make_buffer(
876938
using __buffer_type = __buffer_type_for_props<_Tp, typename ::cuda::std::decay_t<_Resource>::default_queries>;
877939
return __buffer_type{__stream, ::cuda::std::forward<_Resource>(__mr), __ilist, __env};
878940
}
941+
# endif // _CCCL_DOXYGEN_INVOKED
879942

880943
// Range make function for ranges
881944
_CCCL_TEMPLATE(class _Tp,
@@ -894,6 +957,15 @@ make_buffer(stream_ref __stream, _Resource&& __mr, _Range&& __range, const _Env&
894957
__stream, ::cuda::std::forward<_Resource>(__mr), ::cuda::std::forward<_Range>(__range), __env};
895958
}
896959

960+
//! @brief Creates a buffer from \p __range, using the default properties of \p __mr
961+
//! @param __stream The stream used for allocation and copy.
962+
//! @param __mr The memory resource used for allocation.
963+
//! @param __range The input range to be copied into the buffer.
964+
//! @param __env The environment providing additional configuration.
965+
# ifdef _CCCL_DOXYGEN_INVOKED
966+
template <class _Tp, class _Resource, class _Range, class _Env = ::cuda::std::execution::env<>>
967+
auto make_buffer(stream_ref __stream, _Resource&& __mr, _Range&& __range, const _Env& __env = {});
968+
# else // ^^^ _CCCL_DOXYGEN_INVOKED ^^^ / vvv !_CCCL_DOXYGEN_INVOKED vvv
897969
_CCCL_TEMPLATE(class _Tp, class _Resource, class _Range, class _Env = ::cuda::std::execution::env<>)
898970
_CCCL_REQUIRES(
899971
::cuda::mr::synchronous_resource<::cuda::std::decay_t<_Resource>> _CCCL_AND ::cuda::mr::__has_default_queries<
@@ -903,6 +975,7 @@ auto make_buffer(stream_ref __stream, _Resource&& __mr, _Range&& __range, const
903975
using __buffer_type = __buffer_type_for_props<_Tp, typename ::cuda::std::decay_t<_Resource>::default_queries>;
904976
return __buffer_type{__stream, ::cuda::std::forward<_Resource>(__mr), ::cuda::std::forward<_Range>(__range), __env};
905977
}
978+
# endif // _CCCL_DOXYGEN_INVOKED
906979
_CCCL_END_NAMESPACE_CUDA
907980

908981
# include <cuda/std/__cccl/epilogue.h>

0 commit comments

Comments
 (0)