From 351a7279768c474a9bcc40c5882c6bfbfd57dce2 Mon Sep 17 00:00:00 2001 From: Michael Lange Date: Fri, 11 Aug 2023 10:40:22 +0000 Subject: [PATCH] SCC: Add logging of vector-within-seq markers, which indicate issues --- .../transformations/single_column_coalesced.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/transformations/transformations/single_column_coalesced.py b/transformations/transformations/single_column_coalesced.py index 1ee57609d..209fd6eec 100644 --- a/transformations/transformations/single_column_coalesced.py +++ b/transformations/transformations/single_column_coalesced.py @@ -366,6 +366,12 @@ def kernel_annotate_sequential_loops_openacc(cls, routine, horizontal): # Perform pragma addition in place to avoid nested loop replacements loop._update(pragma=(ir.Pragma(keyword='acc', content='loop seq'),)) + # Warn if we detect vector insisde sequential loop nesting + nested_loops = FindNodes(ir.Loop).visit(loop.body) + loop_pragmas = flatten(as_tuple(l.pragma) for l in as_tuple(nested_loops)) + if any('loop vector' in pragma.content for pragma in loop_pragmas): + info(f'[Loki-SCC::Annotate] Detected vector loop in sequential loop in {routine.name}') + @classmethod def kernel_annotate_subroutine_present_openacc(cls, routine): """ @@ -389,12 +395,12 @@ def kernel_annotate_subroutine_present_openacc(cls, routine): @classmethod def insert_annotations(cls, routine, horizontal, vertical, hoist_column_arrays): - # Mark all non-parallel loops as `!$acc loop seq` - cls.kernel_annotate_sequential_loops_openacc(routine, horizontal) - # Mark all parallel vector loops as `!$acc loop vector` cls.kernel_annotate_vector_loops_openacc(routine, horizontal, vertical) + # Mark all non-parallel loops as `!$acc loop seq` + cls.kernel_annotate_sequential_loops_openacc(routine, horizontal) + # Wrap the routine body in `!$acc data present` markers # to ensure device-resident data is used for array and struct arguments. cls.kernel_annotate_subroutine_present_openacc(routine)