Halide
12.0.1
Halide compiler and libraries
|
#include <ExternalCode.h>
Public Member Functions | |
bool | is_for_cpu_target (const Target &host) const |
Return true if this container holds llvm bitcode linkable with code generated for the target argument. More... | |
bool | is_for_device_api (DeviceAPI current_device) const |
True if this container holds code linkable with a code generated for a GPU. More... | |
bool | is_c_plus_plus_source () const |
True if this container holds C++ source code for inclusion in generating C++ output. More... | |
const std::vector< uint8_t > & | contents () const |
Retrieve the bytes of external code held by this container. More... | |
const std::string & | name () const |
Retrieve the name of this container. More... | |
Static Public Member Functions | |
static ExternalCode | bitcode_wrapper (const Target &cpu_type, const std::vector< uint8_t > &code, const std::string &name) |
Construct an ExternalCode container from llvm bitcode. More... | |
static ExternalCode | device_code_wrapper (DeviceAPI device_api, const std::vector< uint8_t > &code, const std::string &name) |
Construct an ExternalCode container from GPU "source code." This container can be used to insert its code into the GPU code generated for a given DeviceAPI. More... | |
static ExternalCode | c_plus_plus_code_wrapper (const std::vector< uint8_t > &code, const std::string &name) |
Construct an ExternalCode container from C++ source code. More... | |
Definition at line 11 of file ExternalCode.h.
|
inlinestatic |
Construct an ExternalCode container from llvm bitcode.
The result can be passed to Halide::Module::append to have the contained bitcode linked with that module. The Module's target must match the target argument here on architecture, bit width, and operating system. The name is used as a unique identifier for the external code and duplicates will be reduced to a single instance. 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.initech.y2k.5d2ac80aaf522eec6cb4b40f39fb923f9902bc7e
Definition at line 43 of file ExternalCode.h.
References name(), and Halide::None.
|
inlinestatic |
Construct an ExternalCode container from GPU "source code." This container can be used to insert its code into the GPU code generated for a given DeviceAPI.
The specific type of code depends on the device API used as follows: CUDA: llvm bitcode for PTX OpenCL: OpenCL source code GLSL: GLSL source code OpenGLCompute: GLSL source code Metal: Metal source code Hexagon: llvm bitcode for Hexagon
At present, this API is not fully working. See Issue: https://github.com/halide/Halide/issues/1971
The name is used as a unique identifier for the external code and duplicates will be reduced to a single instance. 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.tyrell.nexus-6.53947db86ba97a9ca5ecd5e60052880945bfeb37
Definition at line 68 of file ExternalCode.h.
References name().
|
inlinestatic |
Construct an ExternalCode container from C++ source code.
This container can be used to insert its code into C++ output from Halide.
At present, this API is not fully working. See Issue: https://github.com/halide/Halide/issues/1971
The name is used as a unique identifier for the external code and duplicates will be reduced to a single instance. 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.cyberdyne.skynet.78ad6c411d313f050f172cd3d440f23fdd797d0d
Definition at line 86 of file ExternalCode.h.
References name(), and Halide::None.
|
inline |
Return true if this container holds llvm bitcode linkable with code generated for the target argument.
The matching is done on the architecture, bit width, and operating system only. Features are ignored. If the container is for Target::ArchUnkonwn, it applies to all architectures – meaning it is generic llvm bitcode. If the OS is OSUnknown, it applies to all operationg systems. The bit width must match.
Ignoring feature flags isn't too important since generally ExternalCode will be constructed in a Generator which has access to the feature flags in effect and can select code appropriately.
Definition at line 102 of file ExternalCode.h.
References Halide::Target::arch, Halide::Target::ArchUnknown, Halide::Target::bits, Halide::Target::os, and Halide::Target::OSUnknown.
|
inline |
True if this container holds code linkable with a code generated for a GPU.
Definition at line 110 of file ExternalCode.h.
|
inline |
True if this container holds C++ source code for inclusion in generating C++ output.
Definition at line 116 of file ExternalCode.h.
|
inline |
Retrieve the bytes of external code held by this container.
Definition at line 121 of file ExternalCode.h.
|
inline |
Retrieve the name of this container.
Used to ensure the same piece of external code is only included once in linkage.
Definition at line 127 of file ExternalCode.h.
Referenced by bitcode_wrapper(), c_plus_plus_code_wrapper(), and device_code_wrapper().