MLIR-AIE 1.4.5.dev
LongestConvMACChainAnalysis Struct Reference

This analysis builds the longest possible chain of MAC operations whose operands are a vector that may or may not be shifted, and a broadcast. More...

Collaboration diagram for LongestConvMACChainAnalysis:

Classes

struct  ConvMac
struct  ConvMacChainGroup

Public Types

using ConvMacChain = SmallVector<std::unique_ptr<ConvMac>, 8>
using ConvMacChainGroupList = SmallVector<ConvMacChainGroup, 8>

Public Member Functions

void sortChain ()
 Sort the chain of MACs by sources.
const ConvMacChainGroupList & getGroupsInChain ()
int64_t getGroupSignalShift (uint64_t fromIdx, uint64_t toIdx)
int64_t getGroupBcastShift (uint64_t fromIdx, uint64_t toIdx)
int64_t getGroupBcastDist (uint64_t fromIdx, uint64_t toIdx)
bool canChainBeReplacedWithConvOps ()
std::unique_ptr< ConvMac > getConvMacFromMulOp (arith::MulIOp mulOp)
std::unique_ptr< ConvMac > getConvMacFromAddOp (arith::AddIOp addOp)
 LongestConvMACChainAnalysis (arith::AddIOp addOp)

Public Attributes

std::unique_ptr< ConvMacChain > convMacChain
ConvMacChainGroupList groupsInChain

Static Public Attributes

static AnalysisManager * am = nullptr

Detailed Description

This analysis builds the longest possible chain of MAC operations whose operands are a vector that may or may not be shifted, and a broadcast.

That is, these MACs represent vector x scalar ops, and are candidates to be grouped and replaced by mul_conv/fma_conv ops in AIE2.

Definition at line 45 of file FoldMulAddChainToConvOp.cpp.

Member Typedef Documentation

◆ ConvMacChain

using LongestConvMACChainAnalysis::ConvMacChain = SmallVector<std::unique_ptr<ConvMac>, 8>

Definition at line 80 of file FoldMulAddChainToConvOp.cpp.

◆ ConvMacChainGroupList

Constructor & Destructor Documentation

◆ LongestConvMACChainAnalysis()

LongestConvMACChainAnalysis::LongestConvMACChainAnalysis ( arith::AddIOp addOp)
inline

Member Function Documentation

◆ canChainBeReplacedWithConvOps()

bool LongestConvMACChainAnalysis::canChainBeReplacedWithConvOps ( )
inline

◆ getConvMacFromAddOp()

std::unique_ptr< ConvMac > LongestConvMACChainAnalysis::getConvMacFromAddOp ( arith::AddIOp addOp)
inline

Definition at line 315 of file FoldMulAddChainToConvOp.cpp.

References getConvMacFromMulOp().

Referenced by LongestConvMACChainAnalysis().

◆ getConvMacFromMulOp()

std::unique_ptr< ConvMac > LongestConvMACChainAnalysis::getConvMacFromMulOp ( arith::MulIOp mulOp)
inline

Definition at line 226 of file FoldMulAddChainToConvOp.cpp.

References xilinx::aievec::getElementSizeInBits().

Referenced by getConvMacFromAddOp().

◆ getGroupBcastDist()

int64_t LongestConvMACChainAnalysis::getGroupBcastDist ( uint64_t fromIdx,
uint64_t toIdx )
inline

Definition at line 199 of file FoldMulAddChainToConvOp.cpp.

References convMacChain.

Referenced by getGroupsInChain().

◆ getGroupBcastShift()

int64_t LongestConvMACChainAnalysis::getGroupBcastShift ( uint64_t fromIdx,
uint64_t toIdx )
inline

Definition at line 191 of file FoldMulAddChainToConvOp.cpp.

References convMacChain.

Referenced by getGroupsInChain().

◆ getGroupSignalShift()

int64_t LongestConvMACChainAnalysis::getGroupSignalShift ( uint64_t fromIdx,
uint64_t toIdx )
inline

Definition at line 176 of file FoldMulAddChainToConvOp.cpp.

References convMacChain.

Referenced by getGroupsInChain().

◆ getGroupsInChain()

const ConvMacChainGroupList & LongestConvMACChainAnalysis::getGroupsInChain ( )
inline

◆ sortChain()

void LongestConvMACChainAnalysis::sortChain ( )
inline

Sort the chain of MACs by sources.

When two MACs share the same sources, sort them by the broadcast index. If they don't, sort them by the order of the ops in the code. This function should be called after the chain is completed, and before operating on the groups of MACs. After sorting, MACs that can be fused into single convolution ops will be contiguous in the chain.

Definition at line 92 of file FoldMulAddChainToConvOp.cpp.

References convMacChain.

Referenced by xilinx::aievec::AIEVecConvAnalysis::runOnOperation().

Member Data Documentation

◆ am

AnalysisManager * LongestConvMACChainAnalysis::am = nullptr
static

◆ convMacChain

◆ groupsInChain

ConvMacChainGroupList LongestConvMACChainAnalysis::groupsInChain

Definition at line 84 of file FoldMulAddChainToConvOp.cpp.

Referenced by getGroupsInChain().


The documentation for this struct was generated from the following file: