MLIR-AIE 1.4.6.dev
DmaQueueModel.h File Reference
#include "aie/Dialect/AIE/IR/AIETargetModel.h"
#include "aie/Dialect/AIEX/IR/AIEXDialect.h"
#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
#include "mlir/Dialect/Utils/StaticValueUtils.h"
#include "mlir/IR/Builders.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/MathExtras.h"
#include <climits>
#include <algorithm>
#include <array>
#include <cstdint>
#include <functional>
#include <map>
#include <set>
Include dependency graph for DmaQueueModel.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  xilinx::AIEX::DmaQueueModel
 Tracks, per DMA channel, the pushes not yet known to have completed along one execution path. More...
struct  xilinx::AIEX::DmaQueueModel::ChannelState
 One channel's queue: its pushes not yet known to have completed, oldest first, each true when it issues a completion token. More...
struct  xilinx::AIEX::SyncCover
 The channels an aiex.npu.sync syncChannelKey cannot pin down may wait on: its tile range expanded, any value for an operand known only at run time. More...
struct  xilinx::AIEX::QueueEffect
 What one op in a loop body does to a channel queue. More...
struct  xilinx::AIEX::DmaCompletionState
 Completion is distinct from queue occupancy: Task_Queue_Size excludes the running task. More...
struct  xilinx::AIEX::DmaCompletionState::Push

Namespaces

namespace  xilinx
namespace  xilinx::AIEX

Typedefs

using xilinx::AIEX::ChannelVisits
 Per-channel analysis visits only the block each push, await or poll reaches through, plus the ops enclosing them, in block order, rather than the whole sequence.

Functions

std::optional< DmaQueueModel::ChannelKey > xilinx::AIEX::syncChannelKey (NpuSyncOp sync)
 The channel an aiex.npu.sync retires on, or nullopt when it cannot be pinned down.
SyncCover xilinx::AIEX::syncCover (NpuSyncOp sync)
void xilinx::AIEX::awaitSync (DmaQueueModel &queue, NpuSyncOp sync)
 Retire what an aiex.npu.sync proves has drained.
mlir::InFlightDiagnostic xilinx::AIEX::emitQueueOverflowWarning (mlir::Operation *op, int col, int row, AIE::DMAChannelDir dir, uint32_t channel, uint32_t depth, size_t outstanding)
 Shared wording for the two lowering paths, so the explanation does not depend on whether the transfer came from dma_start_task or npu.dma_memcpy_nd.
mlir::InFlightDiagnostic xilinx::AIEX::emitUnsafeBdReuseWarning (mlir::Operation *freeOp, int col, int row, AIE::DMAChannelDir dir, uint32_t channel)
 Wording for a dma_free_task that releases a buffer descriptor id the runtime pool could hand straight back out before hardware has actually finished the freed transfer – the rolled-loop counterpart to aie-assign-runtime-sequence-bd-ids's unsafe-BD-reuse warning.
std::optional< std::pair< uint32_t, uint32_t > > xilinx::AIEX::queueSpacePoll (const AIE::AIETargetModel &tm, int col, int row, uint32_t channel, AIE::DMAChannelDir dir, uint32_t depth)
 Address and mask for a poll that waits for a free task-queue slot.
mlir::LogicalResult xilinx::AIEX::insertQueueSpaceWait (mlir::Operation *before, const AIE::AIETargetModel &tm, int col, int row, uint32_t channel, AIE::DMAChannelDir dir, uint32_t depth)
void xilinx::AIEX::guardQueueOverflow (DmaQueueModel &queue, mlir::Operation *push, const AIE::AIETargetModel &tm, const DmaQueueModel::ChannelKey &key, uint32_t depth, bool enforce)
 Handle a push on key that would land on a full queue: poll where one can be emitted, warn where it cannot (see insertQueueSpaceWait above for when that is).
QueueEffect xilinx::AIEX::rawQueueEffect (mlir::Operation *op, mlir::SymbolTable &symbols)
 What a push or an await that names no task does to its channel: an aiex.npu.push_queue; an aiex.npu.dma_memcpy_nd through the placed shim allocation its metadata names, which always issues a token on S2MM (its lowering sets one); an aiex.npu.sync syncChannelKey pins down; an aiex.npu.dma_wait on a placed shim allocation.
void xilinx::AIEX::recordChannelVisit (mlir::Region &body, mlir::Operation *op, ChannelVisits &blocks)
 Record op and each operation enclosing it up to body's own op into blocks, once per block: an ancestor chain's visited block repeats until the chain's op there changes.
template<typename EffectFn>
void xilinx::AIEX::guardSequenceQueueDepth (mlir::Region &body, DmaQueueModel &queue, const AIE::AIETargetModel &tm, bool enforce, bool warnUnsafeBdReuse, EffectFn effectOf)
 Guard every push in a runtime sequence that can land on a full queue, and (when warnUnsafeBdReuse) warn at every Free effect whose own push is not yet proven complete along some reachable path.
template<typename EffectFn>
mlir::LogicalResult xilinx::AIEX::checkTokensConsumed (AIE::RuntimeSequenceOp sequence, const std::set< DmaQueueModel::ChannelKey > &awaited, llvm::ArrayRef< SyncCover > mayAwait, EffectFn effectOf)
 Check that sequence ends, on every path, with no task-completion token outstanding on a channel some sequence of the device awaits: one in awaited, or one a sync in mayAwait may wait on.

Variables

constexpr llvm::StringLiteral xilinx::AIEX::queueDiagnosedAttr