Halide 19.0.0
Halide compiler and libraries
Loading...
Searching...
No Matches
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 Member Functions

 GeneratorContext (const Target &t)
 
 GeneratorContext (const Target &t, const AutoschedulerParams &autoscheduler_params)
 
 GeneratorContext ()=default
 
 GeneratorContext (const GeneratorContext &)=default
 
GeneratorContextoperator= (const GeneratorContext &)=default
 
 GeneratorContext (GeneratorContext &&)=default
 
GeneratorContextoperator= (GeneratorContext &&)=default
 
const Targettarget () const
 
const AutoschedulerParamsautoscheduler_params () const
 
GeneratorContext with_target (const Target &t) 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 'context()' for the GeneratorContext:

struct SomeGen : Generator<SomeGen> {
void generate() {
...
auto my_stub = MyStub(
context(), // GeneratorContext
// inputs
{ ... },
// generator params
{ ... }
);
...
}
};
GeneratorContext context() const override
Return the Target and autoscheduler info that this Generator was created with.

Definition at line 3007 of file Generator.h.

Constructor & Destructor Documentation

◆ GeneratorContext() [1/5]

Halide::GeneratorContext::GeneratorContext ( const Target & t)
explicit

◆ GeneratorContext() [2/5]

Halide::GeneratorContext::GeneratorContext ( const Target & t,
const AutoschedulerParams & autoscheduler_params )
explicit

◆ GeneratorContext() [3/5]

Halide::GeneratorContext::GeneratorContext ( )
default

◆ GeneratorContext() [4/5]

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

◆ GeneratorContext() [5/5]

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

◆ target()

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

Definition at line 3021 of file Generator.h.

◆ autoscheduler_params()

const AutoschedulerParams & Halide::GeneratorContext::autoscheduler_params ( ) const
inline

Definition at line 3024 of file Generator.h.

◆ with_target()

GeneratorContext Halide::GeneratorContext::with_target ( const Target & t) const

◆ create()

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

Definition at line 3034 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 3038 of file Generator.h.


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