Bug 96265

Summary: building nvptx-none on aarch64-linux-gnu
Product: gcc Reporter: Matthias Klose <doko>
Component: targetAssignee: Not yet assigned to anyone <unassigned>
Status: UNCONFIRMED ---    
Severity: normal CC: ams, burnus, jnorris, mxlol233, tschwinge
Priority: P3    
Version: 11.0   
Target Milestone: ---   
Host: aarch64-linux Target: nvptx
Build: Known to work:
Known to fail: Last reconfirmed:

Description Matthias Klose 2020-07-21 11:55:22 UTC
The nvptx-target usually is built on x86_64-linux-gnu, but searching the web you'll see that these GPUs are also used in aarch64-linux-gnu and powerpc64le-linux-gnu systems.

building the nvptx offload compiler on powerpc64le, you see reasonable test results for libgomp,  and I see at last one powerpc64le related commit:

2015-10-09  James Norris  <jnorris@codesourcery.com>

        * config/rs6000/rs6000.c (rs6000_offload_options): New.

However adding an aarch64_offload_options hook doesn't look that well for AArch64, there are still two type of issues triggered in the testsuite:

FAIL: libgomp.c/../libgomp.c-c++-common/for-11.c (test for excess errors)
Excess errors:
lto1: fatal error: nvptx-none - 0-bit integer numbers unsupported (mode 'SI')


NRESOLVED: libgomp.c/../libgomp.c-c++-common/for-9.c compilation failed to produce executable
UNSUPPORTED: libgomp.c/../libgomp.c-c++-common/function-not-offloaded-aux.c

spawn -ignore SIGHUP /home/ubuntu/gcc-10-10.1.0/build/./gcc/xgcc -B/home/ubuntu/gcc-10-10.1.0/build/./gcc/ -B/usr/aarch64-linux-gnu/b
in/ -B/usr/aarch64-linux-gnu/lib/ -isystem /usr/aarch64-linux-gnu/include -isystem /usr/aarch64-linux-gnu/sys-include -isystem /home/
ubuntu/gcc-10-10.1.0/build/sys-include -fchecking=1 offload_device_nonshared_as411951.c -B/home/ubuntu/gcc-10-10.1.0/build/aarch64-li
nux-gnu/./libgomp/ -B/home/ubuntu/gcc-10-10.1.0/build/aarch64-linux-gnu/./libgomp/.libs -I/home/ubuntu/gcc-10-10.1.0/build/aarch64-li
nux-gnu/./libgomp -I../../../../src/libgomp/testsuite/../../include -I../../../../src/libgomp/testsuite/.. -Lno -fmessage-length=0 -f
no-diagnostics-show-caret -Wno-hsa -fdiagnostics-color=never -B/home/ubuntu/gcc-10-10.1.0/debian/tmp-nvptx/usr/libexec/gcc/aarch64-li
nux-gnu/10 -B/home/ubuntu/gcc-10-10.1.0/debian/tmp-nvptx/usr/bin -fopenmp -L/home/ubuntu/gcc-10-10.1.0/build/aarch64-linux-gnu/./libg
omp/.libs -lm -o offload_device_nonshared_as411951.exe
lto1: internal compiler error: bytecode stream: string too long for the string table
0x62559f string_for_index
0x62559f bp_unpack_indexed_string(data_in*, bitpack_d*, unsigned int*)
0x87a39b lto_input_mode_table(lto_file_decl_data*)
0x5a076f lto_file_finalize
0x5a076f lto_create_files_from_ids
0x5a076f lto_file_read
0x5a076f read_cgraph_and_symbols(unsigned int, char const**)
0x58f523 lto_main()
Please submit a full bug report,
with preprocessed source if appropriate.
Comment 1 Matthias Klose 2020-07-23 13:58:57 UTC
patch for the target hook posted at
Comment 2 Tobias Burnus 2020-11-13 09:12:18 UTC
(Remove powerpc64le-linux-gnu from the summary as this PR is only about aarch64-linux and GCC is known to work on powerpc64le-linux-gnu.)

(In reply to Matthias Klose from comment #1)
> patch for the target hook posted at
> https://gcc.gnu.org/pipermail/gcc-patches/2020-July/550534.html

This patch has been committed on Fri Jul 24 16:17:44 2020 +0200 as
Comment 3 Xiao Ma 2023-10-23 14:30:38 UTC
I think this issue and #111937 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111937) have the same root cause: 
aarch64 also sets NUM_POLY_INT_COEFFS to 2, which makes it incompatible with the default value for nvptx (which is 1).