PSyclone icon indicating copy to clipboard operation
PSyclone copied to clipboard

Additional info to store in messages from the DependencyAnalysis tool

Open hiker opened this issue 2 years ago • 1 comments

The newly integrated message system in the dependency analysis (#1693) stores additional information besides an error/warning code and the message strings. Initially these additional messages are the variable names involved, but Sergi suggested to store pointers to the psyir, e.g.:

self._add_message(LazyString(
    lambda: f"The write access to '{self._language_writer(write_access.node)}' causes a"
    f"write-write race condition."),
    DACode.ERROR_WRITE_WRITE_RACE,
    [write_access.node])

We should agree what exactly this 'additional information' is - variable names, variables in the index expressions, psyir info (either of variable, or only of the index expression), maybe store psyir info of the access plus ComponentIndex of the subscript involved, ...

hiker avatar May 13 '22 03:05 hiker

In #1751 a transformation is introduced that removes induction variables. Ideally this transformation should be executed before calling the dependency analysis, e.g. to remove:

do i=1, n
   im = i-1
   a(i) = a(im)+1
enddo

On the other hand, this transformation will change the code (especially it will move assignment to the variables after the loop), which might not be expected (and could affect other transformations). If on the other hand, we create a copy in the dependency tools, then any reference in the message object will now point to a copied not, not the original node anymore :(

hiker avatar Jun 28 '22 03:06 hiker