mlir-aie
mlir-aie copied to clipboard
Pathfinder pass makes unsafe assumption about operator ordering
AIEPathfinderPass assumes that aie.packet_source always comes before aie.packet_dest in aie.packet_flow regions but there is absolutely no guarantee of ordering.
https://github.com/Xilinx/mlir-aie/blob/59a4a00de97ad4faccf0224a76e74b70bc459db8/lib/Dialect/AIE/Transforms/AIECreatePathFindFlows.cpp#L289-L305
Worse, srcCoords will be used uninitialized when this is not the case (line 305). In practice it crashes:
$ cat pkt.mlir
module {
%tile_1_3 = aie.tile(1, 3)
%tile_2_4 = aie.tile(2, 4)
aie.packet_flow(16) {
aie.packet_dest<%tile_1_3, DMA : 1>
aie.packet_dest<%tile_2_4, DMA : 1>
aie.packet_source<%tile_1_3, DMA : 0>
} {keep_pkt_header = true}
}
$ aiecc.py pkt.mlir
aie-opt: /work/mlir-aie/lib/Dialect/AIE/Transforms/AIEPathFinder.cpp:620: virtual std::optional<std::map<xilinx::AIE::PathEndPoint, std::map<xilinx::AIE::TileID, xilinx::AIE::SwitchSetting> > > xilinx::AIE::Pathfinder::findPaths(int): Assertion `i < sb.srcPorts.size()' failed.