@@ -38,17 +38,16 @@ AIETraceConfigV3Filetype::getValidKernels() const
38
38
for (auto const &mapping : kernelToTileMapping.get ()) {
39
39
std::string functionStr = mapping.second .get <std::string>(" function" );
40
40
if (functionStr.empty ())
41
- continue ; // Skip empty function names
41
+ continue ;
42
42
43
43
// Extract kernel names from function string
44
44
std::vector<std::string> names;
45
45
boost::split (names, functionStr, boost::is_any_of (" ." ));
46
46
47
47
// Add individual kernel components
48
48
for (const auto & name : names) {
49
- if (!name.empty ()) {
50
- uniqueKernels.insert (name);
51
- }
49
+ if (!name.empty ())
50
+ uniqueKernels.insert (name);
52
51
}
53
52
54
53
// Also store the complete function name
@@ -77,17 +76,16 @@ AIETraceConfigV3Filetype::getValidGraphs() const
77
76
for (auto const &mapping : kernelToTileMapping.get ()) {
78
77
std::string graphStr = mapping.second .get <std::string>(" graph" );
79
78
if (graphStr.empty ())
80
- continue ; // Skip empty graph names
79
+ continue ;
81
80
82
81
// Extract subgraph names from complete graph string
83
82
std::vector<std::string> names;
84
83
boost::split (names, graphStr, boost::is_any_of (" ." ));
85
84
86
85
// Add individual subgraph components
87
86
for (const auto & name : names) {
88
- if (!name.empty ()) {
89
- uniqueGraphs.insert (name);
90
- }
87
+ if (!name.empty ())
88
+ uniqueGraphs.insert (name);
91
89
}
92
90
93
91
// Add the complete graph name
@@ -104,25 +102,13 @@ AIETraceConfigV3Filetype::getValidGraphs() const
104
102
// kernel_name = <kernel> : only tiles used by that specific kernel
105
103
std::vector<tile_type>
106
104
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
109
107
{
110
108
if (type == module_type::mem_tile)
111
109
return getMemoryTiles (graph_name, kernel_name);
112
110
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
126
112
auto kernelToTileMapping = aie_meta.get_child_optional (" aie_metadata.TileMapping.AIEKernelToTileMapping" );
127
113
if (!kernelToTileMapping) {
128
114
xrt_core::message::send (severity_level::info, " XRT" , getMessage (" TileMapping.AIEKernelToTileMapping" ));
@@ -157,19 +143,16 @@ AIETraceConfigV3Filetype::getTiles(const std::string& graph_name,
157
143
auto dmaChannelsTree = mapping.second .get_child_optional (" dmaChannels" );
158
144
bool isDMAUsed = (dmaChannelsTree && !dmaChannelsTree.get ().empty ());
159
145
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);
170
153
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) {
173
156
uint8_t coreCol = mapping.second .get <uint8_t >(" column" );
174
157
uint8_t coreRow = mapping.second .get <uint8_t >(" row" ) + rowOffset;
175
158
@@ -187,69 +170,10 @@ AIETraceConfigV3Filetype::getTiles(const std::string& graph_name,
187
170
uniqueTiles.insert (dmaTile);
188
171
}
189
172
}
190
- }
191
- }
192
- }
173
+ } // end of DMA channels processing
174
+ } // end of foundGraph && foundKernel
175
+ } // end of each mapping in kernelToTileMapping
193
176
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
253
177
return std::vector<tile_type>(uniqueTiles.begin (), uniqueTiles.end ());
254
178
}
255
179
@@ -297,83 +221,6 @@ AIETraceConfigV3Filetype::getAIETiles(const std::string& graph_name) const
297
221
return tiles;
298
222
}
299
223
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
-
377
224
// Helper method to match kernel patterns with ordered substring matching
378
225
bool AIETraceConfigV3Filetype::matchesKernelPattern (const std::string& function, const std::string& kernel_name) const
379
226
{
0 commit comments