MLIR-AIE 1.4.6.dev
xilinx::AIE::LockPlan Class Reference

Lock placement shared by aie-objectfifo-allocate and the SA placer, on plain records. More...

#include "aie/Dialect/AIE/Transforms/AIELockPlan.h"

Collaboration diagram for xilinx::AIE::LockPlan:

Classes

struct  Tile
 A tile's candidate positions, and the one placement chose, once it has. More...
struct  User
 A tile using the locks, localOnly when only its own (dmaLocalOnly). More...
struct  Group
struct  Placed
struct  Assignment

Public Types

using Memo = BoundedMemo<std::vector<int64_t>, Outcome>
 Packings by what pack() reads, the least recently used dropped first beyond its capacity.

Public Member Functions

 LockPlan (const AIETargetModel &target)
unsigned addTile (Tile tile)
bool reserve (unsigned tile, int count)
 Takes count locks on tile, or returns false when it has too few left.
bool reaches (const User &user, unsigned tile) const
Placed place (const Group &group)
Assignment assign (llvm::ArrayRef< Group > groups, Memo *memo=nullptr, bool callerOrder=true)
 Places groups first fit: with callerOrder, in order on each one's candidates, then in canonical order (canonicalFirstFit); without, in canonical order only.

Static Public Member Functions

static llvm::SmallVector< int > groupCounts (const AIETargetModel &target, int64_t depth, int owners)
 The lock groups owners lock owners of a pool of depth objects take, by count.
static bool dmaLocalOnly (AIETileType type)
 Whether a DMA on a tile of type uses only its own tile's locks: every DMA does but a mem tile's.
static llvm::SmallVector< mlir::Operation * > lockOwners (const AIETargetModel &target, ObjectFifoPoolOp pool)
 The ops whose locks allocation and the SA each make for pool: with semaphore locks, each segment without its own pair; otherwise the pool, when it has none.
static bool reaches (const AIETargetModel &target, llvm::ArrayRef< TileID > user, llvm::ArrayRef< TileID > memory, bool localOnly)
 Whether a tile at one of user reaches memory at one of memory; with localOnly, only at its own position.
static Group group (int count, unsigned home, bool local, llvm::ArrayRef< unsigned > buffers, llvm::ArrayRef< User > users, llvm::ArrayRef< unsigned > ranked)
 A group of count locks a pool's objects are counted by: on home, else, unless the pool must stay local, on a tile holding its buffers, one of its users' tiles, then any tile in ranked order.

Static Public Attributes

static constexpr int64_t kPackBudget = 1000000
 Steps the exact packing of groups of different counts may take on each connected component.

Detailed Description

Lock placement shared by aie-objectfifo-allocate and the SA placer, on plain records.

Definition at line 32 of file AIELockPlan.h.

Member Typedef Documentation

◆ Memo

using xilinx::AIE::LockPlan::Memo = BoundedMemo<std::vector<int64_t>, Outcome>

Packings by what pack() reads, the least recently used dropped first beyond its capacity.

Definition at line 71 of file AIELockPlan.h.

Constructor & Destructor Documentation

◆ LockPlan()

xilinx::AIE::LockPlan::LockPlan ( const AIETargetModel & target)
inlineexplicit

Definition at line 73 of file AIELockPlan.h.

Member Function Documentation

◆ addTile()

unsigned xilinx::AIE::LockPlan::addTile ( Tile tile)
inline

Definition at line 100 of file AIELockPlan.h.

◆ assign()

LockPlan::Assignment LockPlan::assign ( llvm::ArrayRef< Group > groups,
Memo * memo = nullptr,
bool callerOrder = true )

Places groups first fit: with callerOrder, in order on each one's candidates, then in canonical order (canonicalFirstFit); without, in canonical order only.

On a miss: exact bipartite matching when every group takes one count, else exact packing, which leaves the first-fit placement standing if no packing exists or the search runs out of kPackBudget steps. The SA places in canonical order only, so it fits only where allocation's own-order-first pass fits too.

Definition at line 36 of file AIELockPlan.cpp.

References xilinx::AIE::LockPlan::Group::count, xilinx::AIE::LockPlan::Assignment::failed, xilinx::AIE::LockPlan::Assignment::failure, xilinx::AIE::BoundedMemo< Key, Value, Hash >::find(), group(), place(), xilinx::AIE::BoundedMemo< Key, Value, Hash >::record(), xilinx::AIE::LockPlan::Assignment::stopped, xilinx::AIE::LockPlan::Assignment::tiles, and xilinx::AIE::LockPlan::Assignment::unassigned.

◆ dmaLocalOnly()

bool xilinx::AIE::LockPlan::dmaLocalOnly ( AIETileType type)
inlinestatic

Whether a DMA on a tile of type uses only its own tile's locks: every DMA does but a mem tile's.

Definition at line 90 of file AIELockPlan.h.

◆ group()

Group xilinx::AIE::LockPlan::group ( int count,
unsigned home,
bool local,
llvm::ArrayRef< unsigned > buffers,
llvm::ArrayRef< User > users,
llvm::ArrayRef< unsigned > ranked )
inlinestatic

A group of count locks a pool's objects are counted by: on home, else, unless the pool must stay local, on a tile holding its buffers, one of its users' tiles, then any tile in ranked order.

Definition at line 141 of file AIELockPlan.h.

References group().

Referenced by assign(), group(), and place().

◆ groupCounts()

llvm::SmallVector< int > xilinx::AIE::LockPlan::groupCounts ( const AIETargetModel & target,
int64_t depth,
int owners )
inlinestatic

The lock groups owners lock owners of a pool of depth objects take, by count.

With semaphore locks each owner is a segment taking a pair, one lock counting free objects and one full ones; otherwise the one owner is the pool, taking a binary lock per object.

Definition at line 79 of file AIELockPlan.h.

References xilinx::AIE::AIETargetModel::UsesSemaphoreLocks.

◆ lockOwners()

llvm::SmallVector< mlir::Operation * > LockPlan::lockOwners ( const AIETargetModel & target,
ObjectFifoPoolOp pool )
static

The ops whose locks allocation and the SA each make for pool: with semaphore locks, each segment without its own pair; otherwise the pool, when it has none.

Definition at line 23 of file AIELockPlan.cpp.

References xilinx::AIE::AIETargetModel::UsesSemaphoreLocks.

◆ place()

Placed xilinx::AIE::LockPlan::place ( const Group & group)
inline

◆ reaches() [1/2]

bool xilinx::AIE::LockPlan::reaches ( const AIETargetModel & target,
llvm::ArrayRef< TileID > user,
llvm::ArrayRef< TileID > memory,
bool localOnly )
inlinestatic

Whether a tile at one of user reaches memory at one of memory; with localOnly, only at its own position.

Definition at line 120 of file AIELockPlan.h.

References xilinx::AIE::AIETargetModel::Either, and xilinx::AIE::AIETargetModel::Second.

Referenced by reaches().

◆ reaches() [2/2]

bool xilinx::AIE::LockPlan::reaches ( const User & user,
unsigned tile ) const
inline

◆ reserve()

bool xilinx::AIE::LockPlan::reserve ( unsigned tile,
int count )
inline

Takes count locks on tile, or returns false when it has too few left.

A tile not yet placed is not counted.

Definition at line 107 of file AIELockPlan.h.

Referenced by place().

Member Data Documentation

◆ kPackBudget

int64_t xilinx::AIE::LockPlan::kPackBudget = 1000000
staticconstexpr

Steps the exact packing of groups of different counts may take on each connected component.

Definition at line 196 of file AIELockPlan.h.


The documentation for this class was generated from the following files: