-
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
DependencyAnalysis misses dependency on non-exhaustive write-write #2727
Comments
I don't see an easy way :( I tried to rewrite it as something like:
I believe that should roughly be the same logic - for each element <=3 find the previous element >3 But I assume the dependency analysis will still see read and write accesses to the same index in different iterations (i and j), and there actually is a race condition (consider 4, 1, 1, in array... when the loop index 2 and 3 ... the 1s ... are executed in parallel, loop index 3 might read the value from loop 2, while loop 2 is writing ... ) except of course it doesn't matter, since the same value will be written in loop index 3 (the 4, either from array index 2 or array index 1). But I think this rewrite should allow you to execute this in parallel (by disabling the DA). And of course, handling the problem what happens if the first element is <=3 ... my_val would be uninitialised, and the search loop won't find a value. |
I would like to try to identify the dependency in the original code as this leads to compliable but code with different semantics (psyclone adds a private(my_var) since it finds the write-write), and it's very difficult to find out where the difference in results come from. What make it hard? Is it the fact that it is a "scalar"? If I do something like:
It properly detects the write-write dependency on my_val in the outer loop |
In both cases, if in both condition bodies there was a Ignoring the scalar version for now, the problem seems to be that the write-write is not exhaustive to all branches, and therefore some are carried to the next iteration. Would it be possible to differentiate between:
|
@hiker This is a simplified version of an issue we hit on NEMOv5, here my_val sometimes keeps its value for the next iteration, so it is essentially serialising the loop. Could we do something about this?
The text was updated successfully, but these errors were encountered: