From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id GZnAK11X6mgBkikAWB0awg (envelope-from ) for ; Sat, 11 Oct 2025 09:10:53 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=mM1hPfQg; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id A5C581E0B6; Sat, 11 Oct 2025 09:10:53 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (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 E29B51E047 for ; Sat, 11 Oct 2025 09:10:52 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6143B3857BA5 for ; Sat, 11 Oct 2025 13:10:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6143B3857BA5 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=mM1hPfQg Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by sourceware.org (Postfix) with ESMTPS id 1F28B3857B9E for ; Sat, 11 Oct 2025 13:10:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1F28B3857B9E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 1F28B3857B9E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::329 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1760188214; cv=none; b=EKKojWaHloBx8KxJlJweW3CSowT7vZZi/jmvspaTsKjFe2whU05lkHDTaW9GPHUxNdBQbZpWVqxLlcrOt0i3T1GzEI7nBZBz+n+v8MoGWcR8KFsRrw84ExlZ2gGx8eHtl+OO6/ZMcow6+RUNeQSU9Rr/9cxN1+/S8Dge/6RCm44= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1760188214; c=relaxed/simple; bh=3doLSuHVcLzaEp1kv4iaWS+iwowxFgEwJvc5pmxiWa0=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=tF6H6+kWe+IcRxgiNaYJIAJFXawL9OoAfMCEUbElrJmZmjoqw+lxoWt36ChAHRtOFEdOfE6oyXWmUYapovpys1uBuVSGC2/xBdg24H8V542OPk4Wk4h7X+l/c1D+PtkakmK0P1atUD3zMwrrCRkGQvBFS2FYstP1/sWbSEvwcbA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1F28B3857B9E Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-46f53f88e0bso16649005e9.1 for ; Sat, 11 Oct 2025 06:10:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760188213; x=1760793013; darn=sourceware.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=vh0REF7UaecpC4ae2JcxVQtnG5Y03RfEy1CDnJiFEgc=; b=mM1hPfQgLlYvcIf8DyLaPbBmgDnEwS5hEPejtRceiPjMGqdzRQt8zGVLMYsQJT0yV2 R8N59W8GWt7vzvX4A6DfC6NGKpfq9LnwcpRp2F/8xRu0ywTgNY9EngyQ86Weomu23r1v Hvuh/Eg50sSkRAxzRNSVVHOTNXqlazIxmkNVkk5Rz4k/eRit6zOI9TZ36E8co0kQMa0Y DY99fFUvtDUtxuD50HC3AhWx1M+JyaDUYh5xEHemKwpxxsu/ArKVf4cCrv/1Nn0RSWbh EVtQH997p32uJtzhmdfRlLb+wZoURYurkBjmWEmzaIvB7OfIYphTNpIgSVDaxAlSNvDA e8RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760188213; x=1760793013; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=vh0REF7UaecpC4ae2JcxVQtnG5Y03RfEy1CDnJiFEgc=; b=N5IZDJbkIypBSItDDOPHBUnRwsrEO3vIryt+31ZLXugrVydFcttkDqbnXl3jNEN/Zz hIJTKr8wKPyKdoQUIw7rJRanHBCi4moFwY/RjbfPjNATA2aqP5PfDvGVQ2uIy+xK7aZ4 vhndvP5UwF5ppMjPyaNeNrFJbpaq5i+0tmIRR2DwVbrlnpKYlSvt6U4TxeWYIYHW1B+W D0sn0g5OUjpsKwP6oJruFaWUI9p2T8nWeiBwYK0AGob25MPM41DbK2Q/n+KACC6Qjzkm DIsBevYCby+dCHHbtaIR7YfTXutjYsqkSqXIhnrihmXADmxyD5yCK080JQwMjgltw85o gNKg== X-Forwarded-Encrypted: i=1; AJvYcCWvRExm//cndQCRiBFB7o9mi7XkceoTii47Z3jA1ao+JiFGOL7Rlmi18XaUEjuWNTd4A3luFrvPVnxQDA==@sourceware.org X-Gm-Message-State: AOJu0Yxt5OI5kD7k1+sogNW/CHz4FMKYaYd/lumUht80XR3KtoN5yVlX yizPqmPqUxVVMM+oLavxjnuBoX97PIc1UkmRIKlW/x7BaFPS8PfJhYWW X-Gm-Gg: ASbGncsGv7EsmhX6bgsRvj6D1h8GtZwjq+D4s26yDw1C6TKVEpt2hbGiSl8I2lWF5nE N8Mk1iUxjVx1htOIHyZOZQkhgIfgvRFQh09kGI6hZIzM0RDwf0PMVZ9gFgqKGaWBC4exFRbV9KH BAOR30oKW8HkuLeycS1rObPOfcTEWQnxiiyPzfjr3VbdtHDr/MzjNJwNPGOz5LavbZqhuOAzKsY wweoME4+M6N/LCqKqHTtprrCDOgkH+OObpMQqv2tvcwhvMhVeissy4UXwC1DO2whZduCSSi1MoL X0OHHDKOMW3g2WJtYOV/WGUUgSp16nxVxhhhxt2I9nTSg7wIHi0oo8acU64C4lpFwZSQ6R++z8N QNsdXbkPZH5f9hAgh6ovN6h70M+BIbIZaT5Fn89xRJ6DYqv3ZmhFzqg== X-Google-Smtp-Source: AGHT+IF8M5qa8eCJq/E56q9X9RwRDoMjqZ4G7EnaueS4nDwdq53IRYGFNUQFSZsu2eBHzFZ0Ux6S1Q== X-Received: by 2002:a05:600c:a402:b0:46f:b43a:aef4 with SMTP id 5b1f17b1804b1-46fb43aaf69mr38607535e9.38.1760188212683; Sat, 11 Oct 2025 06:10:12 -0700 (PDT) Received: from [192.168.0.38] ([86.12.216.189]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-46fb482b9easm95507905e9.1.2025.10.11.06.10.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 11 Oct 2025 06:10:12 -0700 (PDT) Message-ID: <148a9787-fe74-4ebb-99dd-8a50174510ce@gmail.com> Date: Sat, 11 Oct 2025 14:10:11 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 3/4] gdb/aarch64: Display fp8 formats in registers Content-Language: en-US To: Ezra.Sitorus@arm.com, gdb-patches@sourceware.org Cc: eliz@gnu.org References: <20250925211804.21967-1-Ezra.Sitorus@arm.com> <20250925211804.21967-4-Ezra.Sitorus@arm.com> From: Luis In-Reply-To: <20250925211804.21967-4-Ezra.Sitorus@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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 Ezra, Given Pedro's input about the representation of fp8's, I'm not sure this is the right path. Enabling these types for the registers would also make the types visible to the rest of GDB. And users can operate on them via arithmetic operators etc. Being integers, the ending result wouldn´t be correct. It might be viable to explore the python extension option to print the types accordingly. We already make vector fields (neon or sve) available as 8, 16, 32, 64 and 128 integers. Converting from that would therefore be easy. Also, I'm not too keen on expanding even further these neon/sve union types. They are very hard to parse due to the multitude of representations. Ideally we´d put together some pseudo-registers to do the job. That would also help with remote debugging stub target description compatibility, as those wouldn´t need to expose these internal details of gdb. Thoughts? On 25/09/2025 22:18, Ezra.Sitorus@arm.com wrote: > From: Ezra Sitorus > > Display fp8 formats for AArch64 vector/float registers. On a system > without SVE, the V register and B-pseudo registers have the new > e5m2/e4m3 formats. If it has SVE, then the Z registers, V and B pseudo > registers get the new e5m2/e4m3 formats. > --- > gdb/aarch64-tdep.c | 41 ++++++++++++++++++++++++++++++++++++ > gdb/aarch64-tdep.h | 4 ++++ > gdb/features/aarch64-fpu.c | 10 +++++++++ > gdb/features/aarch64-fpu.xml | 4 ++++ > gdb/features/aarch64-sve.c | 10 +++++++++ > 5 files changed, 69 insertions(+) > > diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c > index 500ac77d75a..8e71a75efbb 100644 > --- a/gdb/aarch64-tdep.c > +++ b/gdb/aarch64-tdep.c > @@ -2106,6 +2106,40 @@ aarch64_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp) > return sp & ~(CORE_ADDR) 15; > } > > +/* Return the type for FP8 E5M2 format. */ > + > +static struct type * > +aarch64_fp8_e5m2_type (struct gdbarch *gdbarch) > +{ > + aarch64_gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); > + > + if (!tdep->fp8_e5m2_type) > + { > + type_allocator alloc (gdbarch); > + tdep->fp8_e5m2_type = init_float_type ( > + alloc, -1, "builtin_type_fp8_e5m2", floatformats_fp8_e5m2); > + } > + > + return tdep->fp8_e5m2_type; > +} > + > +/* Return the type for FP8 E4M3 format. */ > + > +static struct type * > +aarch64_fp8_e4m3_type (struct gdbarch *gdbarch) > +{ > + aarch64_gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); > + > + if (!tdep->fp8_e4m3_type) > + { > + type_allocator alloc (gdbarch); > + tdep->fp8_e4m3_type = init_float_type ( > + alloc, -1, "builtin_type_fp8_e4m3", floatformats_fp8_e4m3); > + } > + > + return tdep->fp8_e4m3_type; > +} > + > /* Return the type for an AdvSISD Q register. */ > > static struct type * > @@ -2247,6 +2281,9 @@ aarch64_vnb_type (struct gdbarch *gdbarch) > elem = builtin_type (gdbarch)->builtin_int8; > append_composite_type_field (t, "s", elem); > > + append_composite_type_field (t, "e5m2", aarch64_fp8_e5m2_type (gdbarch)); > + append_composite_type_field (t, "e4m3", aarch64_fp8_e4m3_type (gdbarch)); > + > tdep->vnb_type = t; > } > > @@ -2516,6 +2553,10 @@ aarch64_vnv_type (struct gdbarch *gdbarch) > init_vector_type (bt->builtin_uint8, 16)); > append_composite_type_field (sub, "s", > init_vector_type (bt->builtin_int8, 16)); > + append_composite_type_field (sub, "e5m2", > + init_vector_type (aarch64_fp8_e5m2_type (gdbarch), 16)); > + append_composite_type_field (sub, "e4m3", > + init_vector_type (aarch64_fp8_e4m3_type (gdbarch), 16)); > append_composite_type_field (t, "b", sub); > > sub = arch_composite_type (gdbarch, "__gdb_builtin_type_vnq", > diff --git a/gdb/aarch64-tdep.h b/gdb/aarch64-tdep.h > index 99e7d26ce4a..d9f44f1c15c 100644 > --- a/gdb/aarch64-tdep.h > +++ b/gdb/aarch64-tdep.h > @@ -93,6 +93,10 @@ struct aarch64_gdbarch_tdep : gdbarch_tdep_base > struct type *sme_tile_slice_type_h = nullptr; > struct type *sme_tile_slice_type_b = nullptr; > > + /* Types for FP8 formats. */ > + struct type *fp8_e5m2_type = nullptr; > + struct type *fp8_e4m3_type = nullptr; > + > /* Vector of names for SME pseudo-registers. The number of elements is > different for each distinct svl value. */ > std::vector sme_pseudo_names; > diff --git a/gdb/features/aarch64-fpu.c b/gdb/features/aarch64-fpu.c > index 27e75524cfe..13825c74640 100644 > --- a/gdb/features/aarch64-fpu.c > +++ b/gdb/features/aarch64-fpu.c > @@ -46,6 +46,12 @@ create_feature_aarch64_fpu (struct target_desc *result, long regnum) > element_type = tdesc_named_type (feature, "int8"); > tdesc_create_vector (feature, "v16i", element_type, 16); > > + element_type = tdesc_named_type (feature, "fp8_e5m2"); > + tdesc_create_vector (feature, "v16fp8e5m2", element_type, 16); > + > + element_type = tdesc_named_type (feature, "fp8_e4m3"); > + tdesc_create_vector (feature, "v16fp8e4m3", element_type, 16); > + > element_type = tdesc_named_type (feature, "uint128"); > tdesc_create_vector (feature, "v1u", element_type, 1); > > @@ -85,6 +91,10 @@ create_feature_aarch64_fpu (struct target_desc *result, long regnum) > tdesc_add_field (type_with_fields, "u", field_type); > field_type = tdesc_named_type (feature, "v16i"); > tdesc_add_field (type_with_fields, "s", field_type); > + field_type = tdesc_named_type (feature, "v16fp8e5m2"); > + tdesc_add_field (type_with_fields, "e5m2", field_type); > + field_type = tdesc_named_type (feature, "v16fp8e4m3"); > + tdesc_add_field (type_with_fields, "e4m3", field_type); > > type_with_fields = tdesc_create_union (feature, "vnq"); > field_type = tdesc_named_type (feature, "v1u"); > diff --git a/gdb/features/aarch64-fpu.xml b/gdb/features/aarch64-fpu.xml > index 509824f55fb..26e292ee625 100644 > --- a/gdb/features/aarch64-fpu.xml > +++ b/gdb/features/aarch64-fpu.xml > @@ -20,6 +20,8 @@ > > > > + > + > > > > @@ -41,6 +43,8 @@ > > > > + > + > > > > diff --git a/gdb/features/aarch64-sve.c b/gdb/features/aarch64-sve.c > index 0b15881f073..24b88c32fc1 100644 > --- a/gdb/features/aarch64-sve.c > +++ b/gdb/features/aarch64-sve.c > @@ -70,6 +70,12 @@ create_feature_aarch64_sve (struct target_desc *result, long regnum, > element_type = tdesc_named_type (feature, "int8"); > tdesc_create_vector (feature, "svevbs", element_type, 16 * scale); > > + element_type = tdesc_named_type (feature, "fp8_e5m2"); > + tdesc_create_vector (feature, "svevbfp8e5m2", element_type, 16 * scale); > + > + element_type = tdesc_named_type (feature, "fp8_e4m3"); > + tdesc_create_vector (feature, "svevbfp8e4m3", element_type, 16 * scale); > + > type_with_fields = tdesc_create_union (feature, "svevnq"); > field_type = tdesc_named_type (feature, "svevqu"); > tdesc_add_field (type_with_fields, "u", field_type); > @@ -105,6 +111,10 @@ create_feature_aarch64_sve (struct target_desc *result, long regnum, > tdesc_add_field (type_with_fields, "u", field_type); > field_type = tdesc_named_type (feature, "svevbs"); > tdesc_add_field (type_with_fields, "s", field_type); > + field_type = tdesc_named_type (feature, "svevbfp8e5m2"); > + tdesc_add_field (type_with_fields, "e5m2", field_type); > + field_type = tdesc_named_type (feature, "svevbfp8e4m3"); > + tdesc_add_field (type_with_fields, "e4m3", field_type); > > type_with_fields = tdesc_create_union (feature, "svev"); > field_type = tdesc_named_type (feature, "svevnq");