ecmwf-ifs / loki

Freely programmable source-to-source translation for Fortran
https://sites.ecmwf.int/docs/loki/
Apache License 2.0
22 stars 11 forks source link

Split reads and writes for certain accumulation patterns #329

Open awnawab opened 1 month ago

awnawab commented 1 month ago

Lukas M. demonstrated that for accumulation patterns of the type:

do jlon=1,nproma
   var(jlon, n1) = var(jlon, n1) + 1.
   var(jlon, n2) = var(jlon, n2) + 1.
enddo

a compiler cannot rule out the possibility that n1 and n2 do not in fact alias the same location. In such a case, it is unable to run the loads and stores out-of-order.

This PR contributes a pragma assisted transformation to split the above into separate reads and writes, thereby removing the dependency between subsequent loads and stores and allowing the compiler to optimise more effectively.

github-actions[bot] commented 1 month ago

Documentation for this branch can be viewed at https://sites.ecmwf.int/docs/loki/329/index.html

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 95.19%. Comparing base (d5a8e6c) to head (4974f6b).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #329 +/- ## ========================================== + Coverage 95.17% 95.19% +0.01% ========================================== Files 168 170 +2 Lines 35589 35707 +118 ========================================== + Hits 33872 33990 +118 Misses 1717 1717 ``` | [Flag](https://app.codecov.io/gh/ecmwf-ifs/loki/pull/329/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ecmwf-ifs) | Coverage Δ | | |---|---|---| | [lint_rules](https://app.codecov.io/gh/ecmwf-ifs/loki/pull/329/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ecmwf-ifs) | `96.39% <ø> (ø)` | | | [loki](https://app.codecov.io/gh/ecmwf-ifs/loki/pull/329/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ecmwf-ifs) | `95.17% <100.00%> (+0.01%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ecmwf-ifs#carryforward-flags-in-the-pull-request-comment) to find out more.

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