Module#

class Module#

A halide module.

This represents IR containing lowered function definitions and buffers.

Public Functions

const Target &target() const#

Get the target this module has been lowered for.

const std::string &name() const#

The name of this module.

This is used as the default filename for output operations.

const AutoSchedulerResults *get_auto_scheduler_results() const#

If this Module had an auto-generated schedule, return a read-only pointer to the AutoSchedulerResults.

If not, return nullptr.

bool any_strict_float() const#

Return whether this module uses strict floating-point anywhere.

const std::vector<Buffer<void>> &buffers() const#

The declarations contained in this module.

Buffer get_cuda_ptx_assembly_buffer() const#

Tries to locate the offloaded CUDA PTX assembly contained in this Module.

Might return a nullptr in case such buffer is not present in this Module.

Buffer get_device_code_buffer() const#

Tries to locate the offloaded (GPU) Device assembly contained in this Module.

This can be any of the GPU kernel sources, etc…

Internal::LoweredFunc get_function_by_name(const std::string &name) const#

Return the function with the given name.

If no such function exists in this module, assert.

void append(const Buffer<void> &buffer)#

Add a declaration to this module.

void compile(const std::map<OutputFileType, std::string> &output_files) const#

Compile a halide Module to variety of outputs, depending on the fields set in output_files.

Buffer<uint8_t> compile_to_buffer() const#

Compile a halide Module to in-memory object code.

Currently only supports LLVM based compilation, but should be extended to handle source code backends.

Module resolve_submodules() const#

Return a new module with all submodules compiled to buffers on on the result Module.

void remap_metadata_name(const std::string &from, const std::string &to) const#

When generating metadata from this module, remap any occurrences of ‘from’ into ‘to’.

MetadataNameMap get_metadata_name_map() const#

Retrieve the metadata name map.

RuntimeNamespaceMap get_runtime_prefixes_map() const#

Retrieve the runtime namespace map.

void set_runtime_prefixes_map(const RuntimeNamespaceMap &runtime_prefixes_map)#

Set the runtime namespace map, used to rename halide_-prefixed runtime symbols during code generation.

void set_auto_scheduler_results(const AutoSchedulerResults &results)#

Set the AutoSchedulerResults for the Module.

It is an error to call this multiple times for a given Module.

void set_any_strict_float(bool any_strict_float)#

Set whether this module uses strict floating-point directives anywhere.

void set_conceptual_code_stmt(const Internal::Stmt &stmt)#

Remember the Stmt during lowing before device-specific offloading.

const Internal::Stmt &get_conceptual_stmt() const#

Get the remembered conceptual Stmt, remembered before device-specific offloading.