Skip to content

Commit

Permalink
#1664: Fix too strict constraint in sync/wait transformations
Browse files Browse the repository at this point in the history
  • Loading branch information
svalat committed Mar 14, 2023
1 parent cd0b2ea commit 4c44e57
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/psyclone/psyir/nodes/acc_directives.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,14 +276,14 @@ def begin_string(self):
sym_list = _sig_set_to_string(self._sig_set)

# options
options = f" copyin({sym_list}"
options = f" copyin({sym_list})"

# async
options += _build_async_string(self._async_queue)

# Variables need lexicographic sorting since sets guarantee no ordering
# and members of composite variables must appear later in deep copies.
return f"acc enter data{options})"
return f"acc enter data{options}"

def data_on_device(self, parent):
'''
Expand Down
28 changes: 14 additions & 14 deletions src/psyclone/transformations.py
Original file line number Diff line number Diff line change
Expand Up @@ -2284,9 +2284,9 @@ def apply(self, sched, options=None):
posn = sched.children.index(current)

# handle async option
async_queue = None
if options != None:
async_queue = options.get('async_queue', False)
if options == None:
options = {}
async_queue = options.get('async_queue', False)

# Add the directive at the position determined above, i.e. just before
# the first statemement containing an OpenACC compute construct.
Expand Down Expand Up @@ -2322,17 +2322,17 @@ def validate(self, sched, options=None):
"region - cannot add an enter data.")

# do not has mixed async
async_queue = None
if options != None:
async_queue = options.get('async_queue', False)
if async_queue != False:
if options == None:
options = {}
async_queue = options.get('async_queue', False)
if async_queue:
directive_cls = (ACCKernelsDirective, ACCParallelDirective)
for directive in sched.walk(directive_cls):
if directive.async_queue != False and directive.async_queue != async_queue:
if directive.async_queue and directive.async_queue != async_queue:
raise TransformationError(f"Tried to apply async() while another one is used internally \
with different queue ({async_queue} != {directive.async_queue}) !")
directive = sched.ancestor(directive_cls)
if directive and directive.async_queue != False and directive.async_queue != async_queue:
if directive and directive.async_queue and directive.async_queue != async_queue:
raise TransformationError(f"Tried to apply async() while another one is used in ancestor \
with different queue ({async_queue} != {directive.async_queue}) !")

Expand Down Expand Up @@ -2570,17 +2570,17 @@ def validate(self, nodes, options):
"array range but none were found.")

# do not has mixed async
async_queue = None
if options != None:
async_queue = options.get('async_queue', False)
if async_queue != False:
if options == None:
options = {}
async_queue = options.get('async_queue', False)
if async_queue:
directive_cls = (ACCKernelsDirective, ACCParallelDirective)
for directive in sched.walk(directive_cls):
if directive.async_queue != False and directive.async_queue != async_queue:
raise TransformationError(f"Tried to apply async() while another one is used internally \
with different queue ({async_queue} != {directive.async_queue}) !")
directive = sched.ancestor(directive_cls)
if directive and directive.async_queue != False and directive.async_queue != async_queue:
if directive and directive.async_queue and directive.async_queue != async_queue:
raise TransformationError(f"Tried to apply async() while another one is used in ancestor \
with different queue ({async_queue} != {directive.async_queue}) !")

Expand Down

0 comments on commit 4c44e57

Please sign in to comment.