Add call nodes to QuantumFunction - #16931
Open
Ian Hincks (ihincks) wants to merge 1 commit into
Open
Conversation
Ian Hincks (ihincks)
requested review from
Raynel Sanchez (raynelfss)
and removed request for
a team
September 3, 2026 22:13
Collaborator
|
One or more of the following people are relevant to this code:
|
1 similar comment
Collaborator
|
One or more of the following people are relevant to this code:
|
Ian Hincks (ihincks)
requested review from
Matthew Treinish (mtreinish)
and removed request for
Raynel Sanchez (raynelfss)
September 3, 2026 22:15
Coverage Report for CI Build 34398812923Warning No base build found for commit Coverage: 88.079%Details
Uncovered Changes
Coverage RegressionsRequires a base build to compare against. How to fix this → Coverage Stats
💛 - Coveralls |
3 tasks
Ian Hincks (ihincks)
force-pushed
the
ihincks/qp-06a-call-nodes
branch
from
September 9, 2026 17:39
0f967f5 to
9dcd24f
Compare
3 tasks
A call instruction names a function by `FunctionId` and computes nothing itself, so one stored body serves however many sites invoke it. `InstructionRole::Call` is the fourth role, and the only one besides the two boundary roles that carries no `ProgramOp`. A call may only name a function defined before the one holding it. The call graph is therefore acyclic structurally, with nothing to traverse, and a callee is in bounds without a separate check. A function has no identifier until a program holds it, so `add_call` takes the callee's signature from its caller and checks the operands against it, and `QuantumProgram::new` verifies the recorded types against the function actually named. Nothing about the callee is stored: a call instruction's operand types and its own result types are the contract as it was checked. Every function the program holds is verified, not only those the entry point reaches, so evaluation resolves a call with no error path of its own. A function the entry point cannot reach is accepted, and removing one is a pass rather than a validity rule. Both checks compare a declared type against an offered one, which `TensorType::admits` answers: it is `Tensor::matches` with a type in place of the tensor, so a bounded axis admits any size within its bound. The per-axis rule the two share moves onto `Dim::admits`. A result a call declares must admit what its callee produces, because the instructions reading that result were type-checked against the declared type. A call instruction reports no built-in implementation, so a function holding one is not locally evaluable by itself, and the program-level question walks the reachable functions instead. `QuantumProgram::eval` settles that for every reachable function before anything runs, then resolves each call against the program's functions as it walks. A function reached through a call reports its failure through `FunctionEvalError::CallFailed`, whose chain leads from the entry point to the instruction that failed.
Matthew Treinish (mtreinish)
force-pushed
the
ihincks/qp-06a-call-nodes
branch
from
September 9, 2026 20:04
9dcd24f to
4f142be
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds the ability for a function to call another function by function ID.
See also #16922 and $16924.
AI/LLM disclosure
Stack created with GitHub Stacks CLI • Give Feedback 💬