From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id eNZHCvZWV2r/lAkAWB0awg (envelope-from ) for ; Wed, 15 Jul 2026 05:46:30 -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=KY+IIo7C; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 0A6301E09E; Wed, 15 Jul 2026 05:46:30 -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 EBFB71E099 for ; Wed, 15 Jul 2026 05:46:26 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 59A2B4BA2E19 for ; Wed, 15 Jul 2026 09:46:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 59A2B4BA2E19 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=KY+IIo7C Received: from BN8PR05CU002.outbound.protection.outlook.com (mail-eastus2azon11011057.outbound.protection.outlook.com [52.101.57.57]) by sourceware.org (Postfix) with ESMTPS id 329804BA2E08 for ; Wed, 15 Jul 2026 09:45:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 329804BA2E08 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 329804BA2E08 Authentication-Results: sourceware.org; arc=pass smtp.remote-ip=52.101.57.57 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1784108758; cv=pass; b=l1BRMfNTdgWiBXljFiJaYnQVc20rpXc04aDYdChV7TiDSjgqEjkqYeUWLmwA/Yd3Ri8qDzOBdB68cAHBFaLEy8fDYx8sBXfid/o7N6tHWtFqhSBkUgQp0sUkptdiNF7C1+tcXk5mKJ26sM2T0P2XX74cLCdUG9x7iKNvM9FsZeA= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1784108758; c=relaxed/simple; bh=1h3WqHwsyXSt66qfWOUx5TYSU0tCM1HBAJhDfXHMHuI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=bEmLoASmXeSH+dnRNhkHrDreghPFQH9l7eBTn9Yfgoyh/RK5Vw7K3xumqxmOIjyAwxLrmBsVSwRjgJi2KxY1yfchbmlzSmYYs2Gh4ah/f6j1Bb08Pis6H7ffkVYzhgt7zui2niGPvQYgLhG6AcQNwZRvET+LJzY/cnRx2SOnN8E= 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=KY+IIo7C DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 329804BA2E08 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=HYcvEMzwBZiRdkGt5POVWTdDKDNSQUj/HlRpuzAPOgnxo16wYbZc8PHXY9dXlvdQWArQ2AWpjsSoR5zDBUUc9lo/Sc8ID/lJveEncs+SZmzkv4qDFzORWlUOdcVRBrXcv1VJ0Qu9xxo/l7H3druENjuL5ljD/Urru0yOBki+YGlhBX7NTT32hmUsXsD+sCkdhFOMDHHB40QPcjYkTylgiM9v9J+BFqobzl0MR+md3xwZlbhHrwvQThsdWTilKX/ZVs+9EmDRa8HcAzpKv1rnpy8A4B/07Gml/k4rJNvpJGF7VAZUq7qzjeO2sUi8bwGk3gNofDWpd6s4yK30D6AXWw== 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=ChUGlteKiAoleftAWWztg8h4cU826QUUnhqsO92ohww=; b=xiSHUuhdAcW16PjlOsLm/fd83HIwayE1O72x0CS61hv2HRhtqLUFkwaiz/gHoOTFzPGo9bkTq4AM3Cs9Wnhq+pHb8SyZDi1ZsIKPsq3ql4VIvVKcGxQvVRgTRGRz1sNz/C8TEpu8PEtbX2G+SkNZBDvNFVQ3XpfxyKoTVeAaP/jdmFfgXvdBFxMsvA2Ah2X2+1hwaQ2CKVmJksaoU//hM7vX2ORlXal4Ypq12/y7AnoWmxt4E58TRl8AAFdSvG+eiKTeS0IG0lJM6rTWD3LjhWyJKyQJqIILIV0c1WWh3Zhd2enLm/kntYh1tK2bBMpZgauuYMY/qLxwPUkIutfh6A== 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=ChUGlteKiAoleftAWWztg8h4cU826QUUnhqsO92ohww=; b=KY+IIo7C4wgBnzkI0uyqR2cPJrKb3yO73TJDsbFXX5GvkbbL0tZzlQ2c1sVXYO+HTFKCghkQg2mLFizj0CL29iddm9IGl8kZlUhv1PQqenPJsd+TKF75IOQkaTIpSAyFxumxFKpGA5z/z6T6+bGeCRY6o6KyWEm41UgyCQk0KWM= Received: from CH0PR03CA0293.namprd03.prod.outlook.com (2603:10b6:610:e6::28) by SAWPR12MB999165.namprd12.prod.outlook.com (2603:10b6:806:4e1::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.223.10; Wed, 15 Jul 2026 09:45:49 +0000 Received: from CH1PEPF0000AD82.namprd04.prod.outlook.com (2603:10b6:610:e6:cafe::a4) by CH0PR03CA0293.outlook.office365.com (2603:10b6:610:e6::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.223.11 via Frontend Transport; Wed, 15 Jul 2026 09:45:49 +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 CH1PEPF0000AD82.mail.protection.outlook.com (10.167.244.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.223.9 via Frontend Transport; Wed, 15 Jul 2026 09:45:49 +0000 Received: from ctr-rack32-mi300x-1.amd.com (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; Wed, 15 Jul 2026 04:45:48 -0500 From: Sarang Patrange To: CC: Lancelot Six Subject: [PATCH] gdb/testsuite: replace hipcc with amdclang++ as the HIP compiler Date: Wed, 15 Jul 2026 04:45:33 -0500 Message-ID: <20260715094533.3093704-1-spatrang@amd.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: satlexmb08.amd.com (10.181.42.217) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH1PEPF0000AD82:EE_|SAWPR12MB999165:EE_ X-MS-Office365-Filtering-Correlation-Id: 874227d9-72dc-4f45-6965-08dee255da14 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|376014|1800799024|36860700016|23010399003|6133799003|3023799007|18002099003|5023799004|11063799006|56012099006; X-Microsoft-Antispam-Message-Info: Os/AZWo1rpwOEPmfRc38NOr5DH3S518E12KPFC9vx0tJ1VAIynrne6OsaHvYpOg42K9vay3j707aUkz/1VGEJHZ4vae0sqG9ZIb4jx027FKo1Q5ARX7No3HDNuBbKknRYzCPgywSxumBKPe2ETt/uFGrakXoycQmFbzP0+tfzfGJopnfU76yJQ6g5GtFPZUNkM8rsA/amYG73aQN1eQRSCmA0WFcQfX880bESFbKH6Til3fAdfmEresp3J7ycE7Dj+xzu8b8BlyEqQBudhg/eeP7tj6APNI/lBPzRF9NsW9mxNN5imUVZEso18BEdr0ypxuYp5a9+wmkxsFbFoBdL2auJuTCjPpoWGkDoBcEuzt3GcI3VOYitqxwxZhw2Ag/vHhW/44HVTW7uDADCQppqV+8nrK3JnuCJx1A6ss9lx3/nY0qNOYLWizcITn7hjRnyBW7Oom7DttYM9dtzgxJuutRYx72sobRfUWJrYVGiIJiFX7G0K+tWZJmA/2V6PgleVwMgqD1oxJfP8KbCUv4bihsFLa+PToetmf9jPusxgl5elQKd/xw65AKGwA9wGMUd89bkpJsgc+FZysxkisys1YUBCKU22dorf2V6t++z3VIdhUdah96hsrqrE38oYbRsyPC/AGjtHmtUu5OBS17lW9MRSNkdQqKT/YRvWVEraUyINR4iVSNXXiM28af+pGly/DpO2MBJiAV86AWrK/0BQ== 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)(82310400026)(376014)(1800799024)(36860700016)(23010399003)(6133799003)(3023799007)(18002099003)(5023799004)(11063799006)(56012099006); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: /KIgyygERPvviDLs3F37D8rFQ29LUVD9eIzLEBnf39pC52FQaDIqVQNzJ/fvTGIIxRRfCSsTQb5lBvj4PUly3O+Cv5Sef+F9rxVclMfadvs7LixuSDvpCjYfM/uiRH912vsvhwRGMhXE5EqSP3Q0I3eNEdRXT9GtSMvXN2Jx4K4ss5UA87MzvEaOHxWJNqECJlYQP9PQ6+MwCq8dCjCDrX44lIii4+OdftYDhwuKMCAwJabcBVS0M555D/j770pqGDL4W8t4KJioojctRJ0iTtCTqRUmZ+GlQKXsmQTzDxEg8fA7SnkSa5ro0qszF91oBV8oPGOVhqnCSIxQ9SZ9Ug+W2Q/QDbvYpu4fPObPzBs5tOCJ3NL6kWA5WpRYYLVKD0Qrnchpe562UxCwxiNmLU3tzNz+zAhYDFkykCCm+mNk/XcVnk/KrF0VCyB+7shd X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2026 09:45:49.1502 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 874227d9-72dc-4f45-6965-08dee255da14 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: CH1PEPF0000AD82.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SAWPR12MB999165 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 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. --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