public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/104285] New: openmp offload linker issue
@ 2022-01-29 21:17 xw111luoye at gmail dot com
  2022-02-08 19:02 ` [Bug middle-end/104285] " xw111luoye at gmail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: xw111luoye at gmail dot com @ 2022-01-29 21:17 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104285
           Summary: openmp offload linker issue
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: xw111luoye at gmail dot com
  Target Milestone: ---

miniQMC https://github.com/ye-luo/miniqmc
ships a set of OpenMP offload tests.
```
cmake -DCMAKE_CXX_COMPILER=g++ -DENABLE_OFFLOAD=ON ..
make -j32
```

When those tests are compiled into individual executables.
All tests compile/link/run fine.

However if all the tests are linked together into a single executable
test_omptarget_all_in_one
I got 
```
lto1: fatal error:
CMakeFiles/test_omptarget_all_in_one.dir/test_omp_reduction.cpp.o: section
_ZN11qmcplusplusL29____C_A_T_C_H____T_E_S_T____0Ev$_omp_fn$1.3169 is missing
compilation terminated.
mkoffload: fatal error:
/soft/gcc/gcc-12-dev-2022-01-28/bin/x86_64-pc-linux-gnu-accel-nvptx-none-gcc
returned 1 exit status
compilation terminated.
lto-wrapper: fatal error:
/soft/gcc/gcc-12-dev-2022-01-28/libexec/gcc/x86_64-pc-linux-gnu/12.0.1//accel/nvptx-none/mkoffload
returned 1 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
make[2]: ***
[src/Platforms/tests/OMPTarget/CMakeFiles/test_omptarget_all_in_one.dir/build.make:359:
src/Platforms/tests/OMPTarget/test_omptarget_all_in_one] Error 1
make[1]: *** [CMakeFiles/Makefile2:1656:
src/Platforms/tests/OMPTarget/CMakeFiles/test_omptarget_all_in_one.dir/all]
Error 2
make: *** [Makefile:101: all] Error 2
```

gcc compiler commit 3f0fcda37f58d4108feb67de08f181a32bcb6388

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

* [Bug middle-end/104285] openmp offload linker issue
  2022-01-29 21:17 [Bug c++/104285] New: openmp offload linker issue xw111luoye at gmail dot com
@ 2022-02-08 19:02 ` xw111luoye at gmail dot com
  2022-03-23  8:45 ` cvs-commit at gcc dot gnu.org
  2022-03-23 15:17 ` burnus at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: xw111luoye at gmail dot com @ 2022-02-08 19:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Ye Luo <xw111luoye at gmail dot com> ---
Here is a minimal reproducer.
https://github.com/ye-luo/openmp-target/tree/master/tests/linking/two_identical_templates

$ g++ -fopenmp -foffload=nvptx-none -O3 -c test_a.cpp 
$ g++ -fopenmp -foffload=nvptx-none -c test_a.cpp 
$ g++ -fopenmp -foffload=nvptx-none -c test_b.cpp 
$ g++ -fopenmp -foffload=nvptx-none  main.cpp test_a.o test_b.o 
lto1: fatal error: test_a.o: section _Z8test_mapIfEvv$_omp_fn$0.2375 is missing
compilation terminated.
mkoffload: fatal error: x86_64-pc-linux-gnu-accel-nvptx-none-gcc returned 1
exit status
compilation terminated.
lto-wrapper: fatal error:
/soft/gcc/gcc-12-dev-2022-02-08/libexec/gcc/x86_64-pc-linux-gnu/12.0.1//accel/nvptx-none/mkoffload
returned 1 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status

$ g++ -fopenmp -foffload=disable -c test_a.cpp
$ g++ -fopenmp -foffload=disable -c test_b.cpp
g++ -fopenmp -foffload=disable main.cpp test_a.o test_b.o

Using be862bf1f612c884597ace4cbfdec972a0bf0eef from master

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

* [Bug middle-end/104285] openmp offload linker issue
  2022-01-29 21:17 [Bug c++/104285] New: openmp offload linker issue xw111luoye at gmail dot com
  2022-02-08 19:02 ` [Bug middle-end/104285] " xw111luoye at gmail dot com
@ 2022-03-23  8:45 ` cvs-commit at gcc dot gnu.org
  2022-03-23 15:17 ` burnus at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-03-23  8:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 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:1002a7ace111d746249fdea71af9b8e039cea0eb

commit r12-7776-g1002a7ace111d746249fdea71af9b8e039cea0eb
Author: Tobias Burnus <tobias@codesourcery.com>
Date:   Wed Mar 23 09:44:39 2022 +0100

    LTO: Fixes for renaming issues with offload/OpenMP [PR104285]

    gcc/lto/ChangeLog:

            PR middle-end/104285
            * lto-partition.cc (maybe_rewrite_identifier): Use get_identifier
            for the returned string to be usable as hash key.
            (validize_symbol_for_target): Hence, use return value directly.
            (privatize_symbol_name_1): Track maybe_rewrite_identifier renames.
            * lto.cc (offload_handle_link_vars): Move function up before ...
            (do_whole_program_analysis): Call it after static renamings.
            (lto_main): Move call after static renamings.

    libgomp/ChangeLog:

            PR middle-end/104285
            * testsuite/libgomp.c++/target-same-name-2-a.C: New test.
            * testsuite/libgomp.c++/target-same-name-2-b.C: New test.
            * testsuite/libgomp.c++/target-same-name-2.C: New test.
            * testsuite/libgomp.c-c++-common/target-same-name-1-a.c: New test.
            * testsuite/libgomp.c-c++-common/target-same-name-1-b.c: New test.
            * testsuite/libgomp.c-c++-common/target-same-name-1.c: New test.

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

* [Bug middle-end/104285] openmp offload linker issue
  2022-01-29 21:17 [Bug c++/104285] New: openmp offload linker issue xw111luoye at gmail dot com
  2022-02-08 19:02 ` [Bug middle-end/104285] " xw111luoye at gmail dot com
  2022-03-23  8:45 ` cvs-commit at gcc dot gnu.org
@ 2022-03-23 15:17 ` burnus at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu.org @ 2022-03-23 15:17 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
                 CC|                            |burnus at gcc dot gnu.org
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> ---
FIXED on mainline (GCC 12).

Thanks for the report.

It additionally fixes an 'omp declare target link(var)' issue,
exposed by omptests's t-same-name-definitions (which now passes).
However, test-case writing revealed yet another issue (also related to the link
clause),
now tracked at PR105015.

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

end of thread, other threads:[~2022-03-23 15:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-29 21:17 [Bug c++/104285] New: openmp offload linker issue xw111luoye at gmail dot com
2022-02-08 19:02 ` [Bug middle-end/104285] " xw111luoye at gmail dot com
2022-03-23  8:45 ` cvs-commit at gcc dot gnu.org
2022-03-23 15:17 ` burnus 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).