You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The first observation to make is that SSA IR will destructure structs and tuples essentially losing the infromation about the initial higher level type. This makes the SSA IR a lot simpler.
ABI Generation
Abi generation is done here where we take the function signature from the frontend and assign witness indices to types depending on how many field elements it takes to generate the type.
The witness indices will start from 1 and the Abi will only be produced for the input parameters. The witnesses for the return type is passed in as a parameter. We can also compute this at the same time, and when we acir gen the body, it will use the return type' witness index, since the code always checks to see if a ValueId has been assigned a witness index.
ACIR Gen
In ACIR gen, the SSA block parameters are linked to the main parameters to a Noir program. See here where we convert each block parameter to a AcirVar and consequently to a Witness.
This needs to match the Abi Gen section, for example consider:
fnmain(x:Field){}
Abi gen will assign x to the witness index 1.
Acir gen will also need to assign the block parameter linked to x, the witness index 1.
We therefore have two different parts in the codebase which are implicitly linked.
Happy Case
One solution to this is that the ssa generation pass produces a map which tells us what AbiParameters (parameters to main) map to block parameters.
This way we can compute AcirGen and it will produce witnesses for block parameters in whatever way it sees fit, then given the map from AbiParameters to block parameters, we can connect it with the map from block parameters to witness indices that AcirGen will have to create a map from Abi Parameters to witness indices.
Alternatives Considered
No response
Additional Context
No response
Would you like to submit a PR for this Issue?
No
Support Needs
No response
The text was updated successfully, but these errors were encountered:
Problem
The first observation to make is that SSA IR will destructure structs and tuples essentially losing the infromation about the initial higher level type. This makes the SSA IR a lot simpler.
ABI Generation
Abi generation is done here where we take the function signature from the frontend and assign witness indices to types depending on how many field elements it takes to generate the type.
The witness indices will start from
1
and the Abi will only be produced for the input parameters. The witnesses for the return type is passed in as a parameter. We can also compute this at the same time, and when we acir gen the body, it will use the return type' witness index, since the code always checks to see if aValueId
has been assigned a witness index.ACIR Gen
In ACIR gen, the SSA block parameters are linked to the main parameters to a Noir program. See here where we convert each block parameter to a AcirVar and consequently to a Witness.
This needs to match the Abi Gen section, for example consider:
Abi gen will assign x to the witness index 1.
Acir gen will also need to assign the block parameter linked to x, the witness index 1.
We therefore have two different parts in the codebase which are implicitly linked.
Happy Case
One solution to this is that the ssa generation pass produces a map which tells us what AbiParameters (parameters to main) map to block parameters.
This way we can compute AcirGen and it will produce witnesses for block parameters in whatever way it sees fit, then given the map from AbiParameters to block parameters, we can connect it with the map from block parameters to witness indices that AcirGen will have to create a map from Abi Parameters to witness indices.
Alternatives Considered
No response
Additional Context
No response
Would you like to submit a PR for this Issue?
No
Support Needs
No response
The text was updated successfully, but these errors were encountered: