QuantumBFS / YaoLang.jl

YaoLang: The next DSL for Yao and quantum programs.
https://yaoquantum.org/YaoLang.jl/dev/
Apache License 2.0
31 stars 6 forks source link

rework using Julia 1.6 abstract interpretation and new compiler pipeline #62

Closed Roger-luo closed 3 years ago

Roger-luo commented 3 years ago

this implements an entirely new compiler pipeline that tweaks at Julia parsing stage (macro), type inference stage (via AbstractInterpreter).

Now we also have full QASM support (except for opaque and reset since we haven't considered them on Julia IR side, but should be easy to do)

Roger-luo commented 3 years ago

OK so I'll change the plan in this PR a bit. I chatted with Keno about this on slack, it seems if we want to have our own optimization passes, we will need to wait for a new infrastructure from Julia compiler at least after 1.7. So I'll only support optimization like ZX on QASM as target since this is still possible to do codegen. As for Julia, since we don't want to duplicate the effort, we won't compile the optimized code (which is of form similar to a typed IR) back to Julia to run it for now.

cc: @ChenZhao44 this means I'll only support QASM compatible code's ZX optimization pass in this PR then. Let's consider more complicated hybrid program cases later after Julia 1.7 maybe and move on to things like Quon.

Roger-luo commented 3 years ago

OK tests pass. I'm gonna merge this first. We still need to support a few more backends. I might need @ChenZhao44 to add some more tests for the ZX passes.