forked from 0xMiden/compiler
-
Notifications
You must be signed in to change notification settings - Fork 0
Remove verify
from OperationBuilder
and SameOperandsAndResultType
verification implementation
#3
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
Draft
lima-limon-inc
wants to merge
22
commits into
next
Choose a base branch
from
fabrizioorsi/rm-verify-op-builder
base: next
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
SameTypeOperands
implementationSameOperandsAndResultType
implementation
ac061f1
to
8dc03a9
Compare
lima-limon-inc
commented
May 14, 2025
6fc9bea
to
5959688
Compare
SameOperandsAndResultType
implementationverify
from op builder + SameOperandsAndResultType
implementation
verify
from op builder + SameOperandsAndResultType
implementationverify
from OperationBuilder
+ SameOperandsAndResultType
implementation
verify
from OperationBuilder
+ SameOperandsAndResultType
implementationverify
from OperationBuilder
and SameOperandsAndResultType
verification implementation
…t is fixed. Signed-off-by: Tomas Fabrizio Orsi <[email protected]>
Signed-off-by: Tomas Fabrizio Orsi <[email protected]>
Signed-off-by: Tomas Fabrizio Orsi <[email protected]>
…alect Dialect Signed-off-by: Tomas Fabrizio Orsi <[email protected]>
Signed-off-by: Tomas Fabrizio Orsi <[email protected]> Signed-off-by: Tomas Fabrizio Orsi <[email protected]> Signed-off-by: Tomas Fabrizio Orsi <[email protected]>
…explicit dependency Signed-off-by: Tomas Fabrizio Orsi <[email protected]>
Signed-off-by: Tomas Fabrizio Orsi <[email protected]>
Signed-off-by: Tomas Fabrizio Orsi <[email protected]>
…rently comma separated) Signed-off-by: Tomas Fabrizio Orsi <[email protected]>
Signed-off-by: Tomas Fabrizio Orsi <[email protected]>
Signed-off-by: Tomas Fabrizio Orsi <[email protected]>
Signed-off-by: Tomas Fabrizio Orsi <[email protected]>
…on which matches both patterns Signed-off-by: Tomas Fabrizio Orsi <[email protected]>
Signed-off-by: Tomas Fabrizio Orsi <[email protected]>
Signed-off-by: Tomas Fabrizio Orsi <[email protected]>
Signed-off-by: Tomas Fabrizio Orsi <[email protected]>
Signed-off-by: Tomas Fabrizio Orsi <[email protected]>
Signed-off-by: Tomas Fabrizio Orsi <[email protected]>
Signed-off-by: Tomas Fabrizio Orsi <[email protected]>
Signed-off-by: Tomas Fabrizio Orsi <[email protected]>
Signed-off-by: Tomas Fabrizio Orsi <[email protected]>
Signed-off-by: Tomas Fabrizio Orsi <[email protected]>
e007d01
to
4baa815
Compare
Just Rebased |
After re-reading the documentation, this PR should also come with a documentation change; subsection "Validation" from the "Builder" section. Maybe it could be done after a round of reviews. |
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.
Closes # issue nm
The issue states that currently
Operation::verify
is called inside theOperationBuilder
which is called before operations are added to blocks, which could lead failure in operation verification. Because of this,SameTypeOperands
' verification function had been commented out.This PR removes the call to
Operation::verify
from theOperationBuilder
and moves it to the beggining ofPassManager::run
.Operation::verify
is already called inside thePassManager::run
(more precisely, inside theOpToOpPassAdaptor::run_pipeline
), however an earlierverify
call was added to "compensate" the removal and assureOperation
integrity before applying passes. Now, thePassManger
is responsible forOperation
integrity verification, which is done before passes are applied and after each pass applies its modifications.With the call to
verify
in theOperationBuilder
now removed,SameTypeOperands
' verification function was re-enabled and so was its test (derived_op_verifier_test
).Additionally, an implementation for
SameOperandsAndResultType
's verification function was added (which was marked here as a TODO-item). Following the comment's requirements,SameTypeOperands
required as a super-trait.To support this, the
derive!
macro was expanded to support super-traits. The macro supports an arbitrary amount of traits; but it is important to note that the traits must be comma separated instead of the usual "+" separated format. As far as I am aware, it is not possible to use "+" as a separator inside amacro_rules!
context.With the super-trait now added, operations that implemented
SameOperandsAndResultType
but did not implementSameTypeOperands
were updated to now explicitely implement both. This was done explicitely in order to replicate Rust's#[derive]
macro's behavior of explicitely declaring all derive traits.Finally, a unit test was added to test
SameOperandsAndResultType
's verify function. For this, a test operationInvalidOpsWithReturn
was added and registered in the test dialect.Side note: I tried to keep the
SameOperandsAndResultType
's doc comment relatively short in order for it to show up in its entirety when a compilation error shows up, it is currently displayed like so: