Halide 19.0.0
Halide compiler and libraries
|
#include <Generator.h>
Public Member Functions | |
~GeneratorBase () override | |
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. | |
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. | |
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. | |
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) |
void | add_requirement (const Expr &condition, const std::vector< Expr > &error_args) |
template<typename... Args, typename = typename std::enable_if<Internal::all_are_printable_args<Args...>::value>::type> | |
HALIDE_NO_USER_CODE_INLINE void | add_requirement (const Expr &condition, Args &&...error_args) |
void | trace_pipeline () |
std::string | name () override |
Return the name of this Generator. | |
GeneratorContext | context () const override |
Return the Target and autoscheduler info that this Generator was created with. | |
std::vector< ArgInfo > | arginfos () override |
Return a list of all the ArgInfos for this generator. | |
bool | allow_out_of_order_inputs_and_outputs () const override |
By default, a Generator must declare all Inputs before all Outputs. | |
void | set_generatorparam_value (const std::string &name, const std::string &value) override |
Set the value for a specific GeneratorParam for an AbstractGenerator instance. | |
void | set_generatorparam_value (const std::string &name, const LoopLevel &loop_level) override |
std::vector< Parameter > | input_parameter (const std::string &name) override |
Given the name of an input, return the Parameter(s) for that input. | |
std::vector< Func > | output_func (const std::string &name) override |
Given the name of an output, return the Func(s) for that output. | |
void | bind_input (const std::string &name, const std::vector< Parameter > &v) override |
Rebind a specified Input to refer to the given piece of IR, replacing the default ImageParam / Param in place for that Input. | |
void | bind_input (const std::string &name, const std::vector< Func > &v) override |
void | bind_input (const std::string &name, const std::vector< Expr > &v) override |
bool | emit_cpp_stub (const std::string &stub_file_path) override |
Emit a Generator Stub (.stub.h) file to the given path. | |
bool | emit_hlpipe (const std::string &hlpipe_file_path) override |
Emit a Serialized Halide Pipeline (.hlpipe) file to the given path. | |
GeneratorBase (const GeneratorBase &)=delete | |
GeneratorBase & | operator= (const GeneratorBase &)=delete |
GeneratorBase (GeneratorBase &&that)=delete | |
GeneratorBase & | operator= (GeneratorBase &&that)=delete |
Public Member Functions inherited from Halide::Internal::AbstractGenerator | |
virtual | ~AbstractGenerator ()=default |
virtual Pipeline | build_pipeline ()=0 |
Build and return the Pipeline for this AbstractGenerator. | |
Module | build_module (const std::string &function_name="") |
Call generate() and produce a Module for the result. | |
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. | |
Callable | compile_to_callable (const JITHandlers *jit_handlers=nullptr, const std::map< std::string, JITExtern > *jit_externs=nullptr) |
JIT the AbstractGenerator into a Callable (using the currently-set Target) and return it. | |
void | set_generatorparam_values (const GeneratorParamsMap &m) |
Protected Member Functions | |
GeneratorBase (size_t size) | |
void | set_generator_names (const std::string ®istered_name, const std::string &stub_name) |
virtual void | init_from_context (const Halide::GeneratorContext &context) |
virtual void | call_configure ()=0 |
virtual void | call_generate ()=0 |
virtual void | call_schedule ()=0 |
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 | using_autoscheduler () const |
Protected Attributes | |
enum Halide::Internal::GeneratorBase::Phase | Created |
GeneratorParam< Target > | target {"target", Target()} |
GeneratorParam_AutoSchedulerParams | autoscheduler_ |
Additional Inherited Members | |
Static Protected Member Functions inherited from Halide::NamesInterface | |
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 3154 of file Generator.h.
|
protected |
Definition at line 3435 of file Generator.h.
|
protected |
Definition at line 3438 of file Generator.h.
|
protected |
Enumerator | |
---|---|
Created | |
ConfigureCalled | |
InputsSet | |
GenerateCalled | |
ScheduleCalled |
Definition at line 3443 of file Generator.h.
|
override |
|
protected |
|
delete |
|
delete |
|
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 3160 of file Generator.h.
|
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 3167 of file Generator.h.
|
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 3182 of file Generator.h.
References Halide::Internal::GeneratorParamInfo::inputs(), and user_assert.
|
inline |
Definition at line 3191 of file Generator.h.
|
inline |
Definition at line 3199 of file Generator.h.
|
inline |
Definition at line 3204 of file Generator.h.
Pipeline Halide::Internal::GeneratorBase::get_pipeline | ( | ) |
|
inline |
Definition at line 3218 of file Generator.h.
|
inline |
Definition at line 3230 of file Generator.h.
|
inline |
Definition at line 3244 of file Generator.h.
|
inline |
Definition at line 3258 of file Generator.h.
|
inline |
Definition at line 3271 of file Generator.h.
|
inline |
Definition at line 3282 of file Generator.h.
|
inline |
Definition at line 3295 of file Generator.h.
|
inline |
Definition at line 3307 of file Generator.h.
|
inline |
Definition at line 3321 of file Generator.h.
|
inline |
Definition at line 3335 of file Generator.h.
void Halide::Internal::GeneratorBase::add_requirement | ( | const Expr & | condition, |
const std::vector< Expr > & | error_args ) |
|
inline |
Definition at line 3350 of file Generator.h.
|
inline |
Definition at line 3356 of file Generator.h.
|
protected |
|
protectedvirtual |
|
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 |
|
protected |
|
protected |
|
inlineprotected |
Definition at line 3469 of file Generator.h.
|
inlineprotected |
Definition at line 3472 of file Generator.h.
|
overridevirtual |
Return the name of this Generator.
(This should always be the name used to register it.)
Implements Halide::Internal::AbstractGenerator.
|
overridevirtual |
Return the Target and autoscheduler info that this Generator was created with.
Always legal to call on any AbstractGenerator instance, regardless of what other methods have been called. (All AbstractGenerator instances are expected to be created with immutable values for these, which can't be changed for a given instance after creation. Note that Generator<> based subclasses can customize Target somewhat via init_from_context(); see Generator.h for more info.)
CALL-AFTER: any CALL-BEFORE: any
Implements Halide::Internal::AbstractGenerator.
|
overridevirtual |
Return a list of all the ArgInfos for this generator.
The list will be in the order that the input and outputs are declared (possibly interleaved). Any inputs or outputs added by a configure() method will be in the list, at the end, in the order added. All input and output names will be unique within a given Generator instance.
CALL-AFTER: configure() CALL-BEFORE: any
Implements Halide::Internal::AbstractGenerator.
|
overridevirtual |
By default, a Generator must declare all Inputs before all Outputs.
In some unusual situations (e.g. metaprogramming situations), it's desirable to allow them to be declared out-of-order and put the onus of a non-obvious call order on the coder; a Generator may override this to return 'true' to allow this behavior.
Implements Halide::Internal::AbstractGenerator.
|
overridevirtual |
Set the value for a specific GeneratorParam for an AbstractGenerator instance.
Names that aren't known generator names should assert-fail.
Values that can't be parsed for the specific GeneratorParam (e.g. passing "foo" where an integer is expected) should assert-fail at some point (either immediately, or when build_pipeline() is called)
This can be called multiple times, but only prior to build_pipeline().
CALL-AFTER: none CALL-BEFORE: build_pipeline
Implements Halide::Internal::AbstractGenerator.
|
overridevirtual |
Implements Halide::Internal::AbstractGenerator.
|
overridevirtual |
Given the name of an input, return the Parameter(s) for that input.
(Most inputs will have exactly one, but inputs that are declared as arrays will have multiple.)
CALL-AFTER: build_pipeline CALL-BEFORE: none
Implements Halide::Internal::AbstractGenerator.
|
overridevirtual |
Given the name of an output, return the Func(s) for that output.
Most outputs will have exactly one, but outputs that are declared as arrays will have multiple.
Note that outputs with Tuple values are still just a single Func, though they do get realized as multiple Buffers.
Must be called after build_pipeline(), since the output Funcs will be undefined prior to that.
CALL-AFTER: build_pipeline() CALL-BEFORE: none
Implements Halide::Internal::AbstractGenerator.
|
overridevirtual |
Rebind a specified Input to refer to the given piece of IR, replacing the default ImageParam / Param in place for that Input.
Basic type-checking is done to ensure that inputs are still sane (e.g. types, dimensions, etc must match expectations).
CALL-AFTER: set_generatorparam_value CALL-BEFORE: build_pipeline
Implements Halide::Internal::AbstractGenerator.
|
overridevirtual |
Implements Halide::Internal::AbstractGenerator.
|
overridevirtual |
Implements Halide::Internal::AbstractGenerator.
|
overridevirtual |
Emit a Generator Stub (.stub.h) file to the given path.
Not all Generators support this.
If you call this method, you should not call any other AbstractGenerator methods on this instance, before or after this call.
If the Generator is capable of emitting a Stub, do so and return true. (Errors during stub emission should assert-fail rather than returning false.)
If the Generator is not capable of emitting a Stub, do nothing and return false.
CALL-AFTER: none CALL-BEFORE: none
Implements Halide::Internal::AbstractGenerator.
|
overridevirtual |
Emit a Serialized Halide Pipeline (.hlpipe) file to the given path.
Not all Generators support this.
If you call this method, you should not call any other AbstractGenerator methods on this instance, before or after this call.
If the Generator is capable of emitting an hlpipe, do so and return true. (Errors during hlpipe emission should assert-fail rather than returning false.)
If the Generator is not capable of emitting an hlpipe, do nothing and return false.
CALL-AFTER: none CALL-BEFORE: none
Implements Halide::Internal::AbstractGenerator.
|
delete |
|
delete |
|
protected |
|
protected |
Definition at line 3477 of file Generator.h.
|
protected |
Definition at line 3478 of file Generator.h.