On 28.09.22 15:20, Julian Brown wrote:

This patch fixes an ICE when both a complete struct variable and
components of that struct are mapped on the same directive for OpenACC,
using a modified version of the scheme used for OpenMP in the following
patch [...]
Tested with offloading to NVPTX. OK?

OpenACC comments:

I do note that there are now two "appears more than once in map clauses". The
newly added  error_at in oacc_resolve_clause_dependencies is triggered by
gcc/testsuite/gfortran.dg/goacc/{derived-types-3.f90,goacc/mapping-tests-{1,4}.f90}.

However, it looks as if no testcase triggers anymore the OpenACC-only error_at
in omp_accumulate_sibling_list. My impression is that the 
oacc_resolve_clause_dependencies
check + 'if (grp->deleted) continue;' in the sibling-list function makes this 
difficult to hit.

I don't see immediately whether some cases can still reach 
omp_accumulate_sibling_list –
if so, a testcase would be nice, or whether that error_at can now be removed.


However, I note that *without* the patch, the *following* *error* triggers – 
while
it compiles *silently* *with* the *patch* applied:

  15 |   !$acc enter data copyin(x%A, x%A%i(5), x%A%i(5))
     |                                                  ^
Error: ‘x.a.i’ appears more than once in map clauses

  15 |   !$acc enter data copyin(x%A, x%A%i(5), x%A%i(4))
     |                                                  ^
Error: ‘x.a.i’ appears more than once in map clauses

BTW: The two testcases differ by the array-element: '5'/'5' vs. '5'/'4'.
Testcase is a modified existing one:

--- a/gcc/testsuite/gfortran.dg/goacc/mapping-tests-4.f90
+++ b/gcc/testsuite/gfortran.dg/goacc/mapping-tests-4.f90
@@ -3 +3 @@ subroutine foo
-    integer i, j
+    integer i(5), j
@@ -15 +15 @@ subroutine foo
-  !$acc enter data copyin(x%A, x%A%i, x%A%i)
+  !$acc enter data copyin(x%A, x%A%i(5), x%A%i(4))

Otherwise, the patch looks sensible - as far as I understand it.
However, it surely would help if Thomas and/or Jakub could have a second look.

Tobias


2022-09-28  Julian Brown  
<jul...@codesourcery.com><mailto:jul...@codesourcery.com>

gcc/
       PR middle-end/107028
       * gimplify.cc (omp_group_base): Fix IF_PRESENT handling.
       (omp_check_mapping_compatibility, oacc_resolve_clause_dependencies):
       New functions.
       (build_struct_sibling_lists): Skip deleted groups.  Don't build sibling
       list for struct variables that are fully mapped on the same directive
       for OpenACC.
       (gimplify_scan_omp_clauses): Call oacc_resolve_clause_dependencies.

gcc/testsuite/
       PR middle-end/107028
       * c-c++-common/goacc/struct-component-kind-1.c: New test.
       * g++.dg/goacc/pr107028-1.C: New test.
       * g++.dg/goacc/pr107028-2.C: New test.

-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 
München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas 
Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht 
München, HRB 106955

Reply via email to