24 llvm::raw_ostream &output,
25 llvm::StringRef deviceName) {
27 AIE::DeviceOp::getForSymbolInModuleOrError(module, deviceName);
29 return mlir::failure();
31 AIEArch arch = targetOp.getTargetModel().getTargetArch();
33 if (arch == AIEArch::AIE2p) {
35 <<
" \"SimulationConfig\": {\n"
36 <<
" \"device_json\": {\n"
37 <<
" \"directory\": \"data/aie2p/devices\",\n"
38 <<
" \"file\": \"aie2p_8x4_device.json\"\n"
40 <<
" \"phy_device_file\": \"aie2p_8x4_device\",\n"
41 <<
" \"aiearch\": \"aie2p\",\n"
42 <<
" \"aie_freq\": 1000000000.0,\n"
43 <<
" \"use_real_noc\": 1,\n"
44 <<
" \"evaluate_fifo_depth\": 0,\n"
45 <<
" \"noc_ip_block\": {\n"
46 <<
" \"lib_path\": \"./sim/noc/liblnoc_tlm.so\",\n"
47 <<
" \"traffic_file\": \"./sim/noc/noc_traffic.nts\",\n"
48 <<
" \"config_file\": \"./sim/noc/noc_soln.ncr\"\n"
50 <<
" \"pl_ip_block\": [\n"
52 <<
" \"name\": \"ps_ps_main\",\n"
53 <<
" \"ip\": \"ps\",\n"
54 <<
" \"lib_path\": \"ps/ps.so\",\n"
55 <<
" \"pl_freq\": 362500000.0,\n"
58 <<
" \"port_name\": \"ps_axi\",\n"
59 <<
" \"direction\": \"ps_to_gm\",\n"
60 <<
" \"noc_endpoint\": \"NOC_NMU128_X0Y5\",\n"
61 <<
" \"bus_width\": 0\n"
64 <<
" \"event_bus\": []\n"
69 }
else if (arch == AIEArch::AIE2) {
72 <<
" \"SimulationConfig\": {\n"
73 <<
" \"device_json\": {\n"
74 <<
" \"directory\": \"data/aie_ml/devices\",\n"
75 <<
" \"file\": \"VC2802.json\"\n"
77 <<
" \"phy_device_file\": \"xcve2802-vsvh1760-2LP-e-S-es1\",\n"
78 <<
" \"aiearch\": \"aie2\",\n"
79 <<
" \"aie_freq\": 1050000000.0,\n"
80 <<
" \"use_real_noc\": 1,\n"
81 <<
" \"evaluate_fifo_depth\": 0,\n"
82 <<
" \"noc_ip_block\": {\n"
83 <<
" \"lib_path\": \"./sim/noc/liblnoc_tlm.so\",\n"
84 <<
" \"traffic_file\": \"./sim/noc/noc_traffic.nts\",\n"
85 <<
" \"config_file\": \"./sim/noc/noc_soln.ncr\"\n"
87 <<
" \"pl_ip_block\": [\n"
89 <<
" \"name\": \"ps_ps_main\",\n"
90 <<
" \"ip\": \"ps\",\n"
91 <<
" \"lib_path\": \"ps/ps.so\",\n"
92 <<
" \"pl_freq\": 362500000.0,\n"
95 <<
" \"port_name\": \"ps_axi\",\n"
96 <<
" \"direction\": \"ps_to_gm\",\n"
97 <<
" \"noc_endpoint\": \"NOC_NMU128_X0Y5\",\n"
98 <<
" \"bus_width\": 0\n"
101 <<
" \"event_bus\": []\n"
106 }
else if (arch == AIEArch::AIE1) {
108 <<
" \"SimulationConfig\": {\n"
109 <<
" \"device_json\": {\n"
110 <<
" \"directory\": \"data/devices\",\n"
111 <<
" \"file\": \"VC1902.json\"\n"
113 <<
" \"phy_device_file\": \"xcvc1902-vsva2197-2MP-e-S\",\n"
114 <<
" \"aiearch\": \"aie\",\n"
115 <<
" \"aie_freq\": 1250000000.0,\n"
116 <<
" \"use_real_noc\": 1,\n"
117 <<
" \"evaluate_fifo_depth\": 0,\n"
118 <<
" \"noc_ip_block\": {\n"
119 <<
" \"lib_path\": \"./Work/noc/liblnoc_tlm.so\",\n"
120 <<
" \"traffic_file\": \"./Work/noc/noc_traffic.nts\",\n"
121 <<
" \"config_file\": \"./Work/noc/noc_soln.ncr\"\n"
123 <<
" \"pl_ip_block\": [\n"
125 <<
" \"name\": \"ps_ps_main\",\n"
126 <<
" \"ip\": \"ps\",\n"
127 <<
" \"lib_path\": \"ps/ps.so\",\n"
128 <<
" \"pl_freq\": 312500000.0,\n"
129 <<
" \"axi_mm\": [\n"
131 <<
" \"port_name\": \"ps_axi\",\n"
132 <<
" \"direction\": \"ps_to_gm\",\n"
133 <<
" \"noc_endpoint\": \"NOC_NMU128_X0Y5\",\n"
134 <<
" \"bus_width\": 0\n"
137 <<
" \"event_bus\": []\n"
143 return mlir::success();
157 llvm::raw_ostream &output,
158 llvm::StringRef deviceName) {
160 AIE::DeviceOp::getForSymbolInModuleOrError(module, deviceName);
162 return mlir::failure();
167 output <<
" \"Placement\": [\n";
169 int shim_MM2S_count = 0;
172 auto all_shim_ops = targetOp.getOps<ShimDMAOp>();
173 for (ShimDMAOp shimOp : all_shim_ops) {
174 for (DMAStartOp startOp : shimOp.getOps<DMAStartOp>()) {
176 if (startOp.getChannelDir() == DMAChannelDir::MM2S) {
177 if (shim_MM2S_count > 0)
180 std::string port_name =
"";
181 port_name.append(
"M");
182 port_name.append(shim_MM2S_count < 10 ?
"0" :
"");
183 port_name.append(std::to_string(shim_MM2S_count++));
184 port_name.append(
"_AXI");
189 <<
" \"LogicalInstance\" : { \"InstanceName\" : "
190 <<
"\"aie_engine_0\", \"PortName\" : \"" << port_name
193 std::string
col = std::to_string(shimOp.colIndex());
194 int ch = startOp.getChannelIndex();
195 std::string
channel = std::to_string(ch);
197 std::string physical_name =
"";
198 physical_name.append(
"AIE_NOC_X").append(
col).append(
"Y0_AIE_NOC_");
199 physical_name.append(
"M_AXI_ch").append(
channel);
202 output <<
" \"PhysicalInstance\" : [{ \"name\" : \""
203 << physical_name <<
"\", \"column\" : " <<
col
204 <<
", \"channel\" : " <<
channel <<
" }],\n"
205 <<
" \"IsSoft\" : true\n }";
213 return mlir::success();
217 llvm::raw_ostream &output,
218 llvm::StringRef deviceName) {
231 AIE::DeviceOp::getForSymbolInModuleOrError(module, deviceName);
233 return mlir::failure();
235 AIEArch arch = targetOp.getTargetModel().getTargetArch();
239 output <<
"<?xml version=\"1.0\"?>"
241 output <<
"<POWERDATA data=\"AI-Engine Compiler\" dataVersion=\"2022.2\" "
242 "design=\"graph\" date=\"2023\">\n";
243 if ((arch == AIEArch::AIE2) || (arch == AIEArch::AIE2p)) {
246 <<
" <DEVICE part=\"xcve2802\" grade=\"extended\" package=\"vsvh1760\" "
247 "speed=\"-2LP\" process=\"typical\" vid=\"No\"></DEVICE>\n";
253 <<
" <DEVICE part=\"xcvc1902\" grade=\"extended\" package=\"vsva2197\" "
254 "speed=\"-2MP\" process=\"typical\" vid=\"No\"></DEVICE>\n";
256 output <<
" <AIE status=\"COMPILER_OUTPUT\">\n";
259 auto module_tile_ops = targetOp.getOps<TileOp>();
260 int num_tiles = std::distance(module_tile_ops.begin(), module_tile_ops.end());
262 if ((arch == AIEArch::AIE2) || (arch == AIEArch::AIE2p)) {
263 output <<
" <AIE_MODULE name=\"graph\" num_tiles=\""
264 << std::to_string(num_tiles) <<
"\" clk_freq=\"1150\">\n";
266 output <<
" <AIE_MODULE name=\"graph\" num_tiles=\""
267 << std::to_string(num_tiles) <<
"\" clk_freq=\"1250\">\n";
272 std::map<std::pair<int, int>, std::vector<CoreOp>> coreMap;
273 for (CoreOp coreOp : targetOp.getOps<CoreOp>())
274 coreMap[std::make_pair(coreOp.colIndex(), coreOp.rowIndex())].push_back(
278 int kernel_count = 0;
279 for (TileOp tileOp : module_tile_ops) {
280 int col = tileOp.colIndex();
281 int row = tileOp.rowIndex();
284 if (tileOp.isShimNOCorPLTile() || tileOp.isMemTile())
287 if ((arch == AIEArch::AIE2) || (arch == AIEArch::AIE2p)) {
289 output <<
" <TILE name=\"CR(" <<
292 std::to_string(
col) <<
","
294 row - targetOp.getTargetModel().getNumMemTileRows() - 1)
299 <<
"type=\"int16\" int_core_load=\"1.0\" fp_core_load=\"0\" "
300 <<
"mem_banks=\"0\" mem_rw_rate=\"0.2\" stream_util=\"0.0\" "
306 std::to_string(
col) <<
","
307 << std::to_string(
row -
308 targetOp.getTargetModel().getNumMemTileRows())
312 output <<
" <TILE name=\"CR(" <<
314 std::to_string(
col) <<
"," << std::to_string(
row - 1) <<
")\" "
315 <<
"type=\"int16\" int_core_load=\"1.0\" fp_core_load=\"0\" "
316 <<
"mem_banks=\"0\" mem_rw_rate=\"0.2\" stream_util=\"0.0\" "
322 std::to_string(
col) <<
"," << std::to_string(
row) <<
"\">\n";
326 auto coreOps_in_tile =
327 coreMap[std::make_pair(tileOp.colIndex(), tileOp.rowIndex())];
328 for (
auto coreOp : coreOps_in_tile) {
330 output <<
" <KERNEL name=\"i" << std::to_string(kernel_count++)
332 <<
"int_core_load=\"" << std::to_string(1 / coreOps_in_tile.size())
333 <<
"\" fp_core_load=\"0\"></KERNEL>\n";
335 output <<
" </TILE>\n";
339 for (ShimDMAOp shimOp : targetOp.getOps<ShimDMAOp>()) {
340 if ((arch == AIEArch::AIE2) || (arch == AIEArch::AIE2p)) {
341 auto noc_label = (targetOp.getTargetModel().isShimNOCTile(
342 shimOp.colIndex(), shimOp.rowIndex()))
345 output <<
" <SHIM name=\"SHIM(" << std::to_string(shimOp.colIndex())
346 <<
", " << std::to_string(shimOp.rowIndex())
350 << noc_label <<
"\" stream_util=\"0\" num_pl_streams=\"0\" " <<
352 "num_aximm_connections=\"1\" coordinates=\""
353 << std::to_string(shimOp.colIndex()) <<
","
354 << std::to_string(shimOp.rowIndex()) <<
"\" "
357 output <<
" <SHIM name=\"SHIM(" << std::to_string(shimOp.colIndex())
358 <<
", " << std::to_string(shimOp.rowIndex()) <<
")\" " <<
360 "type=\"AIE_PL_NOC_SHIM\" stream_util=\"0\" num_pl_streams=\"0\" " <<
362 "num_aximm_connections=\"1\" coordinates=\""
363 << std::to_string(shimOp.colIndex()) <<
","
364 << std::to_string(shimOp.rowIndex()) <<
"\" "
370 if ((arch == AIEArch::AIE2) || (arch == AIEArch::AIE2p)) {
371 for (TileOp tileOp : module_tile_ops) {
372 int col = tileOp.colIndex();
373 int row = tileOp.rowIndex();
377 row >
static_cast<int>(targetOp.getTargetModel().getNumMemTileRows()))
380 output <<
" <MEM name=\"MEM(" << std::to_string(
col) <<
", "
381 << std::to_string(
row - 1)
384 "type=\"AIE_MEM\" mem_banks=\"0\" mme_rw_rate=\"0.1\" "
385 <<
"stream_util=\"0.1\" coordinates=\"" << std::to_string(
col)
386 <<
"," << std::to_string(
row - 1) <<
"\" "
391 output <<
" </AIE_MODULE>\n";
392 output <<
" </AIE>\n";
393 output <<
"</POWERDATA>\n";
395 return mlir::success();