21 llvm::raw_ostream &output,
22 llvm::StringRef deviceName) {
24 AIE::DeviceOp::getForSymbolInModuleOrError(module, deviceName);
26 return mlir::failure();
28 AIEArch arch = targetOp.getTargetModel().getTargetArch();
30 if (arch == AIEArch::AIE2p) {
32 <<
" \"SimulationConfig\": {\n"
33 <<
" \"device_json\": {\n"
34 <<
" \"directory\": \"data/aie2p/devices\",\n"
35 <<
" \"file\": \"aie2p_8x4_device.json\"\n"
37 <<
" \"phy_device_file\": \"aie2p_8x4_device\",\n"
38 <<
" \"aiearch\": \"aie2p\",\n"
39 <<
" \"aie_freq\": 1000000000.0,\n"
40 <<
" \"use_real_noc\": 1,\n"
41 <<
" \"evaluate_fifo_depth\": 0,\n"
42 <<
" \"noc_ip_block\": {\n"
43 <<
" \"lib_path\": \"./sim/noc/liblnoc_tlm.so\",\n"
44 <<
" \"traffic_file\": \"./sim/noc/noc_traffic.nts\",\n"
45 <<
" \"config_file\": \"./sim/noc/noc_soln.ncr\"\n"
47 <<
" \"pl_ip_block\": [\n"
49 <<
" \"name\": \"ps_ps_main\",\n"
50 <<
" \"ip\": \"ps\",\n"
51 <<
" \"lib_path\": \"ps/ps.so\",\n"
52 <<
" \"pl_freq\": 362500000.0,\n"
55 <<
" \"port_name\": \"ps_axi\",\n"
56 <<
" \"direction\": \"ps_to_gm\",\n"
57 <<
" \"noc_endpoint\": \"NOC_NMU128_X0Y5\",\n"
58 <<
" \"bus_width\": 0\n"
61 <<
" \"event_bus\": []\n"
69 <<
" \"SimulationConfig\": {\n"
70 <<
" \"device_json\": {\n"
71 <<
" \"directory\": \"data/aie_ml/devices\",\n"
72 <<
" \"file\": \"VC2802.json\"\n"
74 <<
" \"phy_device_file\": \"xcve2802-vsvh1760-2LP-e-S-es1\",\n"
75 <<
" \"aiearch\": \"aie2\",\n"
76 <<
" \"aie_freq\": 1050000000.0,\n"
77 <<
" \"use_real_noc\": 1,\n"
78 <<
" \"evaluate_fifo_depth\": 0,\n"
79 <<
" \"noc_ip_block\": {\n"
80 <<
" \"lib_path\": \"./sim/noc/liblnoc_tlm.so\",\n"
81 <<
" \"traffic_file\": \"./sim/noc/noc_traffic.nts\",\n"
82 <<
" \"config_file\": \"./sim/noc/noc_soln.ncr\"\n"
84 <<
" \"pl_ip_block\": [\n"
86 <<
" \"name\": \"ps_ps_main\",\n"
87 <<
" \"ip\": \"ps\",\n"
88 <<
" \"lib_path\": \"ps/ps.so\",\n"
89 <<
" \"pl_freq\": 362500000.0,\n"
92 <<
" \"port_name\": \"ps_axi\",\n"
93 <<
" \"direction\": \"ps_to_gm\",\n"
94 <<
" \"noc_endpoint\": \"NOC_NMU128_X0Y5\",\n"
95 <<
" \"bus_width\": 0\n"
98 <<
" \"event_bus\": []\n"
103 }
else if (arch == AIEArch::AIE1) {
105 <<
" \"SimulationConfig\": {\n"
106 <<
" \"device_json\": {\n"
107 <<
" \"directory\": \"data/devices\",\n"
108 <<
" \"file\": \"VC1902.json\"\n"
110 <<
" \"phy_device_file\": \"xcvc1902-vsva2197-2MP-e-S\",\n"
111 <<
" \"aiearch\": \"aie\",\n"
112 <<
" \"aie_freq\": 1250000000.0,\n"
113 <<
" \"use_real_noc\": 1,\n"
114 <<
" \"evaluate_fifo_depth\": 0,\n"
115 <<
" \"noc_ip_block\": {\n"
116 <<
" \"lib_path\": \"./Work/noc/liblnoc_tlm.so\",\n"
117 <<
" \"traffic_file\": \"./Work/noc/noc_traffic.nts\",\n"
118 <<
" \"config_file\": \"./Work/noc/noc_soln.ncr\"\n"
120 <<
" \"pl_ip_block\": [\n"
122 <<
" \"name\": \"ps_ps_main\",\n"
123 <<
" \"ip\": \"ps\",\n"
124 <<
" \"lib_path\": \"ps/ps.so\",\n"
125 <<
" \"pl_freq\": 312500000.0,\n"
126 <<
" \"axi_mm\": [\n"
128 <<
" \"port_name\": \"ps_axi\",\n"
129 <<
" \"direction\": \"ps_to_gm\",\n"
130 <<
" \"noc_endpoint\": \"NOC_NMU128_X0Y5\",\n"
131 <<
" \"bus_width\": 0\n"
134 <<
" \"event_bus\": []\n"
140 return mlir::success();
154 llvm::raw_ostream &output,
155 llvm::StringRef deviceName) {
157 AIE::DeviceOp::getForSymbolInModuleOrError(module, deviceName);
159 return mlir::failure();
162 return mlir::failure();
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 << R
"( "LogicalInstance" : { "InstanceName" : )"
189 << R"("aie_engine_0", "PortName" : ")" << port_name << "\"},\n";
191 std::string col = std::to_string(shimOp.colIndex());
192 int ch = startOp.getChannelIndex();
193 std::string channel = std::to_string(ch);
195 std::string physical_name =
"";
196 physical_name.append(
"AIE_NOC_X").append(col).append(
"Y0_AIE_NOC_");
197 physical_name.append(
"M_AXI_ch").append(channel);
200 output << R
"( "PhysicalInstance" : [{ "name" : ")" << physical_name
201 << R"(", "column" : )" << col << ", \"channel\" : " << channel
203 <<
" \"IsSoft\" : true\n }";
211 return mlir::success();
215 llvm::raw_ostream &output,
216 llvm::StringRef deviceName) {
229 AIE::DeviceOp::getForSymbolInModuleOrError(module, deviceName);
231 return mlir::failure();
233 AIEArch arch = targetOp.getTargetModel().getTargetArch();
237 output <<
"<?xml version=\"1.0\"?>"
239 output <<
"<POWERDATA data=\"AI-Engine Compiler\" dataVersion=\"2022.2\" "
240 "design=\"graph\" date=\"2023\">\n";
244 <<
" <DEVICE part=\"xcve2802\" grade=\"extended\" package=\"vsvh1760\" "
245 "speed=\"-2LP\" process=\"typical\" vid=\"No\"></DEVICE>\n";
251 <<
" <DEVICE part=\"xcvc1902\" grade=\"extended\" package=\"vsva2197\" "
252 "speed=\"-2MP\" process=\"typical\" vid=\"No\"></DEVICE>\n";
254 output <<
" <AIE status=\"COMPILER_OUTPUT\">\n";
257 auto module_tile_ops = targetOp.getOps<TileOp>();
258 int num_tiles = std::distance(module_tile_ops.begin(), module_tile_ops.end());
261 output << R
"( <AIE_MODULE name="graph" num_tiles=")"
262 << std::to_string(num_tiles) << "\" clk_freq=\"1150\">\n";
264 output << R
"( <AIE_MODULE name="graph" num_tiles=")"
265 << std::to_string(num_tiles) << "\" clk_freq=\"1250\">\n";
270 std::map<std::pair<int, int>, std::vector<CoreOp>> coreMap;
271 for (CoreOp coreOp : targetOp.getOps<CoreOp>())
272 coreMap[std::make_pair(coreOp.colIndex(), coreOp.rowIndex())].push_back(
276 int kernel_count = 0;
277 for (TileOp tileOp : module_tile_ops) {
278 int col = tileOp.colIndex();
279 int row = tileOp.rowIndex();
282 if (tileOp.isShimNOCorPLTile() || tileOp.isMemTile())
287 output <<
" <TILE name=\"CR(" <<
290 std::to_string(col) <<
","
292 row - targetOp.getTargetModel().getNumMemTileRows() - 1)
297 << R
"(type="int16" int_core_load="1.0" fp_core_load="0" )"
298 << "mem_banks=\"0\" mem_rw_rate=\"0.2\" stream_util=\"0.0\" "
304 std::to_string(col) <<
","
305 << std::to_string(row -
306 targetOp.getTargetModel().getNumMemTileRows())
310 output <<
" <TILE name=\"CR(" <<
312 std::to_string(col) <<
"," << std::to_string(row - 1) <<
")\" "
313 << R
"(type="int16" int_core_load="1.0" fp_core_load="0" )"
314 << "mem_banks=\"0\" mem_rw_rate=\"0.2\" stream_util=\"0.0\" "
320 std::to_string(col) <<
"," << std::to_string(row) <<
"\">\n";
324 auto coreOps_in_tile =
325 coreMap[std::make_pair(tileOp.colIndex(), tileOp.rowIndex())];
326 for (
auto coreOp : coreOps_in_tile) {
328 output <<
" <KERNEL name=\"i" << std::to_string(kernel_count++)
330 <<
"int_core_load=\"" << std::to_string(1 / coreOps_in_tile.size())
331 <<
"\" fp_core_load=\"0\"></KERNEL>\n";
333 output <<
" </TILE>\n";
337 for (ShimDMAOp shimOp : targetOp.getOps<ShimDMAOp>()) {
339 const auto *noc_label = (targetOp.getTargetModel().isShimNOCTile(
340 shimOp.colIndex(), shimOp.rowIndex()))
343 output <<
" <SHIM name=\"SHIM(" << std::to_string(shimOp.colIndex())
344 <<
", " << std::to_string(shimOp.rowIndex())
348 << noc_label << R
"(" stream_util="0" num_pl_streams="0" )" <<
350 R
"(num_aximm_connections="1" coordinates=")"
351 << std::to_string(shimOp.colIndex()) << ","
352 << std::to_string(shimOp.rowIndex()) <<
"\" "
355 output <<
" <SHIM name=\"SHIM(" << std::to_string(shimOp.colIndex())
356 <<
", " << std::to_string(shimOp.rowIndex()) <<
")\" " <<
358 R
"(type="AIE_PL_NOC_SHIM" stream_util="0" num_pl_streams="0"
361 R
"(num_aximm_connections="1" coordinates=")"
362 << std::to_string(shimOp.colIndex()) << ","
363 << std::to_string(shimOp.rowIndex()) <<
"\" "
370 for (TileOp tileOp : module_tile_ops) {
371 int col = tileOp.colIndex();
372 int row = tileOp.rowIndex();
376 row >
static_cast<int>(targetOp.getTargetModel().getNumMemTileRows()))
379 output <<
" <MEM name=\"MEM(" << std::to_string(col) <<
", "
380 << std::to_string(row - 1)
383 "type=\"AIE_MEM\" mem_banks=\"0\" mme_rw_rate=\"0.1\" "
384 << R
"(stream_util="0.1" coordinates=")" << std::to_string(col)
385 << "," << std::to_string(row - 1) <<
"\" "
390 output <<
" </AIE_MODULE>\n";
391 output <<
" </AIE>\n";
392 output <<
"</POWERDATA>\n";
394 return mlir::success();