Passes#

Applies to Linux

2024-05-07

6 min read time

pass#

struct pass#

An interface for applying a transformation to the instructions in a program

Public Functions

std::string name() const#

A unique name used to identify the pass.

void apply(module_pass_manager &mpm) const#

Run the pass on the module.

void apply(module &m) const#
void apply(program &p) const#

Run the pass on the program.

dead_code_elimination#

struct dead_code_elimination#

Remove instructions where the output is not used.

Public Functions

inline std::string name() const#
void apply(module &m) const#
void apply(program &p) const#

eliminate_common_subexpression#

struct eliminate_common_subexpression#

Remove identical instructions.

Public Functions

inline std::string name() const#
void apply(module &m) const#

eliminate_concat#

struct eliminate_concat#

Remove concat operators by having each operator can write to different chunk of memory.

Public Functions

inline std::string name() const#
void apply(module &m) const#

Public Members

concat_optimization concat_opt#

eliminate_contiguous#

struct eliminate_contiguous#

Remove contiguous instructions by checking if the operator can use non-standard shapes.

Public Functions

inline std::string name() const#
void apply(module &m) const#

Public Members

std::string op_name#

eliminate_identity#

struct eliminate_identity#

Remove identity instructions. Currently when used as the last pass, it will preserve the semantics of previous program state, therefore dead code elimination should not be used afterwards.

Public Functions

inline std::string name() const#
void apply(module &m) const#

eliminate_pad#

struct eliminate_pad#

Remove pads if they can be written as an attribute to another op (im2col, convolution, pooling)

Public Functions

inline std::string name() const#
void apply(module &m) const#

propagate_constant#

struct propagate_constant#

Replace instructions which take all literals with a literal of the computation.

Public Functions

inline std::string name() const#
void apply(module &m) const#

Public Members

std::unordered_set<std::string> skip_ops = {}#

rewrite_rnn#

struct rewrite_rnn#

Rewrite rnn to gemm and add.

Public Functions

inline std::string name() const#
void apply(module &m) const#

schedule#

struct schedule#

Schedule instructions for concurrent execution

Public Functions

inline std::string name() const#
void apply(module &m) const#

Public Members

schedule_model model = {}#
bool enable = true#

simplify_algebra#

struct simplify_algebra#

Simplify many algebraic instructions to more efficient versions.

Public Functions

inline std::string name() const#
void apply(module &m) const#

simplify_reshapes#

struct simplify_reshapes#

Eliminate redundant reshapes.

Public Functions

inline std::string name() const#
void apply(module &m) const#

Public Members

size_t depth = 4#