MLIR-AIE
Public Member Functions | Public Attributes | List of all members
AIEObjectFifoStatefulTransformPass Struct Reference
+ Inheritance diagram for AIEObjectFifoStatefulTransformPass:
+ Collaboration diagram for AIEObjectFifoStatefulTransformPass:

Public Member Functions

bool isSharedMemory (TileOp a, TileOp b, int *share_direction)
 Function that returns true if two tiles in the AIE array share a memory module.
 
bool requiresDMAs (ObjectFifoCreateOp createOp, int &share_direction)
 
void checkAndApplyViaSharedMemAttribute (ObjectFifoCreateOp createOp, int &share_direction)
 
std::optional< ObjectFifoLinkOp > getOptionalLinkOp (ObjectFifoCreateOp op)
 Function to retrieve ObjectFifoLinkOp of ObjectFifoCreateOp, if it belongs to one.
 
ObjectFifoCreateOp createObjectFifo (OpBuilder &builder, AIEObjectFifoType datatype, std::string name, Value prodTile, Value consTile, Attribute depth, BDDimLayoutArrayAttr dimensionsToStream, BDDimLayoutArrayArrayAttr dimensionsFromStreamPerConsumer)
 
std::vector< LockOp > createObjectFifoLocks (OpBuilder &builder, LockAnalysis &lockAnalysis, ObjectFifoCreateOp op, int numElem, int joinDistribFactor, TileOp creation_tile, int repeatCount)
 Function used to create objectFifo locks based on target architecture.
 
void createObjectFifoElements (OpBuilder &builder, LockAnalysis &lockAnalysis, ObjectFifoCreateOp op, int share_direction)
 Function used to create objectFifo elements and their locks.
 
Block * findEndOpBlock (Region &r)
 Function that returns a pointer to the block of a Region that contains the AIEEndOp.
 
template<typename MyOp >
void createBd (OpBuilder &builder, LockOp acqLock, int acqMode, LockAction acqLockAction, LockOp relLock, int relMode, MyOp buff, int offset, int len, Block *succ, BDDimLayoutArrayAttr dims, BDPadLayoutArrayAttr padDimensions)
 Function used to create a Bd block.
 
template<typename MyOp >
void createBdBlock (OpBuilder &builder, ObjectFifoCreateOp op, int lockMode, int acqNum, int relNum, MyOp buff, int offset, int len, DMAChannelDir channelDir, size_t lockIndex, Block *succ, BDDimLayoutArrayAttr dims, BDPadLayoutArrayAttr padDimensions, bool distribOrJoin=false)
 Function used to create a Bd block.
 
void createDMA (DeviceOp &device, OpBuilder &builder, ObjectFifoCreateOp op, DMAChannelDir channelDir, int channelIndex, int lockMode, BDDimLayoutArrayAttr dims, BDPadLayoutArrayAttr pad_dims)
 Function that either calls createAIETileDMA(), createShimDMA() or createMemTileDMA() based on op tile row value.
 
void createAIETileDMA (DeviceOp &device, OpBuilder &builder, ObjectFifoCreateOp op, DMAChannelDir channelDir, int channelIndex, int lockMode, BDDimLayoutArrayAttr dims)
 Function used to create a MemOp region with a DMA channel.
 
void createShimDMA (DeviceOp &device, OpBuilder &builder, ObjectFifoCreateOp op, DMAChannelDir channelDir, int channelIndex, int lockMode, BDDimLayoutArrayAttr dims)
 Function used to create a ShimDMAOp region with a DMA channel.
 
void createMemTileDMA (DeviceOp &device, OpBuilder &builder, ObjectFifoCreateOp op, DMAChannelDir channelDir, int channelIndex, int lockMode, BDDimLayoutArrayAttr dims, BDPadLayoutArrayAttr padDimensions)
 Function used to create a MemTileDMAOp region with a DMA channel.
 
int computeLCM (std::set< int > values)
 
LogicalResult unrollForLoops (DeviceOp &device, OpBuilder &builder, std::set< TileOp > objectFifoTiles)
 
void updateGlobalNextIndex (OpBuilder &builder, ObjectFifoReleaseOp relOp, BufferOp globalNextIndex, arith::ConstantOp index, arith::ConstantOp size)
 
LogicalResult dynamicGlobalObjectFifos (DeviceOp &device, OpBuilder &builder, std::set< TileOp > objectFifoTiles)
 
void createUseLocks (OpBuilder &builder, ObjectFifoCreateOp op, ObjectFifoPort port, DenseMap< std::pair< ObjectFifoCreateOp, int >, int > &acc, int numLocks, LockAction lockAction)
 Function used to create a UseLockOp based on input parameters.
 
int updateAndReturnIndex (DenseMap< std::pair< ObjectFifoCreateOp, int >, int > &map, std::pair< ObjectFifoCreateOp, int > pair)
 Function used to check whether op is already contained in map.
 
void addExternalBuffer (ObjectFifoCreateOp fifo, ExternalBufferOp buff)
 Function used to add an external buffer to the externalBuffersPerFifo map.
 
void detectExternalBuffers (DeviceOp &device, ObjectFifoCreateOp parent, ObjectFifoCreateOp child, Value tile)
 Function used to detect all external buffers associated with parent objectFifo and tile then map them to child objectFifo.
 
void replaceSplitFifo (ObjectFifoCreateOp originalOp, ObjectFifoCreateOp newOp, TileOp tile)
 Function used to replace uses of split objectFifos.
 
int findObjectFifoSize (DeviceOp &device, Value tile, ObjectFifoCreateOp objFifo)
 Function used to find the size of an objectFifo after split based on the maximum number of elements (of the original objectFifo) acquired by a process running on given tile.
 
void createObjectFifoAllocationInfo (OpBuilder &builder, MLIRContext *ctx, FlatSymbolRefAttr obj_fifo, int colIndex, DMAChannelDir channelDir, int channelIndex, bool plio)
 Function used to generate, from an objectFifo with a shimTile endpoint, a shimDMAAllocationOp containing the channelDir, channelIndex and shimTile col assigned by the objectFifo lowering.
 
void verifyObjectFifoLinks (DeviceOp &device)
 Function used to verify that an objectfifo is present in at most one ObjectFifoLinkOp.
 
void runOnOperation () override
 

Public Attributes

DenseMap< ObjectFifoCreateOp, std::vector< BufferOp > > buffersPerFifo
 
DenseMap< ObjectFifoCreateOp, std::vector< ExternalBufferOp > > externalBuffersPerFifo
 
DenseMap< ObjectFifoCreateOp, std::vector< LockOp > > locksPerFifo
 
std::vector< std::pair< ObjectFifoCreateOp, std::vector< ObjectFifoCreateOp > > > splitFifos
 
DenseMap< ObjectFifoLinkOp, ObjectFifoCreateOp > objFifoLinks
 
std::vector< ObjectFifoCreateOp > splitBecauseLink
 

Detailed Description

Definition at line 132 of file AIEObjectFifoStatefulTransform.cpp.

Member Function Documentation

◆ addExternalBuffer()

void AIEObjectFifoStatefulTransformPass::addExternalBuffer ( ObjectFifoCreateOp  fifo,
ExternalBufferOp  buff 
)
inline

Function used to add an external buffer to the externalBuffersPerFifo map.

Definition at line 1336 of file AIEObjectFifoStatefulTransform.cpp.

◆ checkAndApplyViaSharedMemAttribute()

void AIEObjectFifoStatefulTransformPass::checkAndApplyViaSharedMemAttribute ( ObjectFifoCreateOp  createOp,
int &  share_direction 
)
inline
  • -1 if the shared memory module is that of the first input tile,
  • 1 if it is that of the second input tile

Definition at line 281 of file AIEObjectFifoStatefulTransform.cpp.

References isSharedMemory().

Referenced by requiresDMAs().

◆ computeLCM()

int AIEObjectFifoStatefulTransformPass::computeLCM ( std::set< int >  values)
inline

Definition at line 969 of file AIEObjectFifoStatefulTransform.cpp.

Referenced by unrollForLoops().

◆ createAIETileDMA()

void AIEObjectFifoStatefulTransformPass::createAIETileDMA ( DeviceOp &  device,
OpBuilder &  builder,
ObjectFifoCreateOp  op,
DMAChannelDir  channelDir,
int  channelIndex,
int  lockMode,
BDDimLayoutArrayAttr  dims 
)
inline

Function used to create a MemOp region with a DMA channel.

It uses creatBdBlock(), see there for lockMode input.

Definition at line 621 of file AIEObjectFifoStatefulTransform.cpp.

References buffersPerFifo, findEndOpBlock(), getOptionalLinkOp(), and objFifoLinks.

Referenced by createDMA().

◆ createBd()

template<typename MyOp >
void AIEObjectFifoStatefulTransformPass::createBd ( OpBuilder &  builder,
LockOp  acqLock,
int  acqMode,
LockAction  acqLockAction,
LockOp  relLock,
int  relMode,
MyOp  buff,
int  offset,
int  len,
Block *  succ,
BDDimLayoutArrayAttr  dims,
BDPadLayoutArrayAttr  padDimensions 
)
inline

Function used to create a Bd block.

Definition at line 532 of file AIEObjectFifoStatefulTransform.cpp.

Referenced by createBdBlock().

◆ createBdBlock()

template<typename MyOp >
void AIEObjectFifoStatefulTransformPass::createBdBlock ( OpBuilder &  builder,
ObjectFifoCreateOp  op,
int  lockMode,
int  acqNum,
int  relNum,
MyOp  buff,
int  offset,
int  len,
DMAChannelDir  channelDir,
size_t  lockIndex,
Block *  succ,
BDDimLayoutArrayAttr  dims,
BDPadLayoutArrayAttr  padDimensions,
bool  distribOrJoin = false 
)
inline

Function used to create a Bd block.

If lockMode is 0 we create a consumerDMA (i.e. on producer tile) else a producerDMA (i.e. on consumer tile).

Definition at line 558 of file AIEObjectFifoStatefulTransform.cpp.

References createBd(), and locksPerFifo.

◆ createDMA()

void AIEObjectFifoStatefulTransformPass::createDMA ( DeviceOp &  device,
OpBuilder &  builder,
ObjectFifoCreateOp  op,
DMAChannelDir  channelDir,
int  channelIndex,
int  lockMode,
BDDimLayoutArrayAttr  dims,
BDPadLayoutArrayAttr  pad_dims 
)
inline

Function that either calls createAIETileDMA(), createShimDMA() or createMemTileDMA() based on op tile row value.

Definition at line 601 of file AIEObjectFifoStatefulTransform.cpp.

References createAIETileDMA(), createMemTileDMA(), and createShimDMA().

◆ createMemTileDMA()

void AIEObjectFifoStatefulTransformPass::createMemTileDMA ( DeviceOp &  device,
OpBuilder &  builder,
ObjectFifoCreateOp  op,
DMAChannelDir  channelDir,
int  channelIndex,
int  lockMode,
BDDimLayoutArrayAttr  dims,
BDPadLayoutArrayAttr  padDimensions 
)
inline

Function used to create a MemTileDMAOp region with a DMA channel.

It uses creatBdBlock(), see there for lockMode input.

Definition at line 794 of file AIEObjectFifoStatefulTransform.cpp.

References buffersPerFifo, findEndOpBlock(), getOptionalLinkOp(), and objFifoLinks.

Referenced by createDMA().

◆ createObjectFifo()

ObjectFifoCreateOp AIEObjectFifoStatefulTransformPass::createObjectFifo ( OpBuilder &  builder,
AIEObjectFifoType  datatype,
std::string  name,
Value  prodTile,
Value  consTile,
Attribute  depth,
BDDimLayoutArrayAttr  dimensionsToStream,
BDDimLayoutArrayArrayAttr  dimensionsFromStreamPerConsumer 
)
inline

Definition at line 330 of file AIEObjectFifoStatefulTransform.cpp.

◆ createObjectFifoAllocationInfo()

void AIEObjectFifoStatefulTransformPass::createObjectFifoAllocationInfo ( OpBuilder &  builder,
MLIRContext *  ctx,
FlatSymbolRefAttr  obj_fifo,
int  colIndex,
DMAChannelDir  channelDir,
int  channelIndex,
bool  plio 
)
inline

Function used to generate, from an objectFifo with a shimTile endpoint, a shimDMAAllocationOp containing the channelDir, channelIndex and shimTile col assigned by the objectFifo lowering.

Definition at line 1413 of file AIEObjectFifoStatefulTransform.cpp.

◆ createObjectFifoElements()

void AIEObjectFifoStatefulTransformPass::createObjectFifoElements ( OpBuilder &  builder,
LockAnalysis lockAnalysis,
ObjectFifoCreateOp  op,
int  share_direction 
)
inline

Function used to create objectFifo elements and their locks.

It maps the input objectFifo to associated buffers and locks.

Definition at line 409 of file AIEObjectFifoStatefulTransform.cpp.

References buffersPerFifo, createObjectFifoLocks(), getOptionalLinkOp(), locksPerFifo, and objFifoLinks.

◆ createObjectFifoLocks()

std::vector< LockOp > AIEObjectFifoStatefulTransformPass::createObjectFifoLocks ( OpBuilder &  builder,
LockAnalysis lockAnalysis,
ObjectFifoCreateOp  op,
int  numElem,
int  joinDistribFactor,
TileOp  creation_tile,
int  repeatCount 
)
inline

Function used to create objectFifo locks based on target architecture.

Called by createObjectFifoElements().

Definition at line 343 of file AIEObjectFifoStatefulTransform.cpp.

References externalBuffersPerFifo, and LockAnalysis::getLockID().

Referenced by createObjectFifoElements().

◆ createShimDMA()

void AIEObjectFifoStatefulTransformPass::createShimDMA ( DeviceOp &  device,
OpBuilder &  builder,
ObjectFifoCreateOp  op,
DMAChannelDir  channelDir,
int  channelIndex,
int  lockMode,
BDDimLayoutArrayAttr  dims 
)
inline

Function used to create a ShimDMAOp region with a DMA channel.

It uses creatBdBlock(), see there for lockMode input.

Definition at line 720 of file AIEObjectFifoStatefulTransform.cpp.

References externalBuffersPerFifo, and findEndOpBlock().

Referenced by createDMA().

◆ createUseLocks()

void AIEObjectFifoStatefulTransformPass::createUseLocks ( OpBuilder &  builder,
ObjectFifoCreateOp  op,
ObjectFifoPort  port,
DenseMap< std::pair< ObjectFifoCreateOp, int >, int > &  acc,
int  numLocks,
LockAction  lockAction 
)
inline

Function used to create a UseLockOp based on input parameters.

acc is an accumulator map that tracks the indices of the next locks to acquire (or release). Uses op to find index of acc for next lockID. Updates acc.

Definition at line 1255 of file AIEObjectFifoStatefulTransform.cpp.

References xilinx::AIE::port, and xilinx::AIE::AIETargetModel::UsesSemaphoreLocks.

◆ detectExternalBuffers()

void AIEObjectFifoStatefulTransformPass::detectExternalBuffers ( DeviceOp &  device,
ObjectFifoCreateOp  parent,
ObjectFifoCreateOp  child,
Value  tile 
)
inline

Function used to detect all external buffers associated with parent objectFifo and tile then map them to child objectFifo.

Definition at line 1346 of file AIEObjectFifoStatefulTransform.cpp.

◆ dynamicGlobalObjectFifos()

LogicalResult AIEObjectFifoStatefulTransformPass::dynamicGlobalObjectFifos ( DeviceOp &  device,
OpBuilder &  builder,
std::set< TileOp >  objectFifoTiles 
)
inline

Definition at line 1114 of file AIEObjectFifoStatefulTransform.cpp.

References xilinx::AIE::port.

◆ findEndOpBlock()

Block * AIEObjectFifoStatefulTransformPass::findEndOpBlock ( Region &  r)
inline

Function that returns a pointer to the block of a Region that contains the AIEEndOp.

Definition at line 522 of file AIEObjectFifoStatefulTransform.cpp.

Referenced by createAIETileDMA(), createMemTileDMA(), and createShimDMA().

◆ findObjectFifoSize()

int AIEObjectFifoStatefulTransformPass::findObjectFifoSize ( DeviceOp &  device,
Value  tile,
ObjectFifoCreateOp  objFifo 
)
inline

Function used to find the size of an objectFifo after split based on the maximum number of elements (of the original objectFifo) acquired by a process running on given tile.

If no CoreOp exists for this tile return 0.

Definition at line 1374 of file AIEObjectFifoStatefulTransform.cpp.

◆ getOptionalLinkOp()

std::optional< ObjectFifoLinkOp > AIEObjectFifoStatefulTransformPass::getOptionalLinkOp ( ObjectFifoCreateOp  op)
inline

Function to retrieve ObjectFifoLinkOp of ObjectFifoCreateOp, if it belongs to one.

Definition at line 316 of file AIEObjectFifoStatefulTransform.cpp.

Referenced by createAIETileDMA(), createMemTileDMA(), createObjectFifoElements(), and requiresDMAs().

◆ isSharedMemory()

bool AIEObjectFifoStatefulTransformPass::isSharedMemory ( TileOp  a,
TileOp  b,
int *  share_direction 
)
inline

Function that returns true if two tiles in the AIE array share a memory module.

share_direction is equal to:

  • -1 if the shared memory module is that of the first input tile,
  • 1 if it is that of the second input tile,
  • 0 is no memory module is shared.

Definition at line 156 of file AIEObjectFifoStatefulTransform.cpp.

References xilinx::AIE::getTargetModel().

Referenced by checkAndApplyViaSharedMemAttribute(), and requiresDMAs().

◆ replaceSplitFifo()

void AIEObjectFifoStatefulTransformPass::replaceSplitFifo ( ObjectFifoCreateOp  originalOp,
ObjectFifoCreateOp  newOp,
TileOp  tile 
)
inline

Function used to replace uses of split objectFifos.

Definition at line 1356 of file AIEObjectFifoStatefulTransform.cpp.

◆ requiresDMAs()

bool AIEObjectFifoStatefulTransformPass::requiresDMAs ( ObjectFifoCreateOp  createOp,
int &  share_direction 
)
inline

◆ runOnOperation()

void AIEObjectFifoStatefulTransformPass::runOnOperation ( )
inlineoverride

◆ unrollForLoops()

LogicalResult AIEObjectFifoStatefulTransformPass::unrollForLoops ( DeviceOp &  device,
OpBuilder &  builder,
std::set< TileOp >  objectFifoTiles 
)
inline

Definition at line 977 of file AIEObjectFifoStatefulTransform.cpp.

References computeLCM().

◆ updateAndReturnIndex()

int AIEObjectFifoStatefulTransformPass::updateAndReturnIndex ( DenseMap< std::pair< ObjectFifoCreateOp, int >, int > &  map,
std::pair< ObjectFifoCreateOp, int >  pair 
)
inline

Function used to check whether op is already contained in map.

If it is then return the associated int, if not create new entry and return 0.

Definition at line 1325 of file AIEObjectFifoStatefulTransform.cpp.

◆ updateGlobalNextIndex()

void AIEObjectFifoStatefulTransformPass::updateGlobalNextIndex ( OpBuilder &  builder,
ObjectFifoReleaseOp  relOp,
BufferOp  globalNextIndex,
arith::ConstantOp  index,
arith::ConstantOp  size 
)
inline

Definition at line 1093 of file AIEObjectFifoStatefulTransform.cpp.

◆ verifyObjectFifoLinks()

void AIEObjectFifoStatefulTransformPass::verifyObjectFifoLinks ( DeviceOp &  device)
inline

Function used to verify that an objectfifo is present in at most one ObjectFifoLinkOp.

Definition at line 1426 of file AIEObjectFifoStatefulTransform.cpp.

Member Data Documentation

◆ buffersPerFifo

DenseMap<ObjectFifoCreateOp, std::vector<BufferOp> > AIEObjectFifoStatefulTransformPass::buffersPerFifo

◆ externalBuffersPerFifo

DenseMap<ObjectFifoCreateOp, std::vector<ExternalBufferOp> > AIEObjectFifoStatefulTransformPass::externalBuffersPerFifo

Definition at line 137 of file AIEObjectFifoStatefulTransform.cpp.

Referenced by createObjectFifoLocks(), and createShimDMA().

◆ locksPerFifo

DenseMap<ObjectFifoCreateOp, std::vector<LockOp> > AIEObjectFifoStatefulTransformPass::locksPerFifo

Definition at line 140 of file AIEObjectFifoStatefulTransform.cpp.

Referenced by createBdBlock(), and createObjectFifoElements().

◆ objFifoLinks

DenseMap<ObjectFifoLinkOp, ObjectFifoCreateOp> AIEObjectFifoStatefulTransformPass::objFifoLinks

◆ splitBecauseLink

std::vector<ObjectFifoCreateOp> AIEObjectFifoStatefulTransformPass::splitBecauseLink

Definition at line 148 of file AIEObjectFifoStatefulTransform.cpp.

Referenced by requiresDMAs().

◆ splitFifos

std::vector<std::pair<ObjectFifoCreateOp, std::vector<ObjectFifoCreateOp> > > AIEObjectFifoStatefulTransformPass::splitFifos

Definition at line 142 of file AIEObjectFifoStatefulTransform.cpp.


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