|
Halide 22.0.0
Halide compiler and libraries
|
A Halide::Buffer is a named shared reference to a Halide::Runtime::Buffer. More...
#include <Buffer.h>
Public Types | |
| typedef T | ElemType |
Public Member Functions | |
| virtual | ~Buffer ()=default |
| Buffer ()=default | |
| Make a null Buffer, which points to no Runtime::Buffer. | |
| Buffer (const Buffer &that)=default | |
| Trivial copy constructor. | |
| Buffer & | operator= (const Buffer &that)=default |
| Trivial copy assignment operator. | |
| Buffer & | operator= (Buffer &&) noexcept=default |
| Trivial move assignment operator. | |
| template<typename T2 , int D2> | |
| Buffer (const Buffer< T2, D2 > &other) | |
| Make a Buffer from a Buffer of a different type. | |
| template<typename T2 , int D2> | |
| Buffer (Buffer< T2, D2 > &&other) noexcept | |
| Move construct from a Buffer of a different type. | |
| template<int D2> | |
| Buffer (Runtime::Buffer< T, D2 > &&buf, const std::string &name="") | |
| Construct a Buffer that captures and owns an rvalue Runtime::Buffer. | |
| template<typename... Args, typename = std::enable_if_t<Internal::all_ints_and_optional_name<Args...>::value>> | |
| Buffer (Type t, int first, Args... rest) | |
| Constructors that match Runtime::Buffer with two differences: 1) They take a Type instead of a halide_type_t 2) There is an optional last string argument that gives the buffer a specific name. | |
| Buffer (const halide_buffer_t &buf, const std::string &name="") | |
| template<typename... Args, typename = std::enable_if_t<Internal::all_ints_and_optional_name<Args...>::value>> | |
| Buffer (int first, const Args &...rest) | |
| Buffer (Type t, const std::vector< int > &sizes, const std::string &name="") | |
| Buffer (Type t, const std::vector< int > &sizes, const std::vector< int > &storage_order, const std::string &name="") | |
| Buffer (const std::vector< int > &sizes, const std::string &name="") | |
| Buffer (const std::vector< int > &sizes, const std::vector< int > &storage_order, const std::string &name="") | |
| template<typename Array , size_t N> | |
| Buffer (Array(&vals)[N], const std::string &name="") | |
| template<typename... Args, typename = std::enable_if_t<Internal::all_ints_and_optional_name<Args...>::value>> | |
| Buffer (Type t, Internal::add_const_if_T_is_const< T, void > *data, int first, Args &&...rest) | |
| template<typename... Args, typename = std::enable_if_t<Internal::all_ints_and_optional_name<Args...>::value>> | |
| Buffer (Type t, Internal::add_const_if_T_is_const< T, void > *data, const std::vector< int > &sizes, const std::string &name="") | |
| template<typename... Args, typename = std::enable_if_t<Internal::all_ints_and_optional_name<Args...>::value>> | |
| Buffer (T *data, int first, Args &&...rest) | |
| Buffer (T *data, const std::vector< int > &sizes, const std::string &name="") | |
| Buffer (Type t, Internal::add_const_if_T_is_const< T, void > *data, const std::vector< int > &sizes, const std::string &name="") | |
| Buffer (Type t, Internal::add_const_if_T_is_const< T, void > *data, int d, const halide_dimension_t *shape, const std::string &name="") | |
| Buffer (T *data, int d, const halide_dimension_t *shape, const std::string &name="") | |
| void | set_name (const std::string &n) |
| Buffers are optionally named. | |
| const std::string & | name () const |
| template<typename T2 , int D2> | |
| bool | same_as (const Buffer< T2, D2 > &other) const |
| Check if two Buffer objects point to the same underlying Buffer. | |
| bool | defined () const |
| Check if this Buffer refers to an existing Buffer. | |
| Runtime::Buffer< T, Dims > * | get () |
| Get a pointer to the underlying Runtime::Buffer. | |
| const Runtime::Buffer< T, Dims > * | get () const |
| template<typename Fn , typename... Args> | |
| Buffer< T, Dims > & | for_each_value (Fn &&f, Args... other_buffers) |
| Does the same thing as the equivalent Halide::Runtime::Buffer method. | |
| template<typename Fn , typename... Args> | |
| const Buffer< T, Dims > & | for_each_value (Fn &&f, Args... other_buffers) const |
| template<typename Fn > | |
| Buffer< T, Dims > & | for_each_element (Fn &&f) |
| template<typename Fn > | |
| const Buffer< T, Dims > & | for_each_element (Fn &&f) const |
| template<typename FnOrValue > | |
| Buffer< T, Dims > & | fill (FnOrValue &&f) |
| Type | type () const |
| template<typename T2 , int D2 = Dims> | |
| Buffer< T2, D2 > | as () const |
| Buffer< T, Dims > | copy () const |
| template<typename T2 , int D2> | |
| void | copy_from (const Buffer< T2, D2 > &other) |
| template<typename... Args> | |
| auto | operator() (int first, Args &&...args) -> decltype(std::declval< Runtime::Buffer< T, Dims > >()(first, std::forward< Args >(args)...)) |
| template<typename... Args> | |
| auto | operator() (int first, Args &&...args) const -> decltype(std::declval< const Runtime::Buffer< T, Dims > >()(first, std::forward< Args >(args)...)) |
| auto | operator() (const int *pos) -> decltype(std::declval< Runtime::Buffer< T, Dims > >()(pos)) |
| auto | operator() (const int *pos) const -> decltype(std::declval< const Runtime::Buffer< T, Dims > >()(pos)) |
| auto | operator() () -> decltype(std::declval< Runtime::Buffer< T, Dims > >()()) |
| auto | operator() () const -> decltype(std::declval< const Runtime::Buffer< T, Dims > >()()) |
| template<typename... Args> | |
| const Expr | operator() (const Expr &first, const Args &...rest) const |
| Make an Expr that loads from this concrete buffer at a computed coordinate. | |
| template<typename... Args> | |
| const Expr | operator() (const std::vector< Expr > &args) const |
| int | copy_to_device (const Target &t=get_jit_target_from_environment(), JITUserContext *context=nullptr) |
| Copy to the GPU, using the device API that is the default for the given Target. | |
| int | copy_to_device (const DeviceAPI &d, const Target &t=get_jit_target_from_environment(), JITUserContext *context=nullptr) |
| Copy to the GPU, using the given device API. | |
| int | device_malloc (const Target &t=get_jit_target_from_environment(), JITUserContext *context=nullptr) |
| Allocate on the GPU, using the device API that is the default for the given Target. | |
| int | device_malloc (const DeviceAPI &d, const Target &t=get_jit_target_from_environment(), JITUserContext *context=nullptr) |
| Allocate storage on the GPU, using the given device API. | |
| int | device_wrap_native (const DeviceAPI &d, uint64_t handle, const Target &t=get_jit_target_from_environment(), JITUserContext *context=nullptr) |
| Wrap a native handle, using the given device API. | |
Static Public Attributes | |
| static constexpr int | AnyDims = Halide::AnyDims |
| static constexpr bool | has_static_halide_type = Runtime::Buffer<T, Dims>::has_static_halide_type |
| static constexpr bool | has_static_dimensions = Runtime::Buffer<T, Dims>::has_static_dimensions |
A Halide::Buffer is a named shared reference to a Halide::Runtime::Buffer.
A Buffer<T1, D> can refer to a Buffer<T2, D> if T1 is const whenever T2 is const, and either T1 = T2 or T1 is void. A Buffer<void, D> can refer to any Buffer of any non-const type, and the default template parameter is T = void.
A Buffer<T, D1> can refer to a Buffer<T, D2> if D1 == D2, or if D1 is AnyDims (meaning "dimensionality is checked at runtime, not compiletime").
| typedef T Halide::Buffer< T, Dims >::ElemType |
|
default |
Make a null Buffer, which points to no Runtime::Buffer.
|
default |
Trivial copy constructor.
Make a Buffer from a Buffer of a different type.
Definition at line 180 of file Buffer.h.
References Halide::cast().
|
inlinenoexcept |
Move construct from a Buffer of a different type.
Definition at line 187 of file Buffer.h.
References Halide::cast().
|
inline |
Construct a Buffer that captures and owns an rvalue Runtime::Buffer.
Definition at line 194 of file Buffer.h.
References Halide::Internal, Halide::Buffer< T, Dims >::name(), and Halide::Internal::unique_name().
|
inlineexplicit |
Constructors that match Runtime::Buffer with two differences: 1) They take a Type instead of a halide_type_t 2) There is an optional last string argument that gives the buffer a specific name.
Definition at line 211 of file Buffer.h.
References Halide::Internal.
|
inlineexplicit |
|
inlineexplicit |
Definition at line 224 of file Buffer.h.
References Halide::Internal.
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
Definition at line 261 of file Buffer.h.
References Halide::Internal.
|
inlineexplicit |
|
inlineexplicit |
Definition at line 279 of file Buffer.h.
References Halide::Internal.
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
|
default |
Trivial copy assignment operator.
|
defaultnoexcept |
Trivial move assignment operator.
|
inlinestatic |
Definition at line 313 of file Buffer.h.
References Halide::cast(), and Halide::Buffer< T, Dims >::name().
|
inlinestatic |
Definition at line 317 of file Buffer.h.
References Halide::Buffer< T, Dims >::name().
|
inlinestatic |
Definition at line 321 of file Buffer.h.
References Halide::cast(), and Halide::Buffer< T, Dims >::name().
|
inlinestatic |
Definition at line 325 of file Buffer.h.
References Halide::cast(), and Halide::Buffer< T, Dims >::name().
|
inlinestatic |
Definition at line 329 of file Buffer.h.
References Halide::Buffer< T, Dims >::name().
|
inlinestatic |
Definition at line 333 of file Buffer.h.
References Halide::cast(), and Halide::Buffer< T, Dims >::name().
|
inlinestatic |
Definition at line 338 of file Buffer.h.
References Halide::cast(), and Halide::Buffer< T, Dims >::name().
|
inlinestatic |
Definition at line 344 of file Buffer.h.
References Halide::cast(), Halide::Buffer< T, Dims >::get(), and Halide::Buffer< T, Dims >::name().
|
inlinestatic |
Definition at line 352 of file Buffer.h.
References Halide::cast(), and Halide::Buffer< T, Dims >::name().
|
inline |
|
inline |
Definition at line 366 of file Buffer.h.
Referenced by Halide::Buffer< T, Dims >::Buffer(), Halide::Internal::Call::make(), Halide::Buffer< T, Dims >::make_interleaved(), Halide::Buffer< T, Dims >::make_interleaved(), Halide::Buffer< T, Dims >::make_interleaved(), Halide::Buffer< T, Dims >::make_interleaved(), Halide::Buffer< T, Dims >::make_scalar(), Halide::Buffer< T, Dims >::make_scalar(), Halide::Buffer< T, Dims >::make_scalar(), Halide::Buffer< T, Dims >::make_with_shape_of(), and Halide::Buffer< T, Dims >::make_with_shape_of().
Check if two Buffer objects point to the same underlying Buffer.
Definition at line 373 of file Buffer.h.
References Halide::cast(), and Halide::Internal::IntrusivePtr< T >::get().
|
inline |
|
inline |
Get a pointer to the underlying Runtime::Buffer.
Definition at line 386 of file Buffer.h.
Referenced by Halide::Buffer< T, Dims >::fill(), Halide::Buffer< T, Dims >::for_each_element(), Halide::Buffer< T, Dims >::for_each_element(), Halide::Buffer< T, Dims >::for_each_value(), Halide::Buffer< T, Dims >::for_each_value(), Halide::Buffer< T, Dims >::make_with_shape_of(), Halide::Buffer< T, Dims >::operator()(), Halide::Buffer< T, Dims >::operator()(), Halide::Buffer< T, Dims >::operator()(), Halide::Buffer< T, Dims >::operator()(), Halide::Buffer< T, Dims >::operator()(), and Halide::Buffer< T, Dims >::operator()().
|
inline |
|
inline |
Does the same thing as the equivalent Halide::Runtime::Buffer method.
Definition at line 484 of file Buffer.h.
References Halide::cast(), and Halide::Buffer< T, Dims >::get().
|
inline |
Definition at line 490 of file Buffer.h.
References Halide::cast(), and Halide::Buffer< T, Dims >::get().
|
inline |
Definition at line 496 of file Buffer.h.
References Halide::Buffer< T, Dims >::get().
Definition at line 502 of file Buffer.h.
References Halide::Buffer< T, Dims >::get().
|
inline |
Definition at line 508 of file Buffer.h.
References Halide::Buffer< T, Dims >::get().
|
inlinestaticconstexpr |
Definition at line 515 of file Buffer.h.
References Halide::Runtime::Buffer< T, Dims, InClassDimStorage >::static_halide_type().
|
inlinestaticconstexpr |
Definition at line 521 of file Buffer.h.
References Halide::Runtime::Buffer< T, Dims, InClassDimStorage >::static_dimensions().
|
inlinestatic |
Definition at line 526 of file Buffer.h.
References Halide::Runtime::Buffer< T, Dims, InClassDimStorage >::can_convert_from(), and Halide::cast().
|
inline |
Definition at line 534 of file Buffer.h.
Referenced by Halide::Internal::Call::make(), and Halide::Internal::GeneratorOutput_Buffer< T >::operator=().
|
inline |
Definition at line 539 of file Buffer.h.
References Halide::cast().
Definition at line 543 of file Buffer.h.
References Halide::cast().
Definition at line 548 of file Buffer.h.
References Halide::cast().
|
inline |
Definition at line 553 of file Buffer.h.
References Halide::Buffer< T, Dims >::get().
|
inline |
Definition at line 558 of file Buffer.h.
References Halide::Buffer< T, Dims >::get().
|
inline |
Definition at line 562 of file Buffer.h.
References Halide::cast(), and Halide::Buffer< T, Dims >::get().
|
inline |
Definition at line 566 of file Buffer.h.
References Halide::cast(), and Halide::Buffer< T, Dims >::get().
|
inline |
Definition at line 570 of file Buffer.h.
References Halide::Buffer< T, Dims >::get().
|
inline |
Definition at line 574 of file Buffer.h.
References Halide::Buffer< T, Dims >::get().
|
inline |
|
inline |
|
inline |
Copy to the GPU, using the device API that is the default for the given Target.
Definition at line 597 of file Buffer.h.
References Halide::Buffer< T, Dims >::copy_to_device(), and Halide::Default_GPU.
Referenced by Halide::Buffer< T, Dims >::copy_to_device().
|
inline |
Copy to the GPU, using the given device API.
Definition at line 602 of file Buffer.h.
References Halide::get_device_interface_for_device_api().
|
inline |
Allocate on the GPU, using the device API that is the default for the given Target.
Definition at line 607 of file Buffer.h.
References Halide::Default_GPU, and Halide::Buffer< T, Dims >::device_malloc().
Referenced by Halide::Buffer< T, Dims >::device_malloc().
|
inline |
Allocate storage on the GPU, using the given device API.
Definition at line 612 of file Buffer.h.
References Halide::get_device_interface_for_device_api().
|
inline |
Wrap a native handle, using the given device API.
It is a bad idea to pass DeviceAPI::Default_GPU to this routine as the handle argument must match the API that the default resolves to and it is clearer and more reliable to pass the resolved DeviceAPI explicitly.
Definition at line 621 of file Buffer.h.
References Halide::get_device_interface_for_device_api().
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |