-
Notifications
You must be signed in to change notification settings - Fork 28
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
Canonicalise WHERE with reduction intrinsics, which currently are placed into CodeBlocks #1960
Comments
I suspect it is the |
Simon has also reported:
|
Looking at the intrinsics in fparser, I realise we are going to have similar problems with MAXVAL, MINVAL and PRODUCT. |
As we talk about, these issues are also present in the arrayrange2loop transformation, although we correctly refuse them in the validate because they contain non-elemental intrinsics. If we could convert
to
maybe we could reuse that transfomration to convert the wheres, but we need:
(trying to use the transformation for the where convertion can already be started by putting TransformationErrors to CodeBlocks - but it will have some limitations at least until #2004 ) |
@arporter Having a second thought on the previous comment, wouldn't the array to loop conversion from
be achieved without a temporary by doing
which it is also more memory efficient because skips the temporary store. |
Ooh, that's clever. |
sum2code also does this I think but replaces the final sum as it is not sum2sum! So this functionality could be used here or extracted from here. |
PR #2372 fixes some bugs on the WHERE parsing and adds the construct into a CodeBlock when there is a reduction that we can not safely canonicalise. This prevents the silent bug referenced at the top of this issue, but we leave the issue open until we can get rid of the CodeBlock. |
(Towards #1960) put WHEREs containing reductions into CodeBlocks and fix non-unity lower-bound bug.
PR #2883 handles the xfailing test for this issue, but I'm not sure it necessarily fixes the cases described here. |
In ECMWF NEMO sbccpl.f90 this WHERE construct.
is converted to:
Which produces the compiler error:
The shapes of the array expressions do not conform. [ZEVAP_ICE]
I am not sure what the error is, but it is a nested WHERE (#1651 ?) with array elements ( #717 ?) and it uses 1, SIZE instead of L/UBound which could cause troubles with non-standard bounds.
The text was updated successfully, but these errors were encountered: