tancheng / CGRA-Flow

CGRA-Flow is an integrated framework for CGRA compilation, exploration, synthesis, and development.
113 stars 15 forks source link

How can I map a kernel optimized by soda to CGRA? #16

Closed MIONkb closed 1 year ago

MIONkb commented 1 year ago

Dear Tancheng, good job in CGRA-FLOW! Could you please answer me a question: soda-opt can optimize an application and then generate llvm IR. How can I generate a dfg from that, and then map to CGRA in this framework?

tancheng commented 1 year ago

Hi,

Thanks for your interest. I guess you are talking about mlir-cgra? It is designed to lower a model onto CGRA for acceleration. For now, i have provide a simulator to functionally simulate the lowered/offloaded/generated IR running/mapped on the CGRA. This simulator provide you rough estimation about how many execution cycles it will take if the IR is mapped on CGRA in different ways (detailed in our DAC2023 paper). But the IR to mapping part still requires some manual work (you might need to do some coding in CGRA-Mapper to make it work in an automated way).

I will also probably try to integrate mlir-cgra with cgra-flow (for now, mlir-cgra is just placed in the folder and integration is not fully done), so it won't rely on the above mentioned simulator but run in our RTL simulation. If this could happen, you don't need to manually scope a portion of the IR, and then map to CGRA in this framework. It could be automated but I am not sure if I have time to do it soon.

FYI, soda-opt is born for integrating with HLS so it optimizes the IR targeting HLS rather than targeting CGRA mapping. CGRAs and FPGAs are two directions for IR/kernel/DFG's acceleration in my opinion (though they might share some common optimization techniques, e.g., unrolling).

MIONkb commented 1 year ago

I understand that, thanks for your contribution in CGRA modelling and auto-compile framework!