Skip to content

Inlining of LoadFunction -> indirect_call #1052

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

Open
croyzor opened this issue May 15, 2024 · 3 comments
Open

Inlining of LoadFunction -> indirect_call #1052

croyzor opened this issue May 15, 2024 · 3 comments

Comments

@croyzor
Copy link
Contributor

croyzor commented May 15, 2024

See #978. For BRAT compilation, we'd like to be able to inline static functions, so an indirect_call of a static graph coming from a LoadFunction node becomes an instantiation of that graph. We can then get further by constant folding the whole hugr.

@acl-cqc
Copy link
Contributor

acl-cqc commented Jun 14, 2024

I think that's two separate steps - firstly IndirectCall + LoadFunction -> direct Call (which doesn't require inlining, but removes the need for indirect-call which will likely move to the tierkreis extension); secondly, inlining of arbitrary direct Calls...

@doug-q
Copy link
Collaborator

doug-q commented Jul 3, 2024

This would likely help lazify-measurement. Indirect calls are harder to change arguments of. CQCL/tket2#432

@aborgna-q aborgna-q assigned aborgna-q and unassigned croyzor Oct 22, 2024
@acl-cqc
Copy link
Contributor

acl-cqc commented May 21, 2025

So #2059 has done the groundwork and the analysis here; we just need to either add a new pass, or extend the constant-folding pass (maybe with a config), to convert CallIndirect when the target is known into direct Calls. (interpret_leaf_op gets all the info it needs - this is not exposed to extension ops yet (#2087) but we don't need that here.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants