Halide 22.0.0 Halide compiler and libraries

Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
Halide::Internal::GeneratorBase Class Referenceabstract

`#include <Generator.h>`

Inheritance diagram for Halide::Internal::GeneratorBase:

## 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, 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)

## Protected Types
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 >

## Protected Member Functions
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

## 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)

## Detailed Description

Definition at line 3163 of file Generator.h.

## Member Typedef Documentation

## ◆ Input

template<typename T >

using Halide::Internal::GeneratorBase::Input = GeneratorInput<T>
| protected

Definition at line 3496 of file Generator.h.

## ◆ Output

template<typename T >

using Halide::Internal::GeneratorBase::Output = GeneratorOutput<T>
| protected

Definition at line 3499 of file Generator.h.

## Member Enumeration Documentation

## ◆ Phase

enum Halide::Internal::GeneratorBase::Phase
| protected

Enumerator
Created |
ConfigureCalled |
InputsSet |
GenerateCalled |
ScheduleCalled |

Definition at line 3504 of file Generator.h.

## Constructor & Destructor Documentation

## ◆ ~GeneratorBase()

Halide::Internal::GeneratorBase::~GeneratorBase | ( |  | ) |
| override

## ◆ GeneratorBase() [1/3]

Halide::Internal::GeneratorBase::GeneratorBase | ( | size_t | size | ) |
| protected

## ◆ GeneratorBase() [2/3]

Halide::Internal::GeneratorBase::GeneratorBase | ( | const GeneratorBase & |  | ) |
| delete

## ◆ GeneratorBase() [3/3]

Halide::Internal::GeneratorBase::GeneratorBase | ( | GeneratorBase && | that | ) |
| delete

## Member Function Documentation

## ◆ natural_vector_size() [1/2]

int Halide::Internal::GeneratorBase::natural_vector_size | ( | Halide::Type | t | ) | const
| 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 3169 of file Generator.h.

References get_target(), and Halide::Target::natural_vector_size().

## ◆ natural_vector_size() [2/2]

template<typename data_t >

int Halide::Internal::GeneratorBase::natural_vector_size | ( |  | ) | const
| inline

Given a data type, return an estimate of the "natural" vector size for that data type when compiling for the current target.

Examples
  tutorial/lesson_15_generators.cpp.

Definition at line 3176 of file Generator.h.

References get_target(), and Halide::Target::natural_vector_size().

## ◆ set_inputs()

template<typename... Args>

void Halide::Internal::GeneratorBase::set_inputs | ( | const Args &... | args | ) |
| 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 3191 of file Generator.h.

References Halide::Internal::GeneratorParamInfo::inputs(), and user_assert.

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

## ◆ realize() [1/3]

Realization Halide::Internal::GeneratorBase::realize | ( | std::vector< int32_t > | sizes | ) |
| inline

Definition at line 3200 of file Generator.h.

References get_pipeline(), get_target(), and Halide::Pipeline::realize().

## ◆ realize() [2/3]

template<typename... Args, std::enable_if_t< no_realizations_v< Args... > > * = nullptr>

Realization Halide::Internal::GeneratorBase::realize | ( | Args &&... | args | ) |
| inline

Definition at line 3208 of file Generator.h.

References get_pipeline(), get_target(), and Halide::Pipeline::realize().

## ◆ realize() [3/3]

void Halide::Internal::GeneratorBase::realize | ( | Realization | r | ) |
| inline

Definition at line 3213 of file Generator.h.

References get_pipeline(), get_target(), and Halide::Pipeline::realize().

## ◆ get_pipeline()

Pipeline Halide::Internal::GeneratorBase::get_pipeline | ( |  | ) |

Referenced by realize(), and trace_pipeline().

## ◆ claim_name()

void Halide::Internal::GeneratorBase::claim_name | ( | const std::string & | name,
|  | const char * | param_type
| ) |  |
| inline protected

Definition at line 3225 of file Generator.h.

References name(), and user_assert.

Referenced by add_input(), and add_output().

## ◆ add_input() [1/6]

template<typename T , std::enable_if_t< std::is_same_v< T, Halide::Func > > * = nullptr>

GeneratorInput< T > * Halide::Internal::GeneratorBase::add_input | ( | const std::string & | name,
|  | const Type & | t,
|  | int | dimensions
| ) |  |
| inline

Definition at line 3236 of file Generator.h.

References check_exact_phase(), claim_name(), ConfigureCalled, and name().

## ◆ add_input() [2/6]

template<typename T , std::enable_if_t<!std::is_arithmetic_v< T > &&!std::is_same_v< T, Halide::Func > > * = nullptr>

GeneratorInput< T > * Halide::Internal::GeneratorBase::add_input | ( | const std::string & | name,
|  | const Type & | t,
|  | int | dimensions
| ) |  |
| inline

Definition at line 3249 of file Generator.h.

References check_exact_phase(), claim_name(), ConfigureCalled, and name().

## ◆ add_input() [3/6]

template<typename T , std::enable_if_t<!std::is_arithmetic_v< T > &&!std::is_same_v< T, Halide::Func > > * = nullptr>

GeneratorInput< T > * Halide::Internal::GeneratorBase::add_input | ( | const std::string & | name,
|  | int | dimensions
| ) |  |
| inline

Definition at line 3264 of file Generator.h.

References check_exact_phase(), claim_name(), ConfigureCalled, and name().

## ◆ add_input() [4/6]

template<typename T , std::enable_if_t<!std::is_arithmetic_v< T > &&!std::is_same_v< T, Halide::Func > > * = nullptr>

GeneratorInput< T > * Halide::Internal::GeneratorBase::add_input | ( | const std::string & | name | ) |
| inline

Definition at line 3279 of file Generator.h.

References check_exact_phase(), claim_name(), ConfigureCalled, and name().

## ◆ add_input() [5/6]

template<typename T , std::enable_if_t< std::is_arithmetic_v< T > > * = nullptr>

GeneratorInput< T > * Halide::Internal::GeneratorBase::add_input | ( | const std::string & | name | ) |
| inline

Definition at line 3293 of file Generator.h.

References check_exact_phase(), claim_name(), ConfigureCalled, and name().

## ◆ add_input() [6/6]

template<typename T , std::enable_if_t< std::is_same_v< T, Expr > > * = nullptr>

GeneratorInput< T > * Halide::Internal::GeneratorBase::add_input | ( | const std::string & | name,
|  | const Type & | type
| ) |  |
| inline

Definition at line 3305 of file Generator.h.

References check_exact_phase(), claim_name(), ConfigureCalled, and name().

## ◆ add_output() [1/8]

template<typename T , std::enable_if_t< std::is_same_v< T, Halide::Func > > * = nullptr>

GeneratorOutput< T > * Halide::Internal::GeneratorBase::add_output | ( | const std::string & | name,
|  | const std::vector< Type > & | t,
|  | int | dimensions
| ) |  |
| inline

Definition at line 3319 of file Generator.h.

References check_exact_phase(), claim_name(), ConfigureCalled, and name().

## ◆ add_output() [2/8]

template<typename T , std::enable_if_t< std::is_same_v< T, Halide::Func > > * = nullptr>

GeneratorOutput< T > * Halide::Internal::GeneratorBase::add_output | ( | const std::string & | name,
|  | const Type & | t,
|  | int | dimensions
| ) |  |
| inline

Definition at line 3331 of file Generator.h.

References name().

## ◆ add_output() [3/8]

template<typename T , std::enable_if_t<!std::is_arithmetic_v< T > &&!std::is_same_v< T, Halide::Func > > * = nullptr>

GeneratorOutput< T > * Halide::Internal::GeneratorBase::add_output | ( | const std::string & | name,
|  | const std::vector< Type > & | t,
|  | int | dimensions
| ) |  |
| inline

Definition at line 3338 of file Generator.h.

References check_exact_phase(), claim_name(), ConfigureCalled, and name().

## ◆ add_output() [4/8]

template<typename T , std::enable_if_t<!std::is_arithmetic_v< T > &&!std::is_same_v< T, Halide::Func > > * = nullptr>

GeneratorOutput< T > * Halide::Internal::GeneratorBase::add_output | ( | const std::string & | name,
|  | const Type & | t,
|  | int | dimensions
| ) |  |
| inline

Definition at line 3352 of file Generator.h.

References name().

## ◆ add_output() [5/8]

template<typename T , std::enable_if_t<!std::is_arithmetic_v< T > &&!std::is_same_v< T, Halide::Func > > * = nullptr>

GeneratorOutput< T > * Halide::Internal::GeneratorBase::add_output | ( | const std::string & | name,
|  | int | dimensions
| ) |  |
| inline

Definition at line 3360 of file Generator.h.

References check_exact_phase(), claim_name(), ConfigureCalled, and name().

## ◆ add_output() [6/8]

template<typename T , std::enable_if_t<!std::is_arithmetic_v< T > &&!std::is_same_v< T, Halide::Func > > * = nullptr>

GeneratorOutput< T > * Halide::Internal::GeneratorBase::add_output | ( | const std::string & | name,
|  | const std::vector< Type > & | t
| ) |  |
| inline

Definition at line 3374 of file Generator.h.

References check_exact_phase(), claim_name(), ConfigureCalled, and name().

## ◆ add_output() [7/8]

template<typename T , std::enable_if_t<!std::is_arithmetic_v< T > &&!std::is_same_v< T, Halide::Func > > * = nullptr>

GeneratorOutput< T > * Halide::Internal::GeneratorBase::add_output | ( | const std::string & | name,
|  | const Type & | t
| ) |  |
| inline

Definition at line 3388 of file Generator.h.

References name().

## ◆ add_output() [8/8]

template<typename T , std::enable_if_t<!std::is_arithmetic_v< T > &&!std::is_same_v< T, Halide::Func > > * = nullptr>

GeneratorOutput< T > * Halide::Internal::GeneratorBase::add_output | ( | const std::string & | name | ) |
| inline

Definition at line 3395 of file Generator.h.

References check_exact_phase(), claim_name(), ConfigureCalled, and name().

## ◆ add_requirement() [1/2]

void Halide::Internal::GeneratorBase::add_requirement | ( | const Expr & | condition,
|  | const std::vector< Expr > & | error_args
| ) |  |

Referenced by add_requirement().

## ◆ add_requirement() [2/2]

template<typename... Args, typename = std::enable_if_t<all_are_printable_args_v<Args...>>>

HALIDE_NO_USER_CODE_INLINE void Halide::Internal::GeneratorBase::add_requirement | ( | const Expr & | condition,
|  | Args &&... | error_args
| ) |  |
| inline

Definition at line 3411 of file Generator.h.

References add_requirement(), and Halide::Internal::collect_print_args().

## ◆ trace_pipeline()

void Halide::Internal::GeneratorBase::trace_pipeline | ( |  | ) |
| inline

Definition at line 3417 of file Generator.h.

References get_pipeline(), and Halide::Pipeline::trace_pipeline().

## ◆ set_generator_names()

void Halide::Internal::GeneratorBase::set_generator_names | ( | const std::string & | registered_name,
|  | const std::string & | stub_name
| ) |  |
| protected

## ◆ init_from_context()

virtual void Halide::Internal::GeneratorBase::init_from_context | ( | const Halide::GeneratorContext & | context | ) |
| protected virtual

## ◆ call_configure()

virtual void Halide::Internal::GeneratorBase::call_configure | ( |  | ) |
| protected pure virtual

Implemented in Halide::Generator< T >.

## ◆ call_generate()

virtual void Halide::Internal::GeneratorBase::call_generate | ( |  | ) |
| protected pure virtual

Implemented in Halide::Generator< T >.

## ◆ call_schedule()

virtual void Halide::Internal::GeneratorBase::call_schedule | ( |  | ) |
| protected pure virtual

Implemented in Halide::Generator< T >.

## ◆ pre_build()

void Halide::Internal::GeneratorBase::pre_build | ( |  | ) |
| protected

## ◆ post_build()

void Halide::Internal::GeneratorBase::post_build | ( |  | ) |
| protected

## ◆ pre_configure()

void Halide::Internal::GeneratorBase::pre_configure | ( |  | ) |
| protected

## ◆ post_configure()

void Halide::Internal::GeneratorBase::post_configure | ( |  | ) |
| protected

## ◆ pre_generate()

void Halide::Internal::GeneratorBase::pre_generate | ( |  | ) |
| protected

## ◆ post_generate()

void Halide::Internal::GeneratorBase::post_generate | ( |  | ) |
| protected

## ◆ pre_schedule()

void Halide::Internal::GeneratorBase::pre_schedule | ( |  | ) |
| protected

## ◆ post_schedule()

void Halide::Internal::GeneratorBase::post_schedule | ( |  | ) |
| protected

## ◆ check_exact_phase()

void Halide::Internal::GeneratorBase::check_exact_phase | ( | Phase | expected_phase | ) | const
| protected

Referenced by add_input(), and add_output().

## ◆ check_min_phase()

void Halide::Internal::GeneratorBase::check_min_phase | ( | Phase | expected_phase | ) | const
| protected

## ◆ advance_phase()

void Halide::Internal::GeneratorBase::advance_phase | ( | Phase | new_phase | ) |
| protected

## ◆ ensure_configure_has_been_called()

void Halide::Internal::GeneratorBase::ensure_configure_has_been_called | ( |  | ) |
| protected

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

## ◆ get_target()

Target Halide::Internal::GeneratorBase::get_target | ( |  | ) | const
| inline protected

Definition at line 3530 of file Generator.h.

References target.

Referenced by natural_vector_size(), and realize().

## ◆ using_autoscheduler()

bool Halide::Internal::GeneratorBase::using_autoscheduler | ( |  | ) | const
| inline protected

Definition at line 3533 of file Generator.h.

References autoscheduler_, Halide::AutoschedulerParams::name, and Halide::Internal::GeneratorParamImpl< T >::value().

## ◆ name()

std::string Halide::Internal::GeneratorBase::name | ( |  | ) |
| override virtual

Return the name of this Generator.

(This should always be the name used to register it.)

Implements Halide::Internal::AbstractGenerator.

Referenced by add_input(), add_output(), and claim_name().

## ◆ context()

GeneratorContext Halide::Internal::GeneratorBase::context | ( |  | ) | const
| override virtual

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().

## ◆ arginfos()

std::vector< ArgInfo > Halide::Internal::GeneratorBase::arginfos | ( |  | ) |
| override virtual

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.

## ◆ allow_out_of_order_inputs_and_outputs()

bool Halide::Internal::GeneratorBase::allow_out_of_order_inputs_and_outputs | ( |  | ) | const
| override virtual

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.

## ◆ set_generatorparam_value() [1/2]

void Halide::Internal::GeneratorBase::set_generatorparam_value | ( | const std::string & | name,
|  | const std::string & | value
| ) |  |
| override virtual

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.

## ◆ set_generatorparam_value() [2/2]

void Halide::Internal::GeneratorBase::set_generatorparam_value | ( | const std::string & | name,
|  | const LoopLevel & | loop_level
| ) |  |
| override virtual

Implements Halide::Internal::AbstractGenerator.

## ◆ input_parameter()

std::vector< Parameter > Halide::Internal::GeneratorBase::input_parameter | ( | const std::string & | name | ) |
| override virtual

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.

## ◆ output_func()

std::vector< Func > Halide::Internal::GeneratorBase::output_func | ( | const std::string & | name | ) |
| override virtual

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.

## ◆ bind_input() [1/3]

void Halide::Internal::GeneratorBase::bind_input | ( | const std::string & | name,
|  | const std::vector< Parameter > & | v
| ) |  |
| override virtual

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.

## ◆ bind_input() [2/3]

void Halide::Internal::GeneratorBase::bind_input | ( | const std::string & | name,
|  | const std::vector< Func > & | v
| ) |  |
| override virtual

Implements Halide::Internal::AbstractGenerator.

## ◆ bind_input() [3/3]

void Halide::Internal::GeneratorBase::bind_input | ( | const std::string & | name,
|  | const std::vector< Expr > & | v
| ) |  |
| override virtual

Implements Halide::Internal::AbstractGenerator.

## ◆ emit_cpp_stub()

bool Halide::Internal::GeneratorBase::emit_cpp_stub | ( | const std::string & | stub_file_path | ) |
| override virtual

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.

## ◆ emit_hlpipe()

bool Halide::Internal::GeneratorBase::emit_hlpipe | ( | const std::string & | hlpipe_file_path | ) |
| override virtual

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.

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

GeneratorBase & Halide::Internal::GeneratorBase::operator= | ( | const GeneratorBase & |  | ) |
| delete

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

GeneratorBase & Halide::Internal::GeneratorBase::operator= | ( | GeneratorBase && | that | ) |
| delete

## Member Data Documentation

## ◆ Created

enum Halide::Internal::GeneratorBase::Phase Halide::Internal::GeneratorBase::Created
| protected

## ◆ target

GeneratorParam<Target> Halide::Internal::GeneratorBase::target {"target", Target()}
| protected

Definition at line 3538 of file Generator.h.

Referenced by get_target().

## ◆ autoscheduler_

GeneratorParam_AutoSchedulerParams Halide::Internal::GeneratorBase::autoscheduler_
| protected

Definition at line 3539 of file Generator.h.

Referenced by using_autoscheduler().

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

- src/Generator.h