Halide 22.0.0 Halide compiler and libraries

Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
Halide::Internal::Allocate Struct Reference

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

`#include <IR.h>`

Inheritance diagram for Halide::Internal::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)
virtual Stmt | mutate_stmt (IRMutator *v) const =0
Public Member Functions inherited from Halide::Internal::IRNode
virtual void | accept (IRVisitor *v) const =0
| We use the visitor pattern to traverse IR nodes throughout the compiler, so we have a virtual accept method which accepts visitors. More...
| 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(), int padding=0)
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< Expr > | extents
Expr | condition
Expr | new_expr
std::string | free_function
int | padding
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 371 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()`,
|  | int | padding = `0`
| ) |  |
| 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. Does not include any padding bytes.

## ◆ 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 372 of file IR.h.

## ◆ type

Type Halide::Internal::Allocate::type

Definition at line 373 of file IR.h.

## ◆ memory_type

MemoryType Halide::Internal::Allocate::memory_type

Definition at line 374 of file IR.h.

## ◆ extents

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

Definition at line 375 of file IR.h.

## ◆ condition

Expr Halide::Internal::Allocate::condition

Definition at line 378 of file IR.h.

## ◆ new_expr

Expr Halide::Internal::Allocate::new_expr

Definition at line 387 of file IR.h.

## ◆ free_function

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

Definition at line 388 of file IR.h.

## ◆ padding

int Halide::Internal::Allocate::padding

Definition at line 392 of file IR.h.

## ◆ body

Stmt Halide::Internal::Allocate::body

Definition at line 394 of file IR.h.

## ◆ _node_type

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

Definition at line 409 of file IR.h.

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

- src/IR.h