emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#68871: closed (Can't use od to print half-precision floats)


From: GNU bug Tracking System
Subject: bug#68871: closed (Can't use od to print half-precision floats)
Date: Sun, 04 Feb 2024 15:01:02 +0000

Your message dated Sun, 4 Feb 2024 15:00:19 +0000
with message-id <4e371b3c-d71c-5aed-1b82-c890adf5658f@draigBrady.com>
and subject line Re: bug#68871: Can't use od to print half-precision floats
has caused the debbugs.gnu.org bug report #68871,
regarding Can't use od to print half-precision floats
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
68871: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=68871
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: Can't use od to print half-precision floats Date: Thu, 1 Feb 2024 12:43:47 +0000

If I try to use the od utility to print half-precision (FP16) floating-point values, I get:

 

$ od -t f2 myfloats.bin

od: invalid type string ‘f2’;

this system doesn't provide a 2-byte floating point type

 

I’m not exactly sure what “this system” means, but that should work and print out my floats.

 

Eyal

 

PS – This is my first bug-coreutils post, please be gentle.


--- End Message ---
--- Begin Message --- Subject: Re: bug#68871: Can't use od to print half-precision floats Date: Sun, 4 Feb 2024 15:00:19 +0000 User-agent: Mozilla Thunderbird
On 02/02/2024 01:47, Paul Eggert wrote:
On 2/1/24 13:59, Pádraig Brady wrote:

bfloat16 looks like a truncated single precision IEEE,
so we should be able to just pad the extra 16 bits with zeros
when converting to single precision internally for processing.

Sounds good. This would mean od could work even the platform doesn't
support bfloat16_t, since od.c could fall back on the above code (though
I suppose it could be endianness-dependent).

I see that __bf16 is supported by released versions of gcc and clang,
so rather than add conversion complexity to the core od print loop,
the attached relies on compiler support for _Float16 and __bf16 types,
which compilers will expand to more targets going forward.

I tested the attached on:

gcc 13, clang 17 x86 (Both types supported)
gcc 7 aarch64 (Only -fH supported)
gcc 13 ppc(be) (Neither supported (both will be with GCC 14))

I'll commit this later.
Marking this bug as done.

thanks,
Pádraig

Attachment: od-half-float.patch
Description: Text Data


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]