PSyclone
PSyclone copied to clipboard
[To-Do List] OpenACC enter data and update directives implementation
This is a compilation of the outstanding issues and unimplemented features in the OpenACC enter data and update directives implementation efforts in #310 and #1554.
- Distinguishing between array accesses and function calls.
In the following script, CodeBlock. get_symbol_names()
erroneously includes sine
whereas DependencyTools().get_in_out_parameters()
does not. I suspect this works without the improvements in #1865 because I'm passing a real
literal to sine
, but the whole thing does fall apart if I use an integer
literal.
@hiker, would it possible to change CodeBlock. get_symbol_names()
to behave similarly?
Even when #1865 is eventually completed, this still leaves the question of how to resolve imported symbols via the use
statement, but that's a different beast. In the meantime, I do incur the risk of including function names in the update directive's variable list, although that should be okay, since those names won't correspond to any existing variables.
from fparser.common.readfortran import FortranStringReader
from fparser.two.parser import ParserFactory
from psyclone.psyir.tools import DependencyTools
from psyclone.psyGen import PSyFactory
code = '''
real function sine(x)
implicit none
real :: x
sine = 1 - cos(x*1.)*cos(x*1.)
end function
program test
real r
r = sine(2.)
write(*,*) sine(2.)
end program test
'''
reader = FortranStringReader(code)
parser = ParserFactory().create()
ast = parser(reader)
psy = PSyFactory("nemo", distributed_memory=False).create(ast)
schedule = psy.invokes.invoke_list[1].schedule
print(DependencyTools().get_in_out_parameters(schedule[0]))
print(schedule[1].get_symbol_names())
- Changing
ACCEnterDataDirective
andACCUpdateDirective
to useClause
and "proper" lowering.
I don't exactly know what the latter means but according to @arporter it's something we could improve on.
- Extracting precise array access descriptions.
Currently, if we read or write only a few elements of an array on the host, the entirety of the array is being transferred from and to the device, i.e. the update directives only ever see array names and never subarray specifications with subscript ranges as allowed by the OpenACC standard. While this simplifies dependency resolution, it is obviously suboptimal and can potentially be a major disadvantage vs managed memory. Perhaps @hiker has a better idea of what's already possible here?