MLIR  17.0.0git
Namespaces | Macros | Functions
AffineToStandard.cpp File Reference
#include "mlir/Conversion/AffineToStandard/AffineToStandard.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/Utils.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/IR/IRMapping.h"
#include "mlir/IR/IntegerSet.h"
#include "mlir/IR/MLIRContext.h"
#include "mlir/Transforms/DialectConversion.h"
#include "mlir/Transforms/Passes.h"
#include "mlir/Conversion/Passes.h.inc"

Go to the source code of this file.

Namespaces

 mlir
 This header declares functions that assist transformations in the MemRef dialect.
 

Macros

#define GEN_PASS_DEF_CONVERTAFFINETOSTANDARD
 

Functions

static Value buildMinMaxReductionSeq (Location loc, arith::CmpIPredicate predicate, ValueRange values, OpBuilder &builder)
 Given a range of values, emit the code that reduces them with "min" or "max" depending on the provided comparison predicate. More...
 
static Value lowerAffineMapMax (OpBuilder &builder, Location loc, AffineMap map, ValueRange operands)
 Emit instructions that correspond to computing the maximum value among the values of a (potentially) multi-output affine map applied to operands. More...
 
static Value lowerAffineMapMin (OpBuilder &builder, Location loc, AffineMap map, ValueRange operands)
 Emit instructions that correspond to computing the minimum value among the values of a (potentially) multi-output affine map applied to operands. More...
 

Macro Definition Documentation

◆ GEN_PASS_DEF_CONVERTAFFINETOSTANDARD

#define GEN_PASS_DEF_CONVERTAFFINETOSTANDARD

Definition at line 28 of file AffineToStandard.cpp.

Function Documentation

◆ buildMinMaxReductionSeq()

static Value buildMinMaxReductionSeq ( Location  loc,
arith::CmpIPredicate  predicate,
ValueRange  values,
OpBuilder builder 
)
static

Given a range of values, emit the code that reduces them with "min" or "max" depending on the provided comparison predicate.

The predicate defines which comparison to perform, "lt" for "min", "gt" for "max" and is used for the cmpi operation followed by the select operation:

cond = arith.cmpi "predicate" v0, v1 result = select cond, v0, v1

Multiple values are scanned in a linear sequence. This creates a data dependences that wouldn't exist in a tree reduction, but is easier to recognize as a reduction by the subsequent passes.

Definition at line 47 of file AffineToStandard.cpp.

References mlir::OpBuilder::create().

Referenced by lowerAffineMapMax(), and lowerAffineMapMin().

◆ lowerAffineMapMax()

static Value lowerAffineMapMax ( OpBuilder builder,
Location  loc,
AffineMap  map,
ValueRange  operands 
)
static

Emit instructions that correspond to computing the maximum value among the values of a (potentially) multi-output affine map applied to operands.

Definition at line 65 of file AffineToStandard.cpp.

References buildMinMaxReductionSeq(), and mlir::affine::expandAffineMap().

◆ lowerAffineMapMin()

static Value lowerAffineMapMin ( OpBuilder builder,
Location  loc,
AffineMap  map,
ValueRange  operands 
)
static

Emit instructions that correspond to computing the minimum value among the values of a (potentially) multi-output affine map applied to operands.

Definition at line 75 of file AffineToStandard.cpp.

References buildMinMaxReductionSeq(), and mlir::affine::expandAffineMap().