From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id vZ0JI2W2R2ruuCMAWB0awg (envelope-from ) for ; Fri, 03 Jul 2026 09:17:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1783084645; bh=HWiUjPti2QOu7j6vPOblJywFg/uj+n5rbHRqh+LBd8Q=; h=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=tSoMeLWoesYXdJIMUgIjOzx8hfXPdpCawshjH3yA/d8iy2Qy+a+/3cshkAf/pV5MS 95x5lCoiccjhAAutaNwiYd4RuvaKzsNIwRtk8tdIuca/svkoDOu5q1fOR1un6i2yrp T08kqu+F0Lol1jPhDSBkNcxHhg1xiv3yS2vzGC7M= Received: by simark.ca (Postfix, from userid 112) id 813671E098; Fri, 03 Jul 2026 09:17:25 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=dETKOd5p; dkim-atps=neutral Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::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 1FF471E024 for ; Fri, 03 Jul 2026 09:17:25 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1EB284BA2E31 for ; Fri, 3 Jul 2026 13:17:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1EB284BA2E31 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=dETKOd5p Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 4AEE94BA5436 for ; Fri, 3 Jul 2026 13:17:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4AEE94BA5436 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4AEE94BA5436 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783084620; cv=none; b=Wz70peMxC0HubrEwMPefpeg/8cRX81l6EVjC2ygUVquMS+H7fKSV3trGAjQZBWg7VZf/NeFa0v0RvK5ifiE8m9XZ7esX2g2ldYccxZWVSEzVIg19KrrhFoRo/cDJADAgJCmEGsdS5j7K0ZZ5fq2iQJcuErtdpCQlXwTM0Q2x7J4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783084620; c=relaxed/simple; bh=HWiUjPti2QOu7j6vPOblJywFg/uj+n5rbHRqh+LBd8Q=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=QJqXway9LZQ+U5kjSWALYzcg0BoJm18Sta6B2TxGKO4tTRDRe9qaSS9d7hsFtux4b4CqmChx7CiHQ1AkYa9SomxaqLDXRw2FVAnZ600vfqEYDa2Sd2cblon+K5A/3Z7qDT+0K63n48Oky0CadQPSTYS6GfxAKKkyPvi7Wy6Skrw= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=dETKOd5p DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4AEE94BA5436 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1783084619; bh=HWiUjPti2QOu7j6vPOblJywFg/uj+n5rbHRqh+LBd8Q=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=dETKOd5pVIyICnpuw/QFuGLvBzdDAE9+VMFmJbKXcixugdk8n/UVMnwAv53CxjRy8 Hwoin6gGYdt1rC61N3+mW/78X+TGxbLEUSPIaf5Z9zEnMKrAnq3kyeQNQbTYicptCm 6LJQZExgp1bc3dPkg5JapAuXYxVnaQRBqLVdsb5w= Received: by simark.ca (Postfix) id 1E2DB1E024; Fri, 03 Jul 2026 09:16:59 -0400 (EDT) Message-ID: <0d201386-8f2d-4489-ba37-ca8835f07631@simark.ca> Date: Fri, 3 Jul 2026 09:16:58 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/2] gdb, amd-dbgapi-target: split wave_coordinates::to_string To: Tankut Baris Aktemur , gdb-patches@sourceware.org Cc: lancelot.six@amd.com References: <20260703125058.1828518-1-tankutbaris.aktemur@amd.com> <20260703125058.1828518-2-tankutbaris.aktemur@amd.com> Content-Language: fr From: Simon Marchi In-Reply-To: <20260703125058.1828518-2-tankutbaris.aktemur@amd.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 On 7/3/26 8:50 AM, Tankut Baris Aktemur wrote: > wave_coordinates::to_string() produces a string in the following format: > > AMDGPU Wave a:q:d:w (x,y,z)/i > > Split the method into smaller pieces: > > a:q:d:w : hierarchy_str > (x,y,z) : workgroup_coord_str > (x,y,z)/i : dispatch_pos_str > > This is a refactoring to allow reusing pieces. Currently the reuse > opportunity exists in the downstream debugger. I think this is a nice change even for upstream, as it helps document what the numbers mean. Assuming Lancelot is already fine with the change: Approved-By: Simon Marchi Just one formatting comment below. > --- > gdb/amd-dbgapi-target.c | 55 +++++++++++++++++++++++++++++++++-------- > 1 file changed, 45 insertions(+), 10 deletions(-) > > diff --git a/gdb/amd-dbgapi-target.c b/gdb/amd-dbgapi-target.c > index 923b790664e..33512695fb5 100644 > --- a/gdb/amd-dbgapi-target.c > +++ b/gdb/amd-dbgapi-target.c > @@ -147,6 +147,17 @@ struct wave_coordinates > : wave_id (wave_id) > {} > > + /* Return the string showing the agent -> queue -> dispatch -> wave > + hierarchy. */ > + std::string hierarchy_str () const; > + > + /* Return the workgroup coordinates as a string. */ > + std::string workgroup_coord_str () const; > + > + /* Return the dispatch position string for the wave this > + wave_coordinates is for. */ > + std::string dispatch_pos_str () const; > + > /* Return the target ID string for the wave this wave_coordinates is > for. */ > std::string to_string () const; > @@ -387,13 +398,12 @@ get_amd_dbgapi_inferior_info (inferior *inferior) > static async_event_handler *amd_dbgapi_async_event_handler = nullptr; > > std::string > -wave_coordinates::to_string () const > +wave_coordinates::hierarchy_str () const > { > - std::string str = "AMDGPU Wave"; > - > - str += (agent_id != AMD_DBGAPI_AGENT_NONE > - ? string_printf (" %s", pulongest (agent_id.handle)) > - : " ?"); > + std::string str > + = (agent_id != AMD_DBGAPI_AGENT_NONE > + ? string_printf (" %s", pulongest (agent_id.handle)) > + : "?"); > > str += (queue_id != AMD_DBGAPI_QUEUE_NONE > ? string_printf (":%s", pulongest (queue_id.handle)) > @@ -405,11 +415,25 @@ wave_coordinates::to_string () const > > str += string_printf (":%s", pulongest (wave_id.handle)); > > - str += (group_ids[0] != UINT32_MAX > - ? string_printf (" (%u,%u,%u)", group_ids[0], group_ids[1], > - group_ids[2]) > - : " (?,?,?)"); > + return str; > +} > + > +std::string > +wave_coordinates::workgroup_coord_str () const > +{ > + std::string str > + = (group_ids[0] != UINT32_MAX > + ? string_printf ("(%u,%u,%u)", group_ids[0], group_ids[1], > + group_ids[2]) group_ids[2] could go on the previous line, for one less line wrap. Simon