MLIR-AIE 1.4.6.dev
AIEGenerateColumnControlOverlay.cpp
Go to the documentation of this file.
1//===- AIEGenerateColumnControlOverlay.cpp ----------------------*- C++ -*-===//
2//
3// Copyright (C) 2024 Advanced Micro Devices, Inc.
4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5//
6//===----------------------------------------------------------------------===//
7
15
16#include "mlir/IR/Attributes.h"
17#include "mlir/Pass/PassManager.h"
18
19#include "llvm/ADT/SmallSet.h"
20
21#include <map>
22#include <optional>
23#include <set>
24#include <tuple>
25
26namespace xilinx::AIE {
27#define GEN_PASS_DEF_AIEGENERATECOLUMNCONTROLOVERLAY
28#define GEN_PASS_DEF_AIEASSIGNTILECTRLIDS
29#include "aie/Dialect/AIE/Transforms/AIEPasses.h.inc"
30} // namespace xilinx::AIE
31
32#define DEBUG_TYPE "aie-generate-column-control-overlay"
33
34using namespace mlir;
35using namespace xilinx;
36using namespace xilinx::AIE;
37
38static std::string getCtrlPktAllocName(int col, int chan) {
39 return "ctrlpkt_col" + std::to_string(col) + "_mm2s_chan" +
40 std::to_string(chan);
41}
42
44 : xilinx::AIE::impl::AIEAssignTileCtrlIDsBase<AIEAssignTileCtrlIDsPass> {
45 void runOnOperation() override {
46 DeviceOp device = getOperation();
47 const auto &targetModel = device.getTargetModel();
48
49 if (!targetModel.hasProperty(AIETargetModel::SupportsControlPackets))
50 return;
51
52 auto tileIDMap =
53 targetModel.getTileToControllerIdMap(clColumnWiseUniqueIDs);
54 for (auto tile : device.getOps<TileOp>()) {
55 if (!tile->hasAttr("controller_id"))
56 tile->setAttr("controller_id",
57 PacketInfoAttr::get(tile.getContext(), 0,
58 tileIDMap[tile.getTileID()]));
59 }
60 }
61};
62
65 AIEGenerateColumnControlOverlayPass> {
66 using Base::Base;
67 DenseMap<std::pair<int, int>, unsigned> packetDemand;
68 DenseMap<int, llvm::SmallSet<int, 2>> fixedCircuits;
69
70 void runOnOperation() override {
71 llvm::MapVector<AIEDevice, SmallVector<DeviceOp>> groups;
72 for (DeviceOp device : getOperation().getOps<DeviceOp>())
73 if (getsColumnControlOverlay(device, configuration)) {
74 // AIE4 overlays are fed by the shim ControlMM2S DMA and differ in
75 // packet headers and task-completion routes.
76 if (isa<AIE4TargetModel>(device.getTargetModel())) {
77 device.emitOpError("the column control overlay is not yet "
78 "supported on AIE4");
79 return signalPassFailure();
80 }
81 groups[device.getDevice()].push_back(device);
82 }
83 for (auto &[target, users] : groups)
84 if (failed(generate(users)))
85 return signalPassFailure();
86 }
87
88 LogicalResult generate(ArrayRef<DeviceOp> users) {
89 ModuleOp module = getOperation();
90 AIEDialect::IsCtrlPktOverlayAttrHelper marker(&getContext());
91 DeviceOp first = users.front();
92 auto target = first.getDevice();
93 auto tokenTiles = collectTokenIssuingTiles(users);
94 std::set<int> columns;
95 if (configuration)
96 for (DeviceOp device : users)
97 for (TileOp tile : device.getOps<TileOp>())
98 columns.insert(tile.colIndex());
99 for (TileID tile : tokenTiles)
100 columns.insert(tile.col);
101 if (configuration) {
102 for (DeviceOp device : users)
103 device.walk([&](AIEX::NpuControlPacketOp packet) {
104 columns.insert(packet.getColumnFromAddr());
105 });
106 columns.insert(coverColumns.begin(), coverColumns.end());
107 collectShimMM2SUses(users);
108 }
109 SymbolTable symbols(module);
110 OpBuilder builder(module.getContext());
111 builder.setInsertionPointToEnd(module.getBody());
112 DeviceOp overlay =
113 DeviceOp::create(builder, module.getLoc(), target,
114 builder.getStringAttr("ctrl_pkt_overlay"), nullptr);
115 symbols.insert(overlay);
116 overlay.getRegion().emplaceBlock();
117 builder.setInsertionPointToEnd(overlay.getBody());
118 EndOp::create(builder, overlay.getLoc());
119 marker.setAttr(overlay, builder.getUnitAttr());
120 builder.setInsertionPointToStart(overlay.getBody());
121 for (DeviceOp device : users)
122 for (TileOp tile : device.getOps<TileOp>()) {
123 TileOp dest = TileOp::getOrCreate(builder, overlay, tile.colIndex(),
124 tile.rowIndex());
125 if (auto id = tile->getAttr("controller_id")) {
126 if (auto other = dest->getAttr("controller_id");
127 other && other != id) {
128 tile.emitOpError(
129 "has a different controller ID in another configuration");
130 return failure();
131 }
132 dest->setAttr("controller_id", id);
133 }
134 }
135 const auto &model = overlay.getTargetModel();
136 auto ids = model.getTileToControllerIdMap(true);
137 auto flow = [&](TileOp source, Port src, TileOp dest, Port dst,
138 TileOp controller) {
139 builder.setInsertionPoint(overlay.getBody()->getTerminator());
140 int id = ids[controller.getTileID()];
141 if (auto attr =
142 controller->getAttrOfType<PacketInfoAttr>("controller_id"))
143 id = attr.assignedId();
144 auto packet = PacketFlowOp::create(builder, controller.getLoc(), id,
145 builder.getBoolAttr(true),
146 builder.getBoolAttr(true));
147 OpBuilder::InsertionGuard guard(builder);
148 builder.createBlock(&packet.getPorts());
149 PacketSourceOp::create(builder, packet.getLoc(), source, src.bundle,
150 src.channel);
151 PacketDestOp::create(builder, packet.getLoc(), dest, dst.bundle,
152 dst.channel);
153 EndOp::create(builder, packet.getLoc());
154 };
155 std::map<int, int> controlChannel;
156 for (int col : columns) {
157 if (col < 0 || col >= model.columns()) {
158 overlay.emitOpError("control coverage column is outside the target");
159 return failure();
160 }
161 builder.setInsertionPointToStart(overlay.getBody());
162 TileOp shim = TileOp::getOrCreate(builder, overlay, col, 0);
163 flow(shim, {WireBundle::TileControl, 0}, shim, {WireBundle::South, 0},
164 shim);
165 for (TileID tile : tokenTiles)
166 if (tile.col == col && tile.row != 0) {
167 builder.setInsertionPointToStart(overlay.getBody());
168 TileOp source = TileOp::getOrCreate(builder, overlay, col, tile.row);
169 flow(source, {WireBundle::TileControl, 0}, shim,
170 {WireBundle::South, 0}, source);
171 }
172 if (!configuration)
173 continue;
174 int channel = -1;
175 unsigned best = std::numeric_limits<unsigned>::max();
176 int count =
177 adaptive ? model.getNumDMAChannels(col, 0, DMAChannelDir::MM2S) : 1;
178 for (int ch = 0; ch < count; ++ch)
179 if (!fixedCircuits.lookup(col).contains(ch) &&
180 packetDemand.lookup({col, ch}) < best) {
181 channel = ch;
182 best = packetDemand.lookup({col, ch});
183 }
184 if (channel < 0) {
185 overlay.emitOpError("failed to generate control overlay: no available "
186 "shim MM2S channel in column ")
187 << col;
188 return failure();
189 }
190 controlChannel[col] = channel;
191 builder.setInsertionPoint(overlay.getBody()->getTerminator());
192 auto alloc = ShimDMAAllocationOp::create(
193 builder, shim.getLoc(), getCtrlPktAllocName(col, channel), shim,
194 DMAChannelDir::MM2S, channel, false, nullptr, nullptr);
195 marker.setAttr(alloc, builder.getUnitAttr());
196 for (int row = 0; row < model.rows(); ++row) {
197 builder.setInsertionPointToStart(overlay.getBody());
198 TileOp dest = TileOp::getOrCreate(builder, overlay, col, row);
199 flow(shim, {WireBundle::DMA, channel}, dest,
200 {WireBundle::TileControl, 0}, dest);
201 }
202 }
203 if (configuration && multicastSpan &&
204 failed(addMulticasts(builder, overlay, users, controlChannel)))
205 return failure();
206 for (DeviceOp device : users) {
207 device.setOverlayAttr(FlatSymbolRefAttr::get(overlay.getSymNameAttr()));
208 if (configuration)
209 AIEDialect::ReserveControllerPacketIdsAttrHelper(&getContext())
210 .setAttr(device, builder.getUnitAttr());
211 }
212 if (!configuration)
213 return success();
214 std::vector<std::pair<TileID, Port>> avoided;
215 if (adaptive && failed(applicationPorts(module, avoided)))
216 return failure();
217 // Detours around the application can fill a control channel's slave port
218 // with rules, leaving none for a data flow that shares the channel. Such
219 // an overlay routes again without the detours.
220 OwningOpRef<Operation *> unrouted;
221 if (!avoided.empty())
222 unrouted = overlay->clone();
223 if (failed(route(overlay, avoided)))
224 return failure();
225 if (unrouted && !controlChannelsHaveRuleSlots(overlay)) {
226 overlay.getRegion().takeBody(unrouted.get()->getRegion(0));
227 if (failed(route(overlay, {})))
228 return failure();
229 }
230 // Reprogramming another master set of an active arbiter can stall control
231 // packets.
232 for (auto box : overlay.getOps<SwitchboxOp>()) {
233 auto amsels = llvm::to_vector(box.getConnections().getOps<AMSelOp>());
234 std::set<std::pair<int, int>> slots;
235 for (auto amsel : amsels)
236 slots.emplace(amsel.arbiterIndex(), amsel.getMselValue());
237 builder.setInsertionPoint(box.getConnections().front().getTerminator());
238 for (auto amsel : amsels)
239 for (unsigned msel = 0; msel < model.getNumMselsPerArbiter(); ++msel)
240 if (slots.emplace(amsel.arbiterIndex(), msel).second)
241 AMSelOp::create(builder, amsel.getLoc(), amsel.arbiterIndex(),
242 msel);
243 }
244 overlay.walk([&](Operation *op) {
245 op->removeAttr("aie.priority_route");
246 if (!isa<DeviceOp, EndOp, PacketRulesOp>(op))
247 marker.setAttr(op, builder.getUnitAttr());
248 });
249 return success();
250 }
251
252 LogicalResult route(DeviceOp overlay,
253 ArrayRef<std::pair<TileID, Port>> avoided) {
254 OpPassManager routing(DeviceOp::getOperationName());
255 routing.addPass(createAIEAssignTileCtrlIDsPass());
256 routing.addPass(createAIEPathfinderPass({}, avoided));
257 return runPipeline(routing, overlay);
258 }
259
260 // Whether the slave port by which each control channel enters its
261 // switchbox has a packet rule slot left.
262 static bool controlChannelsHaveRuleSlots(DeviceOp overlay) {
263 unsigned slots = overlay.getTargetModel().getNumSlaveSlots();
264 std::map<TileID, SwitchboxOp> boxes;
265 for (auto box : overlay.getOps<SwitchboxOp>())
266 boxes[box.getTileOp().getTileID()] = box;
267 std::map<std::pair<TileID, int>, Port> entries;
268 for (auto mux : overlay.getOps<ShimMuxOp>())
269 for (auto connect : mux.getConnections().getOps<ConnectOp>())
270 if (connect.getSourceBundle() == WireBundle::DMA)
271 entries[{mux.getTileOp().getTileID(), connect.sourceIndex()}] = {
272 WireBundle::South, connect.destIndex()};
273 for (auto alloc : overlay.getOps<ShimDMAAllocationOp>()) {
274 TileID tile = alloc.getTileOp().getTileID();
275 auto entry = entries.find({tile, (int)alloc.getChannelIndex()});
276 auto box = boxes.find(tile);
277 if (entry == entries.end() || box == boxes.end())
278 continue;
279 for (auto rules : box->second.getConnections().getOps<PacketRulesOp>())
280 if (rules.sourcePort() == entry->second &&
281 llvm::range_size(rules.getRules().getOps<PacketRuleOp>()) >= slots)
282 return false;
283 }
284 return true;
285 }
286
287 // See the pass description's multicast-span. Every group shares one id: the
288 // router keeps two trees on one id apart unless they reach the same tiles,
289 // as it does the controllers' ids, which repeat in every column.
290 LogicalResult addMulticasts(OpBuilder &builder, DeviceOp overlay,
291 ArrayRef<DeviceOp> users,
292 const std::map<int, int> &controlChannel) {
293 std::set<TileID> cores;
294 for (DeviceOp device : users)
295 for (CoreOp core : device.getOps<CoreOp>())
296 cores.insert(core.getTileOp().getTileID());
297 if (cores.empty())
298 return success();
299 int base = cores.begin()->col;
300 std::map<int, SmallVector<TileID>> groups;
301 for (TileID t : cores)
302 groups[(t.col - base) / static_cast<int>(multicastSpan)].push_back(t);
303 for (auto it = groups.begin(); it != groups.end();)
304 it = it->second.size() < 2 ? groups.erase(it) : std::next(it);
305 if (groups.empty())
306 return success();
307
308 SmallVector<PacketIdSpace> spaces;
309 for (DeviceOp device : users)
310 spaces.emplace_back(device, /*reserveControllerIds=*/true);
311 // The router folds the ids headed for one arbiter into mask/value rules,
312 // so the highest free id, among the controllers' where one is free, keeps
313 // those masks narrow.
314 int id = overlay.getTargetModel().getMaxPacketId();
315 for (; id >= 0; --id)
316 if (llvm::none_of(spaces, [&](const PacketIdSpace &space) {
317 return space.isTaken(id);
318 }))
319 break;
320 if (id < 0)
321 return success();
322
323 MLIRContext *ctx = overlay.getContext();
324 SmallVector<Attribute> record;
325 for (auto &[g, members] : groups) {
326 int srcCol = members.front().col;
327 auto channel = controlChannel.find(srcCol);
328 if (channel == controlChannel.end())
329 return overlay.emitOpError("has no control channel in column ")
330 << srcCol << " for a control multicast";
331
332 builder.setInsertionPointToStart(overlay.getBody());
333 TileOp shim = TileOp::getOrCreate(builder, overlay, srcCol, 0);
334 SmallVector<TileOp> tiles;
335 SmallVector<Attribute> listed;
336 for (TileID t : members) {
337 tiles.push_back(TileOp::getOrCreate(builder, overlay, t.col, t.row));
338 listed.push_back(TileAttr::get(ctx, t.col, t.row));
339 }
340 builder.setInsertionPoint(overlay.getBody()->getTerminator());
341 auto flow = PacketFlowOp::create(builder, shim.getLoc(), id,
342 builder.getBoolAttr(true),
343 builder.getBoolAttr(true));
344 OpBuilder::InsertionGuard guard(builder);
345 builder.createBlock(&flow.getPorts());
346 PacketSourceOp::create(builder, flow.getLoc(), shim, WireBundle::DMA,
347 channel->second);
348 for (TileOp t : tiles)
349 PacketDestOp::create(builder, flow.getLoc(), t, WireBundle::TileControl,
350 0);
351 EndOp::create(builder, flow.getLoc());
352 record.push_back(DictionaryAttr::get(
353 ctx,
354 {builder.getNamedAttr(
355 "allocation",
356 FlatSymbolRefAttr::get(
357 ctx, getCtrlPktAllocName(srcCol, channel->second))),
358 builder.getNamedAttr("packet_id", builder.getI32IntegerAttr(id)),
359 builder.getNamedAttr("tiles", ArrayAttr::get(ctx, listed))}));
360 }
361 AIEDialect::CtrlPktMulticastAttrHelper(ctx).setAttr(
362 overlay, ArrayAttr::get(ctx, record));
363 return success();
364 }
365
366 void collectShimMM2SUses(ArrayRef<DeviceOp> devices) {
367 packetDemand.clear();
368 fixedCircuits.clear();
369 for (DeviceOp device : devices) {
370 ShimMM2SUses uses = shimMM2SUses(device, packetSwitched);
371 for (auto &[tile, channels] : uses.circuits)
372 if (std::optional<int> col = cast<TileLike>(tile).tryGetCol())
373 fixedCircuits[*col].insert(channels.begin(), channels.end());
374 for (auto &[at, ends] : uses.packetEnds)
375 if (std::optional<int> col = cast<TileLike>(at.first).tryGetCol())
376 packetDemand[{*col, at.second}] += ends.size();
377 for (auto &[at, flows] : uses.packetFlows)
378 if (std::optional<int> col = cast<TileLike>(at.first).tryGetCol())
379 packetDemand[{*col, at.second}] += flows;
380 }
381 }
382
383 static llvm::SmallSet<AIE::TileID, 4>
384 collectTokenIssuingTiles(ArrayRef<DeviceOp> devices) {
385 llvm::SmallSet<AIE::TileID, 4> tiles;
386 for (DeviceOp device : devices) {
387 for (TileOp tile : device.getOps<TileOp>())
388 if (tile.isShimNOCorPLTile())
389 tiles.insert(tile.getTileID());
390 SymbolTable symbols(device);
391 device.walk([&](Operation *op) {
392 bool issuesToken = false;
393 if (auto task = dyn_cast<AIEX::DMAConfigureTaskOp>(op))
394 issuesToken = bool(task.getIssueToken());
395 else if (auto task = dyn_cast<AIEX::DMAConfigureTaskForOp>(op))
396 issuesToken = bool(task.getIssueToken());
397 if (issuesToken)
398 if (auto tile = dyn_cast_or_null<TileOp>(
399 AIEX::getRuntimeDmaTile(op, symbols)))
400 tiles.insert(tile.getTileID());
401 if (auto push = dyn_cast<AIEX::NpuPushQueueOp>(op))
402 if (push.getIssueToken())
403 tiles.insert({static_cast<int>(push.getColumn()),
404 static_cast<int>(push.getRow())});
405 });
406 }
407 return tiles;
408 }
409
410 LogicalResult
411 applicationPorts(ModuleOp module,
412 std::vector<std::pair<TileID, Port>> &avoided) {
413 OwningOpRef<ModuleOp> trial = cast<ModuleOp>(module->clone());
414 for (DeviceOp device :
415 llvm::make_early_inc_range(trial->getOps<DeviceOp>())) {
416 if (device->hasAttr("aie.is_ctrl_pkt_overlay"))
417 device.erase();
418 else
419 device.removeOverlayAttr();
420 }
421 PassManager pm(&getContext());
422 auto &dpm = pm.nest<DeviceOp>();
423 dpm.addPass(createAIEAssignPacketIdsPass());
424 dpm.addPass(createAIEObjectFifoAllocatePass());
426 if (failed(pm.run(*trial))) {
427 module.emitError("failed to analyze application resources for adaptive "
428 "control overlay");
429 return failure();
430 }
431 std::set<std::pair<TileID, Port>> ports;
432 for (DeviceOp device : trial->getOps<DeviceOp>()) {
433 for (SwitchboxOp box : device.getOps<SwitchboxOp>()) {
434 for (ConnectOp connect : box.getOps<ConnectOp>())
435 ports.insert({box.getTileOp().getTileID(), connect.destPort()});
436 for (MasterSetOp master : box.getOps<MasterSetOp>())
437 ports.insert({box.getTileOp().getTileID(), master.destPort()});
438 }
439 DynamicTileAnalysis analysis;
440 llvm::Error error = analysis.runAnalysis(device);
441 if (error) {
442 device.emitOpError("cannot plan adaptive control overlay: ")
443 << llvm::toString(std::move(error));
444 return failure();
445 }
446 auto collect = [&](const SwitchSettings &settings) {
447 for (const auto &[tile, setting] : settings)
448 for (Port output : setting.dsts)
449 ports.insert({tile, output});
450 };
451 for (const auto &[_, settings] : analysis.routing.settings)
452 collect(settings);
453 for (const auto &[_, settings] : analysis.routing.idSettings)
454 collect(settings);
455 }
456 avoided.assign(ports.begin(), ports.end());
457 return success();
458 }
459};
460
461ShimMM2SUses AIE::shimMM2SUses(DeviceOp device, bool packetSwitched) {
462 ShimMM2SUses uses;
463 auto shim = [](Value tile) -> Operation * {
464 auto like = dyn_cast_or_null<TileLike>(tile.getDefiningOp());
465 return like && (like.getTileType() == AIETileType::ShimNOCTile ||
466 like.getTileType() == AIETileType::ShimPLTile)
467 ? like.getOperation()
468 : nullptr;
469 };
470 for (auto endpoint : device.getOps<RouteEndpointOp>()) {
471 Operation *tile = shim(endpoint.getTile());
472 std::optional<int> channel = endpoint.getChannelIndex();
473 if (!tile || endpoint.getBundle() != WireBundle::DMA ||
474 endpoint.getRouteDirection() != DMAChannelDir::MM2S || !channel)
475 continue;
476 bool packet = llvm::any_of(device.getOps<RouteOp>(), [&](RouteOp route) {
477 std::optional<PacketInfoAttr> header = route.getPacket();
478 return route.namesAsSource(endpoint.getSymName()) &&
479 isPacketSwitched(header.value_or(nullptr), packetSwitched);
480 });
481 if (packet)
482 uses.packetEnds[{tile, *channel}].push_back(endpoint.getSymNameAttr());
483 else
484 uses.circuits[tile].insert(*channel);
485 }
486 for (auto alloc : device.getOps<ShimDMAAllocationOp>())
487 if (alloc.getChannelDir() == DMAChannelDir::MM2S)
488 uses.circuits[alloc.getTile().getDefiningOp()].insert(
489 static_cast<int>(alloc.getChannelIndex()));
490 for (auto flow : device.getOps<FlowOp>())
491 if (flow.getSourceBundle() == WireBundle::DMA)
492 if (Operation *tile = shim(flow.getSource()))
493 uses.circuits[tile].insert(flow.getSourceChannel());
494 for (auto flow : device.getOps<PacketFlowOp>())
495 for (auto src : flow.getOps<PacketSourceOp>())
496 if (src.getBundle() == WireBundle::DMA)
497 if (Operation *tile = shim(src.getTile()))
498 ++uses.packetFlows[{tile, src.channelIndex()}];
499 for (auto mux : device.getOps<ShimMuxOp>())
500 for (auto connect : mux.getConnections().front().getOps<ConnectOp>())
501 if (connect.getSourceBundle() == WireBundle::DMA)
502 uses.circuits[mux.getTile().getDefiningOp()].insert(
503 connect.sourceIndex());
504 return uses;
505}
506
507bool AIE::getsColumnControlOverlay(DeviceOp device, bool configuration) {
508 return !AIEDialect::IsCtrlPktOverlayAttrHelper(device.getContext())
509 .isAttrPresent(device) &&
510 !device.getOverlayAttr() &&
511 device.getTargetModel().hasProperty(
513 (configuration ||
515 {device})
516 .empty());
517}
518
519std::unique_ptr<OperationPass<DeviceOp>> AIE::createAIEAssignTileCtrlIDsPass() {
520 return std::make_unique<AIEAssignTileCtrlIDsPass>();
521}
522
523std::unique_ptr<OperationPass<mlir::ModuleOp>>
525 return std::make_unique<AIEGenerateColumnControlOverlayPass>();
526}
527
528std::unique_ptr<OperationPass<mlir::ModuleOp>>
530 const AIEGenerateColumnControlOverlayOptions &options) {
531 return std::make_unique<AIEGenerateColumnControlOverlayPass>(options);
532}
llvm::Error runAnalysis(DeviceOp &device)
The packet ids a device has already spoken for.
Operation * getRuntimeDmaTile(Operation *op, SymbolTable &symbols)
Definition AIEUtils.cpp:578
std::unique_ptr< mlir::OperationPass< DeviceOp > > createAIEAssignTileCtrlIDsPass()
std::unique_ptr< mlir::OperationPass< DeviceOp > > createAIEObjectFifoAllocatePass()
bool getsColumnControlOverlay(DeviceOp device, bool configuration)
struct TileID { friend std::ostream &operator<<(std::ostream &os, const TileID &s) { os<< "TileID("<< s.col<< ", "<< s.row<< ")"; return os; } friend std::string to_string(const TileID &s) { std::ostringstream ss; ss<< s; return ss.str(); } friend llvm::raw_ostream &operator<<(llvm::raw_ostream &os, const TileID &s) { os<< to_string(s); return os; } inline bool operator<(const TileID &rhs) const { return std::tie(col, row)< std::tie(rhs.col, rhs.row); } bool operator==(const TileID &rhs) const { return std::tie(col, row)==std::tie(rhs.col, rhs.row); } bool operator!=(const TileID &rhs) const { return !(*this==rhs);} int col, row;} TileID
std::unique_ptr< mlir::OperationPass< mlir::ModuleOp > > createAIEGenerateColumnControlOverlayPass()
std::unique_ptr< mlir::OperationPass< DeviceOp > > createAIEAssignPacketIdsPass()
struct Port { WireBundle bundle; int channel; bool operator==(const Port &rhs) const { return std::tie(bundle, channel)==std::tie(rhs.bundle, rhs.channel); } bool operator!=(const Port &rhs) const { return !(*this==rhs);} bool operator<(const Port &rhs) const { return std::tie(bundle, channel)< std::tie(rhs.bundle, rhs.channel); } friend std::ostream &operator<<(std::ostream &os, const Port &port) { os<< "("; os<< stringifyWireBundle(port.bundle).str(); os<< ": "<< std::to_string(port.channel)<< ")"; return os; } friend llvm::raw_ostream &operator<<(llvm::raw_ostream &os, const Port &port) { os<< to_string(port); return os; } } Port
Definition AIEDialect.h:265
std::unique_ptr< mlir::OperationPass< DeviceOp > > createAIEObjectFifoLowerDMAsPass()
std::map< TileID, SwitchSetting > SwitchSettings
std::unique_ptr< mlir::OperationPass< DeviceOp > > createAIEPathfinderPass()
ShimMM2SUses shimMM2SUses(DeviceOp device, bool packetSwitched)
DenseMap< std::pair< int, int >, unsigned > packetDemand
LogicalResult route(DeviceOp overlay, ArrayRef< std::pair< TileID, Port > > avoided)
void collectShimMM2SUses(ArrayRef< DeviceOp > devices)
LogicalResult applicationPorts(ModuleOp module, std::vector< std::pair< TileID, Port > > &avoided)
LogicalResult generate(ArrayRef< DeviceOp > users)
static llvm::SmallSet< AIE::TileID, 4 > collectTokenIssuingTiles(ArrayRef< DeviceOp > devices)
LogicalResult addMulticasts(OpBuilder &builder, DeviceOp overlay, ArrayRef< DeviceOp > users, const std::map< int, int > &controlChannel)
DenseMap< int, llvm::SmallSet< int, 2 > > fixedCircuits
std::map< PathEndPoint, SwitchSettings > settings
std::map< std::pair< PathEndPoint, int >, SwitchSettings > idSettings
The shim MM2S channels device's overlay weighs, for aie-generate-column-control-overlay.
llvm::DenseMap< std::pair< mlir::Operation *, int >, unsigned > packetFlows
Packet flows per (tile, channel).
llvm::DenseMap< mlir::Operation *, llvm::SmallSet< int, 2 > > circuits
Channels a circuit-switched route end, flow, allocation or shim mux holds, per shim tile op.
llvm::DenseMap< std::pair< mlir::Operation *, int >, llvm::SmallVector< mlir::StringAttr > > packetEnds
Packet-switched route ends, by name, per (tile, channel).