diff --git a/transformations/tests/test_data_offload.py b/transformations/tests/test_data_offload.py index 8745a2bf5..d9767388e 100644 --- a/transformations/tests/test_data_offload.py +++ b/transformations/tests/test_data_offload.py @@ -720,6 +720,7 @@ def test_transformation_global_var_hoist(here, config, frontend, hoist_parameter assert [arg.name for arg in kernel0.variables] == sorted(expected_vars) for var in kernel0.arguments: assert kernel0.variable_map[var.name.lower()].type.intent == var_intent_map[var.name.lower()] + assert var.scope == kernel0 kernel0_inline_calls = FindInlineCalls().visit(kernel0.body) for inline_call in kernel0_inline_calls: if ignore_modules is None: @@ -752,6 +753,7 @@ def test_transformation_global_var_hoist(here, config, frontend, hoist_parameter assert [arg.name for arg in kernel_map[call.routine.name].arguments] == expected_args for var in kernel_map[call.routine.name].variables: var_intent = kernel_map[call.routine.name].variable_map[var.name.lower()].type.intent + assert var.scope == kernel_map[call.routine.name] assert var_intent == var_intent_map[var.name.lower()] if call.routine.name in ['kernel1', 'kernel2']: expected_args = ['tmp'] + expected_args diff --git a/transformations/transformations/data_offload.py b/transformations/transformations/data_offload.py index dae7d3326..fe9d723b2 100644 --- a/transformations/transformations/data_offload.py +++ b/transformations/transformations/data_offload.py @@ -893,7 +893,7 @@ def _append_routine_arguments(self, routine, item): new_arguments.append(var.parents[0] if var.parent else var) new_arguments = set(new_arguments) # remove duplicates new_arguments = [ - arg.clone(type=arg.type.clone( + arg.clone(scope=routine, type=arg.type.clone( intent='inout' if arg in all_defines_vars else 'in', parameter=False, initial=None )) for arg in new_arguments