Re: Making Lemonade (Floating-point format changes)

Liste des GroupesRevenir à c arch 
Sujet : Re: Making Lemonade (Floating-point format changes)
De : cr88192 (at) *nospam* gmail.com (BGB)
Groupes : comp.arch
Date : 21. May 2024, 03:52:13
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v2guog$ctck$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
User-Agent : Mozilla Thunderbird
On 5/20/2024 2:58 PM, MitchAlsup1 wrote:
BGB wrote:
 
On 5/20/2024 7:36 AM, Michael S wrote:
>
For subnormal x subnormal you don't need result of multiplication at
all. All you need to know is if it's zero or not and what sign.
Even that is needed only in non-default rounding modes and for inexact
flag in default mode.
>
 
For most non-tiny formats, the seeming advantage of subnormal numbers seems small, in any case.
 There is, it is called Posit (or UNUM depending).
No subnormals, wider range then IEEE, more precision than IEEE (most of the time). Whether it is better overall is still a matter of debate. It is harder to implement than IEEE but
just barely.
 
Not interchange compatible though, so that is a drawback.
Granted, might make sense for small-format converter ops, with the working data in a larger format.
Granted, they are not necessarily the option one would go if they wanted "cheapest possible FPU that is still good enough to be usable".
Though, the point at which an FPU manages to suck badly enough that one needs to resort to software emulation to make software work, is probably a lower limit.
Luckily, "uses 754 formats, but with aggressive cost cutting" can be "good enough", and so long as they more-or-less deliver a full width mantissa, and can exactly compute exact-value calculations, most software is generally going to work.
But OTOH, if 1.0+2.0 gives 2.999999, that is, not good enough, so there is a lower limit here.

But, yeah, in any case I would almost prefer if there could be a separate/cheaper standard, probably mostly aimed at embedded/microcontroller style use-cases (rather than "general purpose"), and would likely relax the requirements a fair bit.
 
Say, likely target might be, say:
   FADD/FSUB/FMUL;
   Binary16 and Binary32 as high-priority formats;
   Binary64 as optional (but nice to have);
   Probably DAZ/FTZ;
   Potentially allow for truncate-only rounding.
 
Assumption being that larger or higher precision cases would fall back to software emulation.
 
Though, truncate-only is pros/cons, as while it is easier to make it deterministic, it is also prone to lead to numerical drift.
Apparently it was popular (along with DAZ+FTZ) on the Nintendo N64, as apparently they had an FPU which would operate entirely in hardware if set to DAZ+FTZ with truncate, but (if it was enabled) would invoke emulation traps to deal with subnormals and rounding.
Then again, this is still a possibility: could add a "Full IEEE" flag, where, say:
Denormal inputs, underflow, or rounding carry propagation outside the low 8 bits, could be dealt with by a trap.
Then have programmers probably leave it disabled, as it isn't likely to be worth the overhead.

 
Could optionally have some 8-bit FP formats, but 8-bit FP is a little bit too limited for general-purpose use.
 
Likely main candidates being:
   S.E4.F3 (Bias=7)
   S.E3.F4 (Bias=7|8, ~ Unit Range)
     More or less A-Law without the XOR.
     Though, A-Law can also be interpreted as a ~ 12 bit integer value.
     Annoyingly, exact bias depends on context for this one
       (eg: 8/7/3/0)...
 
I had also used:
   E4.F4
   E4.F3.S
But, this is wonky (and the possible merit of E4.F3.S is defeated once one also needs S.E4.F3 or S.E3.F4, as these are the "actually used in the wild" formats, so may have been a mistake).
 I spent some of my youth trying to push against immovable objects
(i.e., standards) don't do it, it is a waste of effort and time,
similar to putting lipstick on a pig.
It is debatable...
On the FP8 side of things, I went and added the wonky formats, but then mostly ended up just (ab)using the A-Law format instead, mostly as it is "slightly less useless" (slightly more accurate, also used a fair bit for audio processing, *, ...).
*: Though, within "RIFF WAVE" files, it is typically stored XOR'ed with 0x55, but this is easy enough to resolve (the version used by my audio hardware does not use the XOR).
But, A-Law does suffer from a lack of dynamic range.
If anything, there seems to be a need for an "Add/Subtract bias from SIMD exponents" instruction:
   PADJEXP.H Rm, Imm5s, Rn  //Add Imm5s to 4x Binary16 exponents
Say, the audio pathway goes PCM16 -> Binary16 -> A-Law (or, alternatively, A-Law -> Binary16 -> PCM16 for WAV loading) as this was generally the fastest way to get between them.
Well, also using A-Law in some of the AVI tests as:
   Faster to deal with than ADPCM;
   Less bulky than 16-bit PCM;
   Better audio quality than 8-bit PCM.
Also, unlike Mu-Law, it is effectively an otherwise straightforward microfloat format.
But, I guess it is similar that one could argue for using ELF (and RV64G) because it is more standard than a "hacked to crap PE/COFF" variant and a custom ISA, but all the pain I had been dealing with recently trying to get RV64G PIE binaries generated, and then trying to figure out how to get my ELF loader working with them, doesn't really lead to warm fuzzies...
So, PE/COFF is flatter:
Up-front the static-image case is slightly more involved than with ELF;
But, the base relocs and DLL import/export mechanism is less pain to deal with than trying to deal with full relocation and symbol tables.
But, still don't have stuff working, and don't know if the relocs are mostly correct (for example: the R_RISCV_JUMP_SLOT reloc seemingly does not use the "r_addend" field from what information I can find, but the addend field tends to be non-zero for these relocs, so like, what exactly is going on here? ...).
Though, do at least have it to where the binary manages to print something before crashing (while trying to access an invalid memory address), at least implying that the system call mechanism is seemingly working (and enough is working that it manages a debug "puts()" call).
Still using my own C library. Theoretically, GCC could use GLIBC, but not exactly sure of the specifics of the system call mechanism.
Looking it up, it seems both my stuff and Linux are using the EBREAK instruction, but Linux was using "magic NOP" instructions around the EBREAK to encode the system call number (whereas TestKern was passing/returning values in registers and using normal NOPs), I guess it could be possible to detect and emulate the Linux style syscalls via the magic NOPs (would assume the syscall numbering, etc, is probably the same as for other Linux variants).
Probably faking the Linux syscalls might be an easier option though for trying to get userland software ported (albeit PIC/PIE builds would still be mandated in this case).
Well, assuming at least I manage to get the ELF loader fully working.
...

Date Sujet#  Auteur
12 May 24 * Making Lemonade (Floating-point format changes)101John Savard
12 May 24 +* Re: Making Lemonade (Floating-point format changes)3wolfgang kern
15 May 24 i`* Re: Making Lemonade (Floating-point format changes)2Michael S
15 May 24 i `- Re: Making Lemonade (Floating-point format changes)1BGB
12 May 24 +* Re: Making Lemonade (Floating-point format changes)6Thomas Koenig
12 May 24 i`* Re: Making Lemonade (Floating-point format changes)5John Savard
12 May 24 i +- Re: Making Lemonade (Floating-point format changes)1John Savard
12 May 24 i `* Re: Making Lemonade (Floating-point format changes)3MitchAlsup1
13 May 24 i  `* Re: Making Lemonade (Floating-point format changes)2John Savard
13 May 24 i   `- Re: Making Lemonade (Floating-point format changes)1BGB
12 May 24 `* Re: Making Lemonade (Floating-point format changes)91John Dallman
12 May 24  `* Re: Making Lemonade (Floating-point format changes)90Thomas Koenig
13 May 24   `* Re: Making Lemonade (Floating-point format changes)89Michael S
13 May 24    +* Re: Making Lemonade (Floating-point format changes)56Thomas Koenig
14 May 24    i`* Re: Making Lemonade (Floating-point format changes)55Michael S
15 May 24    i `* Re: Making Lemonade (Floating-point format changes)54Thomas Koenig
15 May 24    i  `* Re: Making Lemonade (Floating-point format changes)53Michael S
19 May 24    i   `* Re: Making Lemonade (Floating-point format changes)52Thomas Koenig
19 May 24    i    +* Re: Making Lemonade (Floating-point format changes)3Michael S
19 May 24    i    i+- Re: Making Lemonade (Floating-point format changes)1MitchAlsup1
20 May 24    i    i`- Re: Making Lemonade (Floating-point format changes)1Thomas Koenig
19 May 24    i    `* Re: Making Lemonade (Floating-point format changes)48Terje Mathisen
19 May 24    i     +* Re: Making Lemonade (Floating-point format changes)40Michael S
19 May 24    i     i+- Re: Making Lemonade (Floating-point format changes)1MitchAlsup1
20 May 24    i     i+* Re: Making Lemonade (Floating-point format changes)30Terje Mathisen
20 May 24    i     ii`* Re: Making Lemonade (Floating-point format changes)29Michael S
20 May 24    i     ii `* Re: Making Lemonade (Floating-point format changes)28Terje Mathisen
20 May 24    i     ii  `* Re: Making Lemonade (Floating-point format changes)27Michael S
20 May 24    i     ii   +* Re: Making Lemonade (Floating-point format changes)19BGB
20 May 24    i     ii   i`* Re: Making Lemonade (Floating-point format changes)18MitchAlsup1
20 May 24    i     ii   i +- Re: Making Lemonade (Floating-point format changes)1Chris M. Thomasson
20 May 24    i     ii   i +- Re: Making Lemonade (Floating-point format changes)1Thomas Koenig
21 May 24    i     ii   i `* Re: Making Lemonade (Floating-point format changes)15BGB
21 May 24    i     ii   i  +* Re: Making Lemonade (Floating-point format changes)12Thomas Koenig
21 May 24    i     ii   i  i+* Re: Making Lemonade (Floating-point format changes)7Michael S
21 May 24    i     ii   i  ii+* Re: Making Lemonade (Floating-point format changes)5Terje Mathisen
21 May 24    i     ii   i  iii+- Re: Making Lemonade (Floating-point format changes)1Michael S
21 May 24    i     ii   i  iii`* Re: Making Lemonade (Floating-point format changes)3BGB
22 May 24    i     ii   i  iii `* Re: Making Lemonade (Floating-point format changes)2MitchAlsup1
22 May 24    i     ii   i  iii  `- Re: Making Lemonade (Floating-point format changes)1BGB-Alt
21 May 24    i     ii   i  ii`- Re: Making Lemonade (Floating-point format changes)1Thomas Koenig
21 May 24    i     ii   i  i`* Re: Making Lemonade (Floating-point format changes)4BGB
21 May 24    i     ii   i  i `* Re: Making Lemonade (Floating-point format changes)3MitchAlsup1
21 May 24    i     ii   i  i  +- Re: Making Lemonade (Floating-point format changes)1BGB
22 May 24    i     ii   i  i  `- Re: Making Lemonade (Floating-point format changes)1Terje Mathisen
21 May 24    i     ii   i  `* Re: Making Lemonade (Floating-point format changes)2MitchAlsup1
21 May 24    i     ii   i   `- Re: Making Lemonade (Floating-point format changes)1BGB
20 May 24    i     ii   `* Re: Making Lemonade (Floating-point format changes)7Terje Mathisen
21 May 24    i     ii    `* Re: Making Lemonade (Floating-point format changes)6Michael S
21 May 24    i     ii     `* Re: Making Lemonade (Floating-point format changes)5MitchAlsup1
21 May 24    i     ii      +* Re: Making Lemonade (Floating-point format changes)2Stefan Monnier
22 May 24    i     ii      i`- Re: Making Lemonade (Floating-point format changes)1MitchAlsup1
22 May 24    i     ii      +- Re: Making Lemonade (Floating-point format changes)1Terje Mathisen
22 May 24    i     ii      `- Re: Making Lemonade (Floating-point format changes)1MitchAlsup1
20 May 24    i     i`* binary128 implementation (was: Making Lemonade (Floating-point format changes)8Anton Ertl
20 May 24    i     i `* Re: binary128 implementation7Terje Mathisen
23 May 24    i     i  `* Re: binary128 implementation6BGB-Alt
23 May 24    i     i   `* Re: binary128 implementation5MitchAlsup1
24 May 24    i     i    `* Re: binary128 implementation4Terje Mathisen
24 May 24    i     i     `* Re: binary128 implementation3BGB-Alt
25 May 24    i     i      `* Re: binary128 implementation2MitchAlsup1
25 May 24    i     i       `- Re: binary128 implementation1BGB
19 May 24    i     +* Re: Making Lemonade (Floating-point format changes)6BGB
19 May 24    i     i`* Re: Making Lemonade (Floating-point format changes)5MitchAlsup1
20 May 24    i     i `* Re: Making Lemonade (Floating-point format changes)4BGB
20 May 24    i     i  `* Re: Making Lemonade (Floating-point format changes)3MitchAlsup1
20 May 24    i     i   `* Re: Making Lemonade (Floating-point format changes)2BGB
20 May 24    i     i    `- Re: Making Lemonade (Floating-point format changes)1MitchAlsup1
19 May 24    i     `- Re: Making Lemonade (Floating-point format changes)1MitchAlsup1
13 May 24    `* Re: Making Lemonade (Floating-point format changes)32BGB
13 May 24     `* Re: Making Lemonade (Floating-point format changes)31MitchAlsup1
14 May 24      +* Re: Making Lemonade (Floating-point format changes)22BGB
14 May 24      i`* Re: Making Lemonade (Floating-point format changes)21MitchAlsup1
14 May 24      i `* Re: Making Lemonade (Floating-point format changes)20BGB
14 May 24      i  `* Re: Making Lemonade (Floating-point format changes)19MitchAlsup1
14 May 24      i   +* Re: Making Lemonade (Floating-point format changes)2Michael S
15 May 24      i   i`- Re: Making Lemonade (Floating-point format changes)1Michael S
14 May 24      i   +- Re: Making Lemonade (Floating-point format changes)1BGB
16 May 24      i   `* Re: Making Lemonade (Floating-point format changes)15MitchAlsup1
17 May 24      i    `* Re: Making Lemonade (Floating-point format changes)14MitchAlsup1
17 May 24      i     +* Re: Making Lemonade (Floating-point format changes)2MitchAlsup1
18 May 24      i     i`- Re: Making Lemonade (Floating-point format changes)1MitchAlsup1
18 May 24      i     `* Re: Making Lemonade (Floating-point format changes)11Chris M. Thomasson
19 May 24      i      `* Re: Making Lemonade (Floating-point format changes)10Chris M. Thomasson
19 May 24      i       `* Re: Making Lemonade (Floating-point format changes)9Chris M. Thomasson
19 May 24      i        `* Re: Making Lemonade (Floating-point format changes)8Chris M. Thomasson
20 May 24      i         `* Re: Making Lemonade (Floating-point format changes)7Chris M. Thomasson
20 May 24      i          `* Re: Making Lemonade (Floating-point format changes)6Chris M. Thomasson
20 May 24      i           `* Re: Making Lemonade (Floating-point format changes)5Chris M. Thomasson
24 May 24      i            `* Re: Making Lemonade (Floating-point format changes)4Chris M. Thomasson
26 May 24      i             `* Re: Making Lemonade (Floating-point format changes)3George Neuner
27 May 24      i              +- Re: Making Lemonade (Floating-point format changes)1Chris M. Thomasson
1 Jun 24      i              `- Re: Making Lemonade (Floating-point format changes)1Chris M. Thomasson
14 May 24      +* Re: Making Lemonade (Floating-point format changes)4Anton Ertl
14 May 24      i`* Re: Making Lemonade (Floating-point format changes)3MitchAlsup1
14 May 24      i +- Re: Making Lemonade (Floating-point format changes)1MitchAlsup1
14 May 24      i `- Re: Making Lemonade (Floating-point format changes)1BGB
10 Jun 24      `* Re: Making Lemonade (Floating-point format changes)4Lawrence D'Oliveiro
10 Jun 24       `* Re: Making Lemonade (Floating-point format changes)3Terje Mathisen
10 Jun 24        `* Re: Making Lemonade (Floating-point format changes)2Niklas Holsti
11 Jun 24         `- Re: Making Lemonade (Floating-point format changes)1Lawrence D'Oliveiro

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal