Halide 22.0.0 Halide compiler and libraries

Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Halide::Generator< T > Class Template Reference

`#include <Generator.h>`

Inheritance diagram for Halide::Generator< T >:

## Public Member Functions
template<typename... Args>
void | apply (const Args &...args)
template<typename T2 >
std::unique_ptr< T2 > | create () const
template<typename T2 , typename... Args>
std::unique_ptr< T2 > | apply (const Args &...args) const
| Generator (const Generator &)=delete
Generator & | operator= (const Generator &)=delete
| Generator (Generator &&that)=delete
Generator & | operator= (Generator &&that)=delete
Public Member Functions inherited from Halide::Internal::GeneratorBase
| ~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, std::enable_if_t< no_realizations_v< Args... > > * = nullptr>
Realization | realize (Args &&...args)
void | realize (Realization r)
Pipeline | get_pipeline ()
template<typename T , std::enable_if_t< std::is_same_v< T, Halide::Func > > * = nullptr>
GeneratorInput< T > * | add_input (const std::string &name, const Type &t, int dimensions)
template<typename T , std::enable_if_t<!std::is_arithmetic_v< T > &&!std::is_same_v< T, Halide::Func > > * = nullptr>
GeneratorInput< T > * | add_input (const std::string &name, const Type &t, int dimensions)
template<typename T , std::enable_if_t<!std::is_arithmetic_v< T > &&!std::is_same_v< T, Halide::Func > > * = nullptr>
GeneratorInput< T > * | add_input (const std::string &name, int dimensions)
template<typename T , std::enable_if_t<!std::is_arithmetic_v< T > &&!std::is_same_v< T, Halide::Func > > * = nullptr>
GeneratorInput< T > * | add_input (const std::string &name)
template<typename T , std::enable_if_t< std::is_arithmetic_v< T > > * = nullptr>
GeneratorInput< T > * | add_input (const std::string &name)
template<typename T , std::enable_if_t< std::is_same_v< T, Expr > > * = nullptr>
GeneratorInput< T > * | add_input (const std::string &name, const Type &type)
template<typename T , std::enable_if_t< std::is_same_v< T, Halide::Func > > * = nullptr>
GeneratorOutput< T > * | add_output (const std::string &name, const std::vector< Type > &t, int dimensions)
template<typename T , std::enable_if_t< std::is_same_v< T, Halide::Func > > * = nullptr>
GeneratorOutput< T > * | add_output (const std::string &name, const Type &t, int dimensions)
template<typename T , std::enable_if_t<!std::is_arithmetic_v< T > &&!std::is_same_v< T, Halide::Func > > * = nullptr>
GeneratorOutput< T > * | add_output (const std::string &name, const std::vector< Type > &t, int dimensions)
template<typename T , std::enable_if_t<!std::is_arithmetic_v< T > &&!std::is_same_v< T, Halide::Func > > * = nullptr>
GeneratorOutput< T > * | add_output (const std::string &name, const Type &t, int dimensions)
template<typename T , std::enable_if_t<!std::is_arithmetic_v< T > &&!std::is_same_v< T, Halide::Func > > * = nullptr>
GeneratorOutput< T > * | add_output (const std::string &name, int dimensions)
template<typename T , std::enable_if_t<!std::is_arithmetic_v< T > &&!std::is_same_v< T, Halide::Func > > * = nullptr>
GeneratorOutput< T > * | add_output (const std::string &name, const std::vector< Type > &t)
template<typename T , std::enable_if_t<!std::is_arithmetic_v< T > &&!std::is_same_v< T, Halide::Func > > * = nullptr>
GeneratorOutput< T > * | add_output (const std::string &name, const Type &t)
template<typename T , std::enable_if_t<!std::is_arithmetic_v< T > &&!std::is_same_v< T, Halide::Func > > * = 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 = std::enable_if_t<all_are_printable_args_v<Args...>>>
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...
bool | allow_out_of_order_inputs_and_outputs () const override
| By default, a Generator must declare all Inputs before all Outputs. 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...
bool | emit_hlpipe (const std::string &hlpipe_file_path) override
| Emit a Serialized Halide Pipeline (.hlpipe) 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 std::string | name ()=0
| Return the name of this Generator. More...
virtual GeneratorContext | context () const =0
| Return the Target and autoscheduler info that this Generator was created with. More...
virtual std::vector< ArgInfo > | arginfos ()=0
| Return a list of all the ArgInfos for this generator. More...
virtual void | set_generatorparam_value (const std::string &name, const std::string &value)=0
| Set the value for a specific GeneratorParam for an AbstractGenerator instance. More...
virtual void | set_generatorparam_value (const std::string &name, const LoopLevel &loop_level)=0
virtual Pipeline | build_pipeline ()=0
| Build and return the Pipeline for this AbstractGenerator. More...
virtual std::vector< Parameter > | input_parameter (const std::string &name)=0
| Given the name of an input, return the Parameter(s) for that input. More...
virtual std::vector< Func > | output_func (const std::string &name)=0
| Given the name of an output, return the Func(s) for that output. More...
virtual void | bind_input (const std::string &name, const std::vector< Parameter > &v)=0
| Rebind a specified Input to refer to the given piece of IR, replacing the default ImageParam / Param in place for that Input. More...
virtual void | bind_input (const std::string &name, const std::vector< Func > &v)=0
virtual void | bind_input (const std::string &name, const std::vector< Expr > &v)=0
virtual bool | emit_cpp_stub (const std::string &stub_file_path)=0
| Emit a Generator Stub (.stub.h) file to the given path. More...
virtual bool | emit_hlpipe (const std::string &hlpipe_file_path)=0
| Emit a Serialized Halide Pipeline (.hlpipe) file to the given path. More...
virtual bool | allow_out_of_order_inputs_and_outputs () const =0
| By default, a Generator must declare all Inputs before all Outputs. 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)

## Static Public Member Functions
static std::unique_ptr< T > | create (const Halide::GeneratorContext &context)
static std::unique_ptr< T > | create (const Halide::GeneratorContext &context, const std::string &registered_name, const std::string &stub_name)

## Protected Member Functions
| Generator ()
Pipeline | build_pipeline () override
| Build and return the Pipeline for this AbstractGenerator. More...
void | call_configure () override
void | call_generate () override
void | call_schedule () override
Protected Member Functions inherited from Halide::Internal::GeneratorBase
void | claim_name (const std::string &name, const char *param_type)
| GeneratorBase (size_t size)
void | set_generator_names (const std::string &registered_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

## Additional Inherited Members
Protected Types inherited from Halide::Internal::GeneratorBase
enum | Phase { Created , ConfigureCalled , InputsSet , GenerateCalled , ScheduleCalled }
template<typename T >
using | Input = GeneratorInput< T >
template<typename T >
using | Output = GeneratorOutput< T >
Protected Types inherited from Halide::NamesInterface
using | Expr = Halide::Expr
using | EvictionKey = Halide::EvictionKey
using | ExternFuncArgument = Halide::ExternFuncArgument
using | Func = Halide::Func
using | GeneratorContext = Halide::GeneratorContext
using | ImageParam = Halide::ImageParam
using | LoopLevel = Halide::LoopLevel
using | MemoryType = Halide::MemoryType
using | NameMangling = Halide::NameMangling
using | Partition = Halide::Partition
using | Pipeline = Halide::Pipeline
using | PrefetchBoundStrategy = Halide::PrefetchBoundStrategy
using | RDom = Halide::RDom
using | RVar = Halide::RVar
using | TailStrategy = Halide::TailStrategy
using | Target = Halide::Target
using | Tuple = Halide::Tuple
using | Type = Halide::Type
using | Var = Halide::Var
template<typename T >
using | GeneratorParam = Halide::GeneratorParam< T >
template<typename T = void, int D = -1>
using | Buffer = Halide::Buffer< T, D >
template<typename T >
using | Param = Halide::Param< T >
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)
Protected Attributes inherited from Halide::Internal::GeneratorBase
enum Halide::Internal::GeneratorBase::Phase | Created
GeneratorParam< Target > | target {"target", Target()}
GeneratorParam_AutoSchedulerParams | autoscheduler_

## Detailed Description

template<class T>
class Halide::Generator< T >

Examples
  tutorial/lesson_15_generators.cpp.

Definition at line 3800 of file Generator.h.

## Constructor & Destructor Documentation

## ◆ Generator() [1/3]

template<class T >

Halide::Generator< T >::Generator | ( |  | ) |
| inlineprotected

Definition at line 3802 of file Generator.h.

References Halide::Internal.

## ◆ Generator() [2/3]

template<class T >

Halide::Generator< T >::Generator | ( | const Generator< T > & |  | ) |
| delete

## ◆ Generator() [3/3]

template<class T >

Halide::Generator< T >::Generator | ( | Generator< T > && | that | ) |
| delete

## Member Function Documentation

## ◆ create() [1/3]

template<class T >

static std::unique_ptr< T > Halide::Generator< T >::create | ( | const Halide::GeneratorContext & | context | ) |
| inlinestatic

Definition at line 3807 of file Generator.h.

References Halide::Internal::GeneratorBase::context().

## ◆ create() [2/3]

template<class T >

static std::unique_ptr< T > Halide::Generator< T >::create | ( | const Halide::GeneratorContext & | context,
|  | const std::string & | registered_name,
|  | const std::string & | stub_name
| ) |  |
| inlinestatic

Definition at line 3816 of file Generator.h.

References Halide::Internal::GeneratorBase::context(), and Halide::Generator< T >::create().

## ◆ apply() [1/2]

template<class T >
template<typename... Args>

void Halide::Generator< T >::apply | ( | const Args &... | args | ) |
| inline

Definition at line 3825 of file Generator.h.

References Halide::Generator< T >::call_configure(), Halide::Generator< T >::call_generate(), Halide::Generator< T >::call_schedule(), and Halide::Internal::GeneratorBase::set_inputs().

## ◆ create() [3/3]

template<class T >
template<typename T2 >

std::unique_ptr< T2 > Halide::Generator< T >::create | ( |  | ) | const
| inline

Definition at line 3833 of file Generator.h.

References Halide::Internal::GeneratorBase::context().

Referenced by Halide::Generator< T >::create().

## ◆ apply() [2/2]

template<class T >
template<typename T2 , typename... Args>

std::unique_ptr< T2 > Halide::Generator< T >::apply | ( | const Args &... | args | ) | const
| inline

Definition at line 3838 of file Generator.h.

## ◆ build_pipeline()

template<class T >

Pipeline Halide::Generator< T >::build_pipeline | ( |  | ) |
| inlineoverrideprotectedvirtual

Build and return the Pipeline for this AbstractGenerator.

This method should be called only once per instance.

CALL-AFTER: set_generatorparam_value, bind_input CALL-BEFORE: input_parameter, output_func, external_code_map

Implements Halide::Internal::AbstractGenerator.

Definition at line 3919 of file Generator.h.

References Halide::Internal::GeneratorBase::ensure_configure_has_been_called().

## ◆ call_configure()

template<class T >

void Halide::Generator< T >::call_configure | ( |  | ) |
| inlineoverrideprotectedvirtual

Implements Halide::Internal::GeneratorBase.

Definition at line 3924 of file Generator.h.

Referenced by Halide::Generator< T >::apply().

## ◆ call_generate()

template<class T >

void Halide::Generator< T >::call_generate | ( |  | ) |
| inlineoverrideprotectedvirtual

Implements Halide::Internal::GeneratorBase.

Definition at line 3928 of file Generator.h.

Referenced by Halide::Generator< T >::apply().

## ◆ call_schedule()

template<class T >

void Halide::Generator< T >::call_schedule | ( |  | ) |
| inlineoverrideprotectedvirtual

Implements Halide::Internal::GeneratorBase.

Definition at line 3932 of file Generator.h.

Referenced by Halide::Generator< T >::apply().

## ◆ operator=() [1/2]

template<class T >

Generator & Halide::Generator< T >::operator= | ( | const Generator< T > & |  | ) |
| delete

## ◆ operator=() [2/2]

template<class T >

Generator & Halide::Generator< T >::operator= | ( | Generator< T > && | that | ) |
| delete

The documentation for this class was generated from the following file:

- src/Generator.h