From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id tohtCucDWmrTZA4AWB0awg (envelope-from ) for ; Fri, 17 Jul 2026 06:28:55 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=G0kc7Mdf; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 089641E099; Fri, 17 Jul 2026 06:28:55 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id A2D321E099 for ; Fri, 17 Jul 2026 06:28:51 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 50AD94BA2E0A for ; Fri, 17 Jul 2026 10:28:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 50AD94BA2E0A Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=G0kc7Mdf Received: from CH4PR04CU002.outbound.protection.outlook.com (mail-northcentralusazlp170130007.outbound.protection.outlook.com [IPv6:2a01:111:f403:c105::7]) by sourceware.org (Postfix) with ESMTPS id 39DC54BA23C3 for ; Fri, 17 Jul 2026 10:28:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 39DC54BA23C3 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=amd.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 39DC54BA23C3 Authentication-Results: sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:c105::7 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1784284098; cv=pass; b=w6uM7UKudGxmxdh6u87zA57e++ituhYV7Hs4fG6CPU3c3R5OXkX1J59e/Gn4HuB7q1rzw87PlKFI+sGXm3pzJ3JAFeFilijrskWK6kVRtlBMUSEcWFBXqy5ZuhcfH3JL+wn0LmK3DIjUPomKuAW1wcrR9uPjBPHIxTvB542vJxM= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1784284098; c=relaxed/simple; bh=5lUJd+4C0nZPaN+zuQglkOrxrVtw4zVlffGrUqNw3C8=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=bEyQq7CpqhMt6gWjIrHoi1UqkrqD1WD27LEeke6L/eHtbUQAh3PVooQ7KfZYNWqF0jsVEbe+arSRQskMIwsGAMdu27o0yjI/HkUeRDlgJh0E2xBaQsVzHguKHAd9K9UN+oZJD8NJCIXdjS/Ibn9PVD4aLTOxPbKYIwJVbgoJw0c= ARC-Authentication-Results: i=2; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=G0kc7Mdf DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 39DC54BA23C3 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=QdhbVAWVrSu0rFEq4/wdhXNlYBRcXMyJno5T35DAKA1HsV3+q6OzVgRCweNq7shmsEOsfyELz8MvMq/B99yzp1dHBdQxmBrBHwwL7rZwhJukUvVSs42II80Q+SmDEQIppTeDwfoPO/D4gNtxk5c/AiTHW2ayiaZawcz7L8nptXsbLRIhlKx1RW2rxaKM3Qe0VO+DEMU8GSBKe6QIji+31ZoGlmaiZoyI5evAHQcNDOwrayJJ4YPsKe44zGGnQfGKa0Ti00iYgE1UowCgWwED15wlFXrMmRjX+DV+QX1NusFlIrZb5sMgzQq0v2CiT+z2V3bxuUHB2it/XucACyj88A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=e2SarnPueKfWyhZgaxWBRlJAHMDApKkZR2Zkxdoaivk=; b=ESiYGUOeN6VRh86HNwyZXDYeoss255mGwhzjWBWXCXMQIjzcbXc8SlxG5Vmyd72QhsLST7cEPiHCEHNkMpZn+Ckd9lrEnPec4ij4rJgUQRveK+Xb3mmrL5sRqGc3QMAny/5ioLLp4htPMkrXKuZsA43q4RbCeG9HJqihtOUdsvUquF6UmHivb2NOHdrxYHtQDjBTO3ouB6iHlfO51sv27Lzql2ijRoqlMYJsDYVL8csxFWn5pgu/Fwv5WB+nwT39cxWuhg0VXi6scJ5PK7f8VMZceOy6OqVf9LqLnSDEMpxOYEVeXtfy0IhVpKDVE9VZAl6bn4I+cvFEatCM/2ktwg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=sourceware.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=e2SarnPueKfWyhZgaxWBRlJAHMDApKkZR2Zkxdoaivk=; b=G0kc7MdfIaild/0Wycz6sl/HA7j/ekdrDxjKg3EVNwZ7eHBWpmZQo2GJTwKibv2QoXRP97FweF67MBz/Sh5YgonpCLU68dABzpa8feroNVQYdb5hoBZnamQoeTnknzaV/QMp0OtEOLGp3WBfOuk93q9IwTMzDB9Yc7fP6b6IpAM= Received: from CH0PR03CA0325.namprd03.prod.outlook.com (2603:10b6:610:118::31) by SA1PR12MB6680.namprd12.prod.outlook.com (2603:10b6:806:253::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.223.10; Fri, 17 Jul 2026 10:28:09 +0000 Received: from CH2PEPF0000013D.namprd02.prod.outlook.com (2603:10b6:610:118:cafe::65) by CH0PR03CA0325.outlook.office365.com (2603:10b6:610:118::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.223.13 via Frontend Transport; Fri, 17 Jul 2026 10:28:09 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by CH2PEPF0000013D.mail.protection.outlook.com (10.167.244.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.245.5 via Frontend Transport; Fri, 17 Jul 2026 10:28:08 +0000 Received: from khazad-dum (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.41; Fri, 17 Jul 2026 05:28:07 -0500 Date: Fri, 17 Jul 2026 11:28:00 +0100 From: Lancelot SIX To: Sarang Patrange , Subject: Re: [PATCH] gdb/testsuite: replace hipcc with amdclang++ as the HIP compiler Message-ID: References: <20260715094533.3093704-1-spatrang@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20260715094533.3093704-1-spatrang@amd.com> X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PEPF0000013D:EE_|SA1PR12MB6680:EE_ X-MS-Office365-Filtering-Correlation-Id: 4fdf3391-1c55-40b1-2904-08dee3ee18bd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700016|376014|1800799024|82310400026|23010399003|3023799007|56012099006|11063799006|5023799004|6133799003|10067099003|18002099003|22082099003|27256017; X-Microsoft-Antispam-Message-Info: SK2qS+lxSfIjqmMiMf/axiwMK0BuC8fC2ctAdYNOQ7pGGKcegK//cvEpt/CJk4i3r//gV/xfgDWTlYp4nML9m2jD7agTO+XPd5RUm95hd9rZNNErECBbHfvrpGv7i+/z+LyVCKq3PlsnaAR8F0pcmukWNU/G/+8FqsDVc4OcUPgGImBN40/woYoDtZXrOEUSoDhttmxzke2Wzx23sLs6BVGAY/A8Kg4mdBcd/h004fQAN6kJeqRZRxFKxBmYppeB2xLwZYFZ+Vx9bHqePjW2h2/IuPsbMkN0RLuSyFep6nMH65EaomjSLJds+ft9zFiT2Y6EMZLo4jj9w1FEzX/H6wc47mqYUPbMARgCZfCUw5QIkbLnNu/fNCFrL2mmBIQ8wkil1cWcTsPwfdzq2r0+cReR5LQR+YGQfXccI7L7wiHqzzBUnGcZvg2V6hD+QnuWQnBTsiJEVRSeLtx5vEbAUI1LH8Ayf/EPcar5N2p6eWSTi3IwtfgmSqWWt4/pjaa+kZggCSMI5+cJQahG0MJvAu1V7IibXTpicbkV/DSjPyxkqy7yT8tlOxmQLP+daCqhU/sYarVFrCcdZPjGA8K094QeFClRqvZZJU1VGWKagtnREKLPPI4w2p0d+V8wipTouZ51Z48c2UW4eymC/fnCwpVSIsfNgxpQdbTc5+zzkG63UAs8toUJeC5iivoYTK/0+6VubFg2aOW+53TV45ejCDqg8kKvkE7zM4vJ1CrdlxQwnzdukQEF24bYZllKzzmW X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:satlexmb07.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(36860700016)(376014)(1800799024)(82310400026)(23010399003)(3023799007)(56012099006)(11063799006)(5023799004)(6133799003)(10067099003)(18002099003)(22082099003)(27256017); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: VLrtK2sa9bK2soz84tL33FPLyrqNmomTd23wqmSesfKFyTNeVEC9lWsddZu74cdOuFh7ToZiCgecQpujK1cxhBMChKUkor8FRZ4eRDB+xD2fZmAa3C1ug8SOEE/fFrDS9rKxYdV2eqDZZk2DPqAObEzljWU9dF/DNekCooBNYOWGdOB5G+Kg+JnRsUNOHcrjBuEX56vSOz7xjenDnI7lfxkfQ/6ehM1afGL5zmFujQqxfC9YkwQLS2raaklR1rZFV1v+NsX+rHFGx81sDB9qClykowDXu/Qu2w6vh0HIyFOHzQQ5EmemP0ccwUPYn28JQ47AM9fXjGDZgx+yb9u7gPvR+Jv742337Lz8WkKSTVKXVo4incu2erfR64B/lRapl4eEG5csVUrkoR/ycuedMoCkye0gkO27JwQVm/3hfonWOPmydvO0jcWxmw+6SQ8l X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2026 10:28:08.9640 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4fdf3391-1c55-40b1-2904-08dee3ee18bd X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CH2PEPF0000013D.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB6680 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org Hi Sarang, Thanks for the patch. When running , I have this: Running .../gdb/testsuite/gdb.rocm/code-object-load-while-breakpoint-hit.exp ... gdb compile failed, clang++: error: unknown argument: '--genco' The `--genco` flag needs to be changed. I think the downstream change we have for this is to use `--cuda-device-only` instead. On Wed, Jul 15, 2026 at 04:45:33AM -0500, Sarang Patrange wrote: > The GDB testsuite discovers and invokes hipcc to compile the HIP > testcases. hipcc is deprecated and slated for removal, so switch the > testsuite over to amdclang++. Unlike the hipcc wrapper, amdclang++ is > the plain clang driver, so a few HIP options that hipcc handled > implicitly now have to be passed explicitly. > > Compiler discovery (lib/future.exp): > - Look for amdclang++ under $ROCM_PATH/lib/llvm/bin instead of hipcc > under $ROCM_PATH/bin. > - Rename the HIPCC_FOR_TARGET environment override to > HIP_COMPILER_FOR_TARGET, and gdb_find_hipcc / find_hipcc to > gdb_find_hip_compiler / find_hip_compiler. The "hipcompiler" > board-info key is left unchanged for backwards compatibility. > > Compile and link flags (lib/gdb.exp): > - amdclang++ infers the input language from the file extension and > compiles .cpp as C++, not HIP. The HIP testcases are kept named > .cpp (rather than renamed to .hip), so tag each input explicitly: > "-x hip" before C/C++/HIP source files and "-x none" before object > files, archives and other inputs. This lets a single invocation > handle a source list that mixes sources with prebuilt objects. > - Pass --hip-link when producing an executable, to bring in the HIP > runtime. > - Pass --rocm-path only when ROCM_PATH is set in the environment; > otherwise defer to amdclang++'s own HIP discovery. > - Pass one --offload-arch per available device, unless the testcase > already selects an architecture. > - Drop the explicit -O0: it was only needed because the hipcc wrapper > defaulted to -O2, whereas amdclang++ already defaults to -O0. An > explicit "optimize" option still overrides it. > > Testcases (lib/rocm.exp, gdb.rocm/*.exp): > - Rename allow_hipcc_tests to allow_hip_tests. > > Signed-off-by: Sarang Patrange > --- > .../gdb.rocm/addr-bp-gpu-no-deb-info.exp | 2 +- > .../gdb.rocm/break-kernel-no-debug-info.exp | 2 +- > .../code-object-load-while-breakpoint-hit.exp | 2 +- > gdb/testsuite/gdb.rocm/displaced-stepping.exp | 2 +- > .../gdb.rocm/fork-exec-gpu-to-non-gpu.exp | 2 +- > .../gdb.rocm/fork-exec-non-gpu-to-gpu.exp | 2 +- > gdb/testsuite/gdb.rocm/interrupt-twice.exp | 2 +- > gdb/testsuite/gdb.rocm/mi-attach.exp | 2 +- > gdb/testsuite/gdb.rocm/multi-inferior-gpu.exp | 2 +- > .../gdb.rocm/precise-memory-exec.exp | 2 +- > .../gdb.rocm/precise-memory-fork.exp | 2 +- > .../precise-memory-multi-inferiors.exp | 2 +- > .../precise-memory-warning-sigsegv.exp | 2 +- > .../precise-memory-warning-watchpoint.exp | 2 +- > gdb/testsuite/gdb.rocm/precise-memory.exp | 2 +- > gdb/testsuite/gdb.rocm/simple.exp | 2 +- > .../gdb.rocm/watchpoint-at-end-of-shader.exp | 2 +- > gdb/testsuite/gdb.rocm/watchpoint-basic.exp | 2 +- > gdb/testsuite/lib/future.exp | 30 ++++----- > gdb/testsuite/lib/gdb.exp | 66 +++++++++++++++++-- > gdb/testsuite/lib/rocm.exp | 2 +- > 21 files changed, 94 insertions(+), 40 deletions(-) > > diff --git a/gdb/testsuite/gdb.rocm/addr-bp-gpu-no-deb-info.exp b/gdb/testsuite/gdb.rocm/addr-bp-gpu-no-deb-info.exp > index 039a208a5fa..a77c628f81d 100644 > --- a/gdb/testsuite/gdb.rocm/addr-bp-gpu-no-deb-info.exp > +++ b/gdb/testsuite/gdb.rocm/addr-bp-gpu-no-deb-info.exp > @@ -20,7 +20,7 @@ load_lib rocm.exp > > standard_testfile .cpp > > -require allow_hipcc_tests > +require allow_hip_tests > > if {[build_executable "failed to prepare" $testfile $srcfile {hip}]} { > return > diff --git a/gdb/testsuite/gdb.rocm/break-kernel-no-debug-info.exp b/gdb/testsuite/gdb.rocm/break-kernel-no-debug-info.exp > index d9e35d36d3d..7fc608c2913 100644 > --- a/gdb/testsuite/gdb.rocm/break-kernel-no-debug-info.exp > +++ b/gdb/testsuite/gdb.rocm/break-kernel-no-debug-info.exp > @@ -25,7 +25,7 @@ load_lib rocm.exp > > standard_testfile .cpp > > -require allow_hipcc_tests > +require allow_hip_tests > > # Build for hip, explicitly without debug infos > if {[build_executable "failed to prepare" $testfile $srcfile {hip nodebug}]} { > diff --git a/gdb/testsuite/gdb.rocm/code-object-load-while-breakpoint-hit.exp b/gdb/testsuite/gdb.rocm/code-object-load-while-breakpoint-hit.exp > index c0603886383..38226528b8d 100644 > --- a/gdb/testsuite/gdb.rocm/code-object-load-while-breakpoint-hit.exp > +++ b/gdb/testsuite/gdb.rocm/code-object-load-while-breakpoint-hit.exp > @@ -34,7 +34,7 @@ > > load_lib rocm.exp > standard_testfile .cpp > -require allow_hipcc_tests > +require allow_hip_tests > > # Build the host executable. > if { [build_executable "failed to prepare" \ > diff --git a/gdb/testsuite/gdb.rocm/displaced-stepping.exp b/gdb/testsuite/gdb.rocm/displaced-stepping.exp > index 383972bbb33..2466a678f19 100644 > --- a/gdb/testsuite/gdb.rocm/displaced-stepping.exp > +++ b/gdb/testsuite/gdb.rocm/displaced-stepping.exp > @@ -19,7 +19,7 @@ load_lib rocm.exp > > standard_testfile .cpp > > -require allow_hipcc_tests > +require allow_hip_tests > > # Since GDB doesn't yet understand DWARF expressions generated by the HIP > # compiler, purposefully generate the binary without debug info. > diff --git a/gdb/testsuite/gdb.rocm/fork-exec-gpu-to-non-gpu.exp b/gdb/testsuite/gdb.rocm/fork-exec-gpu-to-non-gpu.exp > index aa85face813..efc27572a5d 100644 > --- a/gdb/testsuite/gdb.rocm/fork-exec-gpu-to-non-gpu.exp > +++ b/gdb/testsuite/gdb.rocm/fork-exec-gpu-to-non-gpu.exp > @@ -20,7 +20,7 @@ > > load_lib rocm.exp > > -require allow_hipcc_tests > +require allow_hip_tests > require allow_fork_tests > > standard_testfile -execer.cpp -execee.cpp > diff --git a/gdb/testsuite/gdb.rocm/fork-exec-non-gpu-to-gpu.exp b/gdb/testsuite/gdb.rocm/fork-exec-non-gpu-to-gpu.exp > index ca104e1cb07..3e1d43bbb7c 100644 > --- a/gdb/testsuite/gdb.rocm/fork-exec-non-gpu-to-gpu.exp > +++ b/gdb/testsuite/gdb.rocm/fork-exec-non-gpu-to-gpu.exp > @@ -19,7 +19,7 @@ > > load_lib rocm.exp > > -require allow_hipcc_tests > +require allow_hip_tests > require allow_fork_tests > > standard_testfile -execer.cpp -execee.cpp > diff --git a/gdb/testsuite/gdb.rocm/interrupt-twice.exp b/gdb/testsuite/gdb.rocm/interrupt-twice.exp > index 0e87b5c66e8..cfefdff9ff0 100644 > --- a/gdb/testsuite/gdb.rocm/interrupt-twice.exp > +++ b/gdb/testsuite/gdb.rocm/interrupt-twice.exp > @@ -19,7 +19,7 @@ > > load_lib rocm.exp > > -require allow_hipcc_tests > +require allow_hip_tests > > standard_testfile .cpp > > diff --git a/gdb/testsuite/gdb.rocm/mi-attach.exp b/gdb/testsuite/gdb.rocm/mi-attach.exp > index c62a3a1cd97..a9b3a971099 100644 > --- a/gdb/testsuite/gdb.rocm/mi-attach.exp > +++ b/gdb/testsuite/gdb.rocm/mi-attach.exp > @@ -17,7 +17,7 @@ load_lib rocm.exp > load_lib mi-support.exp > set MIFLAGS "-i=mi" > > -require can_spawn_for_attach allow_hipcc_tests > +require can_spawn_for_attach allow_hip_tests > > standard_testfile .cpp > > diff --git a/gdb/testsuite/gdb.rocm/multi-inferior-gpu.exp b/gdb/testsuite/gdb.rocm/multi-inferior-gpu.exp > index 5e07e4d982c..4a06b642cb0 100644 > --- a/gdb/testsuite/gdb.rocm/multi-inferior-gpu.exp > +++ b/gdb/testsuite/gdb.rocm/multi-inferior-gpu.exp > @@ -20,7 +20,7 @@ load_lib rocm.exp > > standard_testfile .cpp > > -require allow_hipcc_tests > +require allow_hip_tests > require hip_devices_support_debug_multi_process > require allow_fork_tests > > diff --git a/gdb/testsuite/gdb.rocm/precise-memory-exec.exp b/gdb/testsuite/gdb.rocm/precise-memory-exec.exp > index 0f9f618d686..bdd423cd65d 100644 > --- a/gdb/testsuite/gdb.rocm/precise-memory-exec.exp > +++ b/gdb/testsuite/gdb.rocm/precise-memory-exec.exp > @@ -20,7 +20,7 @@ > > load_lib rocm.exp > > -require allow_hipcc_tests > +require allow_hip_tests > > standard_testfile .c > > diff --git a/gdb/testsuite/gdb.rocm/precise-memory-fork.exp b/gdb/testsuite/gdb.rocm/precise-memory-fork.exp > index bcf94c36eec..06ae518d5a3 100644 > --- a/gdb/testsuite/gdb.rocm/precise-memory-fork.exp > +++ b/gdb/testsuite/gdb.rocm/precise-memory-fork.exp > @@ -20,7 +20,7 @@ > > load_lib rocm.exp > > -require allow_hipcc_tests > +require allow_hip_tests > require allow_fork_tests > > standard_testfile .c > diff --git a/gdb/testsuite/gdb.rocm/precise-memory-multi-inferiors.exp b/gdb/testsuite/gdb.rocm/precise-memory-multi-inferiors.exp > index d0b50a69e91..e8a7b5802ca 100644 > --- a/gdb/testsuite/gdb.rocm/precise-memory-multi-inferiors.exp > +++ b/gdb/testsuite/gdb.rocm/precise-memory-multi-inferiors.exp > @@ -20,7 +20,7 @@ > > load_lib rocm.exp > > -require allow_hipcc_tests > +require allow_hip_tests > > clean_restart > > diff --git a/gdb/testsuite/gdb.rocm/precise-memory-warning-sigsegv.exp b/gdb/testsuite/gdb.rocm/precise-memory-warning-sigsegv.exp > index 4bf5bd71e15..460d14a2b30 100644 > --- a/gdb/testsuite/gdb.rocm/precise-memory-warning-sigsegv.exp > +++ b/gdb/testsuite/gdb.rocm/precise-memory-warning-sigsegv.exp > @@ -20,7 +20,7 @@ > > load_lib rocm.exp > > -require allow_hipcc_tests > +require allow_hip_tests > > standard_testfile .cpp > > diff --git a/gdb/testsuite/gdb.rocm/precise-memory-warning-watchpoint.exp b/gdb/testsuite/gdb.rocm/precise-memory-warning-watchpoint.exp > index 15ab9a91e4c..373b95fecde 100644 > --- a/gdb/testsuite/gdb.rocm/precise-memory-warning-watchpoint.exp > +++ b/gdb/testsuite/gdb.rocm/precise-memory-warning-watchpoint.exp > @@ -18,7 +18,7 @@ > > load_lib rocm.exp > > -require allow_hipcc_tests > +require allow_hip_tests > > if { ![istarget "*-linux*"] } then { > continue > diff --git a/gdb/testsuite/gdb.rocm/precise-memory.exp b/gdb/testsuite/gdb.rocm/precise-memory.exp > index fc6993e7d7b..8b92af19d29 100644 > --- a/gdb/testsuite/gdb.rocm/precise-memory.exp > +++ b/gdb/testsuite/gdb.rocm/precise-memory.exp > @@ -19,7 +19,7 @@ > > load_lib rocm.exp > > -require allow_hipcc_tests > +require allow_hip_tests > > standard_testfile .cpp > > diff --git a/gdb/testsuite/gdb.rocm/simple.exp b/gdb/testsuite/gdb.rocm/simple.exp > index dba81c2c1e6..e928aa55bee 100644 > --- a/gdb/testsuite/gdb.rocm/simple.exp > +++ b/gdb/testsuite/gdb.rocm/simple.exp > @@ -20,7 +20,7 @@ load_lib rocm.exp > > standard_testfile .cpp > > -require allow_hipcc_tests > +require allow_hip_tests > > if {[build_executable "failed to prepare" $testfile $srcfile {debug hip}]} { > return > diff --git a/gdb/testsuite/gdb.rocm/watchpoint-at-end-of-shader.exp b/gdb/testsuite/gdb.rocm/watchpoint-at-end-of-shader.exp > index 2ae0e044a53..24bd5bc7042 100644 > --- a/gdb/testsuite/gdb.rocm/watchpoint-at-end-of-shader.exp > +++ b/gdb/testsuite/gdb.rocm/watchpoint-at-end-of-shader.exp > @@ -18,7 +18,7 @@ > > load_lib rocm.exp > > -require allow_hipcc_tests > +require allow_hip_tests > > standard_testfile .cpp > > diff --git a/gdb/testsuite/gdb.rocm/watchpoint-basic.exp b/gdb/testsuite/gdb.rocm/watchpoint-basic.exp > index 8d19b0dcba2..b041c742797 100644 > --- a/gdb/testsuite/gdb.rocm/watchpoint-basic.exp > +++ b/gdb/testsuite/gdb.rocm/watchpoint-basic.exp > @@ -17,7 +17,7 @@ > > load_lib rocm.exp > > -require allow_hipcc_tests > +require allow_hip_tests > > standard_testfile .cpp > > diff --git a/gdb/testsuite/lib/future.exp b/gdb/testsuite/lib/future.exp > index 0f45aa44628..08674f3a4ae 100644 > --- a/gdb/testsuite/lib/future.exp > +++ b/gdb/testsuite/lib/future.exp > @@ -120,20 +120,20 @@ proc gdb_find_rustc {} { > return $rustc > } > > -proc gdb_find_hipcc {} { > +proc gdb_find_hip_compiler {} { > global tool_root_dir > if {![is_remote host]} { > - set hipcc [lookfor_file $tool_root_dir hipcc] > - if {$hipcc eq "" && [info exists ::env(ROCM_PATH)]} { > - set hipcc [lookfor_file $::env(ROCM_PATH)/bin hipcc] > + set compiler [lookfor_file $tool_root_dir amdclang++] > + if {$compiler eq "" && [info exists ::env(ROCM_PATH)]} { > + set compiler [lookfor_file $::env(ROCM_PATH)/lib/llvm/bin amdclang++] > } > - if {$hipcc eq ""} { > - set hipcc hipcc > + if {$compiler eq ""} { > + set compiler amdclang++ > } > } else { > - set hipcc "" > + set compiler "" > } > - return $hipcc > + return $compiler > } > > proc gdb_find_ldd {} { > @@ -313,7 +313,7 @@ proc gdb_default_target_compile_1 {source destfile type options} { > if {[board_info $dest exists hipcompiler]} { > set compiler [target_info hipcompiler] > } else { > - set compiler [find_hipcc] > + set compiler [find_hip_compiler] > } > } > > @@ -379,7 +379,7 @@ proc gdb_default_target_compile_1 {source destfile type options} { > global GO_FOR_TARGET > global GO_LD_FOR_TARGET > global RUSTC_FOR_TARGET > - global HIPCC_FOR_TARGET > + global HIP_COMPILER_FOR_TARGET > > if {[info exists GNATMAKE_FOR_TARGET]} { > if { $compiler_type == "ada" } { > @@ -426,9 +426,9 @@ proc gdb_default_target_compile_1 {source destfile type options} { > } > } > > - if {[info exists HIPCC_FOR_TARGET]} { > + if {[info exists HIP_COMPILER_FOR_TARGET]} { > if {$compiler_type == "hip"} { > - set compiler $HIPCC_FOR_TARGET > + set compiler $HIP_COMPILER_FOR_TARGET > } > } > > @@ -732,12 +732,12 @@ if {[info procs find_rustc] == ""} { > rename gdb_find_rustc "" > } > > -if {[info procs find_hipcc] == ""} { > - rename gdb_find_hipcc find_hipcc > +if {[info procs find_hip_compiler] == ""} { > + rename gdb_find_hip_compiler find_hip_compiler > set use_gdb_compile(hip) 1 > gdb_note [join [list $note_prefix "HIP" $note_suffix] ""] > } else { > - rename gdb_find_hipcc "" > + rename gdb_find_hip_compiler "" > } > > # If dejagnu's default_target_compile is missing support for any language, > diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp > index a40c87c6727..ff9da83925c 100644 > --- a/gdb/testsuite/lib/gdb.exp > +++ b/gdb/testsuite/lib/gdb.exp > @@ -6766,14 +6766,46 @@ proc gdb_compile {source dest type options} { > # '-mllvm=-amdgpu-spill-cfi-saved-regs' [-Wunused-command-line-argument] > # > # These happen when we're compiling an executable _and_ all > - # the input files are .o files, like: hipcc foo.o -o foo ... > + # the input files are .o files, like: amdclang++ foo.o -o foo ... > # > - # HIPCC defaults to -O2, so add -O0 to early flags for the HIP > - # language. If "optimize" is also requested, another -O flag > - # (e.g. -O2) will be added to the flags, overriding this -O0. > - lappend new_options "early_flags=-O0\ > - -mllvm=-amdgpu-spill-cfi-saved-regs\ > + # amdclang++ infers the input language from the file extension, > + # and compiles .cpp files as C++, not HIP. The HIP testcases > + # are named .cpp (renaming them all to .hip would be unusual, so > + # we keep them as .cpp), so they must be compiled with an > + # explicit "-x hip". Rather than passing a single global > + # "-x hip" in early_flags (which would also be applied to any .o > + # inputs, e.g. set_unbuffered_mode.o injected via ldflags, > + # causing amdclang++ to try to parse the object as HIP source), > + # we tag each input individually just before target_compile: > + # "-x hip" before .cpp/.c sources and "-x none" before .o/.a > + # files. It feels odd to have this bit of discussion about -x hip -x none here. None of the code that follows deals with this. This is done later (the next hunk of this patch), which also has its own comment regarding this. To me, it seems that this block of text is a duplicate, and the other version lower down is better place. WDYT? Best, Lancelot. > + ......... --hip-link is still required when linking to bring in > + # the HIP runtime. > + set hip_early_flags "-mllvm=-amdgpu-spill-cfi-saved-regs\ > -Wno-unused-command-line-argument" > + if {$type eq "executable"} { > + set hip_early_flags "--hip-link $hip_early_flags" > + } > + # When ROCM_PATH is set in the environment, pass --rocm-path > + # so amdclang++ uses that specific ROCm install for HIP > + # headers and device libraries. When ROCM_PATH is not set, > + # defer to amdclang++'s own HIP discovery, which looks under > + # the parent of its own LLVM directory and falls back on > + # /opt/rocm; overriding that here would silently mask the > + # user's actual compiler-side install. > + if {[info exists ::env(ROCM_PATH)] && $::env(ROCM_PATH) ne ""} { > + set hip_early_flags "--rocm-path=$::env(ROCM_PATH) $hip_early_flags" > + } > + lappend new_options "early_flags=$hip_early_flags" > + > + # amdclang++ requires explicit --offload-arch. Explicitly > + # pass one --offload-arch for each available device. But > + # don't do it if the testcase explicitly used --offload-arch. > + if {[lsearch -exact $options hip_no_offload_arch] == -1 > + && [lsearch -regexp $options "--offload-arch="] == -1} { > + foreach gpu_target [hcc_amdgpu_targets] { > + lappend new_options "early_flags=--offload-arch=$gpu_target" > + } > + } > } > > # Because we link with libraries using their basename, we may need > @@ -6945,6 +6977,28 @@ proc gdb_compile {source dest type options} { > # Automatically handle includes in testsuite/lib/. > auto_lappend_include_files options $source > > + # amdclang++ infers the input language from the file extension and > + # compiles .cpp as C++, not HIP. Since the HIP testcases are named > + # .cpp, explicitly tag each input: "-x hip" before C/C++/HIP source > + # files, and "-x none" before everything else (object files, > + # archives, shared libraries), so the compiler does not try to > + # parse those as HIP source. This lets a single amdclang++ > + # invocation correctly handle a mix of sources and non-source > + # inputs (e.g. when set_unbuffered_mode.o is appended via ldflags > + # later in the command line). > + if {[lsearch -exact $options hip] != -1 && !$getting_compiler_info} { > + set new_source {} > + foreach src $source { > + set ext [string tolower [file extension $src]] > + if {$ext in {".c" ".cc" ".cp" ".cxx" ".cpp" ".c++" ".hip"}} { > + lappend new_source "-x" "hip" $src > + } else { > + lappend new_source "-x" "none" $src > + } > + } > + set source $new_source > + } > + > cond_wrap [expr {$pie != -1 || $nopie != -1}] \ > with_PIE_multilib_flags_filtered { > set result [target_compile $source $dest $type $options] > diff --git a/gdb/testsuite/lib/rocm.exp b/gdb/testsuite/lib/rocm.exp > index ca1ae3f1a8b..f8a3b233fae 100644 > --- a/gdb/testsuite/lib/rocm.exp > +++ b/gdb/testsuite/lib/rocm.exp > @@ -110,7 +110,7 @@ proc hcc_amdgpu_targets {} { > return $unique > } > > -gdb_caching_proc allow_hipcc_tests {} { > +gdb_caching_proc allow_hip_tests {} { > # Only the native target supports ROCm debugging. E.g., when > # testing against GDBserver, there's no point in running the ROCm > # tests. > -- > 2.34.1