From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id WkJIOXJwdGq27AwAWB0awg (envelope-from ) for ; Thu, 06 Aug 2026 07:30:58 -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=oRqI2Xs8; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id D73511E09B; Thu, 06 Aug 2026 07:30:58 -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 CBBC51E09B for ; Thu, 06 Aug 2026 07:30:56 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EEAD14BB3BE3 for ; Thu, 6 Aug 2026 11:30:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EEAD14BB3BE3 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=oRqI2Xs8 Received: from PH8PR06CU001.outbound.protection.outlook.com (mail-westus3azlp170120001.outbound.protection.outlook.com [IPv6:2a01:111:f403:c107::1]) by sourceware.org (Postfix) with ESMTPS id 457994BA799A for ; Thu, 6 Aug 2026 11:30:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 457994BA799A 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 457994BA799A Authentication-Results: sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:c107::1 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1786015826; cv=pass; b=ED48lrsZwzgwokuQo379DPsYAgWKoNOQOPu42dNDTRHyG4hVzlH6xZTV3sjcNmS3yRk+qP+443rC3jGUB4lXa43/m8vIvgcn9Pk+t7wBvdi7O9cBvLFvHuuT9ke4c4/kYBwrK2AS5yQNqj3ssTmnfWdNTyNpSfR1MuJN6g5pTOs= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1786015826; c=relaxed/simple; bh=C7iJ4kZYNVVgmm0/YysD8+YMKgBzp4frwVdm3uqanUM=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=RxD6POIAsURlx27SNqhxlNy7LlrdKMvbJVsLWLM14TzZiZww1pdBonHKyPa+61AxWJQlCZLtEc3vjrOqAkWSLFwX2G0SVQaTjlFfkSeI+AHESwA+/j3xJE7vUzo0jkSAmG1uQSAGE06oKnd6ZirVti00JrZAndniUE54/AO8bvg= 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=oRqI2Xs8 DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 457994BA799A ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Si4AFGqcdBwxUuBC7YZqpOnHskc+bSzj3YUBJ8epmG6ha7VCMKDWykS+pIqWtUW3f+FSt/HJRWwXZT0lO3jVhe2kCnYkaBvRU6EqdSB22F9W/m5fjALVsFY2k5DrW9xLXKU+rC3XTSvG5okv5/x5MrLDcz5gWoe13XvcXZN1a7OfXyUKQ55lLvnYAn8wWnFdPu4oXMNMYYBie5chZo4PfJofdhNTjcznMM+6715hJLiNJvj7yftQwIqRG9xaSw2scYaBnki5yHZFpn0vYWcz1FgYElmroG4uikXUy4VGvKwUuYP7lOc7ySBG6piIyxIaCT5xmJ47HSsp3XQWLyd4RA== 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=xL8p+0IOKdWfahdn0zx5VCXLkTO3AT2k3VSN6I6ZGHg=; b=rssp8I2mEfT55XuzHtRHQRT1LMmX8ER0XQNx65pO90qpOUnLh+q+g9UM1dYVYdXRRqB+/5x09GxpOTqZXbAEx6cYg72qcSHxVFuP+mcvzqXeh6YyxIhLu7qgdxnqmaSqxJPUxWQigCWv8YKjgYLpTPqL9s1fFE4OdMuGhZuKkF/ERsfw9fgTKivWkmdzjGyCsSerB92MXH4wU/vl17Y18NePL3UoHUTv+/WlF/Sz8WYv3nyD80VhYiUhcJvGdNZLJ4achMxZ/q3JSvTaBnqse9A2zoANowcGAqNzBu9U3l+k1roTwoDTpjgiGNklPL5RYP/das0YwC8cT04DS9HxWQ== 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=xL8p+0IOKdWfahdn0zx5VCXLkTO3AT2k3VSN6I6ZGHg=; b=oRqI2Xs89B+m4cEqHg3fmCtpLiuGKKHrgVUPcHTbUDDwySwxjWF5nVCY24lRXTk1RluJxPKzNHtUE3fxhZISpliT7QGaFU/eGPHgkGVUZSr4owS2NSWihJoVUsNBtcFxvjHfeo4lhAYQCL+ljN9uaJJhTFYs9ixE31Bh9tcoFNo= Received: from CH2PR15CA0023.namprd15.prod.outlook.com (2603:10b6:610:51::33) by CH1PR12MB9648.namprd12.prod.outlook.com (2603:10b6:610:2b0::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.292.19; Thu, 6 Aug 2026 11:30:15 +0000 Received: from DS3PEPF000099DF.namprd04.prod.outlook.com (2603:10b6:610:51:cafe::ad) by CH2PR15CA0023.outlook.office365.com (2603:10b6:610:51::33) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.292.21 via Frontend Transport; Thu, 6 Aug 2026 11:30:15 +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 DS3PEPF000099DF.mail.protection.outlook.com (10.167.17.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.315.6 via Frontend Transport; Thu, 6 Aug 2026 11:30:14 +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; Thu, 6 Aug 2026 06:30:14 -0500 From: Sarang Patrange To: CC: Lancelot Six , Pedro Alves Subject: [PATCH v2] gdb/testsuite: replace hipcc with amdclang++ as the HIP compiler Date: Thu, 6 Aug 2026 06:29:51 -0500 Message-ID: <20260806112951.1322605-1-spatrang@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260715094533.3093704-1-spatrang@amd.com> References: <20260715094533.3093704-1-spatrang@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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: DS3PEPF000099DF:EE_|CH1PR12MB9648:EE_ X-MS-Office365-Filtering-Correlation-Id: fe28ec98-2294-473e-a49f-08def3ae15dd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|82310400026|23010399003|36860700016|376014|13003099007|6133799003|10067099003|11063799006|56012099006|5023799004|22082099003|18002099003|3023799007; X-Microsoft-Antispam-Message-Info: KXvda5bF3HeQTJLSy+ved7bW/zAyMAA+BrBGRNkIBwKo0wCodctqvaFExY0aDR8Ace+z1JHX0HhdRjJE4CSVx8qq+RAgZiKqheYVmemOTmAbKaIyqrxNvCjtcXFislOAcPN2BJE9rPOh+21eeXvb31qoMBt3n8LYbmKX4leTsnHr6JxlQvWm5oodeOTYCCwBF7A2m5r0IibO9vZioTSBzjusgsSc2/34rKRLZibxBQQ5EEUKsnZSBH9bamhbRvqYA5XaqoaSa+f20eHBCRhTHe43yuqaOWhSdgKoQc24AK7BSkxB60miLP9BviroqgHYy/WophPGxLaJRACFxXZ1i7knwCa9Xa94roYlAPknQS4FEAH/6qJWSPpLoJmIJcKeQk/uvwt1SSUrjgfxj7bcgYQePWmOMFKMZRdKi2cLulYsuTJ9rXV7CMsHAatfhoYq4RkjkaAXiEs2pkjCPkYbCmxo/K9Sc+ir4axvtWTLzY7BvVTKeOH+MBU9hVfRXupcqncUCJgkZaGahvqRy1FPiW5u8WRCinJEHBhiuMvM/lngOcD7I9GpWOMa3bWgBMFQgs4Q/xqGjKcRTXVR040XKN0xcjETM2IBlYf/+Q6bCSDQEWfVVPRrz/V7+fCPYNRnyM2Yuye16km30ySYAw0SYdMCZiZWxWBUAolW0dc4Esw= 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)(1800799024)(82310400026)(23010399003)(36860700016)(376014)(13003099007)(6133799003)(10067099003)(11063799006)(56012099006)(5023799004)(22082099003)(18002099003)(3023799007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: L+fKMM4tnFv4r5KD8Ri5t3cvTzRnS/ZCrClxVRDqxcVLNI7vbvLVqkcF7441FQ+2OnoS9RgZqlC6vf1NnPb2tqPA2CjM2P5LF6Lkm6wcwYhh3z8YNENHcXcrP4ksiQg2Zx7ez8mnjjasZ9P4E7GaQWHcUsngc16y1yvOZItyrMwvnHYiRATSvRNrnZu580NBIVSVBiFjSLZ2c9FWSby/CZq0aR/dAUyCbZX2pWf50CROBjd6cGUJxEBrU7a5qUWOCAmhojtRpdU3j+1UqTwMK/NwNh3v1//S0ISGckArbreBPSAHXCrwhfggffQI46qFiLKDZ0neMj0wIVNltjWDcjQ6Ktdu9gtpFfcb1KSMMACiGFqLz03M2ayDG2ithTvc6Gn7VGVdFp5MtBxae7Xna/SYkE3mWALZNVZg+m1qWibFGrRtPQQBGfnDo3FSRA6S X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Aug 2026 11:30:14.8822 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fe28ec98-2294-473e-a49f-08def3ae15dd 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: DS3PEPF000099DF.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH1PR12MB9648 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. - Replace hipcc's --genco with amdclang++'s --cuda-device-only in gdb.rocm/code-object-load-while-breakpoint-hit.exp, which builds a standalone device code object. Signed-off-by: Sarang Patrange --- Changes in v2: - Replace hipcc's --genco with amdclang++'s --cuda-device-only in gdb.rocm/code-object-load-while-breakpoint-hit.exp (Lancelot). - Remove the duplicated "-x hip"/"-x none" explanation from the early_flags comment; keep it only at the tagging site where the code actually lives (Lancelot). - Drop the hip_no_offload_arch check; that option is added by a separate, not-yet-submitted patch (Pedro). .../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 | 4 +- 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 | 55 +++++++++++++++++-- gdb/testsuite/lib/rocm.exp | 2 +- 21 files changed, 84 insertions(+), 41 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..c1fdbe69c1b 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" \ @@ -47,7 +47,7 @@ set hipmodule_path [standard_output_file ${testfile}.co] # Build the kernel object file. if { [gdb_compile $srcdir/$subdir/$srcfile \ $hipmodule_path object \ - { debug hip additional_flags=--genco additional_flags=-DDEVICE } ] != "" } { + { debug hip additional_flags=--cuda-device-only additional_flags=-DDEVICE } ] != "" } { return -1 } 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..cbf3725fed9 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -6766,14 +6766,35 @@ 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\ + # --hip-link is 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 -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 +6966,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