Halide 14.0.0
Halide compiler and libraries
Halide::GeneratorContext Class Reference

GeneratorContext is a class that is used when using Generators (or Stubs) directly; it is used to allow the outer context (typically, either a Generator or "top-level" code) to specify certain information to the inner context to ensure that inner and outer Generators are compiled in a compatible way. More...

#include <Generator.h>

Public Types

using ExternsMap = std::map< std::string, ExternalCode >
 

Public Member Functions

 GeneratorContext (const Target &t, bool auto_schedule=false, const MachineParams &machine_params=MachineParams::generic())
 
 GeneratorContext ()=default
 
 GeneratorContext (const GeneratorContext &)=default
 
GeneratorContextoperator= (const GeneratorContext &)=default
 
 GeneratorContext (GeneratorContext &&)=default
 
GeneratorContextoperator= (GeneratorContext &&)=default
 
const Targetget_target () const
 
bool get_auto_schedule () const
 
const MachineParamsget_machine_params () const
 
template<typename T >
std::unique_ptr< T > create () const
 
template<typename T , typename... Args>
std::unique_ptr< T > apply (const Args &...args) const
 

Detailed Description

GeneratorContext is a class that is used when using Generators (or Stubs) directly; it is used to allow the outer context (typically, either a Generator or "top-level" code) to specify certain information to the inner context to ensure that inner and outer Generators are compiled in a compatible way.

If you are using this at "top level" (e.g. with the JIT), you can construct a GeneratorContext with a Target:

auto my_stub = MyStub(
// inputs
{ ... },
// generator params
{ ... }
);
Target get_target_from_environment()
Return the target that Halide will use.

Note that all Generators embed a GeneratorContext, so if you are using a Stub from within a Generator, you can just pass 'contex()' for the GeneratorContext:

struct SomeGen : Generator<SomeGen> {
void generate() {
...
auto my_stub = MyStub(
context(), // GeneratorContext
// inputs
{ ... },
// generator params
{ ... }
);
...
}
};

Definition at line 2934 of file Generator.h.

Member Typedef Documentation

◆ ExternsMap

using Halide::GeneratorContext::ExternsMap = std::map<std::string, ExternalCode>

Definition at line 2938 of file Generator.h.

Constructor & Destructor Documentation

◆ GeneratorContext() [1/4]

Halide::GeneratorContext::GeneratorContext ( const Target t,
bool  auto_schedule = false,
const MachineParams machine_params = MachineParams::generic() 
)
explicit

◆ GeneratorContext() [2/4]

Halide::GeneratorContext::GeneratorContext ( )
default

◆ GeneratorContext() [3/4]

Halide::GeneratorContext::GeneratorContext ( const GeneratorContext )
default

◆ GeneratorContext() [4/4]

Halide::GeneratorContext::GeneratorContext ( GeneratorContext &&  )
default

Member Function Documentation

◆ operator=() [1/2]

GeneratorContext & Halide::GeneratorContext::operator= ( const GeneratorContext )
default

◆ operator=() [2/2]

GeneratorContext & Halide::GeneratorContext::operator= ( GeneratorContext &&  )
default

◆ get_target()

const Target & Halide::GeneratorContext::get_target ( ) const
inline

Definition at line 2950 of file Generator.h.

◆ get_auto_schedule()

bool Halide::GeneratorContext::get_auto_schedule ( ) const
inline

Definition at line 2953 of file Generator.h.

◆ get_machine_params()

const MachineParams & Halide::GeneratorContext::get_machine_params ( ) const
inline

Definition at line 2956 of file Generator.h.

◆ create()

template<typename T >
std::unique_ptr< T > Halide::GeneratorContext::create ( ) const
inline

Definition at line 2961 of file Generator.h.

◆ apply()

template<typename T , typename... Args>
std::unique_ptr< T > Halide::GeneratorContext::apply ( const Args &...  args) const
inline

Definition at line 2965 of file Generator.h.


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