MLIR  15.0.0git
Functions
ElementwiseToLinalg.cpp File Reference
#include "mlir/Dialect/Linalg/Passes.h"
#include "PassDetail.h"
#include "mlir/Dialect/Arithmetic/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 dependency graph for ElementwiseToLinalg.cpp:

Go to the source code of this file.

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

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 linalg::InitTensorOp 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 44 of file ElementwiseToLinalg.cpp.

References mlir::Operation::getLoc(), mlir::Operation::getOperands(), mlir::Operation::getResultTypes(), and isElementwiseMappableOpOnRankedTensors().

◆ isElementwiseMappableOpOnRankedTensors()

static bool isElementwiseMappableOpOnRankedTensors ( Operation op)
static