Skip to content

Commit 2f52665

Browse files
committed
Simplified implementation and kept only required functions
Signed-off-by: Vinod Pangul <146476973+vipangul@users.noreply.github.com>
1 parent 9a0d571 commit 2f52665

File tree

6 files changed

+28
-204
lines changed

6 files changed

+28
-204
lines changed

src/runtime_src/xdp/profile/database/static_info/aie_util.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -213,23 +213,6 @@ namespace xdp::aie {
213213
return *rowOffset;
214214
}
215215

216-
/****************************************************************************
217-
* Get all valid graph names from metadata
218-
* NOTE: This is applicable only for aie_trace_config.json format till major v2.
219-
* Use latest version of AIETraceConfigFiletype for v3 and later.
220-
***************************************************************************/
221-
std::vector<std::string>
222-
getValidGraphs(const boost::property_tree::ptree& aie_meta,
223-
const std::string& root)
224-
{
225-
std::vector<std::string> graphs;
226-
for (auto& graph : aie_meta.get_child(root)) {
227-
std::string graphName = graph.second.get<std::string>("name");
228-
graphs.push_back(graphName);
229-
}
230-
return graphs;
231-
}
232-
233216
/****************************************************************************
234217
* Read AIE metadata from axlf section
235218
***************************************************************************/

src/runtime_src/xdp/profile/database/static_info/aie_util.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,6 @@ namespace xdp::aie {
6161
getAIETileRowOffset(const boost::property_tree::ptree& aie_meta,
6262
const std::string& location);
6363

64-
XDP_CORE_EXPORT
65-
std::vector<std::string>
66-
getValidGraphs(const boost::property_tree::ptree& aie_meta,
67-
const std::string& root);
68-
6964
XDP_CORE_EXPORT
7065
bool isInfoVerbosity();
7166

src/runtime_src/xdp/profile/database/static_info/filetypes/aie_control_config_filetype.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,12 @@ AIEControlConfigFiletype::getPartitionOverlayStartCols() const {
7878
std::vector<std::string>
7979
AIEControlConfigFiletype::getValidGraphs() const
8080
{
81-
return xdp::aie::getValidGraphs(aie_meta, "aie_metadata.graphs");
81+
std::vector<std::string> graphs;
82+
for (auto& graph : aie_meta.get_child("aie_metadata.graphs")) {
83+
std::string graphName = graph.second.get<std::string>("name");
84+
graphs.push_back(graphName);
85+
}
86+
return graphs;
8287
}
8388

8489
std::vector<std::string>

src/runtime_src/xdp/profile/database/static_info/filetypes/aie_trace_config_v3_filetype.cpp

Lines changed: 21 additions & 174 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,16 @@ AIETraceConfigV3Filetype::getValidKernels() const
3838
for (auto const &mapping : kernelToTileMapping.get()) {
3939
std::string functionStr = mapping.second.get<std::string>("function");
4040
if (functionStr.empty())
41-
continue; // Skip empty function names
41+
continue;
4242

4343
// Extract kernel names from function string
4444
std::vector<std::string> names;
4545
boost::split(names, functionStr, boost::is_any_of("."));
4646

4747
// Add individual kernel components
4848
for (const auto& name : names) {
49-
if (!name.empty()) {
50-
uniqueKernels.insert(name);
51-
}
49+
if (!name.empty())
50+
uniqueKernels.insert(name);
5251
}
5352

5453
// Also store the complete function name
@@ -77,17 +76,16 @@ AIETraceConfigV3Filetype::getValidGraphs() const
7776
for (auto const &mapping : kernelToTileMapping.get()) {
7877
std::string graphStr = mapping.second.get<std::string>("graph");
7978
if (graphStr.empty())
80-
continue; // Skip empty graph names
79+
continue;
8180

8281
// Extract subgraph names from complete graph string
8382
std::vector<std::string> names;
8483
boost::split(names, graphStr, boost::is_any_of("."));
8584

8685
// Add individual subgraph components
8786
for (const auto& name : names) {
88-
if (!name.empty()) {
89-
uniqueGraphs.insert(name);
90-
}
87+
if (!name.empty())
88+
uniqueGraphs.insert(name);
9189
}
9290

9391
// Add the complete graph name
@@ -104,25 +102,13 @@ AIETraceConfigV3Filetype::getValidGraphs() const
104102
// kernel_name = <kernel> : only tiles used by that specific kernel
105103
std::vector<tile_type>
106104
AIETraceConfigV3Filetype::getTiles(const std::string& graph_name,
107-
module_type type,
108-
const std::string& kernel_name) const
105+
module_type type,
106+
const std::string& kernel_name) const
109107
{
110108
if (type == module_type::mem_tile)
111109
return getMemoryTiles(graph_name, kernel_name);
112110

113-
// For DMA type, we want tiles that have DMA channels (both core tiles and DMA-only)
114-
if (type == module_type::dma) {
115-
if (kernel_name == "all")
116-
return getEventTiles(graph_name, type);
117-
// For specific kernel, we need special logic to include DMA-only tiles
118-
// Fall through to handle this case below
119-
}
120-
121-
// For core type or default, get tiles that use cores
122-
if (type == module_type::core && kernel_name == "all")
123-
return getAllAIETiles(graph_name);
124-
125-
// Now search by graph-kernel pairs for specific kernel
111+
// Always return both core and DMA tiles for both core and dma module types
126112
auto kernelToTileMapping = aie_meta.get_child_optional("aie_metadata.TileMapping.AIEKernelToTileMapping");
127113
if (!kernelToTileMapping) {
128114
xrt_core::message::send(severity_level::info, "XRT", getMessage("TileMapping.AIEKernelToTileMapping"));
@@ -157,19 +143,16 @@ AIETraceConfigV3Filetype::getTiles(const std::string& graph_name,
157143
auto dmaChannelsTree = mapping.second.get_child_optional("dmaChannels");
158144
bool isDMAUsed = (dmaChannelsTree && !dmaChannelsTree.get().empty());
159145

160-
// Add core tile if it matches the requested module type
161-
if ((type == module_type::core && isCoreUsed) ||
162-
(type == module_type::dma && isDMAUsed)) {
163-
tile_type tile;
164-
tile.col = mapping.second.get<uint8_t>("column");
165-
tile.row = mapping.second.get<uint8_t>("row") + rowOffset;
166-
tile.active_core = isCoreUsed;
167-
tile.active_memory = isDMAUsed;
168-
uniqueTiles.insert(tile);
169-
}
146+
// Always add core tile (for both core and dma module types)
147+
tile_type tile;
148+
tile.col = mapping.second.get<uint8_t>("column");
149+
tile.row = mapping.second.get<uint8_t>("row") + rowOffset;
150+
tile.active_core = isCoreUsed;
151+
tile.active_memory = isDMAUsed;
152+
uniqueTiles.insert(tile);
170153

171-
// For DMA module type, also add DMA-only tiles at different coordinates
172-
if (type == module_type::dma && dmaChannelsTree) {
154+
// Always add DMA-only tiles at different coordinates (for both core and dma module types)
155+
if (dmaChannelsTree) {
173156
uint8_t coreCol = mapping.second.get<uint8_t>("column");
174157
uint8_t coreRow = mapping.second.get<uint8_t>("row") + rowOffset;
175158

@@ -187,69 +170,10 @@ AIETraceConfigV3Filetype::getTiles(const std::string& graph_name,
187170
uniqueTiles.insert(dmaTile);
188171
}
189172
}
190-
}
191-
}
192-
}
173+
} // end of DMA channels processing
174+
} // end of foundGraph && foundKernel
175+
} // end of each mapping in kernelToTileMapping
193176

194-
// Convert set back to vector
195-
return std::vector<tile_type>(uniqueTiles.begin(), uniqueTiles.end());
196-
}
197-
198-
// Find all AIE tiles in a graph that use core and/or memories (kernel_name = all)
199-
std::vector<tile_type>
200-
AIETraceConfigV3Filetype::getAllAIETiles(const std::string& graph_name) const
201-
{
202-
auto kernelToTileMapping = aie_meta.get_child_optional("aie_metadata.TileMapping.AIEKernelToTileMapping");
203-
if (!kernelToTileMapping) {
204-
xrt_core::message::send(severity_level::info, "XRT", getMessage("TileMapping.AIEKernelToTileMapping"));
205-
return {};
206-
}
207-
208-
std::set<tile_type> uniqueTiles;
209-
auto rowOffset = getAIETileRowOffset();
210-
211-
for (auto const &mapping : kernelToTileMapping.get()) {
212-
std::string graphStr = mapping.second.get<std::string>("graph");
213-
if (graphStr.empty())
214-
continue; // Skip empty graph names
215-
216-
if ((graphStr.find(graph_name) == std::string::npos) && (graph_name.compare("all")) != 0)
217-
continue; // Skip graphs/subgraphs that do not match the requested graph name
218-
219-
// Add core tile
220-
tile_type coreTile;
221-
coreTile.col = xdp::aie::convertStringToUint8(mapping.second.get<std::string>("column"));
222-
coreTile.row = xdp::aie::convertStringToUint8(mapping.second.get<std::string>("row")) + rowOffset;
223-
224-
// Compute tile properties from metadata
225-
std::string tileType = mapping.second.get<std::string>("tile", "");
226-
coreTile.active_core = (tileType == "aie");
227-
228-
auto dmaChannelsTree = mapping.second.get_child_optional("dmaChannels");
229-
coreTile.active_memory = (dmaChannelsTree && !dmaChannelsTree.get().empty());
230-
231-
uniqueTiles.insert(coreTile);
232-
233-
// Add DMA-only tiles from dmaChannels that are at different coordinates than core tiles
234-
if (dmaChannelsTree) {
235-
for (auto const &channel : dmaChannelsTree.get()) {
236-
uint8_t dmaCol = xdp::aie::convertStringToUint8(channel.second.get<std::string>("column"));
237-
uint8_t dmaRow = xdp::aie::convertStringToUint8(channel.second.get<std::string>("row")) + rowOffset;
238-
239-
// Check if this DMA channel is at a different location than the core
240-
if (dmaCol != coreTile.col || dmaRow != coreTile.row) {
241-
tile_type dmaTile;
242-
dmaTile.col = dmaCol;
243-
dmaTile.row = dmaRow;
244-
dmaTile.active_core = false;
245-
dmaTile.active_memory = true;
246-
uniqueTiles.insert(dmaTile); // Set automatically handles uniqueness
247-
}
248-
}
249-
}
250-
}
251-
252-
// Convert set back to vector
253177
return std::vector<tile_type>(uniqueTiles.begin(), uniqueTiles.end());
254178
}
255179

@@ -297,83 +221,6 @@ AIETraceConfigV3Filetype::getAIETiles(const std::string& graph_name) const
297221
return tiles;
298222
}
299223

300-
// Find all AIE tiles in a graph that use the core or memory module (kernels = all)
301-
std::vector<tile_type>
302-
AIETraceConfigV3Filetype::getEventTiles(const std::string& graph_name,
303-
module_type type) const
304-
{
305-
if ((type == module_type::shim) || (type == module_type::mem_tile))
306-
return {};
307-
308-
auto kernelToTileMapping = aie_meta.get_child_optional("aie_metadata.TileMapping.AIEKernelToTileMapping");
309-
if (!kernelToTileMapping) {
310-
xrt_core::message::send(severity_level::info, "XRT", getMessage("TileMapping.AIEKernelToTileMapping"));
311-
return {};
312-
}
313-
314-
// Use set to handle uniqueness, especially important for DMA tiles
315-
std::set<tile_type> uniqueTiles;
316-
auto rowOffset = getAIETileRowOffset();
317-
318-
for (auto const &mapping : kernelToTileMapping.get()) {
319-
std::string graphStr = mapping.second.get<std::string>("graph", "");
320-
if (graphStr.empty())
321-
continue; // Skip empty graph names
322-
323-
if ((graphStr.find(graph_name) == std::string::npos) && (graph_name.compare("all") != 0))
324-
continue; // Skip graphs/subgraphs that do not match the requested graph name
325-
326-
// Compute isCoreUsed: true if tile type is "aie"
327-
std::string tileType = mapping.second.get<std::string>("tile", "");
328-
bool isCoreUsed = (tileType == "aie");
329-
330-
// Compute isDMAUsed: true if tile has non-empty dmaChannels
331-
auto dmaChannelsTree = mapping.second.get_child_optional("dmaChannels");
332-
bool isDMAUsed = (dmaChannelsTree && !dmaChannelsTree.get().empty());
333-
334-
// Filter based on the requested module type
335-
bool includesTile = false;
336-
if (type == module_type::core) {
337-
includesTile = isCoreUsed;
338-
} else if (type == module_type::dma) {
339-
includesTile = isDMAUsed;
340-
}
341-
342-
// Skip tiles that do not match the requested module type
343-
if (!includesTile)
344-
continue;
345-
346-
// Add the core/mapped tile
347-
tile_type tile;
348-
tile.col = mapping.second.get<uint8_t>("column");
349-
tile.row = mapping.second.get<uint8_t>("row") + rowOffset;
350-
tile.active_core = isCoreUsed;
351-
tile.active_memory = isDMAUsed;
352-
uniqueTiles.insert(tile);
353-
354-
// For DMA module type, also add DMA-only tiles at different coordinates
355-
if (type == module_type::dma && dmaChannelsTree) {
356-
for (auto const &channel : dmaChannelsTree.get()) {
357-
uint8_t dmaCol = xdp::aie::convertStringToUint8(channel.second.get<std::string>("column"));
358-
uint8_t dmaRow = xdp::aie::convertStringToUint8(channel.second.get<std::string>("row")) + rowOffset;
359-
360-
// Check if this DMA channel is at a different location than the core
361-
if (dmaCol != tile.col || dmaRow != tile.row) {
362-
tile_type dmaTile;
363-
dmaTile.col = dmaCol;
364-
dmaTile.row = dmaRow;
365-
dmaTile.active_core = false;
366-
dmaTile.active_memory = true;
367-
uniqueTiles.insert(dmaTile); // Set automatically handles uniqueness
368-
}
369-
}
370-
}
371-
}
372-
373-
// Convert set back to vector
374-
return std::vector<tile_type>(uniqueTiles.begin(), uniqueTiles.end());
375-
}
376-
377224
// Helper method to match kernel patterns with ordered substring matching
378225
bool AIETraceConfigV3Filetype::matchesKernelPattern(const std::string& function, const std::string& kernel_name) const
379226
{

src/runtime_src/xdp/profile/database/static_info/filetypes/aie_trace_config_v3_filetype.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,8 @@ class AIETraceConfigV3Filetype : public AIETraceConfigFiletype {
2828
module_type type,
2929
const std::string& kernel_name = "all") const override;
3030

31-
std::vector<tile_type>
32-
getAllAIETiles(const std::string& graph_name) const override;
33-
3431
std::vector<tile_type>
3532
getAIETiles(const std::string& graph_name) const override;
36-
37-
std::vector<tile_type>
38-
getEventTiles(const std::string& graph_name, module_type type) const override;
3933

4034
private:
4135
// Helper method to match kernel patterns with ordered substring matching

src/runtime_src/xdp/profile/plugin/aie_status/aie_status_plugin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ namespace xdp {
124124
// Note: in the future, we could support user-defined tile sets
125125
auto graphs = metadataReader->getValidGraphs();
126126
for (auto& graph : graphs) {
127-
mGraphCoreTilesMap[graph] = metadataReader->getEventTiles(graph, module_type::core);
127+
mGraphCoreTilesMap[graph] = metadataReader->getTiles(graph, module_type::core, "all");
128128
}
129129

130130
// NOTE: AIE Status is not released product on client. Whenever client support is needed,

0 commit comments

Comments
 (0)