Halide
14.0.0
Halide compiler and libraries
|
#include <Generator.h>
Inherits Halide::NamesInterface.
Inherited by Halide::Generator< T >.
Public Member Functions | |
virtual | ~GeneratorBase () |
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_same< T, Halide::Func >::value >::type * = nullptr> | |
GeneratorInput< T > * | add_input (const std::string &name, const Type &t, int dimensions) |
template<typename T , typename std::enable_if<!std::is_arithmetic< T >::value &&!std::is_same< T, Halide::Func >::value >::type * = nullptr> | |
GeneratorInput< T > * | add_input (const std::string &name, const Type &t, int dimensions) |
template<typename T , typename std::enable_if<!std::is_arithmetic< T >::value &&!std::is_same< T, Halide::Func >::value >::type * = nullptr> | |
GeneratorInput< T > * | add_input (const std::string &name, int dimensions) |
template<typename T , typename std::enable_if<!std::is_arithmetic< T >::value &&!std::is_same< T, Halide::Func >::value >::type * = nullptr> | |
GeneratorInput< T > * | add_input (const std::string &name) |
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_same< T, Halide::Func >::value >::type * = nullptr> | |
GeneratorOutput< T > * | add_output (const std::string &name, const Type &t, int dimensions) |
template<typename T , typename std::enable_if<!std::is_arithmetic< T >::value &&!std::is_same< T, Halide::Func >::value >::type * = nullptr> | |
GeneratorOutput< T > * | add_output (const std::string &name, const Type &t, int dimensions) |
template<typename T , typename std::enable_if<!std::is_arithmetic< T >::value &&!std::is_same< T, Halide::Func >::value >::type * = nullptr> | |
GeneratorOutput< T > * | add_output (const std::string &name, int dimensions) |
template<typename T , typename std::enable_if<!std::is_arithmetic< T >::value &&!std::is_same< T, Halide::Func >::value >::type * = nullptr> | |
GeneratorOutput< T > * | add_output (const std::string &name) |
template<typename... Args> | |
HALIDE_NO_USER_CODE_INLINE void | add_requirement (Expr condition, Args &&...args) |
void | trace_pipeline () |
GeneratorContext | context () const |
GeneratorBase (const GeneratorBase &)=delete | |
GeneratorBase & | operator= (const GeneratorBase &)=delete |
GeneratorBase (GeneratorBase &&that)=delete | |
GeneratorBase & | operator= (GeneratorBase &&that)=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) |
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 () |
Target | get_target () const |
bool | get_auto_schedule () const |
MachineParams | get_machine_params () const |
std::shared_ptr< GeneratorContext::ExternsMap > | get_externs_map () const |
Generators can register ExternalCode objects onto themselves. More... | |
Protected Attributes | |
enum Halide::Internal::GeneratorBase::Phase | Created |
GeneratorParam< Target > | target {"target", Target()} |
GeneratorParam< bool > | auto_schedule {"auto_schedule", false} |
GeneratorParam< MachineParams > | machine_params {"machine_params", MachineParams::generic()} |
Additional Inherited Members | |
![]() | |
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 3108 of file Generator.h.
|
protected |
Definition at line 3368 of file Generator.h.
|
protected |
Definition at line 3371 of file Generator.h.
|
protected |
Enumerator | |
---|---|
Created | |
ConfigureCalled | |
InputsSet | |
GenerateCalled | |
ScheduleCalled |
Definition at line 3376 of file Generator.h.
|
virtual |
|
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 3116 of file Generator.h.
References 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 3123 of file Generator.h.
References 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 3161 of file Generator.h.
References Halide::Internal::GeneratorParamInfo::inputs(), and user_assert.
Referenced by Halide::Generator< T >::apply().
|
inline |
Definition at line 3170 of file Generator.h.
References get_pipeline(), get_target(), and Halide::Pipeline::realize().
|
inline |
Definition at line 3178 of file Generator.h.
References get_pipeline(), get_target(), and Halide::Pipeline::realize().
|
inline |
Definition at line 3183 of file Generator.h.
References get_pipeline(), get_target(), and Halide::Pipeline::realize().
Pipeline Halide::Internal::GeneratorBase::get_pipeline | ( | ) |
Referenced by add_requirement(), realize(), and trace_pipeline().
|
inline |
Definition at line 3206 of file Generator.h.
References check_exact_phase(), and ConfigureCalled.
|
inline |
Definition at line 3218 of file Generator.h.
References check_exact_phase(), and ConfigureCalled.
|
inline |
Definition at line 3232 of file Generator.h.
References check_exact_phase(), and ConfigureCalled.
|
inline |
Definition at line 3246 of file Generator.h.
References check_exact_phase(), and ConfigureCalled.
|
inline |
Definition at line 3259 of file Generator.h.
References check_exact_phase(), and ConfigureCalled.
|
inline |
Definition at line 3270 of file Generator.h.
References check_exact_phase(), and ConfigureCalled.
|
inline |
Definition at line 3283 of file Generator.h.
References check_exact_phase(), and ConfigureCalled.
|
inline |
Definition at line 3295 of file Generator.h.
References check_exact_phase(), and ConfigureCalled.
|
inline |
Definition at line 3309 of file Generator.h.
References check_exact_phase(), and ConfigureCalled.
|
inline |
Definition at line 3323 of file Generator.h.
References check_exact_phase(), and ConfigureCalled.
|
inline |
Definition at line 3335 of file Generator.h.
References Halide::Pipeline::add_requirement(), and get_pipeline().
|
inline |
Definition at line 3339 of file Generator.h.
References get_pipeline(), and Halide::Pipeline::trace_pipeline().
GeneratorContext Halide::Internal::GeneratorBase::context | ( | ) | const |
Referenced by Halide::Generator< T >::create().
|
protected |
|
protected |
|
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 |
|
inlineprotected |
Definition at line 3409 of file Generator.h.
References target.
Referenced by natural_vector_size(), and realize().
|
inlineprotected |
Definition at line 3412 of file Generator.h.
References auto_schedule.
|
inlineprotected |
Definition at line 3415 of file Generator.h.
References machine_params.
|
inlineprotected |
Generators can register ExternalCode objects onto themselves.
The Generator infrastructure will arrange to have this ExternalCode appended to the Module that is finally compiled using the Generator. This allows encapsulating functionality that depends on external libraries or handwritten code for various targets. The name argument should match the name of the ExternalCode block and is used to ensure the same code block is not duplicated in the output. Halide does not do anything other than to compare names for equality. To guarantee uniqueness in public code, we suggest using a Java style inverted domain name followed by organization specific naming. E.g.: com.yoyodyne.overthruster.0719acd19b66df2a9d8d628a8fefba911a0ab2b7
See test/generator/external_code_generator.cpp for example use.
Definition at line 3433 of file Generator.h.
|
delete |
|
delete |
|
protected |
|
protected |
Definition at line 3438 of file Generator.h.
Referenced by get_target().
|
protected |
Definition at line 3439 of file Generator.h.
Referenced by get_auto_schedule().
|
protected |
Definition at line 3440 of file Generator.h.
Referenced by get_machine_params().