MLIR  19.0.0git
Namespaces | Macros | Functions
ElementwiseToLinalg.cpp File Reference
#include "mlir/Dialect/Linalg/Passes.h"
#include "mlir/Dialect/Arith/Utils/Utils.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/Dialect/Linalg/Transforms/Transforms.h"
#include "mlir/Dialect/Linalg/Utils/Utils.h"
#include "mlir/Transforms/DialectConversion.h"
#include "mlir/Dialect/Linalg/Passes.h.inc"

Go to the source code of this file.

Namespaces

 mlir
 Include the generated interface declarations.
 

Macros

#define GEN_PASS_DEF_CONVERTELEMENTWISETOLINALGPASS
 

Functions

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: More...
 

Macro Definition Documentation

◆ GEN_PASS_DEF_CONVERTELEMENTWISETOLINALGPASS

#define GEN_PASS_DEF_CONVERTELEMENTWISETOLINALGPASS

Definition at line 18 of file ElementwiseToLinalg.cpp.

Function Documentation

◆ getOrCreateOperandsMatchingResultTypes()

static 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 47 of file ElementwiseToLinalg.cpp.

◆ isElementwiseMappableOpOnRankedTensors()

static bool isElementwiseMappableOpOnRankedTensors ( Operation op)
static

Definition at line 24 of file ElementwiseToLinalg.cpp.