157 llvm::raw_ostream &output) {
159 for (
auto tOp :
module.getOps<DeviceOp>()) {
166 output <<
" \"Placement\": [\n";
168 int shim_MM2S_count = 0;
171 auto all_shim_ops = targetOp.getOps<ShimDMAOp>();
172 for (ShimDMAOp shimOp : all_shim_ops) {
173 for (DMAStartOp startOp : shimOp.getOps<DMAStartOp>()) {
175 if (startOp.getChannelDir() == DMAChannelDir::MM2S) {
176 if (shim_MM2S_count > 0)
179 std::string port_name =
"";
180 port_name.append(
"M");
181 port_name.append(shim_MM2S_count < 10 ?
"0" :
"");
182 port_name.append(std::to_string(shim_MM2S_count++));
183 port_name.append(
"_AXI");
188 <<
" \"LogicalInstance\" : { \"InstanceName\" : "
189 <<
"\"aie_engine_0\", \"PortName\" : \"" << port_name
192 std::string col = std::to_string(shimOp.colIndex());
193 int ch = startOp.getChannelIndex();
194 std::string channel = std::to_string(ch);
196 std::string physical_name =
"";
197 physical_name.append(
"AIE_NOC_X").append(col).append(
"Y0_AIE_NOC_");
198 physical_name.append(
"M_AXI_ch").append(channel);
201 output <<
" \"PhysicalInstance\" : [{ \"name\" : \""
202 << physical_name <<
"\", \"column\" : " << col
203 <<
", \"channel\" : " << channel <<
" }],\n"
204 <<
" \"IsSoft\" : true\n }";
212 return mlir::success();
216 llvm::raw_ostream &output) {
229 for (
auto tOp :
module.getOps<DeviceOp>()) {
235 arch = targetOp.getTargetModel().getTargetArch();
240 output <<
"<?xml version=\"1.0\"?>"
242 output <<
"<POWERDATA data=\"AI-Engine Compiler\" dataVersion=\"2022.2\" "
243 "design=\"graph\" date=\"2023\">\n";
244 if ((arch == AIEArch::AIE2) || (arch == AIEArch::AIE2p)) {
247 <<
" <DEVICE part=\"xcve2802\" grade=\"extended\" package=\"vsvh1760\" "
248 "speed=\"-2LP\" process=\"typical\" vid=\"No\"></DEVICE>\n";
254 <<
" <DEVICE part=\"xcvc1902\" grade=\"extended\" package=\"vsva2197\" "
255 "speed=\"-2MP\" process=\"typical\" vid=\"No\"></DEVICE>\n";
257 output <<
" <AIE status=\"COMPILER_OUTPUT\">\n";
260 auto module_tile_ops = targetOp.getOps<TileOp>();
261 int num_tiles = std::distance(module_tile_ops.begin(), module_tile_ops.end());
263 if ((arch == AIEArch::AIE2) || (arch == AIEArch::AIE2p)) {
264 output <<
" <AIE_MODULE name=\"graph\" num_tiles=\""
265 << std::to_string(num_tiles) <<
"\" clk_freq=\"1150\">\n";
267 output <<
" <AIE_MODULE name=\"graph\" num_tiles=\""
268 << std::to_string(num_tiles) <<
"\" clk_freq=\"1250\">\n";
273 std::map<std::pair<int, int>, std::vector<CoreOp>> coreMap;
274 for (CoreOp coreOp : targetOp.getOps<CoreOp>())
275 coreMap[std::make_pair(coreOp.colIndex(), coreOp.rowIndex())].push_back(
279 int kernel_count = 0;
280 for (TileOp tileOp : module_tile_ops) {
281 int col = tileOp.colIndex();
282 int row = tileOp.rowIndex();
285 if (tileOp.isShimNOCorPLTile() || tileOp.isMemTile())
288 if ((arch == AIEArch::AIE2) || (arch == AIEArch::AIE2p)) {
290 output <<
" <TILE name=\"CR(" <<
293 std::to_string(col) <<
","
295 row - targetOp.getTargetModel().getNumMemTileRows() - 1)
300 <<
"type=\"int16\" int_core_load=\"1.0\" fp_core_load=\"0\" "
301 <<
"mem_banks=\"0\" mem_rw_rate=\"0.2\" stream_util=\"0.0\" "
307 std::to_string(col) <<
","
308 << std::to_string(row -
309 targetOp.getTargetModel().getNumMemTileRows())
313 output <<
" <TILE name=\"CR(" <<
315 std::to_string(col) <<
"," << std::to_string(row - 1) <<
")\" "
316 <<
"type=\"int16\" int_core_load=\"1.0\" fp_core_load=\"0\" "
317 <<
"mem_banks=\"0\" mem_rw_rate=\"0.2\" stream_util=\"0.0\" "
323 std::to_string(col) <<
"," << std::to_string(row) <<
"\">\n";
327 auto coreOps_in_tile =
328 coreMap[std::make_pair(tileOp.colIndex(), tileOp.rowIndex())];
329 for (
auto coreOp : coreOps_in_tile) {
331 output <<
" <KERNEL name=\"i" << std::to_string(kernel_count++)
333 <<
"int_core_load=\"" << std::to_string(1 / coreOps_in_tile.size())
334 <<
"\" fp_core_load=\"0\"></KERNEL>\n";
336 output <<
" </TILE>\n";
340 for (ShimDMAOp shimOp : targetOp.getOps<ShimDMAOp>()) {
341 if ((arch == AIEArch::AIE2) || (arch == AIEArch::AIE2p)) {
342 auto noc_label = (targetOp.getTargetModel().isShimNOCTile(
343 shimOp.colIndex(), shimOp.rowIndex()))
346 output <<
" <SHIM name=\"SHIM(" << std::to_string(shimOp.colIndex())
347 <<
", " << std::to_string(shimOp.rowIndex())
351 << noc_label <<
"\" stream_util=\"0\" num_pl_streams=\"0\" " <<
353 "num_aximm_connections=\"1\" coordinates=\""
354 << std::to_string(shimOp.colIndex()) <<
","
355 << std::to_string(shimOp.rowIndex()) <<
"\" "
358 output <<
" <SHIM name=\"SHIM(" << std::to_string(shimOp.colIndex())
359 <<
", " << std::to_string(shimOp.rowIndex()) <<
")\" " <<
361 "type=\"AIE_PL_NOC_SHIM\" stream_util=\"0\" num_pl_streams=\"0\" " <<
363 "num_aximm_connections=\"1\" coordinates=\""
364 << std::to_string(shimOp.colIndex()) <<
","
365 << std::to_string(shimOp.rowIndex()) <<
"\" "
371 if ((arch == AIEArch::AIE2) || (arch == AIEArch::AIE2p)) {
372 for (TileOp tileOp : module_tile_ops) {
373 int col = tileOp.colIndex();
374 int row = tileOp.rowIndex();
378 row >
static_cast<int>(targetOp.getTargetModel().getNumMemTileRows()))
381 output <<
" <MEM name=\"MEM(" << std::to_string(col) <<
", "
382 << std::to_string(row - 1)
385 "type=\"AIE_MEM\" mem_banks=\"0\" mme_rw_rate=\"0.1\" "
386 <<
"stream_util=\"0.1\" coordinates=\"" << std::to_string(col)
387 <<
"," << std::to_string(row - 1) <<
"\" "
392 output <<
" </AIE_MODULE>\n";
393 output <<
" </AIE>\n";
394 output <<
"</POWERDATA>\n";
396 return mlir::success();