Halide
|
#include <Generator.h>
Inherits Halide::NamesInterface, and Halide::Internal::AbstractGenerator.
Inherited by Halide::Generator< T >.
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. 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... | |
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) |
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. More... | |
GeneratorContext | context () const override |
Return the Target and autoscheduler info that this Generator was created with. More... | |
std::vector< ArgInfo > | arginfos () override |
Return a list of all the ArgInfos for this generator. More... | |
void | set_generatorparam_value (const std::string &name, const std::string &value) override |
Set the value for a specific GeneratorParam for an AbstractGenerator instance. More... | |
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. More... | |
std::vector< Func > | output_func (const std::string &name) override |
Given the name of an output, return the Func(s) for that output. More... | |
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. More... | |
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. More... | |
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. More... | |
Module | build_module (const std::string &function_name="") |
Call generate() and produce a Module for the result. More... | |
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... | |
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. More... | |
void | set_generatorparam_values (const GeneratorParamsMap &m) |
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) |
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 3144 of file Generator.h.
|
protected |
Definition at line 3425 of file Generator.h.
|
protected |
Definition at line 3428 of file Generator.h.
|
protected |
Enumerator | |
---|---|
Created | |
ConfigureCalled | |
InputsSet | |
GenerateCalled | |
ScheduleCalled |
Definition at line 3433 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 3150 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 3157 of file Generator.h.
References get_target(), and Halide::Target::natural_vector_size().
|
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 3172 of file Generator.h.
References Halide::Internal::GeneratorParamInfo::inputs(), and user_assert.
Referenced by Halide::Generator< T >::apply().
|
inline |
Definition at line 3181 of file Generator.h.
References get_pipeline(), get_target(), and Halide::Pipeline::realize().
|
inline |
Definition at line 3189 of file Generator.h.
References get_pipeline(), get_target(), and Halide::Pipeline::realize().
|
inline |
Definition at line 3194 of file Generator.h.
References get_pipeline(), get_target(), and Halide::Pipeline::realize().
Pipeline Halide::Internal::GeneratorBase::get_pipeline | ( | ) |
Referenced by realize(), and trace_pipeline().
|
inline |
Definition at line 3208 of file Generator.h.
References check_exact_phase(), ConfigureCalled, and name().
|
inline |
Definition at line 3220 of file Generator.h.
References check_exact_phase(), ConfigureCalled, and name().
|
inline |
Definition at line 3234 of file Generator.h.
References check_exact_phase(), ConfigureCalled, and name().
|
inline |
Definition at line 3248 of file Generator.h.
References check_exact_phase(), ConfigureCalled, and name().
|
inline |
Definition at line 3261 of file Generator.h.
References check_exact_phase(), ConfigureCalled, and name().
|
inline |
Definition at line 3272 of file Generator.h.
References check_exact_phase(), ConfigureCalled, and name().
|
inline |
Definition at line 3285 of file Generator.h.
References check_exact_phase(), ConfigureCalled, and name().
|
inline |
Definition at line 3297 of file Generator.h.
References check_exact_phase(), ConfigureCalled, and name().
|
inline |
Definition at line 3311 of file Generator.h.
References check_exact_phase(), ConfigureCalled, and name().
|
inline |
Definition at line 3325 of file Generator.h.
References check_exact_phase(), ConfigureCalled, and name().
void Halide::Internal::GeneratorBase::add_requirement | ( | const Expr & | condition, |
const std::vector< Expr > & | error_args | ||
) |
Referenced by add_requirement().
|
inline |
Definition at line 3340 of file Generator.h.
References add_requirement(), and Halide::Internal::collect_print_args().
|
inline |
Definition at line 3346 of file Generator.h.
References get_pipeline(), and Halide::Pipeline::trace_pipeline().
|
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 |
Referenced by add_input(), and add_output().
|
protected |
|
protected |
|
protected |
Referenced by Halide::Generator< T >::build_pipeline().
|
inlineprotected |
Definition at line 3459 of file Generator.h.
References target.
Referenced by natural_vector_size(), and realize().
|
inlineprotected |
Definition at line 3462 of file Generator.h.
References autoscheduler_, Halide::AutoschedulerParams::name, and Halide::Internal::GeneratorParamImpl< T >::value().
|
overridevirtual |
Return the name of this Generator.
(This should always be the name used to register it.)
Implements Halide::Internal::AbstractGenerator.
Referenced by add_input(), and add_output().
|
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.
Referenced by Halide::Generator< T >::create().
|
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 |
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.
|
delete |
|
delete |
|
protected |
|
protected |
Definition at line 3467 of file Generator.h.
Referenced by get_target().
|
protected |
Definition at line 3468 of file Generator.h.
Referenced by using_autoscheduler().