Halide
Halide::Internal::Allocate Struct Reference

Allocate a scratch area called with the given name, type, and size. More...

#include <IR.h>

Inherits Halide::Internal::StmtNode< Allocate >.

Public Member Functions

int32_t constant_allocation_size () const
 
- Public Member Functions inherited from Halide::Internal::StmtNode< Allocate >
void accept (IRVisitor *v) const override
 We use the visitor pattern to traverse IR nodes throughout the compiler, so we have a virtual accept method which accepts visitors. More...
 
Stmt mutate_stmt (IRMutator *v) const override
 
 StmtNode ()
 
 ~StmtNode () override=default
 
- Public Member Functions inherited from Halide::Internal::BaseStmtNode
 BaseStmtNode (IRNodeType t)
 
- Public Member Functions inherited from Halide::Internal::IRNode
 IRNode (IRNodeType t)
 
virtual ~IRNode ()=default
 

Static Public Member Functions

static Stmt make (const std::string &name, Type type, MemoryType memory_type, const std::vector< Expr > &extents, Expr condition, Stmt body, Expr new_expr=Expr(), const std::string &free_function=std::string())
 
static int32_t constant_allocation_size (const std::vector< Expr > &extents, const std::string &name)
 A routine to check if the extents are all constants, and if so verify the total size is less than 2^31 - 1. More...
 

Public Attributes

std::string name
 
Type type
 
MemoryType memory_type
 
std::vector< Exprextents
 
Expr condition
 
Expr new_expr
 
std::string free_function
 
Stmt body
 
- Public Attributes inherited from Halide::Internal::IRNode
RefCount ref_count
 These classes are all managed with intrusive reference counting, so we also track a reference count. More...
 
IRNodeType node_type
 Each IR node subclass has a unique identifier. More...
 

Static Public Attributes

static const IRNodeType _node_type = IRNodeType::Allocate
 

Detailed Description

Allocate a scratch area called with the given name, type, and size.

The buffer lives for at most the duration of the body statement, within which it may or may not be freed explicitly with a Free node with a matching name. Allocation only occurs if the condition evaluates to true. Within the body of the allocation, defines a symbol with the given name and the type Handle().

Definition at line 352 of file IR.h.

Member Function Documentation

◆ make()

static Stmt Halide::Internal::Allocate::make ( const std::string &  name,
Type  type,
MemoryType  memory_type,
const std::vector< Expr > &  extents,
Expr  condition,
Stmt  body,
Expr  new_expr = Expr(),
const std::string &  free_function = std::string() 
)
static

◆ constant_allocation_size() [1/2]

static int32_t Halide::Internal::Allocate::constant_allocation_size ( const std::vector< Expr > &  extents,
const std::string &  name 
)
static

A routine to check if the extents are all constants, and if so verify the total size is less than 2^31 - 1.

If the result is constant, but overflows, this routine asserts. This returns 0 if the extents are not all constants; otherwise, it returns the total constant allocation size.

◆ constant_allocation_size() [2/2]

int32_t Halide::Internal::Allocate::constant_allocation_size ( ) const

Member Data Documentation

◆ name

std::string Halide::Internal::Allocate::name

Definition at line 353 of file IR.h.

◆ type

Type Halide::Internal::Allocate::type

Definition at line 354 of file IR.h.

◆ memory_type

MemoryType Halide::Internal::Allocate::memory_type

Definition at line 355 of file IR.h.

◆ extents

std::vector<Expr> Halide::Internal::Allocate::extents

Definition at line 356 of file IR.h.

◆ condition

Expr Halide::Internal::Allocate::condition

Definition at line 357 of file IR.h.

◆ new_expr

Expr Halide::Internal::Allocate::new_expr

Definition at line 366 of file IR.h.

◆ free_function

std::string Halide::Internal::Allocate::free_function

Definition at line 367 of file IR.h.

◆ body

Stmt Halide::Internal::Allocate::body

Definition at line 369 of file IR.h.

◆ _node_type

const IRNodeType Halide::Internal::Allocate::_node_type = IRNodeType::Allocate
static

Definition at line 384 of file IR.h.


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