devitocodes / devito

DSL and compiler framework for automated finite-differences and stencil computation
http://www.devitoproject.org
MIT License
564 stars 229 forks source link

compiler: fix cse with different conditionals #2410

Closed mloubout closed 4 months ago

mloubout commented 4 months ago

Fix cse to make sure expression from different conditionals get properly handled.

avoids things like

if (a){
  f1 = expr
 }
if (b){
  f1 = expr
 }

to be converted to

if (a){
  r0 = expr
  f1 = r0
 }
if (b){
  f1 = r0
 }

CSE now counts expression based on the equation's conditional. We could also just lift all rxx out of conditionals but that would be computing those cse temps way more than needed which I don't think it great

codecov[bot] commented 4 months ago

Codecov Report

Attention: Patch coverage is 96.29630% with 2 lines in your changes missing coverage. Please review.

Project coverage is 86.75%. Comparing base (6e79f1c) to head (a9a4d14).

Files Patch % Lines
devito/passes/clusters/cse.py 88.23% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #2410 +/- ## ======================================= Coverage 86.74% 86.75% ======================================= Files 235 235 Lines 44563 44610 +47 Branches 8250 8257 +7 ======================================= + Hits 38657 38702 +45 - Misses 5187 5189 +2 Partials 719 719 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.