Halide
12.0.1
Halide compiler and libraries
|
GeneratorContext is a base 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>
Inherited by Halide::Internal::GeneratorBase.
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()) | |
virtual | ~GeneratorContext ()=default |
Target | get_target () const |
bool | get_auto_schedule () const |
MachineParams | get_machine_params () const |
std::shared_ptr< ExternsMap > | get_externs_map () const |
Generators can register ExternalCode objects onto themselves. More... | |
template<typename T > | |
std::unique_ptr< T > | create () const |
template<typename T , typename... Args> | |
std::unique_ptr< T > | apply (const Args &...args) const |
GeneratorContext (const GeneratorContext &)=delete | |
GeneratorContext & | operator= (const GeneratorContext &)=delete |
GeneratorContext (GeneratorContext &&)=delete | |
GeneratorContext & | operator= (GeneratorContext &&)=delete |
Protected Member Functions | |
GeneratorContext () | |
virtual void | init_from_context (const Halide::GeneratorContext &context) |
std::shared_ptr< Internal::ValueTracker > | get_value_tracker () const |
Protected Attributes | |
GeneratorParam< Target > | target |
GeneratorParam< bool > | auto_schedule |
GeneratorParam< MachineParams > | machine_params |
std::shared_ptr< ExternsMap > | externs_map |
std::shared_ptr< Internal::ValueTracker > | value_tracker |
GeneratorContext is a base 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:
Note that all Generators inherit from GeneratorContext, so if you are using a Stub from within a Generator, you can just pass 'this' for the GeneratorContext:
Definition at line 2877 of file Generator.h.
using Halide::GeneratorContext::ExternsMap = std::map<std::string, ExternalCode> |
Definition at line 2879 of file Generator.h.
|
explicit |
|
virtualdefault |
|
inlineprotected |
Definition at line 2934 of file Generator.h.
|
delete |
|
delete |
|
inline |
Definition at line 2886 of file Generator.h.
References target.
Referenced by Halide::Internal::GeneratorBase::natural_vector_size(), and Halide::Internal::GeneratorBase::realize().
|
inline |
Definition at line 2889 of file Generator.h.
References auto_schedule.
|
inline |
Definition at line 2892 of file Generator.h.
References machine_params.
|
inline |
Generators can register ExternalCode objects onto themselves.
The Generator infrastructure will arrange to have this ExternalCode appended to the Module that is finally compiled using the Generator. This allows encapsulating functionality that depends on external libraries or handwritten code for various targets. The name argument should match the name of the ExternalCode block and is used to ensure the same code block is not duplicated in the output. Halide does not do anything other than to compare names for equality. To guarantee uniqueness in public code, we suggest using a Java style inverted domain name followed by organization specific naming. E.g.: com.yoyodyne.overthruster.0719acd19b66df2a9d8d628a8fefba911a0ab2b7
See test/generator/external_code_generator.cpp for example use.
Definition at line 2911 of file Generator.h.
References externs_map.
|
inline |
Definition at line 2916 of file Generator.h.
Referenced by Halide::Generator< T >::create().
|
inline |
Definition at line 2921 of file Generator.h.
|
protectedvirtual |
Reimplemented in Halide::Internal::GeneratorBase.
|
inlineprotected |
Definition at line 2940 of file Generator.h.
References value_tracker.
|
delete |
|
delete |
|
protected |
Definition at line 2928 of file Generator.h.
Referenced by get_target().
|
protected |
Definition at line 2929 of file Generator.h.
Referenced by get_auto_schedule().
|
protected |
Definition at line 2930 of file Generator.h.
Referenced by get_machine_params().
|
protected |
Definition at line 2931 of file Generator.h.
Referenced by get_externs_map().
|
protected |
Definition at line 2932 of file Generator.h.
Referenced by get_value_tracker().