Halide 21.0.0
Halide compiler and libraries
Loading...
Searching...
No Matches
Halide::Module Class Reference

A halide module. More...

#include <Module.h>

Public Member Functions

 Module (const std::string &name, const Target &target, const MetadataNameMap &metadata_name_map={})
const Targettarget () const
 Get the target this module has been lowered for.
const std::string & name () const
 The name of this module.
const AutoSchedulerResultsget_auto_scheduler_results () const
 If this Module had an auto-generated schedule, return a read-only pointer to the AutoSchedulerResults.
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.
const std::vector< Internal::LoweredFunc > & functions () const
std::vector< Internal::LoweredFunc > & functions ()
const std::vector< Module > & submodules () const
Buffer get_cuda_ptx_assembly_buffer () const
 Tries to locate the offloaded CUDA PTX assembly contained in this Module.
Buffer get_device_code_buffer () const
 Tries to locate the offloaded (GPU) Device assembly contained in this Module.
Internal::LoweredFunc get_function_by_name (const std::string &name) const
 Return the function with the given name.
void append (const Buffer< void > &buffer)
 Add a declaration to this module.
void append (const Internal::LoweredFunc &function)
void append (const Module &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_tcompile_to_buffer () const
 Compile a halide Module to in-memory object code.
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.
void set_auto_scheduler_results (const AutoSchedulerResults &results)
 Set the AutoSchedulerResults for the 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::Stmtget_conceptual_stmt () const
 Get the remembered conceptual Stmt, remembered before device-specific offloading.

Detailed Description

A halide module.

This represents IR containing lowered function definitions and buffers.

Definition at line 142 of file Module.h.

Constructor & Destructor Documentation

◆ Module()

Halide::Module::Module ( const std::string & name,
const Target & target,
const MetadataNameMap & metadata_name_map = {} )

References name(), and target().

Referenced by append(), and resolve_submodules().

Member Function Documentation

◆ target()

const Target & Halide::Module::target ( ) const

Get the target this module has been lowered for.

Referenced by Module().

◆ name()

const std::string & Halide::Module::name ( ) const

The name of this module.

This is used as the default filename for output operations.

Referenced by get_function_by_name(), and Module().

◆ get_auto_scheduler_results()

const AutoSchedulerResults * Halide::Module::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.

◆ any_strict_float()

bool Halide::Module::any_strict_float ( ) const

Return whether this module uses strict floating-point anywhere.

Referenced by set_any_strict_float().

◆ buffers()

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

The declarations contained in this module.

◆ functions() [1/2]

const std::vector< Internal::LoweredFunc > & Halide::Module::functions ( ) const

◆ functions() [2/2]

std::vector< Internal::LoweredFunc > & Halide::Module::functions ( )

◆ submodules()

const std::vector< Module > & Halide::Module::submodules ( ) const

◆ get_cuda_ptx_assembly_buffer()

Buffer Halide::Module::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.

◆ get_device_code_buffer()

Buffer Halide::Module::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...

◆ get_function_by_name()

Internal::LoweredFunc Halide::Module::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.

References name().

◆ append() [1/3]

void Halide::Module::append ( const Buffer< void > & buffer)

Add a declaration to this module.

◆ append() [2/3]

void Halide::Module::append ( const Internal::LoweredFunc & function)

◆ append() [3/3]

void Halide::Module::append ( const Module & module)

References Module().

◆ compile()

void Halide::Module::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.

◆ compile_to_buffer()

Buffer< uint8_t > Halide::Module::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.

◆ resolve_submodules()

Module Halide::Module::resolve_submodules ( ) const

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

References Module().

◆ remap_metadata_name()

void Halide::Module::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'.

◆ get_metadata_name_map()

MetadataNameMap Halide::Module::get_metadata_name_map ( ) const

Retrieve the metadata name map.

◆ set_auto_scheduler_results()

void Halide::Module::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.

◆ set_any_strict_float()

void Halide::Module::set_any_strict_float ( bool any_strict_float)

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

References any_strict_float().

◆ set_conceptual_code_stmt()

void Halide::Module::set_conceptual_code_stmt ( const Internal::Stmt & stmt)

Remember the Stmt during lowing before device-specific offloading.

References Halide::stmt.

◆ get_conceptual_stmt()

const Internal::Stmt & Halide::Module::get_conceptual_stmt ( ) const

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


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