Pass Manager for the Sway-IR #3596
Replies: 3 comments 4 replies
-
Cool. Two immediate thoughts:
Dunno how you'd manage to get a static checker for recursive hard dependencies, but I guess it may be possible 🙂 Otherwise sounds good. It makes the most sense for it to be a part of |
Beta Was this translation helpful? Give feedback.
-
[profile.release]
opt-level = 'z' # Optimize for size We could request that from tooling. Flags for Everything else suggested here makes sense to me!
So is the verifier probably. On thought: I remember that LLVM had a way to pass in "arguments" to passes. For example, you can run the same pass in the pass manager multiple times but with different parameters depending on the use case. Likely a super low priority thing but could be an interesting tweaking mechanism. May also be useful for tweaking the optimization for various backends. |
Beta Was this translation helpful? Give feedback.
-
Some thoughts / decisions as I'm implementing the pass manager:
This may be a bad idea, introducing unnecessary complications. It is simpler to allow only dependences on analyses (what I call as hard dependence above) and ensure no cycles at all. There can never be a dependence on a transform. |
Beta Was this translation helpful? Give feedback.
-
Pass Manager for the Sway-IR
GitHub: #2399
Requirements
X => Y
(Y
hard depends onX
), thenX
must be run beforeY
. This is only allowed whenX
isan analysis and not a transformation.
X -> Y
(Y
soft depends onX
), thenrunning
X
beforeY
may improve the quality of generated code,but is not necessary for correctness.
Design: Interface
Category
Several categories are defined. Optimization levels
-O0
,-O1
etc are alsocategories. Each optimization pass can list out the set (size >= 0) of categories that it belongs to.
Dependences
Each pass can specify a list of other passes that it depends (hard or soft) on.
ensure that hard dependences don't form a cycle. (need to think through and decide).
till there's no change (or we've met some other criteria such as compile time).
Configuration
The pass manager is invoked with exactly one configuration parameter. A configuration
specifies an ordered list of passes and or catetories of passes to execute. It is
the job of the pass manager to execute these passes as close to the specified order
as can be executed satisfying all dependences.
A debug printer will be provided that prints the final ordered list of passes as
computed by the pass manager, ready for execution.
Design: Internals (working)
TBD
Beta Was this translation helpful? Give feedback.
All reactions