bd7ebe9da7
It turned out that a compiler built without offloading support and one with can produce slightly different diagnostic. Offloading support implies ENABLE_OFFLOAD which implies that g->have_offload is set when offloading is actually needed. In cgraphunit.c, the latter causes flag_generate_offload = 1, which in turn affects tree.c's free_lang_data. The result is that the front-end specific diagnostic gets reset ('tree_diagnostics_defaults (global_dc)'), which affects in this case 'Warning' vs. 'warning' via the Fortran frontend. Result: 'Warning:' vs. 'warning:'. Side note: Other FE also override the diagnostic, leading to similar differences, e.g. the C++ FE outputs mangled function names differently, cf. patch thread. libgomp/ChangeLog: * testsuite/libgomp.oacc-fortran/par-reduction-2-1.f: Use [Ww]arning in dg-bogus as FE diagnostic and default diagnostic differ and the result depends on ENABLE_OFFLOAD. * testsuite/libgomp.oacc-fortran/par-reduction-2-2.f: Likewise. * testsuite/libgomp.oacc-fortran/parallel-dims.f90: Likewise. * testsuite/libgomp.oacc-fortran/parallel-reduction.f90: Likewise. gcc/testsuite/ChangeLog: * gfortran.dg/goacc/classify-serial.f95: Use [Ww]arning in dg-bogus as FE diagnostic and default diagnostic differ and the result depends on ENABLE_OFFLOAD. * gfortran.dg/goacc/kernels-decompose-2.f95: Likewise. * gfortran.dg/goacc/routine-module-mod-1.f90: Likewise.
67 lines
2.1 KiB
Fortran
67 lines
2.1 KiB
Fortran
! Test of reduction on parallel directive (with async).
|
|
! Variant of "../libgomp.oacc-c-c++-common/par-reduction-2.c".
|
|
! Variant using the "openacc" module.
|
|
|
|
! { dg-do run }
|
|
|
|
! { dg-additional-options "-Wopenacc-parallelism" } for
|
|
! testing/documenting aspects of that functionality.
|
|
|
|
PROGRAM MAIN
|
|
USE OPENACC
|
|
IMPLICIT NONE
|
|
|
|
INTEGER RES, RES1, RES2
|
|
|
|
RES1 = 0
|
|
RES2 = 0
|
|
|
|
!$ACC PARALLEL NUM_GANGS(256) NUM_WORKERS(32) VECTOR_LENGTH(32)
|
|
!$ACC& REDUCTION(+:RES1) COPY(RES1, RES2) ASYNC(1)
|
|
! { dg-bogus "\[Ww\]arning: region is gang partitioned but does not contain gang partitioned code" "TODO 'reduction', 'atomic'" { xfail *-*-* } .-1 }
|
|
! { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .-2 }
|
|
! { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-3 }
|
|
res1 = res1 + 5
|
|
|
|
!$ACC ATOMIC
|
|
res2 = res2 + 5
|
|
!$ACC END PARALLEL
|
|
|
|
IF (ACC_GET_DEVICE_TYPE () .EQ. ACC_DEVICE_HOST) THEN
|
|
RES = 1 * 5
|
|
ELSE
|
|
RES = 256 * 5
|
|
END IF
|
|
|
|
CALL ACC_ASYNC_WAIT (1)
|
|
|
|
IF (RES .NE. RES1) STOP 1
|
|
IF (RES .NE. RES2) STOP 2
|
|
|
|
RES1 = 1
|
|
RES2 = 1
|
|
|
|
!$ACC PARALLEL NUM_GANGS(8) NUM_WORKERS(32) VECTOR_LENGTH(32)
|
|
!$ACC& REDUCTION(*:RES1) COPY(RES1, RES2) ASYNC(1)
|
|
! { dg-bogus "\[Ww\]arning: region is gang partitioned but does not contain gang partitioned code" "TODO 'reduction', 'atomic'" { xfail *-*-* } .-1 }
|
|
! { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .-2 }
|
|
! { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-3 }
|
|
res1 = res1 * 5
|
|
|
|
!$ACC ATOMIC
|
|
res2 = res2 * 5
|
|
!$ACC END PARALLEL
|
|
|
|
IF (ACC_GET_DEVICE_TYPE () .EQ. ACC_DEVICE_HOST) THEN
|
|
RES = 5 ** 1
|
|
ELSE
|
|
RES = 5 ** 8
|
|
END IF
|
|
|
|
CALL ACC_ASYNC_WAIT_ALL
|
|
|
|
IF (RES .NE. RES1) STOP 3
|
|
IF (RES .NE. RES2) STOP 4
|
|
|
|
END PROGRAM
|