-
Notifications
You must be signed in to change notification settings - Fork 14
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
Minor bugfixes for GlobalVarOffloadTransformation #204
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -359,7 +359,6 @@ def process_driver(self, routine, successors): | |
""" | ||
Add offload and/or copy-back directives for the imported variables. | ||
""" | ||
|
||
update_device = () | ||
update_host = () | ||
|
||
|
@@ -370,7 +369,7 @@ def process_driver(self, routine, successors): | |
'enter_data_create': 'enter data create', | ||
} | ||
for key, directive in key_directive_map.items(): | ||
variables = set.union(*[s.trafo_data.get(self._key, {}).get(key) for s in successors], set()) | ||
variables = set.union(*[s.trafo_data.get(self._key, {}).get(key, {}) for s in successors], set()) | ||
if variables: | ||
update_device += (Pragma(keyword='acc', content=f'{directive}({",".join(variables)})'),) | ||
|
||
|
@@ -379,7 +378,7 @@ def process_driver(self, routine, successors): | |
'acc_copyout': 'update self' | ||
} | ||
for key, directive in key_directive_map.items(): | ||
variables = set.union(*[s.trafo_data.get(self._key, {}).get(key) for s in successors], set()) | ||
variables = set.union(*[s.trafo_data.get(self._key, {}).get(key, {}) for s in successors], set()) | ||
if variables: | ||
update_host += (Pragma(keyword='acc', content=f'{directive}({",".join(variables)})'),) | ||
|
||
|
@@ -429,14 +428,9 @@ def process_driver(self, routine, successors): | |
new_imports += as_tuple(Import(k, symbols=tuple(Variable(name=s, scope=routine) for s in v))) | ||
|
||
# add new imports to driver subroutine sepcification | ||
import_pos = 0 | ||
if (old_imports := FindNodes(Import).visit(routine.spec)): | ||
import_pos = routine.spec.body.index(old_imports[-1]) + 1 | ||
if new_imports: | ||
routine.spec.insert(import_pos, Comment(text= | ||
routine.spec.prepend(new_imports) | ||
routine.spec.prepend(Comment(text= | ||
'![Loki::GlobalVarOffload].....Adding global variables to driver symbol table for offload instructions')) | ||
import_pos += 1 | ||
routine.spec.insert(import_pos, new_imports) | ||
Comment on lines
-432
to
-439
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change modifies the way the module variable imports are added to the driver routine. The original inserts them to the specification part. The problem with this is that it may add the imports after |
||
|
||
def process_kernel(self, routine, successors, item): | ||
""" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change avoids an iteration error over
None
s, since in the original version, theget(key)
can return aNone