-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add inline-all-calls pass #1886
Comments
I also have some inlining code in the static evaluator but both these will break in the function has static edges incoming from other functions, we need #1833 first |
github-merge-queue bot
pushed a commit
that referenced
this issue
Mar 4, 2025
Including adding a new method for copying descendants of another node (preserving edges incoming to that subtree), with optional Substitution. The choice of copying descendants rather than a subtree and its root may seem a little strange. The minor difference is that in most usecases (others are peeling tail loops, and monomorphization which can be refactored to use this too) we're gonna update the root node optype too, so we might as well just make the new optype first rather than copy+overwrite. The bigger differences are * Edges between the copied subtree and the root (e.g. recursive Calls) want to point to the original FuncDefn, not the inlined copy (which will be a DFG). This helps the inline-call usecase, and may help monomorphization (recursive calls may have different type args, so we should monomorphize their targets too), and makes no difference for loop peeling (there are no edges to/from a TailLoop from inside). * Edges already existing to the new root (the old Call node) can be left untouched, rather than having to be moved (and the old Call node deleted). Again I think this makes no difference for loop peeling, nor monomorphization. closes #1833, #1886 --------- Co-authored-by: Douglas Wilson <douglas.wilson@quantinuum.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hugr-qir will need to inline all functions to produce valid qir.
We already have a Callgraph in hugr-passes, which is required for inlining.
I suggest that the inlining pass take a set of Call nodes as input, and that if these calls contain a cycle we error. Otherwise inline all those calls. That way we don't dictate the inlining policty, and in particular hugr-qir can easily "inline everything"
Prototype, which is pre our callgraph and perhaps out of date in other ways:
The text was updated successfully, but these errors were encountered: