Hello

A number of the libgomp tests running with AMD GCN offloading fail with the following internal compiler error:

during RTL pass: final
/scratch/ci-cs/amdtest/upstream-offload/src/gcc-mainline/libgomp/testsuite/libgomp.fortran/examples-4/async_target-1.f90: In function 'pipedf_._omp_fn.2': /scratch/ci-cs/amdtest/upstream-offload/src/gcc-mainline/libgomp/testsuite/libgomp.fortran/examples-4/async_target-1.f90:49: internal compiler error: in dwarf2out_inline_entry, at dwarf2out.c:27682
0x626210 dwarf2out_inline_entry
        
/scratch/ci-cs/amdtest/upstream-offload/src/gcc-mainline/gcc/dwarf2out.c:27682
0x9692c4 final_scan_insn_1
        
/scratch/ci-cs/amdtest/upstream-offload/src/gcc-mainline/gcc/final.c:2435
0x969f4b final_scan_insn(rtx_insn*, _IO_FILE*, int, int, int*)
        
/scratch/ci-cs/amdtest/upstream-offload/src/gcc-mainline/gcc/final.c:3152
0x96a214 final_1
        
/scratch/ci-cs/amdtest/upstream-offload/src/gcc-mainline/gcc/final.c:2020
0x96ac7f rest_of_handle_final
        
/scratch/ci-cs/amdtest/upstream-offload/src/gcc-mainline/gcc/final.c:4658
0x96ac7f execute
        
/scratch/ci-cs/amdtest/upstream-offload/src/gcc-mainline/gcc/final.c:4736

The ICE is due to an assert for debug_inline_points firing. The test case does not explicitly set this (using -ginline-points), so it is auto-detected.

The problem arises because the host compiler enables it by default, but the offload compiler disables it. The host compiler generates the Gimple debug statements for inlined functions, then streams them out using the LTO mechanism. The accelerator compiler streams them in, encounters the unexpected debug statements and ICEs due to a failed assertion.

It is possible to make GCN enable support inline-points by default, but I think it would be better to fix it for the general case where there is a disagreement between host and accelerator? This patch makes dwarf2out_inline_entry ignore the inline entry note if debug_inline_points is not set while the compiler is in LTO mode. This is effectively relaxing the assertion condition by allowing an exception for LTO.

Bootstrapped on x86_64, and tested using GCN as an offload accelerator. Okay for trunk?

Kwok


It is possible for the host compiler to emit entry point markers in the
GIMPLE code while the accelerator compiler has them disabled, causing an
assertion to fire where processed by the accelerator compiler.  This is
fixed by allowing the markers to be ignored in LTO mode only.

2019-12-06  Kwok Cheung Yeung  <k...@codesourcery.com>

        gcc/
        * dwarf2out.c (dwarf2out_inline_entry): Return early if in LTO and
        debug_inline_points not set.
---
 gcc/dwarf2out.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 6fb345b..44fa071 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -27679,6 +27679,13 @@ block_within_block_p (tree block, tree outer, bool bothways)
 static void
 dwarf2out_inline_entry (tree block)
 {
+ /* In an offloading configuration, it is possible for the host toolchain but + not the offload toolchain to support extended debug information for inlined
+     functions.  In that case, we can just ignore any entry point markers
+     read from the LTO stream.  */
+  if (in_lto_p && !debug_inline_points)
+    return;
+
   gcc_assert (debug_inline_points);

   /* If we can't represent it, don't bother.  */
--
2.8.1

Reply via email to