MLIR 22.0.0git
ElementwiseToLinalg.cpp File Reference

Go to the source code of this file.

Classes

class  mlir::impl::ConvertElementwiseToLinalgPassBase< DerivedT >

Namespaces

namespace  mlir
 Include the generated interface declarations.
namespace  mlir::impl
 Attribute collections provide a dictionary-like interface.

Macros

#define GEN_PASS_DEF_CONVERTELEMENTWISETOLINALGPASS

Functions

std::unique_ptr<::mlir::Passmlir::impl::createConvertElementwiseToLinalgPass ()
std::unique_ptr<::mlir::Passmlir::createConvertElementwiseToLinalgPass ()
static bool isScalarLike (Type t)
static bool isElementwiseMappableOpOnRankedTensors (Operation *op)
static SmallVector< Value, 4 > getOrCreateOperandsMatchingResultTypes (OpBuilder &b, Operation *op)
 Given op assumed isElementwiseMappableOpOnRankedTensors, iterate over the result types and return a list of values such that, for each result type t and value v at the same index idx:

Macro Definition Documentation

◆ GEN_PASS_DEF_CONVERTELEMENTWISETOLINALGPASS

#define GEN_PASS_DEF_CONVERTELEMENTWISETOLINALGPASS

Definition at line 17 of file ElementwiseToLinalg.cpp.

Function Documentation

◆ getOrCreateOperandsMatchingResultTypes()

SmallVector< Value, 4 > getOrCreateOperandsMatchingResultTypes ( OpBuilder & b,
Operation * op )
static

Given op assumed isElementwiseMappableOpOnRankedTensors, iterate over the result types and return a list of values such that, for each result type t and value v at the same index idx:

  1. v.getType() == t
  2. If an operand of op has type t, let operand_first be the first such operand. Thenv == operand_first.
  3. Otherwise, v is a newly created tensor::EmptyOp with: a. Static and dynamic dims extracted from the first operand of op. b. Elemental type equal to the elemental type of t.

This is sufficient because ElementwiseMappable guarantees that "The static types of all vector (resp. tensor) operands and results must have the same shape".

Definition at line 59 of file ElementwiseToLinalg.cpp.

References b, and isElementwiseMappableOpOnRankedTensors().

◆ isElementwiseMappableOpOnRankedTensors()

bool isElementwiseMappableOpOnRankedTensors ( Operation * op)
static

◆ isScalarLike()

bool isScalarLike ( Type t)
inlinestatic

Definition at line 23 of file ElementwiseToLinalg.cpp.