-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
LICM for pure functions #29285
Copy link
Copy link
Open
Labels
compiler:optimizerOptimization passes (mostly in base/compiler/ssair/)Optimization passes (mostly in base/compiler/ssair/)featureIndicates new feature / enhancement requestsIndicates new feature / enhancement requests
Metadata
Metadata
Assignees
Labels
compiler:optimizerOptimization passes (mostly in base/compiler/ssair/)Optimization passes (mostly in base/compiler/ssair/)featureIndicates new feature / enhancement requestsIndicates new feature / enhancement requests
Julia 1.0:
I just realized, that this is a gotcha one easily runs into, especially when using the
@.macro:This likely happens because the compiler can't infer that sin is pure.
I realize, with having access to the call tree in the new lazy broadcast, we could solve this for a predefined set of functions.
First trick could be to just overload
broadcastedfor known signatures:this solves the problem for a chosen set of functions.
We could also consider, if we introduce a purity trait to make this easier for multiple argument functions:
I guess this has been discussed before, but I couldn't really find an issue about it...