MLIR-AIE 1.4.5.dev
AIERoutingDiagnostics.cpp
Go to the documentation of this file.
1//===- AIERoutingDiagnostics.cpp --------------------------------*- C++ -*-===//
2//
3// Copyright (C) 2026 Advanced Micro Devices, Inc.
4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5//
6//===----------------------------------------------------------------------===//
7
9
10#include "llvm/Support/FormatVariadic.h"
11
12using namespace xilinx;
13
14std::string AIE::describePort(Port port) {
15 return llvm::formatv("{0}:{1}", stringifyWireBundle(port.bundle),
16 port.channel);
17}
18
19std::string AIE::describeTilePort(TileID tile, Port port) {
20 return llvm::formatv("({0}, {1}) {2}", tile.col, tile.row,
21 describePort(port));
22}
23
24std::string AIE::joinNames(llvm::ArrayRef<std::string> names, size_t shown) {
25 size_t more = names.size() > shown ? names.size() - shown : 0;
26 llvm::ArrayRef<std::string> listed = names.drop_back(more);
27 std::string list;
28 for (auto [i, name] : llvm::enumerate(listed))
29 list += (i == 0 ? ""
30 : i + 1 == listed.size() && !more ? " and "
31 : ", ") +
32 name;
33 if (more)
34 list += " and " + std::to_string(more) + " more";
35 return list;
36}
37
38std::string AIE::describePrioritized(llvm::ArrayRef<std::string> sources) {
39 return "packet flows from " + joinNames(sources) +
40 " are prioritized (priority_route) in a design a control-packet "
41 "reload configures (has_ctrl_pkt_overlay), so they keep the route "
42 "they take alone, as in @ctrl_pkt_overlay";
43}
std::string joinNames(llvm::ArrayRef< std::string > names, size_t shown=4)
Lists names as "A, B and C", the first shown of them followed by "N more" if there are more.
std::string describePrioritized(llvm::ArrayRef< std::string > sources)
Says that the packet flows from sources keep the route they take alone, as a control-packet reload of...
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::string describeTilePort(TileID tile, Port port)
Names a tile port the way diagnostics do, e.g. "(0, 2) DMA:1".
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::string describePort(Port port)
Names a port the way diagnostics do, e.g. "DMA:1".