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::For Struct Reference

A for loop. More...

`#include <IR.h>`

Inheritance diagram for Halide::Internal::For:

## Public Member Functions
bool | is_unordered_parallel () const
bool | is_parallel () const
Expr | extent () const
Public Member Functions inherited from Halide::Internal::StmtNode< For >
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, Expr min, Expr max, ForType for_type, Partition partition_policy, DeviceAPI device_api, Stmt body)

## Public Attributes
std::string | name
Expr | min
Expr | max
ForType | for_type
DeviceAPI | device_api
Stmt | body
Partition | partition_policy
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::For

## Detailed Description

A for loop.

Execute the 'body' statement for all values of the variable 'name' from 'min' to 'max' inclusive. There are four types of For nodes. A 'Serial' for loop is a conventional one. In a 'Parallel' for loop, each iteration of the loop happens in parallel or in some unspecified order. In a 'Vectorized' for loop, each iteration maps to one SIMD lane, and the whole loop is executed in one shot. For this case, the extent (max - min + 1) must be some small integer constant (probably 4, 8, or 16). An 'Unrolled' for loop compiles to a completely unrolled version of the loop. Each iteration becomes its own statement. Again in this case, the extent should be a small integer constant.

Definition at line 856 of file IR.h.

## Member Function Documentation

## ◆ make()

static Stmt Halide::Internal::For::make | ( | const std::string & | name,
|  | Expr | min,
|  | Expr | max,
|  | ForType | for_type,
|  | Partition | partition_policy,
|  | DeviceAPI | device_api,
|  | Stmt | body
| ) |  |
| static

## ◆ is_unordered_parallel()

bool Halide::Internal::For::is_unordered_parallel | ( |  | ) | const
| inline

Definition at line 870 of file IR.h.

References for_type, and Halide::Internal::is_unordered_parallel().

## ◆ is_parallel()

bool Halide::Internal::For::is_parallel | ( |  | ) | const
| inline

Definition at line 873 of file IR.h.

References for_type, and Halide::Internal::is_parallel().

## ◆ extent()

Expr Halide::Internal::For::extent | ( |  | ) | const
| inline

Definition at line 877 of file IR.h.

References Halide::Internal::Add::make(), Halide::Internal::Sub::make(), max, and min.

## Member Data Documentation

## ◆ name

std::string Halide::Internal::For::name

Definition at line 857 of file IR.h.

## ◆ min

Expr Halide::Internal::For::min

Definition at line 858 of file IR.h.

Referenced by extent().

## ◆ max

Expr Halide::Internal::For::max

Definition at line 858 of file IR.h.

Referenced by extent().

## ◆ for_type

ForType Halide::Internal::For::for_type

Definition at line 859 of file IR.h.

Referenced by is_parallel(), and is_unordered_parallel().

## ◆ device_api

DeviceAPI Halide::Internal::For::device_api

Definition at line 860 of file IR.h.

## ◆ body

Stmt Halide::Internal::For::body

Definition at line 861 of file IR.h.

## ◆ partition_policy

Partition Halide::Internal::For::partition_policy

Definition at line 862 of file IR.h.

## ◆ _node_type

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

Definition at line 881 of file IR.h.

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

- src/IR.h