opencompl / Quidditch

IREE compiler and runtime for Snitch
Apache License 2.0
6 stars 3 forks source link

[quidditch_snitch] Implement lowering of `pipeline` op #100

Closed zero9178 closed 4 months ago

zero9178 commented 4 months ago

This PR implements the lowering of bufferized pipeline operations to standard set of dialects. The lowering itself does not introduce any concurrency but rather relies on the stages to start and wait for concurrent operations.

It starts of by generating a "ramp up", which pastes all stages after each other until the last stage could start executing. It then enters the hot loop which is a single scf.for that executes every pipeline stage after another, albeit with a different IV for each. After the core scf.for a ramp down makes sure that later stages consume the results of the previous stages that were still executed within the scf.for.

The only limitation of the lowering is that it currently requires the loop to execute at least "numStages - 1" many times. Otherwise, UB occurs.