Xilinx / mlir-air

MIT License
71 stars 26 forks source link

Running Matrix Scalar Add Examples with `aircc --experimental-passes` #628

Open hunhoffe opened 1 week ago

hunhoffe commented 1 week ago

This is low priority, but ideally I would like to run the Matrix Scalar Add examples with the experimental_passes aircc.py option set. However, the experimental passes break both of the currently working examples, single_core_dma and single_core_channel. For single_core_dma, the output is wrong. For single_core_channel, there is a segfault.

To replicate, set experimental_passes=True in this file (on the minimal-matrix-scalar-add branch).

For single_core_dma:

cd programming_examples/matrix_scalar_add/single_core_dma
make clean
make

For single_core_channel:

cd programming_examples/matrix_scalar_add/single_core_dma
make clean
make

I investigated a bit which passes might be causing the problems, and if I just comment out the first two of the experimental passes (defined here), both examples still work with the remaining passes:

    #"air-dependency",
    #"air-dependency-schedule-opt",
erwei-xilinx commented 1 week ago

I identified an issue in the AIRLowering pass which didn't handle the operand type conversions properly. This PR should fix the issue: https://github.com/Xilinx/mlir-air/pull/644

I also modified the aircc.py experimental pipeline by inserting an air-dma-to-channel after air-dependency. This is because air.channel.put/get ops are not yet supported in the air-dependency pass. So currently we have been doing air-dependency on air.dma_memcpy_nd then do air-dma-to-channel to get async channels for us.

In my local build, I was able to get the single_core_dma and multi_core_dma tests to pass with experimental_passes on, but the channel version would not, because air-dependency doesn't support input IRs containing air.channel.put/get ops yet.

erwei-xilinx commented 5 days ago

experimental_passes should be enabled with this PR: https://github.com/Xilinx/mlir-air/pull/652