Skip to content
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

Fix cudafor import in driver for SCC CUF #157

Merged
merged 1 commit into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions transformations/tests/test_scc_cuf.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ def fixture_config():


def check_subroutine_driver(routine, blocking, disable=()):
# use of "use cudafor"
imports = [_import.module.lower() for _import in FindNodes(Import).visit(routine.spec)]
assert "cudafor" in imports
# device arrays
# device arrays: declaration
arrays = [var for var in routine.variables if isinstance(var, sym.Array)]
Expand Down
10 changes: 1 addition & 9 deletions transformations/transformations/scc_cuf.py
Original file line number Diff line number Diff line change
Expand Up @@ -671,13 +671,6 @@ def __init__(self, horizontal, vertical, block_dim, transformation_type='paramet
self.derived_types = [_.upper() for _ in derived_types]
self.derived_type_variables = ()

def transform_module(self, module, **kwargs):

role = kwargs.get('role')

if role == 'driver':
module.spec.prepend(ir.Import(module="cudafor"))

def transform_subroutine(self, routine, **kwargs):

item = kwargs.get('item', None)
Expand All @@ -696,8 +689,7 @@ def transform_subroutine(self, routine, **kwargs):
single_variable_declaration(routine=routine, group_by_shape=True)
device_subroutine_prefix(routine, depth)

if depth > 0:
routine.spec.prepend(ir.Import(module="cudafor"))
routine.spec.prepend(ir.Import(module="cudafor"))

if role == 'driver':
self.process_routine_driver(routine, targets=targets)
Expand Down