public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgomp/110842] New: [14 Regression] Openmp loops with KIND=16 DO loops
@ 2023-07-28 10:49 tkoenig at gcc dot gnu.org
  2023-07-28 10:55 ` [Bug libgomp/110842] " tkoenig at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2023-07-28 10:49 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110842
           Summary: [14 Regression] Openmp loops with KIND=16 DO loops
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgomp
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tkoenig at gcc dot gnu.org
                CC: jakub at gcc dot gnu.org
  Target Milestone: ---

gfortran with a reasonably current trunk gives wrong
results for omp parallel:

$ cat dynamic.f90 
program main
  implicit none
  integer(kind=16) :: i, anfang, ende, delta
  anfang = 0
  ende = 2**10
  delta = 2**6
  !$omp parallel do default(private) schedule(dynamic,1)
  do i=anfang, ende, delta
     !$omp critical
     print *,i
     !$omp end critical
  end do
end program main
$ gfortran dynamic.f90 
$ ./a.out
                                        0
                                       64
                                      128
                                      192
                                      256
                                      320
                                      384
                                      448
                                      512
                                      576
                                      640
                                      704
                                      768
                                      832
                                      896
                                      960
                                     1024

Without openmp, no problem.

With openmp, some values are garbage:

$ gfortran -fopenmp dynamic.f90 
$ ./a.out
       2584020860371700504877596135129104
                                      768
                                      192
                                      704
                                      960
                                      128
                                      896
                                       64
       2584020860371700504877596135130128
                                      384
                                      448
                                      576
                                      640
                                      320
                                      512
                                      256
                                      832
$ gfortran -v
Es werden eingebaute Spezifikationen verwendet.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/home/ig25/libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper
Ziel: x86_64-pc-linux-gnu
Konfiguriert mit: ../trunk/configure --prefix=/home/ig25
--enable-languages=c,c++,fortran --disable-multilib
Thread-Modell: posix
Unterstützte LTO-Kompressionsalgorithmen: zlib
gcc-Version 14.0.0 20230722 (experimental) [master r14-2725-g73cc6ce1294] (GCC) 

System compiler works fine:

$ /usr/bin/gfortran -fopenmp dynamic.f90 
$ ./a.out
                                        0
                                       64
                                      832
                                      256
                                      320
                                      960
                                      576
                                      192
                                      896
                                      640
                                      128
                                      384
                                      704
                                      768
                                      512
                                      448
                                     1024
$ /usr/bin/gfortran -v
Using built-in specs.
COLLECT_GCC=/usr/bin/gfortran
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
11.3.0-1ubuntu1~22.04.1' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs
--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr
--with-gcc-major-version-only --program-suffix=-11
--program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib
--enable-libphobos-checking=release --with-target-system-zlib=auto
--enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet
--with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32
--enable-multilib --with-tune=generic
--enable-offload-targets=nvptx-none=/build/gcc-11-aYxV0E/gcc-11-11.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-aYxV0E/gcc-11-11.3.0/debian/tmp-gcn/usr
--without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
--with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04.1)

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

* [Bug libgomp/110842] [14 Regression] Openmp loops with KIND=16 DO loops
  2023-07-28 10:49 [Bug libgomp/110842] New: [14 Regression] Openmp loops with KIND=16 DO loops tkoenig at gcc dot gnu.org
@ 2023-07-28 10:55 ` tkoenig at gcc dot gnu.org
  2023-07-28 10:57 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2023-07-28 10:55 UTC (permalink / raw)
  To: gcc-bugs

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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.0
           Keywords|                            |needs-bisection, wrong-code

--- Comment #1 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
I just tested trunk, this might have happened earlier.

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

* [Bug libgomp/110842] [14 Regression] Openmp loops with KIND=16 DO loops
  2023-07-28 10:49 [Bug libgomp/110842] New: [14 Regression] Openmp loops with KIND=16 DO loops tkoenig at gcc dot gnu.org
  2023-07-28 10:55 ` [Bug libgomp/110842] " tkoenig at gcc dot gnu.org
@ 2023-07-28 10:57 ` jakub at gcc dot gnu.org
  2023-07-28 11:10 ` tkoenig at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-07-28 10:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Why a regression?
libgomp has no support for loop iterators larger than 64-bit unsigned, and I
believe in OpenMP it is implementation defined which iterator type is used.
C/C++ OpenMP loops with __int128 or unsigned __int128 iterator will not work
either (nor with _BitInt(575) or similar).

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

* [Bug libgomp/110842] [14 Regression] Openmp loops with KIND=16 DO loops
  2023-07-28 10:49 [Bug libgomp/110842] New: [14 Regression] Openmp loops with KIND=16 DO loops tkoenig at gcc dot gnu.org
  2023-07-28 10:55 ` [Bug libgomp/110842] " tkoenig at gcc dot gnu.org
  2023-07-28 10:57 ` jakub at gcc dot gnu.org
@ 2023-07-28 11:10 ` tkoenig at gcc dot gnu.org
  2023-07-28 12:02 ` burnus at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2023-07-28 11:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #2)
> Why a regression?

It worked before (if only by accident), hence I put "Regression" there.

> libgomp has no support for loop iterators larger than 64-bit unsigned, and I
> believe in OpenMP it is implementation defined which iterator type is used.
> C/C++ OpenMP loops with __int128 or unsigned __int128 iterator will not work
> either (nor with _BitInt(575) or similar).

If it is illegal, then the best way to do this would probably be an error
message instead of silent wrong code.

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

* [Bug libgomp/110842] [14 Regression] Openmp loops with KIND=16 DO loops
  2023-07-28 10:49 [Bug libgomp/110842] New: [14 Regression] Openmp loops with KIND=16 DO loops tkoenig at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-07-28 11:10 ` tkoenig at gcc dot gnu.org
@ 2023-07-28 12:02 ` burnus at gcc dot gnu.org
  2024-01-10 14:49 ` jamborm at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu.org @ 2023-07-28 12:02 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |openmp

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> ---
> libgomp has no support for loop iterators larger than 64-bit unsigned, and I believe in OpenMP it is implementation defined which iterator type is used.

"The iterations of some number of associated loops can be collapsed into one
larger iteration space that is called the logical iteration space. The
particular integer type used to compute the iteration count for the collapsed
loop is implementation defined, but its bit precision must be at least that of3
the widest type that the implementation would use for the iteration count of
each loop if it was the only associated loop."

This sounds a bit as if it should be supported – but at the end it is
implementation defined.

However, I think it makes sense to document it as implementation defined in
libomp.texi – and to output a compile time error if we know that something is
not implemented.

* * *

For use the largest type used in the loop, see also OG13-only patch (originally
for OG-12): commit
https://gcc.gnu.org/g:90d8139007c69657325c5c187b0d47f463b455d1 "openmp: Scale
type precision of collapsed iterator variable"
But that won't help if libgomp does not support the integer type.

* * *

> C/C++ OpenMP loops with __int128 or unsigned __int128 iterator will not work either (nor with _BitInt(575) or similar).

... and we likely don't want to support _BitInt iterators!

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

* [Bug libgomp/110842] [14 Regression] Openmp loops with KIND=16 DO loops
  2023-07-28 10:49 [Bug libgomp/110842] New: [14 Regression] Openmp loops with KIND=16 DO loops tkoenig at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-07-28 12:02 ` burnus at gcc dot gnu.org
@ 2024-01-10 14:49 ` jamborm at gcc dot gnu.org
  2024-03-22 13:42 ` law at gcc dot gnu.org
  2024-05-07  7:41 ` [Bug libgomp/110842] [14/15 " rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jamborm at gcc dot gnu.org @ 2024-01-10 14:49 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Jambor <jamborm at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|needs-bisection             |

--- Comment #5 from Martin Jambor <jamborm at gcc dot gnu.org> ---
So IIUC nothing to bisect here and so I am removing the tag.  Please re-add if
I am somehow mistaken.

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

* [Bug libgomp/110842] [14 Regression] Openmp loops with KIND=16 DO loops
  2023-07-28 10:49 [Bug libgomp/110842] New: [14 Regression] Openmp loops with KIND=16 DO loops tkoenig at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2024-01-10 14:49 ` jamborm at gcc dot gnu.org
@ 2024-03-22 13:42 ` law at gcc dot gnu.org
  2024-05-07  7:41 ` [Bug libgomp/110842] [14/15 " rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: law at gcc dot gnu.org @ 2024-03-22 13:42 UTC (permalink / raw)
  To: gcc-bugs

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

Jeffrey A. Law <law at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |law at gcc dot gnu.org
           Priority|P3                          |P4

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

* [Bug libgomp/110842] [14/15 Regression] Openmp loops with KIND=16 DO loops
  2023-07-28 10:49 [Bug libgomp/110842] New: [14 Regression] Openmp loops with KIND=16 DO loops tkoenig at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2024-03-22 13:42 ` law at gcc dot gnu.org
@ 2024-05-07  7:41 ` rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-05-07  7:41 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|14.0                        |14.2

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 14.1 is being released, retargeting bugs to GCC 14.2.

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

end of thread, other threads:[~2024-05-07  7:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-28 10:49 [Bug libgomp/110842] New: [14 Regression] Openmp loops with KIND=16 DO loops tkoenig at gcc dot gnu.org
2023-07-28 10:55 ` [Bug libgomp/110842] " tkoenig at gcc dot gnu.org
2023-07-28 10:57 ` jakub at gcc dot gnu.org
2023-07-28 11:10 ` tkoenig at gcc dot gnu.org
2023-07-28 12:02 ` burnus at gcc dot gnu.org
2024-01-10 14:49 ` jamborm at gcc dot gnu.org
2024-03-22 13:42 ` law at gcc dot gnu.org
2024-05-07  7:41 ` [Bug libgomp/110842] [14/15 " rguenth 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).