Halide
12.0.1
Halide compiler and libraries
|
#include <Generator.h>
Inherits Halide::NamesInterface, and Halide::GeneratorContext.
Inherited by Halide::Generator< T >.
Public Member Functions | |
~GeneratorBase () override | |
void | set_generator_param_values (const GeneratorParamsMap ¶ms) |
int | natural_vector_size (Halide::Type t) const |
Given a data type, return an estimate of the "natural" vector size for that data type when compiling for the current target. More... | |
template<typename data_t > | |
int | natural_vector_size () const |
Given a data type, return an estimate of the "natural" vector size for that data type when compiling for the current target. More... | |
void | emit_cpp_stub (const std::string &stub_file_path) |
Module | build_module (const std::string &function_name="", LinkageType linkage_type=LinkageType::ExternalPlusMetadata) |
Module | build_gradient_module (const std::string &function_name) |
Build a module that is suitable for using for gradient descent calculation in TensorFlow or PyTorch. More... | |
template<typename... Args> | |
void | set_inputs (const Args &...args) |
set_inputs is a variadic wrapper around set_inputs_vector, which makes usage much simpler in many cases, as it constructs the relevant entries for the vector for you, which is often a bit unintuitive at present. More... | |
Realization | realize (std::vector< int32_t > sizes) |
template<typename... Args, typename std::enable_if< NoRealizations< Args... >::value >::type * = nullptr> | |
Realization | realize (Args &&...args) |
void | realize (Realization r) |
Pipeline | get_pipeline () |
template<typename T , typename std::enable_if<!std::is_arithmetic< T >::value >::type * = nullptr> | |
GeneratorInput< T > * | add_input (const std::string &name, const Type &t, int dimensions) |
template<typename T , typename std::enable_if< T::has_static_halide_type >::type * = nullptr> | |
GeneratorInput< T > * | add_input (const std::string &name, int dimensions) |
template<typename T , typename std::enable_if< std::is_arithmetic< T >::value >::type * = nullptr> | |
GeneratorInput< T > * | add_input (const std::string &name) |
template<typename T , typename std::enable_if< std::is_same< T, Expr >::value >::type * = nullptr> | |
GeneratorInput< T > * | add_input (const std::string &name, const Type &type) |
template<typename T , typename std::enable_if<!std::is_arithmetic< T >::value >::type * = nullptr> | |
GeneratorOutput< T > * | add_output (const std::string &name, const Type &t, int dimensions) |
template<typename T , typename std::enable_if< T::has_static_halide_type >::type * = nullptr> | |
GeneratorOutput< T > * | add_output (const std::string &name, int dimensions) |
template<typename... Args> | |
HALIDE_NO_USER_CODE_INLINE void | add_requirement (Expr condition, Args &&...args) |
void | trace_pipeline () |
GeneratorBase (const GeneratorBase &)=delete | |
GeneratorBase & | operator= (const GeneratorBase &)=delete |
GeneratorBase (GeneratorBase &&that)=delete | |
GeneratorBase & | operator= (GeneratorBase &&that)=delete |
![]() | |
GeneratorContext (const Target &t, bool auto_schedule=false, const MachineParams &machine_params=MachineParams::generic()) | |
virtual | ~GeneratorContext ()=default |
Target | get_target () const |
bool | get_auto_schedule () const |
MachineParams | get_machine_params () const |
std::shared_ptr< ExternsMap > | get_externs_map () const |
Generators can register ExternalCode objects onto themselves. More... | |
template<typename T > | |
std::unique_ptr< T > | create () const |
template<typename T , typename... Args> | |
std::unique_ptr< T > | apply (const Args &...args) const |
GeneratorContext (const GeneratorContext &)=delete | |
GeneratorContext & | operator= (const GeneratorContext &)=delete |
GeneratorContext (GeneratorContext &&)=delete | |
GeneratorContext & | operator= (GeneratorContext &&)=delete |
Protected Member Functions | |
GeneratorBase (size_t size, const void *introspection_helper) | |
void | set_generator_names (const std::string ®istered_name, const std::string &stub_name) |
void | init_from_context (const Halide::GeneratorContext &context) override |
virtual Pipeline | build_pipeline ()=0 |
virtual void | call_configure ()=0 |
virtual void | call_generate ()=0 |
virtual void | call_schedule ()=0 |
void | track_parameter_values (bool include_outputs) |
void | pre_build () |
void | post_build () |
void | pre_configure () |
void | post_configure () |
void | pre_generate () |
void | post_generate () |
void | pre_schedule () |
void | post_schedule () |
void | check_exact_phase (Phase expected_phase) const |
void | check_min_phase (Phase expected_phase) const |
void | advance_phase (Phase new_phase) |
void | ensure_configure_has_been_called () |
![]() | |
GeneratorContext () | |
std::shared_ptr< Internal::ValueTracker > | get_value_tracker () const |
Protected Attributes | |
enum Halide::Internal::GeneratorBase::Phase | Created |
![]() | |
GeneratorParam< Target > | target |
GeneratorParam< bool > | auto_schedule |
GeneratorParam< MachineParams > | machine_params |
std::shared_ptr< ExternsMap > | externs_map |
std::shared_ptr< Internal::ValueTracker > | value_tracker |
Additional Inherited Members | |
![]() | |
using | ExternsMap = std::map< std::string, ExternalCode > |
![]() | |
template<typename T > | |
static Expr | cast (Expr e) |
static Expr | cast (Halide::Type t, Expr e) |
static Type | Bool (int lanes=1) |
static Type | Float (int bits, int lanes=1) |
static Type | Int (int bits, int lanes=1) |
static Type | UInt (int bits, int lanes=1) |
Definition at line 3074 of file Generator.h.
|
protected |
Definition at line 3266 of file Generator.h.
|
protected |
Definition at line 3269 of file Generator.h.
|
protected |
Enumerator | |
---|---|
Created | |
ConfigureCalled | |
InputsSet | |
GenerateCalled | |
ScheduleCalled |
Definition at line 3274 of file Generator.h.
|
override |
|
protected |
|
delete |
|
delete |
void Halide::Internal::GeneratorBase::set_generator_param_values | ( | const GeneratorParamsMap & | params | ) |
|
inline |
Given a data type, return an estimate of the "natural" vector size for that data type when compiling for the current target.
Definition at line 3082 of file Generator.h.
References Halide::GeneratorContext::get_target(), and Halide::Target::natural_vector_size().
|
inline |
Given a data type, return an estimate of the "natural" vector size for that data type when compiling for the current target.
Definition at line 3089 of file Generator.h.
References Halide::GeneratorContext::get_target(), and Halide::Target::natural_vector_size().
void Halide::Internal::GeneratorBase::emit_cpp_stub | ( | const std::string & | stub_file_path | ) |
Module Halide::Internal::GeneratorBase::build_module | ( | const std::string & | function_name = "" , |
LinkageType | linkage_type = LinkageType::ExternalPlusMetadata |
||
) |
Module Halide::Internal::GeneratorBase::build_gradient_module | ( | const std::string & | function_name | ) |
Build a module that is suitable for using for gradient descent calculation in TensorFlow or PyTorch.
Essentially:
The new Pipeline is adjoint to the original; it has:
|
inline |
set_inputs is a variadic wrapper around set_inputs_vector, which makes usage much simpler in many cases, as it constructs the relevant entries for the vector for you, which is often a bit unintuitive at present.
The arguments are passed in Input<>-declaration-order, and the types must be compatible. Array inputs are passed as std::vector<> of the relevant type.
Note: at present, scalar input types must match exactly, i.e., for Input<uint8_t>, you must pass an argument that is actually uint8_t; an argument that is int-that-will-fit-in-uint8 will assert-fail at Halide compile time.
Definition at line 3127 of file Generator.h.
References Halide::Internal::GeneratorParamInfo::inputs(), and user_assert.
Referenced by Halide::Generator< T >::apply().
|
inline |
Definition at line 3136 of file Generator.h.
References get_pipeline(), Halide::GeneratorContext::get_target(), and Halide::Pipeline::realize().
|
inline |
Definition at line 3144 of file Generator.h.
References get_pipeline(), Halide::GeneratorContext::get_target(), and Halide::Pipeline::realize().
|
inline |
Definition at line 3149 of file Generator.h.
References get_pipeline(), Halide::GeneratorContext::get_target(), and Halide::Pipeline::realize().
Pipeline Halide::Internal::GeneratorBase::get_pipeline | ( | ) |
Referenced by add_requirement(), realize(), and trace_pipeline().
|
inline |
Definition at line 3164 of file Generator.h.
References check_exact_phase(), and ConfigureCalled.
|
inline |
Definition at line 3176 of file Generator.h.
References check_exact_phase(), and ConfigureCalled.
|
inline |
Definition at line 3188 of file Generator.h.
References check_exact_phase(), and ConfigureCalled.
|
inline |
Definition at line 3200 of file Generator.h.
References check_exact_phase(), and ConfigureCalled.
|
inline |
Definition at line 3213 of file Generator.h.
References check_exact_phase(), and ConfigureCalled.
|
inline |
Definition at line 3225 of file Generator.h.
References check_exact_phase(), and ConfigureCalled.
|
inline |
Definition at line 3235 of file Generator.h.
References Halide::Pipeline::add_requirement(), and get_pipeline().
|
inline |
Definition at line 3239 of file Generator.h.
References get_pipeline(), and Halide::Pipeline::trace_pipeline().
|
protected |
|
overrideprotectedvirtual |
Reimplemented from Halide::GeneratorContext.
|
protectedpure virtual |
Implemented in Halide::Generator< T >.
|
protectedpure virtual |
Implemented in Halide::Generator< T >.
|
protectedpure virtual |
Implemented in Halide::Generator< T >.
|
protectedpure virtual |
Implemented in Halide::Generator< T >.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Referenced by add_input(), and add_output().
|
protected |
|
protected |
|
protected |
|
delete |
|
delete |
|
protected |