Halide 22.0.0 Halide compiler and libraries

Loading...
Searching...
No Matches
Public Member Functions | List of all members
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
GeneratorContext & | operator= (const GeneratorContext &)=default
| GeneratorContext (GeneratorContext &&)=default
GeneratorContext & | operator= (GeneratorContext &&)=default
const Target & | target () const
const AutoschedulerParams & | autoscheduler_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(
GeneratorContext(get_target_from_environment()),
// inputs
{ ... },
// generator params
{ ... }
);
Halide::GeneratorContext::GeneratorContext
GeneratorContext()=default
Halide::get_target_from_environment
Target get_target_from_environment()
Return the target that Halide will use.
Halide::cast
Internal::ConstantInterval cast(Type t, const Internal::ConstantInterval &a)
Cast operators for ConstantIntervals.

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
{ ... }
);
...
}
};
Halide::Generator
Definition Generator.h:3800

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

## ◆ autoscheduler_params()

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

Definition at line 3030 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 3040 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 3044 of file Generator.h.

References Halide::cast().

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

- src/Generator.h