Bug 66332 - goacc/acc_on_device-2.c scan-rtl-dump-times expand testsuite failure
Summary: goacc/acc_on_device-2.c scan-rtl-dump-times expand testsuite failure
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 6.0
: P3 normal
Target Milestone: ---
Assignee: Thomas Schwinge
URL:
Keywords: openacc
Depends on:
Blocks:
 
Reported: 2015-05-29 01:46 UTC by John Stanley
Modified: 2015-09-10 15:57 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2015-05-29 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Stanley 2015-05-29 01:46:17 UTC
Hi,

I'm getting the following openacc-related testsuite error for gcc-5.1.0 on an x86_64-pc-linux-gnu system:

FAIL: c-c++-common/goacc/acc_on_device-2.c scan-rtl-dump-times expand "\\(call [^\\n]* acc_on_device" 0

This failure does not appear to be related to BUG 64850.

The failure occurs in gcc-5.1.0/gcc/testsuite/c-c++-common/goacc/acc_on_device-2.c:27

  1 /* Have to enable optimizations, as otherwise builtins won't be expanded.  */
  2 /* { dg-additional-options "-O -fdump-rtl-expand" } */
  3 
  4 #if __cplusplus
  5 extern "C" {
  6 #endif
  7 
  8 typedef enum acc_device_t { acc_device_X = 123 } acc_device_t;
  9 extern int acc_on_device (acc_device_t);
 10 
 11 #if __cplusplus
 12 }
 13 #endif
 14 
 15 int
 16 f (void)
 17 {
 18   const acc_device_t dev = acc_device_X;
 19   return acc_on_device (dev);
 20 }
 21 
 22 /* With -fopenacc, we're expecting the builtin to be expanded, so no calls.
 23    TODO: in C++, even under extern "C", the use of enum for acc_device_t
 24    perturbs expansion as a builtin, which expects an int parameter.  It's fine
 25    when changing acc_device_t to plain int, but that's not what we're doing in
 26    <openacc.h>.
 27    { dg-final { scan-rtl-dump-times "\\\(call \[^\\n\]* acc_on_device" 0 "expand" { xfail c++ } } } */
 28
 29 /* { dg-final { cleanup-rtl-dump "expand" } } */

Running:

/home/pkgbase/bld/gcc.5.1.0-x86_64-build4/build/gcc/xgcc -B/home/pkgbase/bld/gcc.5.1.0-x86_64-build4/build/gcc/ /home/pkgbase/bld/gcc.5.1.0-x86_64-build4/gcc-5.1.0/gcc/testsuite/c-c++-common/goacc/acc_on_device-2.c -fno-diagnostics-show-caret -fdiagnostics-color=never -fopenacc -O -fdump-rtl-expand -ffat-lto-objects -S -o acc_on_device-2.s

I get (acc_on_device-2.s):

  1         .file   "acc_on_device-2.c"
  2         .text
  3         .globl  f
  4         .type   f, @function
  5 f:
  6 .LFB0:
  7         .cfi_startproc
  8         subq    $8, %rsp
  9         .cfi_def_cfa_offset 16
 10         movl    $123, %edi
 11         call    acc_on_device
 12         addq    $8, %rsp
 13         .cfi_def_cfa_offset 8
 14         ret
 15         .cfi_endproc
 16 .LFE0:
 17         .size   f, .-f
 18         .ident  "GCC: (GNU) 5.1.0"
 19         .section        .note.GNU-stack,"",@progbits

and (acc_on_device-2.c.191r.expand):

  1
  2 ;; Function f (f, funcdef_no=0, decl_uid=1846, cgraph_uid=0, symbol_order=0)
  3
  4
  5 ;; Generating RTL for gimple basic block 2
  6
  7
  8 try_optimize_cfg iteration 1
  9
 10 Merging block 3 into block 2...
 11 Merged blocks 2 and 3.
 12 Merged 2 and 3 without moving.
 13 Removing jump 11.
 14 Merging block 4 into block 2...
 15 Merged blocks 2 and 4.
 16 Merged 2 and 4 without moving.
 17
 18
 19 try_optimize_cfg iteration 2
 20
 21
 22
 23 ;;
 24 ;; Full RTL generated for this function:
 25 ;;
 26 (note 1 0 3 NOTE_INSN_DELETED)
 27 (note 3 1 2 2 [bb 2] NOTE_INSN_BASIC_BLOCK)
 28 (note 2 3 5 2 NOTE_INSN_FUNCTION_BEG)
 29 (insn 5 2 6 2 (set (reg:SI 5 di)
 30         (const_int 123 [0x7b])) /home/pkgbase/bld/gcc.5.1.0-x86_64-build4/gcc-5.1.0/gcc/testsuite/c-c++-common/goacc/acc_on_device-2.c:19 -1
 31      (nil))
 32 (call_insn/u 6 5 7 2 (set (reg:SI 0 ax)
 33         (call (mem:QI (symbol_ref:DI ("acc_on_device") [flags 0x41]  <function_decl 0x7f1eaf74b870 acc_on_device>) [0 __builtin_acc_on_device S1 A8])
 34             (const_int 0 [0]))) /home/pkgbase/bld/gcc.5.1.0-x86_64-build4/gcc-5.1.0/gcc/testsuite/c-c++-common/goacc/acc_on_device-2.c:19 -1
 35      (expr_list:REG_EH_REGION (const_int 0 [0])
 36         (nil))
 37     (expr_list:SI (use (reg:SI 5 di))
 38         (nil)))
 39 (insn 7 6 8 2 (set (reg:SI 89)
 40         (reg:SI 0 ax)) /home/pkgbase/bld/gcc.5.1.0-x86_64-build4/gcc-5.1.0/gcc/testsuite/c-c++-common/goacc/acc_on_device-2.c:19 -1
 41      (nil))
 42 (insn 8 7 9 2 (set (reg:SI 90)
 43         (reg:SI 89)) /home/pkgbase/bld/gcc.5.1.0-x86_64-build4/gcc-5.1.0/gcc/testsuite/c-c++-common/goacc/acc_on_device-2.c:19 -1
 44      (nil))
 45 (insn 9 8 10 2 (set (reg:SI 87 [ D.1855 ])
 46         (reg:SI 90)) /home/pkgbase/bld/gcc.5.1.0-x86_64-build4/gcc-5.1.0/gcc/testsuite/c-c++-common/goacc/acc_on_device-2.c:19 -1
 47      (nil))
 48 (insn 10 9 14 2 (set (reg:SI 88 [ <retval> ])
 49         (reg:SI 87 [ D.1855 ])) /home/pkgbase/bld/gcc.5.1.0-x86_64-build4/gcc-5.1.0/gcc/testsuite/c-c++-common/goacc/acc_on_device-2.c:19 -1
 50      (nil))
 51 (insn 14 10 15 2 (set (reg/i:SI 0 ax)
 52         (reg:SI 88 [ <retval> ])) /home/pkgbase/bld/gcc.5.1.0-x86_64-build4/gcc-5.1.0/gcc/testsuite/c-c++-common/goacc/acc_on_device-2.c:20 -1
 53      (nil))
 54 (insn 15 14 0 2 (use (reg/i:SI 0 ax)) /home/pkgbase/bld/gcc.5.1.0-x86_64-build4/gcc-5.1.0/gcc/testsuite/c-c++-common/goacc/acc_on_device-2.c:20 -1
 55      (nil))

The test fails because the "(call .." regexp should not occur with -fopenacc (the '0' argument to scan-rtl-dump-times at acc_on_device-2.c:27), but it is apparently detected on at acc_on_device-2.c.191r.expand:33.

Unfortunately, I haven't the slightest idea about what is going on with this test, but am wondering if it is serious or not.


thanks much for your time and work,
John Stanley
Comment 1 Thomas Schwinge 2015-05-29 05:41:51 UTC
Thanks for the report.  I also noticed this, and I'm in the process of fixing this.  It is a regression introduced with the fix for PR65742, r223801.  For non-offloaded code, we must now in fact expect a library call (even though the OpenACC 2.0a specification mandates we shouldn't).  So, I'll XFAIL this test case.
Comment 2 Thomas Schwinge 2015-06-02 11:49:28 UTC
Author: tschwinge
Date: Tue Jun  2 11:48:56 2015
New Revision: 224028

URL: https://gcc.gnu.org/viewcvs?rev=224028&root=gcc&view=rev
Log:
[PR libgomp/65742, PR middle-end/66332] XFAIL acc_on_device compile-time evaluation

The OpenACC 2.0a specification mandates differently, but we currently do get a
library call in the host code.

	PR libgomp/65742
	PR middle-end/66332

	gcc/testsuite/
	* c-c++-common/goacc/acc_on_device-2.c: XFAIL for C, too.

Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/c-c++-common/goacc/acc_on_device-2.c
Comment 3 Thomas Schwinge 2015-06-02 12:05:23 UTC
XFAILed in r 224028.  Documented: <http://gcc.gnu.org/wiki/OpenACC?action=diff&rev1=10&rev2=11>.
Comment 4 Thomas Schwinge 2015-07-15 11:55:32 UTC
Author: tschwinge
Date: Wed Jul 15 11:55:00 2015
New Revision: 225822

URL: https://gcc.gnu.org/viewcvs?rev=225822&root=gcc&view=rev
Log:
[PR libgomp/65742, PR middle-end/66332] OpenACC acc_on_device fixes

Backport trunk r223801:

    PR libgomp/65742

    gcc/
    * builtins.c (expand_builtin_acc_on_device): Don't use open-coded
    sequence for !ACCEL_COMPILER.

    libgomp/
    * oacc-init.c (plugin/plugin-host.h): Include.
    (acc_on_device): Check whether we're in an offloaded region for
    host_nonshm
    plugin. Don't use __builtin_acc_on_device.
    * plugin/plugin-host.c (GOMP_OFFLOAD_openacc_parallel): Set
    nonshm_exec flag in thread-local data.
    (GOMP_OFFLOAD_openacc_create_thread_data): Allocate thread-local
    data for host_nonshm plugin.
    (GOMP_OFFLOAD_openacc_destroy_thread_data): Free thread-local data
    for host_nonshm plugin.
    * plugin/plugin-host.h: New.

Mark parameters with ATTRIBUTE_UNUSED

Backport trunk r223805:

	* builtins.c (expand_builtin_acc_on_device): Mark parameters
	with ATTRIBUTE_UNUSED.

[PR libgomp/65742, PR middle-end/66332] XFAIL acc_on_device compile-time evaluation

The OpenACC 2.0a specification mandates differently, but we currently do get a
library call in the host code.

Backport trunk r224028:

	PR libgomp/65742
	PR middle-end/66332

	gcc/testsuite/
	* c-c++-common/goacc/acc_on_device-2.c: XFAIL for C, too.

Added:
    branches/gcc-5-branch/libgomp/plugin/plugin-host.h
Modified:
    branches/gcc-5-branch/gcc/ChangeLog
    branches/gcc-5-branch/gcc/builtins.c
    branches/gcc-5-branch/gcc/testsuite/ChangeLog
    branches/gcc-5-branch/gcc/testsuite/c-c++-common/goacc/acc_on_device-2.c
    branches/gcc-5-branch/libgomp/ChangeLog
    branches/gcc-5-branch/libgomp/oacc-init.c
    branches/gcc-5-branch/libgomp/plugin/plugin-host.c
Comment 5 Thomas Schwinge 2015-07-31 14:14:31 UTC
Author: tschwinge
Date: Fri Jul 31 14:13:59 2015
New Revision: 226444

URL: https://gcc.gnu.org/viewcvs?rev=226444&root=gcc&view=rev
Log:
[PR libgomp/65742, PR middle-end/66332] libgomp: Remove plugin for non-shared memory host execution

	gcc/
	* builtins.c (expand_builtin_acc_on_device) [ACCEL_COMPILER]: Emit
	open-coded sequence.
	gcc/testsuite/
	* c-c++-common/goacc/acc_on_device-2.c: Remove XFAIL for C.
	include/
	* gomp-constants.c (GOMP_DEVICE_HOST_NONSHM): Remove.
	libgomp/
	* libgomp-plugin.h (enum offload_target_type): Remove
	OFFLOAD_TARGET_TYPE_HOST_NONSHM.
	* openacc.f90 (openacc_kinds): Remove acc_device_host_nonshm.
	* openacc.h (enum acc_device_t): Likewise.
	* openacc_lib.h: Likewise.
	* oacc-parallel.c (GOACC_parallel_keyed): Don't handle it.
	* oacc-init.c (name_of_acc_device_t): Likewise.
	(acc_on_device): Just use __builtin_acc_on_device.
	* testsuite/libgomp.oacc-c-c++-common/if-1.c: Don't forbit usage
	of acc_on_device builtin.
	* plugin/plugin-host.h: Remove file.
	* plugin/plugin-host.c: Likewise, but salvage some content into...
	* oacc-host.c: ... this file.
	* plugin/Makefrag.am: Don't build libgomp-plugin-host_nonshm.la.
	* plugin/configfrag.ac (offload_targets): Don't add host_nonshm.
	* Makefile.in: Regenerate.
	* configure: Likewise.
	* testsuite/lib/libgomp.exp
	(check_effective_target_openacc_host_nonshm_selected): Remove.
	(libgomp_init): Don't handle ACC_DEVICE_TYPE=host_nonshm.
	* testsuite/libgomp.oacc-c++/c++.exp: Likewise.
	* testsuite/libgomp.oacc-c/c.exp: Likewise.
	* testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/acc_on_device-1.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/firstprivate-1.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/private-vars-local-gang-1.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/private-vars-par-gang-2.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/worker-single-6.c: Likewise.
	* testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90: Likewise.
	* testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f: Likewise.
	* testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f: Likewise.
	* testsuite/libgomp.oacc-fortran/data-2.f90: Likewise.
	* testsuite/libgomp.oacc-fortran/private-vars-par-gang-2.f90:
	Likewise.

Removed:
    branches/gomp-4_0-branch/libgomp/plugin/plugin-host.c
    branches/gomp-4_0-branch/libgomp/plugin/plugin-host.h
Modified:
    branches/gomp-4_0-branch/gcc/ChangeLog.gomp
    branches/gomp-4_0-branch/gcc/builtins.c
    branches/gomp-4_0-branch/gcc/testsuite/ChangeLog.gomp
    branches/gomp-4_0-branch/gcc/testsuite/c-c++-common/goacc/acc_on_device-2.c
    branches/gomp-4_0-branch/include/ChangeLog.gomp
    branches/gomp-4_0-branch/include/gomp-constants.h
    branches/gomp-4_0-branch/libgomp/ChangeLog.gomp
    branches/gomp-4_0-branch/libgomp/Makefile.in
    branches/gomp-4_0-branch/libgomp/configure
    branches/gomp-4_0-branch/libgomp/libgomp-plugin.h
    branches/gomp-4_0-branch/libgomp/oacc-host.c
    branches/gomp-4_0-branch/libgomp/oacc-init.c
    branches/gomp-4_0-branch/libgomp/oacc-parallel.c
    branches/gomp-4_0-branch/libgomp/openacc.f90
    branches/gomp-4_0-branch/libgomp/openacc.h
    branches/gomp-4_0-branch/libgomp/openacc_lib.h
    branches/gomp-4_0-branch/libgomp/plugin/Makefrag.am
    branches/gomp-4_0-branch/libgomp/plugin/configfrag.ac
    branches/gomp-4_0-branch/libgomp/testsuite/lib/libgomp.exp
    branches/gomp-4_0-branch/libgomp/testsuite/libgomp.oacc-c++/c++.exp
    branches/gomp-4_0-branch/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_on_device-1.c
    branches/gomp-4_0-branch/libgomp/testsuite/libgomp.oacc-c-c++-common/firstprivate-1.c
    branches/gomp-4_0-branch/libgomp/testsuite/libgomp.oacc-c-c++-common/if-1.c
    branches/gomp-4_0-branch/libgomp/testsuite/libgomp.oacc-c-c++-common/private-vars-local-gang-1.c
    branches/gomp-4_0-branch/libgomp/testsuite/libgomp.oacc-c-c++-common/private-vars-par-gang-2.c
    branches/gomp-4_0-branch/libgomp/testsuite/libgomp.oacc-c-c++-common/worker-single-6.c
    branches/gomp-4_0-branch/libgomp/testsuite/libgomp.oacc-c/c.exp
    branches/gomp-4_0-branch/libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90
    branches/gomp-4_0-branch/libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f
    branches/gomp-4_0-branch/libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f
    branches/gomp-4_0-branch/libgomp/testsuite/libgomp.oacc-fortran/data-2.f90
    branches/gomp-4_0-branch/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
    branches/gomp-4_0-branch/libgomp/testsuite/libgomp.oacc-fortran/private-vars-par-gang-2.f90
Comment 6 Thomas Schwinge 2015-08-10 16:48:58 UTC
Author: tschwinge
Date: Mon Aug 10 16:48:26 2015
New Revision: 226763

URL: https://gcc.gnu.org/viewcvs?rev=226763&root=gcc&view=rev
Log:
[PR libgomp/65742, PR middle-end/66332] libgomp: Remove plugin for non-shared memory host execution

	gcc/
	* builtins.c (expand_builtin_acc_on_device) [ACCEL_COMPILER]: Emit
	open-coded sequence.
	* omp-low.c (oacc_process_reduction_data): Remove handline of
	GOMP_DEVICE_HOST_NONSHM.
	gcc/testsuite/
	* c-c++-common/goacc/acc_on_device-2.c: Remove XFAIL for C.
	include/
	* gomp-constants.c (GOMP_DEVICE_HOST_NONSHM): Remove.
	libgomp/
	* libgomp-plugin.h (enum offload_target_type): Remove
	OFFLOAD_TARGET_TYPE_HOST_NONSHM.
	* openacc.f90 (openacc_kinds): Remove acc_device_host_nonshm.
	* openacc.h (enum acc_device_t): Likewise.
	* openacc_lib.h: Likewise.
	* oacc-init.c (name_of_acc_device_t): Don't handle it.
	(acc_on_device): Just use __builtin_acc_on_device.
	* testsuite/libgomp.oacc-c-c++-common/if-1.c: Don't forbid usage
	of acc_on_device builtin.
	* plugin/plugin-host.h: Remove file.
	* plugin/plugin-host.c: Likewise, but salvage some content into...
	* oacc-host.c: ... this file.
	* plugin/Makefrag.am: Don't build libgomp-plugin-host_nonshm.la.
	* plugin/configfrag.ac (offload_targets): Don't add host_nonshm.
	* Makefile.in: Regenerate.
	* configure: Likewise.
	* testsuite/lib/libgomp.exp
	(check_effective_target_openacc_host_nonshm_selected): Remove.
	* testsuite/libgomp.oacc-c++/c++.exp: Don't handle
	ACC_DEVICE_TYPE=host_nonshm.
	* testsuite/libgomp.oacc-c/c.exp: Likewise.
	* testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/acc_on_device-1.c: Likewise.
	* testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90: Likewise.
	* testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f: Likewise.
	* testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f: Likewise.

Removed:
    trunk/libgomp/plugin/plugin-host.c
    trunk/libgomp/plugin/plugin-host.h
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/builtins.c
    trunk/gcc/omp-low.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/c-c++-common/goacc/acc_on_device-2.c
    trunk/include/ChangeLog
    trunk/include/gomp-constants.h
    trunk/libgomp/ChangeLog
    trunk/libgomp/Makefile.in
    trunk/libgomp/configure
    trunk/libgomp/libgomp-plugin.h
    trunk/libgomp/oacc-host.c
    trunk/libgomp/oacc-init.c
    trunk/libgomp/openacc.f90
    trunk/libgomp/openacc.h
    trunk/libgomp/openacc_lib.h
    trunk/libgomp/plugin/Makefrag.am
    trunk/libgomp/plugin/configfrag.ac
    trunk/libgomp/testsuite/lib/libgomp.exp
    trunk/libgomp/testsuite/libgomp.oacc-c++/c++.exp
    trunk/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_on_device-1.c
    trunk/libgomp/testsuite/libgomp.oacc-c-c++-common/if-1.c
    trunk/libgomp/testsuite/libgomp.oacc-c/c.exp
    trunk/libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90
    trunk/libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f
    trunk/libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f
    trunk/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
Comment 7 Steve Ellcey 2015-09-10 15:57:55 UTC
I think the patch checked in on August 10 broke my MIPS build.  The install
dies with:

/usr/bin/install: cannot create regular file `/scratch/sellcey/repos/nightly/install-mips-mti-linux-gnu/lib/gcc/mips-mti-linux-gnu/6.0.0/finclude/omp_lib_kinds.mod': File exists


Note that I am building a multilib cross compiler with parallel make.

See https://gcc.gnu.org/ml/gcc/2015-09/msg00161.html