Dear Community,
I am new to the Catalyst package and I am currently on learning curve. I have been going through the documentation to understand the Catalyst better. At the page Catalyst Compiler Passes — Catalyst 0.6.0 documentation, I see there is an example of Catalyst’s IR and then I got curious how can I extract IR for my circuit. I looked in to the code of jit.py file catalyst/frontend/catalyst/jit.py at main · PennyLaneAI/catalyst · GitHub. I can see that there is a function generate_ir() for the IR. Since this is part of qjit decorator I am not sure how to extract IR string.
Is there any other way where I can extract MLIR for my custom circuit?
@josh Thanks! that’s what I was looking for.
So that means, function has to be compiled. Either it’s called first time or argument type hints are provided for “ahead of the time” compilation.
May be a stupid question, Why it has to be compiled? is it because of the you need to first convert fun to JAXPR and then lower from JAXPR to the quantum MLIR representation?
May be a stupid question, Why it has to be compiled? is it because of the you need to first convert fun to JAXPR and then lower from JAXPR to the quantum MLIR representation?
Hi @quantum-girl, that’s exactly right! Technically the function doesn’t have to be compiled all the way down to binary code, but the compilation process has to proceed at least far enough for us to generate the MLIR. Hope that helps