-
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
feat: Extend LowerTypes pass to linearize by inserting copy/discard #2018
Open
acl-cqc
wants to merge
103
commits into
main
Choose a base branch
from
acl/lower_types_linearize
base: main
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.
Open
Changes from all commits
Commits
Show all changes
103 commits
Select commit
Hold shift + click to select a range
937cd14
Add TypeTransformer and (Sum/Function)Type(Arg/Row)::transform
acl-cqc 815536b
trait Transformable to common up all the 'let mut any_change = false'…
acl-cqc cc1e8f2
Transformable v2: implement for [E], works without iter_mut/etc. in a…
acl-cqc 4888184
first test, fix CustomType bound caching
acl-cqc 7002e4d
Second test, fix SumType caching
acl-cqc 6cc7cea
Make clippy happy
acl-cqc d43784b
Add HugrMut::optype_mut (v2, allow mutating root if RootHandle == Node)
acl-cqc 422c496
WIP add hugr-passes/src/lower_types.rs (w/ change_node, subst_ty)
acl-cqc 76ed391
Add def_arc
acl-cqc ed5b5dd
change_node, change_type, and the rest
acl-cqc adcbbf6
Use TypeTransformer framework, removing most type_stuff from lower_ty…
acl-cqc d84ae4e
Add a load of copy/discard lowering stuff, OpReplacement
acl-cqc bfa52cf
OpHashWrapper
acl-cqc b373571
Parametrized type support
acl-cqc a8e613a
remove copy_discard stuff
acl-cqc 24ed15c
Assume less in OpReplacement::replace
acl-cqc 9153fcf
parametrized ops
acl-cqc a89879c
Comments, renaming, use const_fn
acl-cqc c78d88a
Comment const_fn TODO
acl-cqc bf6a9a4
Test panics on unexpected argument - simpler, better
acl-cqc 5ecd9e6
test functiontype
acl-cqc d9a6d29
clippy that new test
acl-cqc 83e798e
Merge remote-tracking branch 'origin/main' into acl/type_transform
acl-cqc 84fe82d
WIP setup for test
acl-cqc 6168353
First test
acl-cqc fcb85a2
read only makes sense for Copyables
acl-cqc 0f9aa17
Extend test to Calls of polyfunc; comments, monomorphize first
acl-cqc 74c6775
no, instantiate the calls with types being lowered
acl-cqc 00fd284
Consts: HashMap keyed by either, add lower_ methods. Test TailLoop an…
acl-cqc 9f02acf
clippy, turn off type-complexity
acl-cqc a0ac6d6
Actual Error for check_sig, add setter method
acl-cqc 6ac9efc
docs
acl-cqc 044ff32
Test variable, boundednat; use list_type
acl-cqc b539e2f
Yet Another ValidationLevel interface
acl-cqc 2c7e035
Merge remote-tracking branch 'origin/main' into acl/type_transform
acl-cqc 6b190a6
Merge branch 'acl/type_transform' into acl/lower_types
acl-cqc bd24d1a
clippy
acl-cqc a5d8b65
doclinxs
acl-cqc 6b1438c
pub re-export
acl-cqc d1036bc
fix const_loop for extensions
acl-cqc d19dc5a
fix other test for extensions, but turn off extension validation afte…
acl-cqc d0fddde
Add another test of Conditional + Case
acl-cqc 3494887
common up read_op
acl-cqc ffdcaf2
test tidies
acl-cqc 6f8f43c
No need to validate, run() does it for us
acl-cqc e3da259
check_sig: use Option::unzip to tuple-ize
acl-cqc 28f2470
Move private utility classes below the pub ones; add comments
acl-cqc bef90b0
Comments - all callbacks return Option
acl-cqc 85df7ff
test: Rename lower_types to lowerer
acl-cqc 507f027
Extend loop_const test
acl-cqc bae0ebe
Add copy/dup linearization stuff
acl-cqc 8fa79bd
do_copy_chain => insert_copy_discard
acl-cqc 6a186a5
Move insert_copy_discard into Linearizer
acl-cqc 6d8a89b
Add LinearizeError
acl-cqc 3f0f1e6
pass Linearizer to callbacks
acl-cqc 974a25b
comments
acl-cqc 2bbf663
first test, don't linearize root node outputs, reject nonlocal edges
acl-cqc 290a8ae
copy_fn/discard_fn return Result
acl-cqc 19b1442
linearize takes &TypeDef not TypeDef
acl-cqc 269f0f1
OpReplacement::add(&self, ...) -> add_hugr(self, ...)
acl-cqc f6a1af5
Drop an else-continue
acl-cqc ac9adac
Add OpReplacement::add for builder
acl-cqc 65eaf52
Handle Sum Types in copy_op/discard_op
acl-cqc 354a89c
drop redundant allow-missing_docs
acl-cqc 1b31631
Refactor test code, fix --all-features
acl-cqc d5cbd58
Test copying+discarding an option of two elements
acl-cqc 63bdd3b
tidy imports
acl-cqc 1ac3728
Combine lower_consts(_parametric) with lower_(parametric_)type
acl-cqc e768814
Test sig checking
acl-cqc 506570b
No, remove sig checking
acl-cqc 0958e2a
Test funky partial replace
acl-cqc 74cfdb1
common up just_elem_type
acl-cqc dc79c93
comment spacing
acl-cqc 63d24b0
RIP SignatureMismatch
acl-cqc ba63fbe
Reinstate separate lower_consts/lower_consts_parametric
acl-cqc 2c7bb80
Remove the boxes
acl-cqc 08d3227
drop comment re. validation_level
acl-cqc dedc3d5
rename module lower_types -> replace_types
acl-cqc 9993467
rename LowerTypes=>ReplaceTypes, ChangeTypeError => ReplaceTypesError
acl-cqc cc81d87
rename methods, parametric => parametrized
acl-cqc 74c6492
doc notes
acl-cqc 18316de
comment/doc updates
acl-cqc 520e414
fmt
acl-cqc 0814bf2
callbacks for Const take &ReplaceTypes
acl-cqc 0a82fef
Replace that break 'changed block with a match, + map_or_else to avoi…
acl-cqc 94c0ff3
Add Type::as_extension
acl-cqc e9ff81c
wip
acl-cqc cf6451f
add list_const handler, use in test
acl-cqc 9a355d5
Clarify replace_consts_parametrized callback
acl-cqc ec2d0ba
const callbacks report errors via Result
acl-cqc c9d7033
fmt+fix
acl-cqc 812ac89
comment tweaks
acl-cqc ae7bd6e
Merge remote-tracking branch 'origin/main' into acl/lower_types
acl-cqc e0937ee
docs
acl-cqc 36df03c
and some more - warn on missing_docs except ReplaceTypesError
acl-cqc 71f8c0b
Merge remote-tracking branch 'origin/main' into acl/lower_types
acl-cqc dc0c7dd
Merge branch 'acl/lower_types' into acl/lower_types_linearize
acl-cqc 31ba4e0
docs, make pub, more errors
acl-cqc 86c73ed
Test copyable element inside Sum - breaks test
acl-cqc 92d7a51
Error on copyable; handle copyable elements of sums - fixes
acl-cqc 582b9f1
register errors with type; panic on function as already ruled out
acl-cqc 95da97d
more docs - no overriding copy/discard of non-extension types
acl-cqc c7e56e6
pub discard_op
acl-cqc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two are pub because other extensions may want them for defining their own copy/discard handlers (that build nested Hugrs that copy elements of collections, etc.)