From unknown Sun Jun 22 11:33:49 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#69770 <69770@debbugs.gnu.org> To: bug#69770 <69770@debbugs.gnu.org> Subject: Status: [PATCH] build: strengthen 16 bit float support checks Reply-To: bug#69770 <69770@debbugs.gnu.org> Date: Sun, 22 Jun 2025 18:33:49 +0000 retitle 69770 [PATCH] build: strengthen 16 bit float support checks reassign 69770 coreutils submitter 69770 Grisha Levit severity 69770 normal tag 69770 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Tue Mar 12 22:26:35 2024 Received: (at submit) by debbugs.gnu.org; 13 Mar 2024 02:26:35 +0000 Received: from localhost ([127.0.0.1]:44258 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rkEKA-0001mo-Ug for submit@debbugs.gnu.org; Tue, 12 Mar 2024 22:26:35 -0400 Received: from lists.gnu.org ([209.51.188.17]:49334) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rkEK5-0001me-TP for submit@debbugs.gnu.org; Tue, 12 Mar 2024 22:26:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rkEJV-0000Tb-0m for bug-coreutils@gnu.org; Tue, 12 Mar 2024 22:25:53 -0400 Received: from mail-qk1-x734.google.com ([2607:f8b0:4864:20::734]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rkEJT-0002Tv-JN for bug-coreutils@gnu.org; Tue, 12 Mar 2024 22:25:52 -0400 Received: by mail-qk1-x734.google.com with SMTP id af79cd13be357-789cbdfd06cso943285a.1 for ; Tue, 12 Mar 2024 19:25:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710296749; x=1710901549; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=F8OFSUIefrGaBB+LEZXwvRtRYQKnH0u+NWGFYCTp6uI=; b=L8L0jA+Ddr8zSvmw3vjfIxZ6TbheBNXqS7dDfulWWqXCEsTcMd4UvEGuwql/Aj0EYl nRCPLSvOM97lBBNKpCYxEpacPnGujVyj1mEBi7w99VI3NZ84B+D8MqqRDC214+pCZdXM 93twU6P9uBfIHAHVE0DIfo3pFVhVTUCf4IKp6OS3vToioceuEKlYKiZfE8n3IfSQMz8l pHToKa0q0wdBrz6RPcQzTNyMJpdYpiKj7Cf08/zBkvVywGNviVUaHXhwIIHxYPsDq+uV RzukMkBgpALPL4O7o4WWEazpxWycfY2jBDbYn8iQW4oi7gKpq6brRyIoVa71XDkjxkff EYHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710296749; x=1710901549; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=F8OFSUIefrGaBB+LEZXwvRtRYQKnH0u+NWGFYCTp6uI=; b=K9gUK/HnhsSOye8GuYLtIC9eSH1VPrWIwyaWa3BPPRg8A7f3xO1jh3I/PYMyphaMER un+Z+5EDAXe4UykZOS9gQHyOHe5gObIYF3uRkYnV0CQj2nP5shPUo/qhRWZY27ko+kCr A7UhMNMTfvBwhndYbwQD8WUrdXGrmEgWgY/yGfwWqybXXYRgVE7qhroaIsJcgX9wKsXR lNt2113gLtxRyTFYNhf9un/4CBi1vRbUSyhUkka4SBBZ7ib5JIAg0QqeIryBAmzAZolj DY/JVO4ZmGYxIvCIXVeja6M7B3CKY5f1kEBUBdOGfviCNA0vl8PqnJ1BtbvUcb7eeE3k TXZQ== X-Gm-Message-State: AOJu0Ywty8f7k512Revnvqa9CrlxkH8pAyFq60AcqlWdJskrQMnUgqDi JEW38Fh1Xwrrjhq6t2QI2aKnGwkRszuytLL4+25MH/XOesL9MnH+GB03QrxEXUY= X-Google-Smtp-Source: AGHT+IGlT5v3aF8L1+lujC4cZwEBCU+24csepJhQari+UWkH6oukEiOfqFco68DVFUvoNzrBweiTjg== X-Received: by 2002:a05:620a:94d:b0:788:2176:e1ed with SMTP id w13-20020a05620a094d00b007882176e1edmr12581228qkw.41.1710296749146; Tue, 12 Mar 2024 19:25:49 -0700 (PDT) Received: from localhost ([4.7.173.99]) by smtp.gmail.com with UTF8SMTPSA id bj33-20020a05620a192100b00788435ab818sm4276419qkb.0.2024.03.12.19.25.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 12 Mar 2024 19:25:48 -0700 (PDT) From: Grisha Levit To: bug-coreutils@gnu.org Subject: [PATCH] build: strengthen 16 bit float support checks Date: Tue, 12 Mar 2024 22:24:34 -0400 Message-ID: <20240313022545.13117-1-grishalevit@gmail.com> X-Mailer: git-send-email 2.44.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::734; envelope-from=grishalevit@gmail.com; helo=mail-qk1-x734.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit Cc: Grisha Levit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) Recent clang provides __bf16 on aarch64 but it is broken. If built with -O0, the conversion is wrong: $ printf '\x3F\x80' | od --end=big -An -tfB | tr -d ' ' 1.875 If built with -O1 or higher, compilation fails: fatal error: error in backend: Cannot select: 0xb400007a58d29780: f32 = fp_extend 0xb400007a58d31720 0xb400007a58d31720: bf16,ch = CopyFromReg 0xb400007b78c53720, Register:bf16 %13 0xb400007a58d29470: bf16 = Register %13 In function: print_bfloat The latter issue does not cause the existing configure test to fail because the promotion is optimized out. * configure.ac: Ensure 16 bit float promotion code does not get optimized out, and produces an expected result. --- configure.ac | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 248e30ca2..21bee28d1 100644 --- a/configure.ac +++ b/configure.ac @@ -569,13 +569,14 @@ ac_c_werror_flag=$cu_save_c_werror_flag # Test compiler support for half precision floating point types (for od) AC_MSG_CHECKING([IEEE 16 bit floating point]) - AC_COMPILE_IFELSE( + AC_RUN_IFELSE( [AC_LANG_SOURCE([[ int main (void) { - _Float16 hf; + volatile _Float16 hf = 1; float f = hf; /* Ensure compiler can promote to float. */ + return !(f == 1.0f); } ]]) ],[ @@ -589,13 +590,14 @@ if test $ieee_16_bit_supported = yes; then fi AC_MSG_CHECKING([Brain 16 bit floating point]) - AC_COMPILE_IFELSE( + AC_RUN_IFELSE( [AC_LANG_SOURCE([[ int main (void) { - __bf16 hf; + volatile __bf16 hf = 1; float f = hf; /* Ensure compiler can promote to float. */ + return !(f == 1.0f); } ]]) ],[ -- 2.44.0 From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 13 08:38:42 2024 Received: (at 69770-done) by debbugs.gnu.org; 13 Mar 2024 12:38:42 +0000 Received: from localhost ([127.0.0.1]:44970 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rkNsX-000550-UL for submit@debbugs.gnu.org; Wed, 13 Mar 2024 08:38:42 -0400 Received: from mail-wm1-f45.google.com ([209.85.128.45]:46507) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rkNsW-00054n-2M for 69770-done@debbugs.gnu.org; Wed, 13 Mar 2024 08:38:40 -0400 Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-413e6a11280so6071915e9.1 for <69770-done@debbugs.gnu.org>; Wed, 13 Mar 2024 05:38:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710333419; x=1710938219; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=+/kKgDNtvToJv47PsgNKNEZRx0i9Br0e2Tm+MDa+E7Q=; b=NFk9mDPoFcpZoQ9iTXz1lHSQ/y+eGBM0sYWLsmId6t+AhZgFUxP8ag7YjAKk55ayWf sA3N8PtL7l/VJSlAeevsjGfv4YLSizBAl56Y9Zv5udN2uxK51u0FixGwevux64em/EoM 4Ko47HFDsRmUqe5iRhUpwRnNpY84K5fU93zMP09H4eOVhLZJIpUPmmBISXxJ3+qX3KXN LyuHXKxpILfzIo/AhDkEfYx13ZvSX63NX7bEhCSC2ZBincsx9cFqDp3NW7Rutp73/AoE jtk4e1riJyqIOuL5kwAcK3UuulRjIUKfzEOV+uaR/L9C0EeX3okG8CqFnwv/nRciMbFl yaKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710333419; x=1710938219; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+/kKgDNtvToJv47PsgNKNEZRx0i9Br0e2Tm+MDa+E7Q=; b=BbaWQ6fJs6e7rQgTtqIk8Cx8HgCxnqCuBRJKuOXgIBg3Pu7wz4oC7KmdvnrV9yTQtC aMNhbJbtDs81pW9ZJ2ljsFGA1rmUkzk6nNWDyTcvP3SlaFlYEi7v/zw3KtyB70UpdtWL RVvegSx8fdePcA+zwAwTQbf6inPn27wdfXUwFk9lCv57ltLJhmUjvya7bewnAWLmdQQh RptlQlV+7mFGBIuDYTfs+337JsM7dW/NfqsRed3HuoKKD2tfpK7KWQJsiyuEz284/6FJ jiax4COeYnGfnNvMo0fZMDMmJIaxenuXjW+GI38QN4kd2uEfHejgqte/fJdz8r/1e5bC VkjQ== X-Forwarded-Encrypted: i=1; AJvYcCXVt4JyQCFwZxqbqmAISpe/PhpUNFJ3w3021aa8ssWgAlQpWhmweVHmM+hMARnduLrtlzkHYEE6uOPmga7OAuQ+TqYjaKbI++aBsQ== X-Gm-Message-State: AOJu0YwbB9GbKr8rDg+rujPCyHfj2SGTLJGMEtCCtgcVZWILj29DkZc2 38BW+I+BhVfYhWT+BsIenD2l68nrVxbNJQSZWSV8Q3kkuTHwxs+i X-Google-Smtp-Source: AGHT+IEbyzpgjm2xxjqzGYaAXGAUZDZjl2IlkV2uvjd1LzJMYYs4L8WGcoqo/Aqi037H0qWIV4PtGQ== X-Received: by 2002:a05:600c:4710:b0:413:286c:4fc3 with SMTP id v16-20020a05600c471000b00413286c4fc3mr2253146wmo.10.1710333418839; Wed, 13 Mar 2024 05:36:58 -0700 (PDT) Received: from [192.168.1.28] ([86.44.211.146]) by smtp.googlemail.com with ESMTPSA id n7-20020a05600c3b8700b00413ea3db648sm1766691wms.26.2024.03.13.05.36.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 13 Mar 2024 05:36:58 -0700 (PDT) Message-ID: <40cecf61-b314-8648-ede4-a86ffdeda226@draigBrady.com> Date: Wed, 13 Mar 2024 12:36:51 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#69770: [PATCH] build: strengthen 16 bit float support checks Content-Language: en-US To: Grisha Levit , 69770-done@debbugs.gnu.org References: <20240313022545.13117-1-grishalevit@gmail.com> From: =?UTF-8?Q?P=C3=A1draig_Brady?= In-Reply-To: <20240313022545.13117-1-grishalevit@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: 0.2 (/) X-Debbugs-Envelope-To: 69770-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.8 (/) On 13/03/2024 02:24, Grisha Levit wrote: > Recent clang provides __bf16 on aarch64 but it is broken. > > If built with -O0, the conversion is wrong: > > $ printf '\x3F\x80' | od --end=big -An -tfB | tr -d ' ' > 1.875 > > If built with -O1 or higher, compilation fails: > > fatal error: error in backend: Cannot select: 0xb400007a58d29780: f32 = fp_extend 0xb400007a58d31720 > 0xb400007a58d31720: bf16,ch = CopyFromReg 0xb400007b78c53720, Register:bf16 %13 > 0xb400007a58d29470: bf16 = Register %13 > In function: print_bfloat > > The latter issue does not cause the existing configure test to fail > because the promotion is optimized out. > > * configure.ac: Ensure 16 bit float promotion code does not get > optimized out, and produces an expected result. Looks good! I'll follow up with another patch to all these involved checks to be cached / bypassed, by wrapping them in AC_CACHE_VAL(). Marking this as done. thanks! Pádraig From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 14 02:00:22 2024 Received: (at 69770) by debbugs.gnu.org; 14 Mar 2024 06:00:22 +0000 Received: from localhost ([127.0.0.1]:47829 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rke8c-0003VJ-CE for submit@debbugs.gnu.org; Thu, 14 Mar 2024 02:00:22 -0400 Received: from mail.cs.ucla.edu ([131.179.128.66]:56752) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rke8Z-0003V4-Ku for 69770@debbugs.gnu.org; Thu, 14 Mar 2024 02:00:20 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id ADB423C00F4E2; Wed, 13 Mar 2024 22:59:37 -0700 (PDT) Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP id xOzX5upWwHrf; Wed, 13 Mar 2024 22:59:37 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 4860A3C00F4E3; Wed, 13 Mar 2024 22:59:37 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 4860A3C00F4E3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1710395977; bh=g240+/uw48Cstawf77wKsZEt66Qd9q6TUsqqRzA5rF0=; h=Message-ID:Date:MIME-Version:To:From; b=QuG4vU4seV6n9+RW+YW7IcQbkSIq5qlsva5r+TPZ0GR1snUsT3kjY9QV72yUJ/bOE t1p2x5+KC12tFUGq/ACzcV72GzIYKahw5z0mSGt7dkgOcBRu3FQB8EnkTqQt1jIZkT REABu7WUekJLFOaVRQnqdZZvG3iDaFhTtdgLzZ7R61dNKmEjRupYMcA9v6spKGCiAJ OdQKrpunvqlcjy3hPcznZaHn1a9155KmDNseUt7lMl6xVUA+Cdf7e9pKYGF4V4JZYc hUo+cDtHDCFdLt/BsNp3MvKjsw5n/WWszWeDNn/2wfDlce3xwAR7TRGKFAA2v1gnhq xLBE/vajpKN8A== X-Virus-Scanned: amavis at mail.cs.ucla.edu Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id ehv3vhCq2tG1; Wed, 13 Mar 2024 22:59:37 -0700 (PDT) Received: from [192.168.254.12] (unknown [47.148.192.211]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id 23A0B3C00F4E2; Wed, 13 Mar 2024 22:59:37 -0700 (PDT) Message-ID: <2613e2f8-93e3-4c52-af45-8552b4f60e96@cs.ucla.edu> Date: Wed, 13 Mar 2024 22:59:36 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#69770: [PATCH] build: strengthen 16 bit float support checks Content-Language: en-US To: Grisha Levit , 69770@debbugs.gnu.org References: <20240313022545.13117-1-grishalevit@gmail.com> From: Paul Eggert Organization: UCLA Computer Science Department In-Reply-To: <20240313022545.13117-1-grishalevit@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 69770 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 2024-03-12 19:24, Grisha Levit wrote: > - AC_COMPILE_IFELSE( > + AC_RUN_IFELSE( This sort of change would break cross-compilation, no? How about leaving it AC_COMPILE_IFELSE, but ensuring that -O1 or better is used when the compiler supports -O1? That way we don't have to worry about running the program, because (with the "volatile") clang will error out. Alternatively perhaps there's some way to check for the bug using preprocessor macros like __FLT16_MANT_DIG__, __FLT16_MAX_EXP__, __clang_major__, and __aarch64__. (This could be more fragile, though, as clang presumably will fix the bug eventually.) From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 14 09:05:26 2024 Received: (at 69770) by debbugs.gnu.org; 14 Mar 2024 13:05:26 +0000 Received: from localhost ([127.0.0.1]:49006 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rkklx-0002CE-UE for submit@debbugs.gnu.org; Thu, 14 Mar 2024 09:05:26 -0400 Received: from mail-lf1-f53.google.com ([209.85.167.53]:57778) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rkklw-0002Bz-1i for 69770@debbugs.gnu.org; Thu, 14 Mar 2024 09:05:24 -0400 Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-513d4559fb4so361947e87.3 for <69770@debbugs.gnu.org>; Thu, 14 Mar 2024 06:04:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710421422; x=1711026222; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=girlwZGLrCHrYNi9Vnu6EbNNvGpXjw2hBtXGaOT402c=; b=YIjy+IQAOCVczD7dC5eAAtnJ5jsqE6J/od7cRl6KX79YOG8epvrduljhelNEAIjer1 SStpAg/0kcqzbz5WgPfFUwGLUnpiWzdYdzW9hwA0gUIOQ0bgQ3Fv6Pmwyh4TXaONRKko G8ZAfxzNvRRHH0z/JfbZZxQme8MfLsaOI4guSBpq8H0zl9R+6W9UxuclWe/zVvEZKBZ7 yR8pinxyj4CXOetblsgkMEMj4s0mHbEkaXukhkpYvIrg5Wrj2Fyr8RsrzXWYVfQFGx9p fOq5QKs0cOx4abqKZ2+2IlcMnKy6gZ10EME/tEmk5zf9XKnvz/L6U4BJI0r8SQXLbxh4 XNYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710421422; x=1711026222; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=girlwZGLrCHrYNi9Vnu6EbNNvGpXjw2hBtXGaOT402c=; b=h0zvmlvwMg08wPGieZ8DI4h0BkQesWvzlodk3H6HmQqFt7TIhMEf1xS+1yUDQjC6NC F37NRjpBJaKN5ExoHHmVEzMEX0UbU7vTmWoBPuH2WfcX3gCm12/uZpITi3KEs0prKXPF WpfT6j/Tm4Ik9L4QXYquOYUfJYLl5aUKTfTbp+5t5cfdKEUKCImNvi3ib0sMRyXqioDA gep6vRQe8Q2IDo/xDCJaZf35OJQIKG5g95S1Rgyi7xzHhPlDwlPVDe6C9VqKB3m26U0a ec2V4gBJ7SwKmtk53YJSUiMu6/uv4aTpfjLuhcTYd3bFxwg9wXykxrLR1X0JCWArdVrm IxJg== X-Forwarded-Encrypted: i=1; AJvYcCWMt8ZA1gL9CxIWpZEODnZLHNPKFVbc3X+qOWnp5Yft8uzIGl3PKM/vN2EH0Di4qEbnmM5ICyxj0Rz/zvLbNbfegMtAexY= X-Gm-Message-State: AOJu0YzL5y+w+3BA55X6K+yzRzAOEltjip4DiZjGOOxhpi0vCxuKujcT hm5W1xPc2n6157+bEqjlczduhaedg/kcvKXVJ776JvFFXq2txBAY X-Google-Smtp-Source: AGHT+IH/gmoLyoTamDba5HzrLulEiFXvCoggs64yqmz/12djZwP2JTSJ6BrIO1UXezkdxZeD41RUEw== X-Received: by 2002:a19:740a:0:b0:513:cc23:3b6b with SMTP id v10-20020a19740a000000b00513cc233b6bmr1218811lfe.48.1710421421838; Thu, 14 Mar 2024 06:03:41 -0700 (PDT) Received: from [192.168.1.28] (86-44-211-146-dynamic.agg2.lod.rsl-rtd.eircom.net. [86.44.211.146]) by smtp.googlemail.com with ESMTPSA id he13-20020a05600c540d00b00413f7a2b33esm952215wmb.1.2024.03.14.06.03.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 14 Mar 2024 06:03:41 -0700 (PDT) Message-ID: Date: Thu, 14 Mar 2024 13:03:40 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#69770: [PATCH] build: strengthen 16 bit float support checks Content-Language: en-US To: Paul Eggert , Grisha Levit , 69770@debbugs.gnu.org References: <20240313022545.13117-1-grishalevit@gmail.com> <2613e2f8-93e3-4c52-af45-8552b4f60e96@cs.ucla.edu> From: =?UTF-8?Q?P=C3=A1draig_Brady?= In-Reply-To: <2613e2f8-93e3-4c52-af45-8552b4f60e96@cs.ucla.edu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: 0.2 (/) X-Debbugs-Envelope-To: 69770 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.8 (/) On 14/03/2024 05:59, Paul Eggert wrote: > On 2024-03-12 19:24, Grisha Levit wrote: >> - AC_COMPILE_IFELSE( >> + AC_RUN_IFELSE( > > This sort of change would break cross-compilation, no? It would disable this feature for cross-compilation yes, but this isn't the first instance of AC_RUN_IFELSE we use. > How about leaving it AC_COMPILE_IFELSE, but ensuring that -O1 or better > is used when the compiler supports -O1? That way we don't have to worry > about running the program, because (with the "volatile") clang will > error out. > > Alternatively perhaps there's some way to check for the bug using > preprocessor macros like __FLT16_MANT_DIG__, __FLT16_MAX_EXP__, > __clang_major__, and __aarch64__. (This could be more fragile, though, > as clang presumably will fix the bug eventually.) That would probably work for this edge case, but it's brittle and I'm worried about other combinations of compiler versions, complier options, and architectures. For example sse availability is in the mix here, so this will now correctly avoid this feature with: CFLAGS=-mno-sse ./configure --quiet Whereas previously it would have built but produced wrong values. cheers, Pádraig. From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 14 09:36:26 2024 Received: (at submit) by debbugs.gnu.org; 14 Mar 2024 13:36:26 +0000 Received: from localhost ([127.0.0.1]:49072 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rklFy-0002wZ-21 for submit@debbugs.gnu.org; Thu, 14 Mar 2024 09:36:26 -0400 Received: from lists.gnu.org ([209.51.188.17]:59072) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rklFu-0002wP-5w for submit@debbugs.gnu.org; Thu, 14 Mar 2024 09:36:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rklFI-0001UX-FL for bug-coreutils@gnu.org; Thu, 14 Mar 2024 09:35:44 -0400 Received: from mail-ot1-x333.google.com ([2607:f8b0:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rklFF-0000F5-Q2 for bug-coreutils@gnu.org; Thu, 14 Mar 2024 09:35:43 -0400 Received: by mail-ot1-x333.google.com with SMTP id 46e09a7af769-6e519d73850so633229a34.2 for ; Thu, 14 Mar 2024 06:35:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710423338; x=1711028138; darn=gnu.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=N5oqIh1RkaomQK8c0tDnqpys0kecl3/tSn+6ZhfA+4k=; b=D20jvp/vuB2K0k3SMpqNyxp/dhWX1cXrFO0dgRceN/43oAoGjnGYUX+d3cbf/7wYeC PiJsZoA0jSzMe4gNVSUGiJd8SiyaFFXW8vWUx7hKfniqOpNt5mzxV5YOUk64xWMemcLg F9MIUDDu2/tltCvwnCqw9IqzUAS/x3s35jzJTvYtX61aLcSeeC38oKcRyjMbtpLe/1wu YK4XjPDlKHL0GtVLgRKaKHuJ8EvU/f+DOBmKdjOzrFEWgX5Zvyol9Drp/uySv9O3h8XB c9kWFCRV+01UmI2H2FXJOYEfvvcVHjgG+7CgBfyj4fjGmMwPxKl4MNVQBFmSnrXFoGOi POwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710423338; x=1711028138; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=N5oqIh1RkaomQK8c0tDnqpys0kecl3/tSn+6ZhfA+4k=; b=C7B21EpEELSKzz2YuI/XAZJVJZf2mdtGWxxf9EGKfEgouTBVlFH9AqvPqzbMzE+lv2 Tbj4T2mjHvo7KcdUhnbTVZGAcuYKFuQ4p4DljmwaSdvHqRFuHJ0x0IeOpLH2fysGp7/5 igl0+aDdsbzP2tgWsGVNscg+aRKnzC35f5nBUXiXOj2kYAucwRzv1A5N8ab+cgzYAjgh mZwIHKVzs3BERkpmnYGxzGrvtXr7tB31SVVVkmzxyGfjBF2hHv16Ry0LvBatjgBcOuKM KodVjEhFXz/dAthTEkpQx81GJwp894S5Fi6irvGG4wLhtM8ZBHdVwqi6N03wkQEvA6Bj cNYw== X-Gm-Message-State: AOJu0Yyvylh4MKUYN48+881RkDY2H/l2Fmhto4TAf76G5sz+4MAIvJ7e numaYrpOU9siqBBGlMdNkEe2ZBYtDsSbnR1yqLVFoygNBcKl/20Tf8AefsLpZSc= X-Google-Smtp-Source: AGHT+IHUS94USr3WxEIa747LL4Wx/te2FZPUIJkQhAR5c6ZYP9aU3lntwwiUmigIzf3wxW6MBUuhCg== X-Received: by 2002:a05:6830:1613:b0:6e5:2347:9dbc with SMTP id g19-20020a056830161300b006e523479dbcmr1754962otr.35.1710423338340; Thu, 14 Mar 2024 06:35:38 -0700 (PDT) Received: from [192.168.1.5] (c-73-189-213-139.hsd1.ca.comcast.net. [73.189.213.139]) by smtp.gmail.com with ESMTPSA id y127-20020a1f7d85000000b004d41ded4a4asm85331vkc.15.2024.03.14.06.35.37 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 14 Mar 2024 06:35:37 -0700 (PDT) Message-ID: Date: Thu, 14 Mar 2024 06:35:36 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#69770: [PATCH] build: strengthen 16 bit float support checks To: bug-coreutils@gnu.org References: <20240313022545.13117-1-grishalevit@gmail.com> <2613e2f8-93e3-4c52-af45-8552b4f60e96@cs.ucla.edu> Content-Language: en-US From: Collin Funk In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::333; envelope-from=collin.funk1@gmail.com; helo=mail-ot1-x333.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.1 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.1 (--) On 3/14/24 6:03 AM, Pádraig Brady wrote: > It would disable this feature for cross-compilation yes, > but this isn't the first instance of AC_RUN_IFELSE we use. Sorry if this is not the proper place to ask, but would it be possible to make Autoconf use an emulator when cross-compiling? This issue would be *less* of a problem in that case. I am more familiar with CMake where check_c_source_runs is used performs a similar task [1]. It is essentially a wrapper function around try_run [2]. CMake allows you to set CMAKE_CROSSCOMPILING_EMULATOR which will make try_run use an emulator to run programs instead [3]. I've used this with Wine and QEMU User a few times and it makes CMake's configure tests work fine (though much slower). If this functionality seems beneficial then I can look into adding it to Autoconf. [1] https://cmake.org/cmake/help/latest/module/CheckCSourceRuns.html [2] https://github.com/Kitware/CMake/blob/4285dec5f012260337193f29f18899d6cf2536a4/Modules/Internal/CheckSourceRuns.cmake#L93 [3] https://cmake.org/cmake/help/latest/variable/CMAKE_CROSSCOMPILING_EMULATOR.html Collin From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 14 10:50:38 2024 Received: (at 69770) by debbugs.gnu.org; 14 Mar 2024 14:50:38 +0000 Received: from localhost ([127.0.0.1]:50423 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rkmPm-0005NT-Ed for submit@debbugs.gnu.org; Thu, 14 Mar 2024 10:50:38 -0400 Received: from mail-wr1-f50.google.com ([209.85.221.50]:57460) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rkmPg-0005N2-Ne for 69770@debbugs.gnu.org; Thu, 14 Mar 2024 10:50:36 -0400 Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-33d38c9ca5bso578250f8f.2 for <69770@debbugs.gnu.org>; Thu, 14 Mar 2024 07:49:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710427731; x=1711032531; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=Xa5+cwFKiVxnAE1tEWrVd1fueTU0+WlbZouphObLlUQ=; b=g5u7a1ZlehIY9B3aEPbfJzvhrLzzxNXLxF5Kyi9+xUipBqE8BmjurCco2wUxMUqcR2 /30b+yMwiIt1JLE5L0kTmqd28EFgD0FPeY6YOgw7Addx4x/Nh11RZ22gOrw3XrdFei8v 3KOg9AYfc2YlXzNcjCbpHeGKoMpCBYiD4R8ZoNRh8OosAC/UJGVO/JymRJw8ykI4WRWF HETpjOQScvrC8TifFjCB7jhgXfCbGxN5azSlUgFZHH1bmUW4mClXUnD0CgQ7vXaMMVaD p8FAmuHH0vszAYhFtRJUM9TluQJNX/v1gBG43wfz9Jl7ZovTQK6URephgvYJx+WdlSw/ 2GaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710427731; x=1711032531; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Xa5+cwFKiVxnAE1tEWrVd1fueTU0+WlbZouphObLlUQ=; b=nJ9k+39NU0yRbtvJ3XqWvvrajCPN4FDpJAAQY7nJIBOZnNUwE3mPyR2sNKUJN2Ncsk 5/vYVUiqYA5UPzDe7q9pOS0NO1dWGApRIqFCpw63b+3q+k9gGhEtjj3yu4RntJhP8tt7 8/68aQyHx37Fftv4aCG2XnBcgT2KY/c5bG14zvNlgP75X50TmdkDHE/GvhpqOIHrR7o8 MMqSCOMWHMMhOyTyZ94s74J9DfshxCWFUw2URORZ6+mHZmX++tyYN7HRcsYuf2Mm3Nco 8KbW00dbTL+dZBPt5uHldeL2l6V/pIGwFZTEYR5tiqn4H5UT4uGxzwYDsIKD2tRO+HQ1 P3rA== X-Forwarded-Encrypted: i=1; AJvYcCXWRxEEbmjZU1uxjkf47Rk/L+N8wpYrR1wxM0ysm4fVed3raRELp8pvrRIsrX/BSWrshAPiDeCjY1yRjD88h1hG/RPXFsk= X-Gm-Message-State: AOJu0YyWEsavIxmlfFy/t+W64V5j53kauJ1ijSP7Xq7HMn6Z72U5jRus Mwg3dWCxkO8w3868JK4V7jmFvOtQZZSteNZ801irGZWXJ7m0qb1T X-Google-Smtp-Source: AGHT+IHh8Ctnx5T9Hv7RhbyOG281AEWNWVpkRLohzRbHVDpvQcP0jYhfI50461mV/GC1JPM8ieCPKA== X-Received: by 2002:a05:6000:719:b0:33e:c8f7:dbbc with SMTP id bs25-20020a056000071900b0033ec8f7dbbcmr1773600wrb.2.1710427730762; Thu, 14 Mar 2024 07:48:50 -0700 (PDT) Received: from [192.168.1.28] (86-44-211-146-dynamic.agg2.lod.rsl-rtd.eircom.net. [86.44.211.146]) by smtp.googlemail.com with ESMTPSA id d10-20020adfe88a000000b0033b6e26f0f9sm899314wrm.42.2024.03.14.07.48.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 14 Mar 2024 07:48:50 -0700 (PDT) Message-ID: <62b663f0-980f-dc14-9f3a-89b3e2c94aa2@draigBrady.com> Date: Thu, 14 Mar 2024 14:48:49 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#69770: [PATCH] build: strengthen 16 bit float support checks Content-Language: en-US To: Collin Funk , 69770@debbugs.gnu.org References: <20240313022545.13117-1-grishalevit@gmail.com> <2613e2f8-93e3-4c52-af45-8552b4f60e96@cs.ucla.edu> From: =?UTF-8?Q?P=C3=A1draig_Brady?= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: 0.2 (/) X-Debbugs-Envelope-To: 69770 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.8 (/) On 14/03/2024 13:35, Collin Funk wrote: > On 3/14/24 6:03 AM, Pádraig Brady wrote: >> It would disable this feature for cross-compilation yes, >> but this isn't the first instance of AC_RUN_IFELSE we use. For completeness I should add that the above check can be overridden if cross-compiling or whatever like: ./configure utils_cv_ieee_16_bit_supported=yes utils_cv_brain_16_bit_supported=yes > Sorry if this is not the proper place to ask, but would it be possible > to make Autoconf use an emulator when cross-compiling? This issue > would be *less* of a problem in that case. > > I am more familiar with CMake where check_c_source_runs is used > performs a similar task [1]. It is essentially a wrapper function > around try_run [2]. CMake allows you to set > CMAKE_CROSSCOMPILING_EMULATOR which will make try_run use an emulator > to run programs instead [3]. > > I've used this with Wine and QEMU User a few times and it makes > CMake's configure tests work fine (though much slower). If this > functionality seems beneficial then I can look into adding it to > Autoconf. > > [1] https://cmake.org/cmake/help/latest/module/CheckCSourceRuns.html > [2] https://github.com/Kitware/CMake/blob/4285dec5f012260337193f29f18899d6cf2536a4/Modules/Internal/CheckSourceRuns.cmake#L93 > [3] https://cmake.org/cmake/help/latest/variable/CMAKE_CROSSCOMPILING_EMULATOR.html Interesting. Perhaps this is something that could be configured separately on the build system, through something like binfmt_misc ? cheers, Pádraig From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 14 11:53:30 2024 Received: (at 69770) by debbugs.gnu.org; 14 Mar 2024 15:53:30 +0000 Received: from localhost ([127.0.0.1]:50445 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rknOb-0007BF-Rd for submit@debbugs.gnu.org; Thu, 14 Mar 2024 11:53:30 -0400 Received: from mail-pj1-f53.google.com ([209.85.216.53]:49168) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rknOY-0007B0-Kq for 69770@debbugs.gnu.org; Thu, 14 Mar 2024 11:53:28 -0400 Received: by mail-pj1-f53.google.com with SMTP id 98e67ed59e1d1-29b7164eef6so924218a91.2 for <69770@debbugs.gnu.org>; Thu, 14 Mar 2024 08:52:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710431505; x=1711036305; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=0U6kn2DrGmj8S8D6H1I6H5rTSPuzFnB6zeEgul0FUmo=; b=DZ6bkcTErkvS9ic2qX8PbWRB3I2qByxSyxDBGaZrm7WhOR0CKEK7w14jASy+wW8nYb /Ba2XxCUD2bado1LY2cU5hPhzDaISj8ApG/BW1BC3sSUp21RmofgdixkzrojS75iArFn DfyC4ZPP1dx/T4RT2OKYSVVMND520wfvLpykybL8CFoDUrBCvBex2uxd4QagLGjnaiTQ bNYfT4PEx4+jRZ7cdNUP1ulSuPz9iqh7WHIR1FvNAb5ut+jnJ+D3+5wxCMyIzfeaG70R H0KQYYlXvAt255M9anskFBMDq4QJfWjXeohc+T8C8nrZBOi+RtdNzjAeqtzoWJ/bAVHZ pCKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710431505; x=1711036305; h=content-transfer-encoding:in-reply-to:from:references: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=0U6kn2DrGmj8S8D6H1I6H5rTSPuzFnB6zeEgul0FUmo=; b=juO34i/s644sShB9xDTRs4HD/CW53Fd0zY004l1YOdqVky2RwF3fCgaNPeZcDpxyRO ++iT19WpelwAba03gtgqnoh9F5eoC5AeMB9BcIqf7J/zijHL0MS1/kCNP3zzP3rUcmRc Qc//858zR6rh3DE85i0OQRHuD45XyEcq0yVQ4V3DE5nUJhYHTxDyMtDmKF6eTQORFMn5 A0ywkl6rBRdKFruLuF8yY2QzPNGDU/0H4+lbpAdluu7vh45aOF0qXbPbneNBWFon6p1V avExx0nSedFtptOi8jgGwt/UssQrLfxpDnTTXe4Tz7z+GivSHCj6r4WXdooP92QXXnhf YVlA== X-Forwarded-Encrypted: i=1; AJvYcCVKCJAQMf4O029P1KRHCG8ZIUB+A6szy62LMKaBfHGg2Wofle2y4maRlUKE2FxFyK4LXjke9b8djE44Pf10kShHOSKZd70= X-Gm-Message-State: AOJu0YzDQjNzDsT0urL+6Xrv2a7xHTb7B6qZ0o1BRVhqO1Jc134EEir6 slmq4GRnuWs2787iDPFeb7wGlvcA+HWOtSaSAIzaed3W8kb1rfLrH3HDlsXb8r4= X-Google-Smtp-Source: AGHT+IH3aACl1g9DciQ4NUTP4BYw9DSwaIksV5K4ikR3gmBCQbD9cd01VixmiFjNlQCmPXA3gLgtWg== X-Received: by 2002:a17:90b:617:b0:29b:fa9f:af9f with SMTP id gb23-20020a17090b061700b0029bfa9faf9fmr2038549pjb.18.1710431504610; Thu, 14 Mar 2024 08:51:44 -0700 (PDT) Received: from [192.168.1.5] (c-73-189-213-139.hsd1.ca.comcast.net. [73.189.213.139]) by smtp.gmail.com with ESMTPSA id bo19-20020a17090b091300b0029c5ee381dfsm1097650pjb.26.2024.03.14.08.51.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 14 Mar 2024 08:51:44 -0700 (PDT) Message-ID: <76cb51bb-156b-4aa6-8028-ebd20866b38a@gmail.com> Date: Thu, 14 Mar 2024 08:51:42 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#69770: [PATCH] build: strengthen 16 bit float support checks Content-Language: en-US To: =?UTF-8?Q?P=C3=A1draig_Brady?= , 69770@debbugs.gnu.org References: <20240313022545.13117-1-grishalevit@gmail.com> <2613e2f8-93e3-4c52-af45-8552b4f60e96@cs.ucla.edu> <62b663f0-980f-dc14-9f3a-89b3e2c94aa2@draigBrady.com> From: Collin Funk In-Reply-To: <62b663f0-980f-dc14-9f3a-89b3e2c94aa2@draigBrady.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.2 (/) X-Debbugs-Envelope-To: 69770 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.8 (/) On 3/14/24 7:48 AM, Pádraig Brady wrote: > For completeness I should add that the above check can be > overridden if cross-compiling or whatever like: > > ./configure utils_cv_ieee_16_bit_supported=yes utils_cv_brain_16_bit_supported=yes Ah, thanks. I wasn't aware of this. > Interesting. > Perhaps this is something that could be configured separately > on the build system, through something like binfmt_misc ? It has been a while, but IIRC on Debian GNU/Linux: $ sudo apt install binfmt-support wine-binfmt would allow you to run QEMU and Windows binaries similar to a normal program, e.g. './emulated-program' would run QEMU or Wine. I assume other distributions have similar packages. I typically used this for CMake cross-compiling instead of setting CMAKE_CROSSCOMPILING_EMULATOR. Then you could also run test programs that were built as if they were native programs which was nice. I'd have to look at Autoconf's sources, but I'd imagine something similar could be done there. You'd just have to check if binfmt is supported and that cross-compiled binaries could be run. Binfmt is Linux specific though right? Allowing the user to pass an emulator explicitly would be more portable in that case. I am willing to look into it more if it seems beneficial. Collin From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 15 01:21:59 2024 Received: (at 69770) by debbugs.gnu.org; 15 Mar 2024 05:21:59 +0000 Received: from localhost ([127.0.0.1]:51127 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rl010-0002Es-Ru for submit@debbugs.gnu.org; Fri, 15 Mar 2024 01:21:59 -0400 Received: from mail.cs.ucla.edu ([131.179.128.66]:39206) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rl00w-0002Ed-9v for 69770@debbugs.gnu.org; Fri, 15 Mar 2024 01:21:58 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 1B9733C00E8B0; Thu, 14 Mar 2024 22:21:12 -0700 (PDT) Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP id zdHeNW3MagbK; Thu, 14 Mar 2024 22:21:11 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 8F5AD3C00E400; Thu, 14 Mar 2024 22:21:11 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 8F5AD3C00E400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1710480071; bh=KtahcJRSDWQ2YbTOWsf/WTdAh7k9xWmSZghAgYWHbfM=; h=Message-ID:Date:MIME-Version:To:From; b=f4MOBIrX27sFw1OHAj1wsd31iFDDKUCC4D8WKExQJYbGeY/kh5KzjoNToo0xcgmlg /vGl7uQ4/7Q5agDrJP95dkuXgvOiVCgXtuTPYpJqUN3DHgxTtv12XidBbemRJo/MD3 rW6m52+q6eKqHw5BfaRy0P3ll2kgWQvMhDn8Eu27a02cIXQ+DGDfvEeADisb0Xfofp jgqAH1u/k+xac4hm403xdh5u/o6oJmscrEPBka/pn1SK1fTACl1BDsHZCBZ/Svly60 EU5YWOCi9o/eGVdBHcxpiLMjS3V9C67HTut2GOQa5hD5qc+zq3iBkdlXJ5r9aW9XwT fQjcNxLA9MJOw== X-Virus-Scanned: amavis at mail.cs.ucla.edu Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id qiZTC20CrI3M; Thu, 14 Mar 2024 22:21:11 -0700 (PDT) Received: from [192.168.254.12] (unknown [47.148.192.211]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id 643043C00E8B0; Thu, 14 Mar 2024 22:21:11 -0700 (PDT) Message-ID: <28c19716-ef9f-408a-8282-e06d14de8917@cs.ucla.edu> Date: Thu, 14 Mar 2024 22:21:11 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#69770: [PATCH] build: strengthen 16 bit float support checks To: =?UTF-8?Q?P=C3=A1draig_Brady?= , Grisha Levit , 69770@debbugs.gnu.org References: <20240313022545.13117-1-grishalevit@gmail.com> <2613e2f8-93e3-4c52-af45-8552b4f60e96@cs.ucla.edu> Content-Language: en-US From: Paul Eggert Organization: UCLA Computer Science Department In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 69770 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 2024-03-14 06:03, P=C3=A1draig Brady wrote: >=20 >> How about leaving it AC_COMPILE_IFELSE, but ensuring that -O1 or bette= r >> is used when the compiler supports -O1? That way we don't have to worr= y >> about running the program, because (with the "volatile") clang will >> error out. >> >> Alternatively perhaps there's some way to check for the bug using >> preprocessor macros like __FLT16_MANT_DIG__, __FLT16_MAX_EXP__, >> __clang_major__, and __aarch64__. (This could be more fragile, though, >> as clang presumably will fix the bug eventually.) >=20 > That would probably work for this edge case, but it's brittle > and I'm worried about other combinations of > compiler versions, complier options, and architectures. Sure, but one cannot resolve such worries completely, as compiler errors=20 are inherently brittle: even a runtime test cannot prove their absence. As I understand it, __bf16 is a real zoo: sometimes hardware supports=20 it, sometimes it doesn't, sometimes the software emulation library is=20 there, sometimes it's not, and so forth. Running a program on a=20 development host is likely to not match the runtime behavior on a=20 production host, so AC_RUN_IFELSE is reasonably likely to produce a=20 false positive, which is worse than a false negative. Another issue, which is somewhat related, is that coreutils's current=20 macro BF16_SUPPORTED is too broad. Because __bf16 has so many bugs,=20 currently it's probably a mistake to say __bf16 is fully supported=20 anywhere. Even GCC is buggy; see for example: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D114347 which I just now discovered when writing this email. The question isn't=20 so much whether __bf16 is supported, it's whether it's supported well=20 enough to compile and run GNU od. Come to think of it, for 'od' we might be better off avoiding __bf16=20 entirely, and simply converting the bits by hand into a 'float'=20 variable. This would likely be more portable, as it would work even with=20 compilers that lack __bf16, or that have __bf16 bugs relevant to 'od'.=20 And that way we could remove the configure-time test entirely. (There=20 would be endianness issues but they're easily addressible.) From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 15 07:51:14 2024 Received: (at 69770) by debbugs.gnu.org; 15 Mar 2024 11:51:14 +0000 Received: from localhost ([127.0.0.1]:52215 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rl65i-0004AY-0a for submit@debbugs.gnu.org; Fri, 15 Mar 2024 07:51:14 -0400 Received: from mail-wr1-f46.google.com ([209.85.221.46]:43395) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rl65e-0004AG-M6 for 69770@debbugs.gnu.org; Fri, 15 Mar 2024 07:51:12 -0400 Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-33ed6078884so123177f8f.1 for <69770@debbugs.gnu.org>; Fri, 15 Mar 2024 04:50:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710503368; x=1711108168; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=Yj8tKDkRNodcwBeRTRSAMSOuj2lHBesCev/teiN0PdE=; b=ibQU0LoML8P1U6UO34wdLQci5D6IaK2HWw7vMNwa34yj2Uz8Q1JalHHbdrHqEefAb7 hDp+rHLCwXQJltd+B6p/7JNaW5i1ArxCZ5LbPmiK15P+8qWAcbSBg15mqX4sFJNUeoln fnXuETu7mfI988JBt5dZ3OqH7/A2+SeTOAogLXBAnJfFu3VyknYjgU6lwnN1SW94SmyX P420Mlb2CF0WyM2xZniQeKfMp6AET1qNoY3SAR48kiw+YJxM9yMGil8UY+Xtls9aqq76 DyD1i3FKtZJlY3DeVpICrmUgdVlopDtpH7m7LP+bHJ9LS8Euhzk2LrfGi4ma1lLK0s+G 4VTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710503368; x=1711108168; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Yj8tKDkRNodcwBeRTRSAMSOuj2lHBesCev/teiN0PdE=; b=L3yRGn7KdixpP3JkZ3HOphtpmQihu/WgTzjsspTIl35YLcBJOE7iYYehwH8xGApgMn DI7tkqxn2NN1ija7hkw8QtW1p1Q+t/LQPv73v8dLU1tQbZctVQ51XnFt4kJL+R8Nm9Wn +93RR7dpHh1vhiVPnBeoEx7uSEWub+MJDBwcfHvvtI10cOaoDd0lNk0p4YGmG/qByXVO iaqp5KbhGgrHhyiILu5jn1dh5tKKTHMnl6eNUo6+14jv9AF7a7fpOOhoDQkVqPeqFaSH qPy0sOYLceOHtOtNRv9Y82DeEpYpW2GtcqouO0yDBKJnWc/3PK2GDEerDJvadV2lAE0u 4wjg== X-Forwarded-Encrypted: i=1; AJvYcCUSRxX2UIrUybpiIXP5Qcm33miACaXpDkLjcUUwW21bxPshFxbqK8x5AxXayzou0vxX6wxSEXKG33OLKL0Gsl54tAfXvU8= X-Gm-Message-State: AOJu0YzAbF/Le257z27gjCNR41OzqWtD1sZ9ku8NbVjQwne0Yg7sHTPe NbSi2Dce9IsHCbGaj50OCtLO8CXIaARorzPg40bfbABJcbGA3k/A X-Google-Smtp-Source: AGHT+IE67hKSpTCWdEsWUDC2ltC6hGtlqE2dCAEEhhEAhC6LxdUq41RAB9icJZmf6qQUly1U6aC8uQ== X-Received: by 2002:adf:eccd:0:b0:33e:9e27:fab with SMTP id s13-20020adfeccd000000b0033e9e270fabmr4327633wro.12.1710503368279; Fri, 15 Mar 2024 04:49:28 -0700 (PDT) Received: from [192.168.1.28] (86-44-211-146-dynamic.agg2.lod.rsl-rtd.eircom.net. [86.44.211.146]) by smtp.googlemail.com with ESMTPSA id w21-20020adf8bd5000000b0033e0ed396bdsm3017638wra.106.2024.03.15.04.49.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 15 Mar 2024 04:49:27 -0700 (PDT) Message-ID: <4d24f2d8-a94f-38b7-5866-141a59209a08@draigBrady.com> Date: Fri, 15 Mar 2024 11:49:26 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#69770: [PATCH] build: strengthen 16 bit float support checks Content-Language: en-US To: Paul Eggert , Grisha Levit , 69770@debbugs.gnu.org References: <20240313022545.13117-1-grishalevit@gmail.com> <2613e2f8-93e3-4c52-af45-8552b4f60e96@cs.ucla.edu> <28c19716-ef9f-408a-8282-e06d14de8917@cs.ucla.edu> From: =?UTF-8?Q?P=C3=A1draig_Brady?= In-Reply-To: <28c19716-ef9f-408a-8282-e06d14de8917@cs.ucla.edu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: 0.2 (/) X-Debbugs-Envelope-To: 69770 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.8 (/) On 15/03/2024 05:21, Paul Eggert wrote: > On 2024-03-14 06:03, Pádraig Brady wrote: >> >>> How about leaving it AC_COMPILE_IFELSE, but ensuring that -O1 or better >>> is used when the compiler supports -O1? That way we don't have to worry >>> about running the program, because (with the "volatile") clang will >>> error out. >>> >>> Alternatively perhaps there's some way to check for the bug using >>> preprocessor macros like __FLT16_MANT_DIG__, __FLT16_MAX_EXP__, >>> __clang_major__, and __aarch64__. (This could be more fragile, though, >>> as clang presumably will fix the bug eventually.) >> >> That would probably work for this edge case, but it's brittle >> and I'm worried about other combinations of >> compiler versions, complier options, and architectures. > > Sure, but one cannot resolve such worries completely, as compiler errors > are inherently brittle: even a runtime test cannot prove their absence. > > As I understand it, __bf16 is a real zoo: sometimes hardware supports > it, sometimes it doesn't, sometimes the software emulation library is > there, sometimes it's not, and so forth. Running a program on a > development host is likely to not match the runtime behavior on a > production host, so AC_RUN_IFELSE is reasonably likely to produce a > false positive, which is worse than a false negative. > > Another issue, which is somewhat related, is that coreutils's current > macro BF16_SUPPORTED is too broad. Because __bf16 has so many bugs, > currently it's probably a mistake to say __bf16 is fully supported > anywhere. Even GCC is buggy; see for example: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114347 > > which I just now discovered when writing this email. Nice one! (though that should not impact od) > The question isn't > so much whether __bf16 is supported, it's whether it's supported well > enough to compile and run GNU od. > > > Come to think of it, for 'od' we might be better off avoiding __bf16 > entirely, and simply converting the bits by hand into a 'float' > variable. This would likely be more portable, as it would work even with > compilers that lack __bf16, or that have __bf16 bugs relevant to 'od'. > And that way we could remove the configure-time test entirely. (There > would be endianness issues but they're easily addressible.) Right. My thinking though was that it was nice code wise to treat __bf16 like _Float16 (and like float etc.). More importantly I only see __bf16 support improving going forward, so preferred to keep the code simpler (and the configure check robust). Currently both the main compilers, and main architectures are supported (when not cross-compiling), and tested quite robustly in the configure check. Another thing that dissuaded me from implementing the conversions ourselves is the plethora of floating point config options for compilers, which made me think in general that floating point conversion was best left to the compiler. I've just now realized that AC_RUN_IFELSE needs an explicit default for cross-compiling, and I've just pushed a conservative default (which may default the other way in future when support broadens). thanks, Pádraig. From unknown Sun Jun 22 11:33:49 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 13 Apr 2024 11:24:13 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator