MLIR  15.0.0git
Functions
AffineToStandard.cpp File Reference
#include "mlir/Conversion/AffineToStandard/AffineToStandard.h"
#include "../PassDetail.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/BlockAndValueMapping.h"
#include "mlir/IR/IntegerSet.h"
#include "mlir/IR/MLIRContext.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"
#include "mlir/Transforms/Passes.h"
+ Include dependency graph for AffineToStandard.cpp:

Go to the source code of this file.

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

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 43 of file AffineToStandard.cpp.

References mlir::OpBuilder::create(), and value.

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 61 of file AffineToStandard.cpp.

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

Referenced by mlir::lowerAffineLowerBound().

◆ 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 71 of file AffineToStandard.cpp.

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

Referenced by mlir::lowerAffineLowerBound(), and mlir::lowerAffineUpperBound().