MLIR  15.0.0git
Macros | Functions
LoopFusion.cpp File Reference
#include "PassDetail.h"
#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
#include "mlir/Dialect/Affine/Analysis/Utils.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/LoopFusionUtils.h"
#include "mlir/Dialect/Affine/LoopUtils.h"
#include "mlir/Dialect/Affine/Utils.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/IR/AffineExpr.h"
#include "mlir/IR/AffineMap.h"
#include "mlir/IR/Builders.h"
#include "mlir/Transforms/Passes.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include <iomanip>
#include <sstream>
+ Include dependency graph for LoopFusion.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "affine-loop-fusion"
 

Functions

static void sinkSequentialLoops (MemRefDependenceGraph::Node *node)
 
static unsigned getMemRefEltSizeInBytes (MemRefType memRefType)
 
static Value createPrivateMemRef (AffineForOp forOp, Operation *srcStoreOpInst, unsigned dstLoopDepth, Optional< unsigned > fastMemorySpace, uint64_t localBufSizeThreshold)
 
static bool hasNonAffineUsersOnThePath (unsigned srcId, unsigned dstId, Value memref, MemRefDependenceGraph *mdg)
 Walking from node 'srcId' to node 'dstId' (exclusive of 'srcId' and 'dstId'), if there is any non-affine operation accessing 'memref', return true. More...
 
static bool hasNonAffineUsersOnThePath (unsigned srcId, unsigned dstId, MemRefDependenceGraph *mdg)
 Check whether a memref value in node 'srcId' has a non-affine that is between node 'srcId' and node 'dstId' (exclusive of 'srcNode' and 'dstNode'). More...
 
static bool isFusionProfitable (Operation *srcOpInst, Operation *srcStoreOpInst, AffineForOp dstForOp, ArrayRef< ComputationSliceState > depthSliceUnions, unsigned maxLegalFusionDepth, unsigned *dstLoopDepth, double computeToleranceThreshold)
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "affine-loop-fusion"

Definition at line 35 of file LoopFusion.cpp.

Function Documentation

◆ createPrivateMemRef()

static Value createPrivateMemRef ( AffineForOp  forOp,
Operation srcStoreOpInst,
unsigned  dstLoopDepth,
Optional< unsigned fastMemorySpace,
uint64_t  localBufSizeThreshold 
)
static

◆ getMemRefEltSizeInBytes()

static unsigned getMemRefEltSizeInBytes ( MemRefType  memRefType)
static

Definition at line 870 of file LoopFusion.cpp.

References vectorType().

Referenced by createPrivateMemRef().

◆ hasNonAffineUsersOnThePath() [1/2]

static bool hasNonAffineUsersOnThePath ( unsigned  srcId,
unsigned  dstId,
Value  memref,
MemRefDependenceGraph *  mdg 
)
static

Walking from node 'srcId' to node 'dstId' (exclusive of 'srcId' and 'dstId'), if there is any non-affine operation accessing 'memref', return true.

Otherwise, return false.

Definition at line 992 of file LoopFusion.cpp.

References mlir::WalkResult::advance(), mlir::Value::getUsers(), mlir::WalkResult::interrupt(), mlir::Operation::isBeforeInBlock(), and mlir::Operation::walk().

Referenced by hasNonAffineUsersOnThePath(), and isFusionProfitable().

◆ hasNonAffineUsersOnThePath() [2/2]

static bool hasNonAffineUsersOnThePath ( unsigned  srcId,
unsigned  dstId,
MemRefDependenceGraph *  mdg 
)
static

Check whether a memref value in node 'srcId' has a non-affine that is between node 'srcId' and node 'dstId' (exclusive of 'srcNode' and 'dstNode').

Definition at line 1026 of file LoopFusion.cpp.

References mlir::WalkResult::advance(), mlir::Operation::getOperands(), and hasNonAffineUsersOnThePath().

◆ isFusionProfitable()

static bool isFusionProfitable ( Operation srcOpInst,
Operation srcStoreOpInst,
AffineForOp  dstForOp,
ArrayRef< ComputationSliceState depthSliceUnions,
unsigned  maxLegalFusionDepth,
unsigned dstLoopDepth,
double  computeToleranceThreshold 
)
static

◆ sinkSequentialLoops()

static void sinkSequentialLoops ( MemRefDependenceGraph::Node *  node)
static

Definition at line 863 of file LoopFusion.cpp.

References mlir::sinkSequentialLoops().