public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/98476] New: OpenMP offload syntax restriction
@ 2020-12-30  5:13 xw111luoye at gmail dot com
  2020-12-30  7:09 ` [Bug fortran/98476] " jakub at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: xw111luoye at gmail dot com @ 2020-12-30  5:13 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98476

            Bug ID: 98476
           Summary: OpenMP offload syntax restriction
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: xw111luoye at gmail dot com
  Target Milestone: ---

C version code works. The corresponding Fortran version is blocked by the
compiler errror.

C version:
#include <stdio.h>

int main()
{
  int a[1];
  int* b = a;
  a[0] = 0;
  #pragma omp target enter data map(to:b[:1])
  #pragma omp target data use_device_ptr(b)
  {
    #pragma omp target is_device_ptr(b)
    {
      b[0] = 1;
    }
  }
  printf("value before exit data %d\n", b[0]);
  #pragma omp target exit data map(from:b[:1])
  printf("value after exit data %d\n", b[0]);
  return 0;
}


Fortran version, XL fortran compiler works with this case.
program abc
  implicit none
  integer a

  a = 0
  call test(a)

contains
  subroutine test(a)
    implicit none
    integer a

  !$omp target enter data map(to:a)
  !$omp target data use_device_ptr(a)
  ! Error: TARGET DATA must contain at least one MAP clause at (1)
  ! after adding map(to: a), the second printout is still wrong.
  !$omp target is_device_ptr(a)
    a = 1
  !$omp end target
  !$omp end target data
  write(6,*) "before exit data a = ", a
  !$omp target exit data map(from:a)
  write(6,*) "after exit data a = ", a

  endsubroutine
end program

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug fortran/98476] OpenMP offload syntax restriction
  2020-12-30  5:13 [Bug fortran/98476] New: OpenMP offload syntax restriction xw111luoye at gmail dot com
@ 2020-12-30  7:09 ` jakub at gcc dot gnu.org
  2020-12-30 16:45 ` xw111luoye at gmail dot com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-12-30  7:09 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98476

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The error is correct for OpenMP 4.5, !$omp target data there has the
restriction:
At least one map clause must appear on the directive.
and OpenMP 4.5 is what GCC 10 implements in Fortran mostly.
OpenMP 5.0 and 5.1 changes that restriction to:
At least one map, use_device_addr or use_device_ptr clause must appear on the
directive.
which is what you can see in the C and C++ FEs.
GCC 11 is going to implement the 5.0 behavior here even in Fortran.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug fortran/98476] OpenMP offload syntax restriction
  2020-12-30  5:13 [Bug fortran/98476] New: OpenMP offload syntax restriction xw111luoye at gmail dot com
  2020-12-30  7:09 ` [Bug fortran/98476] " jakub at gcc dot gnu.org
@ 2020-12-30 16:45 ` xw111luoye at gmail dot com
  2020-12-31  0:17 ` xw111luoye at gmail dot com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: xw111luoye at gmail dot com @ 2020-12-30 16:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98476

--- Comment #2 from Ye Luo <xw111luoye at gmail dot com> ---
@jakub thanks for the quick reply. However, even if I add map(to: a) which is
almost a no-op to satisfy the compiler for 4.5 spec. The printout result is
still wrong. It should be 0 and 1 but the fortran case prints 0 and 0.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug fortran/98476] OpenMP offload syntax restriction
  2020-12-30  5:13 [Bug fortran/98476] New: OpenMP offload syntax restriction xw111luoye at gmail dot com
  2020-12-30  7:09 ` [Bug fortran/98476] " jakub at gcc dot gnu.org
  2020-12-30 16:45 ` xw111luoye at gmail dot com
@ 2020-12-31  0:17 ` xw111luoye at gmail dot com
  2021-01-19 10:15 ` burnus at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: xw111luoye at gmail dot com @ 2020-12-31  0:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98476

--- Comment #3 from Ye Luo <xw111luoye at gmail dot com> ---
I verified that current master has removed the syntax restriction. However, the
printout remains incorrect.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug fortran/98476] OpenMP offload syntax restriction
  2020-12-30  5:13 [Bug fortran/98476] New: OpenMP offload syntax restriction xw111luoye at gmail dot com
                   ` (2 preceding siblings ...)
  2020-12-31  0:17 ` xw111luoye at gmail dot com
@ 2021-01-19 10:15 ` burnus at gcc dot gnu.org
  2021-01-19 10:19 ` dominiq at lps dot ens.fr
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu.org @ 2021-01-19 10:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98476

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Patch: https://gcc.gnu.org/pipermail/gcc-patches/2021-January/563784.html

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug fortran/98476] OpenMP offload syntax restriction
  2020-12-30  5:13 [Bug fortran/98476] New: OpenMP offload syntax restriction xw111luoye at gmail dot com
                   ` (3 preceding siblings ...)
  2021-01-19 10:15 ` burnus at gcc dot gnu.org
@ 2021-01-19 10:19 ` dominiq at lps dot ens.fr
  2021-01-19 10:59 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: dominiq at lps dot ens.fr @ 2021-01-19 10:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98476

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-01-19
     Ever confirmed|0                           |1

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug fortran/98476] OpenMP offload syntax restriction
  2020-12-30  5:13 [Bug fortran/98476] New: OpenMP offload syntax restriction xw111luoye at gmail dot com
                   ` (4 preceding siblings ...)
  2021-01-19 10:19 ` dominiq at lps dot ens.fr
@ 2021-01-19 10:59 ` cvs-commit at gcc dot gnu.org
  2021-01-19 11:00 ` burnus at gcc dot gnu.org
  2021-01-20  7:35 ` cvs-commit at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-01-19 10:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98476

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tobias Burnus <burnus@gcc.gnu.org>:

https://gcc.gnu.org/g:049bfd186fae9fb764a3ec04acb20d3eaacda7a3

commit r11-6787-g049bfd186fae9fb764a3ec04acb20d3eaacda7a3
Author: Tobias Burnus <tobias@codesourcery.com>
Date:   Tue Jan 19 11:57:34 2021 +0100

    OpenMP/Fortran: Fixes for {use,is}_device_ptr

    gcc/fortran/ChangeLog:

            PR fortran/98476
            * openmp.c (resolve_omp_clauses): Change use_device_ptr
            to use_device_addr for unless type(c_ptr); check all
            list item for is_device_ptr.

    gcc/ChangeLog:

            PR fortran/98476
            * omp-low.c (lower_omp_target): Handle nonpointer is_device_ptr.

    libgomp/ChangeLog:

            PR fortran/98476
            * testsuite/libgomp.fortran/is_device_ptr-1.f90: New test.

    gcc/testsuite/ChangeLog:

            PR fortran/98476
            * gfortran.dg/gomp/map-3.f90: Update expected scan-dump-tree.
            * gfortran.dg/gomp/is_device_ptr-2.f90: New test.
            * gfortran.dg/gomp/use_device_ptr-1.f90: New test.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug fortran/98476] OpenMP offload syntax restriction
  2020-12-30  5:13 [Bug fortran/98476] New: OpenMP offload syntax restriction xw111luoye at gmail dot com
                   ` (5 preceding siblings ...)
  2021-01-19 10:59 ` cvs-commit at gcc dot gnu.org
@ 2021-01-19 11:00 ` burnus at gcc dot gnu.org
  2021-01-20  7:35 ` cvs-commit at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu.org @ 2021-01-19 11:00 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98476

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Close as FIXED.

Thanks for the report, especially for checking already upcoming GCC 11, which
helps to iron out issues before the release :-)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug fortran/98476] OpenMP offload syntax restriction
  2020-12-30  5:13 [Bug fortran/98476] New: OpenMP offload syntax restriction xw111luoye at gmail dot com
                   ` (6 preceding siblings ...)
  2021-01-19 11:00 ` burnus at gcc dot gnu.org
@ 2021-01-20  7:35 ` cvs-commit at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-01-20  7:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98476

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tobias Burnus <burnus@gcc.gnu.org>:

https://gcc.gnu.org/g:c05cdfb3f6335d55226cef7917a783498aa41244

commit r11-6809-gc05cdfb3f6335d55226cef7917a783498aa41244
Author: Tobias Burnus <tobias@codesourcery.com>
Date:   Wed Jan 20 08:31:30 2021 +0100

    OpenMP/Fortran: Fix gfortran.dg/gomp/is_device_ptr-2.f90

    gcc/testsuite/ChangeLog:

            PR fortran/98757
            PR fortran/98476
            * gfortran.dg/gomp/is_device_ptr-2.f90: Fix dg-error.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-01-20  7:35 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-30  5:13 [Bug fortran/98476] New: OpenMP offload syntax restriction xw111luoye at gmail dot com
2020-12-30  7:09 ` [Bug fortran/98476] " jakub at gcc dot gnu.org
2020-12-30 16:45 ` xw111luoye at gmail dot com
2020-12-31  0:17 ` xw111luoye at gmail dot com
2021-01-19 10:15 ` burnus at gcc dot gnu.org
2021-01-19 10:19 ` dominiq at lps dot ens.fr
2021-01-19 10:59 ` cvs-commit at gcc dot gnu.org
2021-01-19 11:00 ` burnus at gcc dot gnu.org
2021-01-20  7:35 ` cvs-commit at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).