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

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:3797
Halide::Internal::GeneratorBase::context
GeneratorContext context() const override
Return the Target and autoscheduler info that this Generator was created with.

Definition at line 3012 of file Generator.h.

## Constructor & Destructor Documentation

## GeneratorContext() [1/5]

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

explicit

Referenced by GeneratorContext(), GeneratorContext(), operator=(), operator=(), and with_target().

## GeneratorContext() [2/5]

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

explicit

References autoscheduler_params().

## GeneratorContext() [3/5]

Halide::GeneratorContext::GeneratorContext | ( |  | ) |

default

## GeneratorContext() [4/5]

Halide::GeneratorContext::GeneratorContext | ( | const GeneratorContext & |  | ) |

default

References GeneratorContext().

## GeneratorContext() [5/5]

Halide::GeneratorContext::GeneratorContext | ( | GeneratorContext && |  | ) |

default

References GeneratorContext().

## Member Function Documentation

## operator=() [1/2]

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

default

References GeneratorContext().

## operator=() [2/2]

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

default

References GeneratorContext().

## target()

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

inline

Definition at line 3026 of file Generator.h.

## autoscheduler_params()

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

inline

Definition at line 3029 of file Generator.h.

Referenced by GeneratorContext().

## with_target()

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

References GeneratorContext().

## create()

template<typename T>

std::unique_ptr< T > Halide::GeneratorContext::create | ( |  | ) | const

inline

Definition at line 3039 of file Generator.h.

Referenced by apply().

## apply()

template<typename T, typename... Args>

std::unique_ptr< T > Halide::GeneratorContext::apply | ( | const Args &... | args | ) | const

inline

Definition at line 3043 of file Generator.h.

References create().

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

- src/Generator.h