Closed FabioLuporini closed 9 months ago
"Fabio, have you thought about just performing a round of cse()
instead"
"Yes I have, unfortunately it's not that easy because CSE is a Cluster-local pass, which doesn't work well here"
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
c888cee
) 86.76% compared to head (df4e53d
) 86.76%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
"Fabio, have you thought about just performing a round of
cse()
instead""Yes I have, unfortunately it's not that easy because CSE is a Cluster-local pass, which doesn't work well here"
Why does it not work well? Not sure I understand TBH
Why does it not work well? Not sure I understand TBH
lower_index_derivative
might produce:
Cluster([
r1 = 0
r1 += <lowered index derivative>
r0 = r1
])
CSE would be able to see that r0 is unnecessary here and safely removable. But r0
is needed in later Clusters, so it would produce wrong code ultimately
Note that this is just a simplified example
You would need to understand lower_index_derivatives
fully to appreciate all the different flavors of this issue
Why does it not work well? Not sure I understand TBH
lower_index_derivative
might produce:Cluster([ r1 = 0 r1 += <lowered index derivative> r0 = r1 ])
CSE would be able to see that r0 is unnecessary here and safely removable. But
r0
is needed in later Clusters, so it would produce wrong code ultimatelyNote that this is just a simplified example
You would need to understand
lower_index_derivatives
fully to appreciate all the different flavors of this issue
Thanks
Tiny enhancement to avoid useless stupid temporary variables in the generated code