-
Notifications
You must be signed in to change notification settings - Fork 77
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
core: implement EffectInstance #2987
Conversation
…iven specific value. Use it instead of just EffectKind.
…re dead. Update the side effects of stencil allocation to let generic DCE eliminate allocs.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2987 +/- ##
==========================================
- Coverage 89.84% 89.83% -0.01%
==========================================
Files 411 411
Lines 51641 51641
Branches 8027 8028 +1
==========================================
- Hits 46399 46394 -5
- Misses 3961 3964 +3
- Partials 1281 1283 +2 ☔ View full report in Codecov by Sentry. |
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.
Code looks good, how closely does this change mirror the MLIR mechanism?
Good question ahah So on previous bits, I was convinced to implement RecursiveMemoryEffect in terms of MemoryEffect, recursively returning nested effects as one's own effects. (As opposed to MLIR's design where it is a distinct trait, handled specifically in each effect-related analysis) The only difference on this PR's bit is about those allocation effects' treatment in dead coda analysis; because MLIR actually recurse in that test, it only removes allocation effects of one operation if it's about its result (slightly cheaper to do I believe); here, I actually remove more effects from the "faulty" list in dead code analysis, be removing any allocation effect affecting a value defined by the effecting operation or any nested operation, to properly reuse this recursive effect query. This relies on MLIR's Value Scoping, more precisely:
|
It would be good to document this difference a bit more in a comment in the code |
Up until now, xDSL's implementation of side-effects only expressed effect kinds, that is, this operations reads, but never restricting what it effects.
This implements EffectInstance, which contains both an effect kind and an optional effected value, which can be an SSAValue (the effect only affect what this value represents, e.g., read from this memref only) or a SymbolRef (e.g., globals!)
This is used to consider allocation effects in generic DCE: an unused operation only allocating values it defines can safely be regarded as dead.
Also, state this property on
stencil.alloc
to let generic DCE erase unused allocations rather than a specific canonicalization pattern.NB: I intend to use it to simplify the implementation of finer stencil bufferization analyses.