From patchwork Fri Dec 6 17:26:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kwok Cheung Yeung X-Patchwork-Id: 1205220 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-515360-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="vj7MbRM7"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47Tzzc4D3sz9sPf for ; Sat, 7 Dec 2019 04:27:06 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :subject:to:cc:message-id:date:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=OP4YYLa32Da+69Jq UnY7R3G11Cb1/+SOC8opRq6p7AGFxGJD0gYRVTQlloWTwrcHfuf9NKggJ2Q9B3p6 tTj8I8bn3sFQh37zvS2fx/kfSUq6yTRFQMjNl3Xv6lAslH339z4XOe+Kvigb2jT/ jAuS5XieMqJ0Ye+jAqeDt9xVX4o= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :subject:to:cc:message-id:date:mime-version:content-type :content-transfer-encoding; s=default; bh=ouxZdPwI8Rqne+b1vXyq0I WGbt8=; b=vj7MbRM7ugjJ1gnX6i2m1VP7sB369lCiiNxGOsA39UikkPBCuwHHRD Eicjg+UlFMZCDANkBNDO23UAZSgxeOmGdDdRmjpYTkWd5vbdcNohkrsv6CUhTY3N qrKSYBstBf2gSIiTkcQ0fG4Ud2HoPcWHGZVA5yCMrQn83oX0kARJM= Received: (qmail 2895 invoked by alias); 6 Dec 2019 17:27:00 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 2870 invoked by uid 89); 6 Dec 2019 17:26:59 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy=examples4, examples-4, finalc, UD:final.c X-HELO: esa4.mentor.iphmx.com Received: from esa4.mentor.iphmx.com (HELO esa4.mentor.iphmx.com) (68.232.137.252) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 06 Dec 2019 17:26:58 +0000 IronPort-SDR: lD81Rs6M7WNQ5GFgMPIUHSIxwGqhynyn0XyNMggIV9VgezjKl7bZkfutE8nC+QukyY6EWfq7+h fVzYyJTpPlze2FDEMKw/JRCuTzvVHCgYqUrfnvrHdkdG05Ak5kkGYUYHXCCEs5jL4yjMq1Mgcd 6MaB76MnqpxTZb2mNVfbNRG1b/bP5skoj3NZZbFwZo1Xf7WRlDUZYfrh1VoT046tyXDXbsK/tj KE6tJldPgGNSAIAZR2I/7o+B/GwCm+GO1keLwykzM6/x/EdOkKk3ScwedeMehbVROt7rL8tJ0r a7w= Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa4.mentor.iphmx.com with ESMTP; 06 Dec 2019 09:26:56 -0800 IronPort-SDR: pYEoQHI15GTx6RYPEq+SegqE3kO6VBv7Up05aXHkffufpyDvcBPrrz51cZ9X6SVViUmhmMCe3B zVPMpMr8X0+/a1UIQhnVZUhZVXAYpYQnFUVEYKw/8MNZFNYzl024tsEF5Ypk3A+a75FNGXxoAO HemQpM+jTcPz7kXi+i0cqbiEPrlQHJID9PgDT7WBx6tRQIzzbAtpb/g1gDl6HMHbhEh6QXj844 QSiNAEvYMc5w+14KudqZqanAaUNeIrcnGtvaWUGnnDezYNpnIgNGw20g/8rJ6Yc8qXf5nbu+k4 cg8= From: Kwok Cheung Yeung Subject: [PATCH] Allow entry point markers without debug support in accelerator compiler To: , Andrew Stubbs , Thomas Schwinge CC: Message-ID: <442e7929-1a4b-c6f0-3d16-4d9b6f593455@codesourcery.com> Date: Fri, 6 Dec 2019 17:26:42 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 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 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(+) gcc_assert (debug_inline_points); /* If we can't represent it, don't bother. */ 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; +