Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.arch > #32156 > unrolled thread
| Started by | jgk@panix.com (Joe keane) |
|---|---|
| First post | 2015-12-26 21:45 +0000 |
| Last post | 2016-02-19 11:40 +0100 |
| Articles | 20 on this page of 42 — 14 participants |
Back to article view | Back to comp.arch
floating-point range jgk@panix.com (Joe keane) - 2015-12-26 21:45 +0000
Re: floating-point range MitchAlsup <MitchAlsup@aol.com> - 2015-12-26 18:49 -0800
Re: floating-point range Quadibloc <jsavard@ecn.ab.ca> - 2015-12-26 20:19 -0800
Re: floating-point range Terje Mathisen <terje.mathisen@tmsw.no> - 2015-12-27 09:53 +0100
Re: floating-point range Morten Reistad <first@last.name.invalid> - 2016-02-16 18:23 +0100
Re: floating-point range Robert Wessel <robertwessel2@yahoo.com> - 2016-02-16 12:28 -0600
Re: floating-point range Robert Wessel <robertwessel2@yahoo.com> - 2016-02-16 12:41 -0600
Re: floating-point range Morten Reistad <first@last.name.invalid> - 2016-02-16 21:43 +0100
Re: floating-point range Robert Wessel <robertwessel2@yahoo.com> - 2016-02-16 17:27 -0600
Re: floating-point range Terje Mathisen <terje.mathisen@tmsw.no> - 2016-02-17 08:35 +0100
Re: floating-point range nmm@wheeler.UUCP (Nick Maclaren) - 2016-02-17 09:51 +0000
Re: floating-point range Terje Mathisen <terje.mathisen@tmsw.no> - 2016-02-17 11:42 +0100
Re: floating-point range nmm@wheeler.UUCP (Nick Maclaren) - 2016-02-17 11:56 +0000
Re: floating-point range BGB <cr88192@hotmail.com> - 2016-02-17 09:56 -0600
Re: floating-point range nmm@wheeler.UUCP (Nick Maclaren) - 2016-02-17 16:14 +0000
Re: floating-point range Terje Mathisen <terje.mathisen@tmsw.no> - 2016-02-18 07:42 +0100
Re: floating-point range BGB <cr88192@hotmail.com> - 2016-02-18 10:09 -0600
Re: floating-point range jim.brakefield@ieee.org - 2016-02-18 12:33 -0800
Re: floating-point range Terje Mathisen <terje.mathisen@tmsw.no> - 2016-02-18 22:08 +0100
Re: floating-point range BGB <cr88192@hotmail.com> - 2016-02-18 15:45 -0600
Re: floating-point range MitchAlsup <MitchAlsup@aol.com> - 2016-02-18 16:42 -0800
Re: floating-point range BGB <cr88192@hotmail.com> - 2016-02-19 08:04 -0600
Re: floating-point range nmm@wheeler.UUCP (Nick Maclaren) - 2016-02-19 11:55 +0000
Re: floating-point range BGB <cr88192@hotmail.com> - 2016-02-19 08:24 -0600
Re: floating-point range MitchAlsup <MitchAlsup@aol.com> - 2016-02-19 07:09 -0800
Re: floating-point range BGB <cr88192@hotmail.com> - 2016-02-19 10:51 -0600
Re: floating-point range Terje Mathisen <terje.mathisen@tmsw.no> - 2016-02-19 18:02 +0100
Re: floating-point range Quadibloc <jsavard@ecn.ab.ca> - 2016-02-19 11:55 -0800
Re: floating-point range Terje Mathisen <terje.mathisen@tmsw.no> - 2016-02-19 21:14 +0100
Re: floating-point range MitchAlsup <MitchAlsup@aol.com> - 2016-02-19 16:20 -0800
Re: floating-point range Terje Mathisen <terje.mathisen@tmsw.no> - 2016-02-20 10:14 +0100
Re: floating-point range anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-02-20 12:51 +0000
Re: floating-point range anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-02-20 12:30 +0000
Re: floating-point range paul wallich <pw@panix.com> - 2016-02-19 12:37 -0500
Re: floating-point range Quadibloc <jsavard@ecn.ab.ca> - 2016-02-19 11:58 -0800
Re: floating-point range jim.brakefield@ieee.org - 2016-02-19 14:29 -0800
Re: floating-point range "James Van Buskirk" <not_valid@comcast.net> - 2016-02-17 10:21 -0700
Re: floating-point range nmm@wheeler.UUCP (Nick Maclaren) - 2016-02-17 17:34 +0000
Re: floating-point range Quadibloc <jsavard@ecn.ab.ca> - 2016-02-17 11:13 -0800
Re: floating-point range "wolfgang kern" <nowhere@never.at> - 2016-02-16 19:39 +0100
Re: floating-point range MitchAlsup <MitchAlsup@aol.com> - 2016-02-16 16:36 -0800
Re: floating-point range Piotr Wyderski <peter.pan@neverland.mil> - 2016-02-19 11:40 +0100
Page 1 of 3 [1] 2 3 Next page →
| From | jgk@panix.com (Joe keane) |
|---|---|
| Date | 2015-12-26 21:45 +0000 |
| Subject | floating-point range |
| Message-ID | <n5n1p5$k1h$1@reader1.panix.com> |
I'd like to be able to have slightly less exponent, slightly more mantissa. But it's so hard.
[toc] | [next] | [standalone]
| From | MitchAlsup <MitchAlsup@aol.com> |
|---|---|
| Date | 2015-12-26 18:49 -0800 |
| Message-ID | <c5ea2202-b7e6-4aef-9aa5-225f354089c9@googlegroups.com> |
| In reply to | #32156 |
On Saturday, December 26, 2015 at 3:45:11 PM UTC-6, Joe keane wrote: > I'd like to be able to have slightly less exponent, slightly more > mantissa. But it's so hard. Basically, its not going to happen, either.
[toc] | [prev] | [next] | [standalone]
| From | Quadibloc <jsavard@ecn.ab.ca> |
|---|---|
| Date | 2015-12-26 20:19 -0800 |
| Message-ID | <d0a7765b-04c8-4217-8340-1ed8be1eedfc@googlegroups.com> |
| In reply to | #32164 |
On Saturday, December 26, 2015 at 7:49:34 PM UTC-7, MitchAlsup wrote: > On Saturday, December 26, 2015 at 3:45:11 PM UTC-6, Joe keane wrote: > > I'd like to be able to have slightly less exponent, slightly more > > mantissa. But it's so hard. > Basically, its not going to happen, either. About the only thing one can do for more mantissa is switch to a higher precision format with more exponent range too. John Savard
[toc] | [prev] | [next] | [standalone]
| From | Terje Mathisen <terje.mathisen@tmsw.no> |
|---|---|
| Date | 2015-12-27 09:53 +0100 |
| Message-ID | <n5o8u8$pln$1@speranza.aioe.org> |
| In reply to | #32156 |
Joe keane wrote: > I'd like to be able to have slightly less exponent, slightly more > mantissa. But it's so hard. > If you want something slightly different, then you probably have to implement it yourself. The fastest method is probably to use pairs of doubles and convert to your storage format when loading/storing. Terje -- - <Terje.Mathisen at tmsw.no> "almost all programming can be viewed as an exercise in caching"
[toc] | [prev] | [next] | [standalone]
| From | Morten Reistad <first@last.name.invalid> |
|---|---|
| Date | 2016-02-16 18:23 +0100 |
| Message-ID | <kh2cpc-loq.ln1@sambook.reistad.name> |
| In reply to | #32171 |
In article <n5o8u8$pln$1@speranza.aioe.org>, Terje Mathisen <terje.mathisen@tmsw.no> wrote: >Joe keane wrote: >> I'd like to be able to have slightly less exponent, slightly more >> mantissa. But it's so hard. >> >If you want something slightly different, then you probably have to >implement it yourself. The fastest method is probably to use pairs of >doubles and convert to your storage format when loading/storing. I wonder about the exponent sizes sometimes. The size of the observable universe divided by the Planc length is around 1.4E61, or representable with an exponent of ~204, well within 8 bits. I still look for business cases for anything beyond that. -- mrr
[toc] | [prev] | [next] | [standalone]
| From | Robert Wessel <robertwessel2@yahoo.com> |
|---|---|
| Date | 2016-02-16 12:28 -0600 |
| Message-ID | <c4q6cbt6maq10jbvdjm9gmurq46uot9o14@4ax.com> |
| In reply to | #33687 |
On Tue, 16 Feb 2016 18:23:32 +0100, Morten Reistad <first@last.name.invalid> wrote: >In article <n5o8u8$pln$1@speranza.aioe.org>, >Terje Mathisen <terje.mathisen@tmsw.no> wrote: >>Joe keane wrote: >>> I'd like to be able to have slightly less exponent, slightly more >>> mantissa. But it's so hard. >>> >>If you want something slightly different, then you probably have to >>implement it yourself. The fastest method is probably to use pairs of >>doubles and convert to your storage format when loading/storing. > >I wonder about the exponent sizes sometimes. The size of the >observable universe divided by the Planc length is around 1.4E61, or >representable with an exponent of ~204, well within 8 bits. I still >look for business cases for anything beyond that. Same issue as with (scaled integer) sizes with currency. It's easy to pick a size that will handle any plausible amount of currency, or, in this case, any plausible physical quantity, but you have to consider intermediate results. Multiply a few physical quantities together on your way to a final result, and you may need considerably more exponent range to avoid overflow during the calculation, even though all of the inputs and outputs fall well within the "reasonable" range.
[toc] | [prev] | [next] | [standalone]
| From | Robert Wessel <robertwessel2@yahoo.com> |
|---|---|
| Date | 2016-02-16 12:41 -0600 |
| Message-ID | <60r6cb1gmrr1hgls467t7f2ratnmu2q5th@4ax.com> |
| In reply to | #33689 |
On Tue, 16 Feb 2016 12:28:29 -0600, Robert Wessel <robertwessel2@yahoo.com> wrote: >On Tue, 16 Feb 2016 18:23:32 +0100, Morten Reistad ><first@last.name.invalid> wrote: > >>In article <n5o8u8$pln$1@speranza.aioe.org>, >>Terje Mathisen <terje.mathisen@tmsw.no> wrote: >>>Joe keane wrote: >>>> I'd like to be able to have slightly less exponent, slightly more >>>> mantissa. But it's so hard. >>>> >>>If you want something slightly different, then you probably have to >>>implement it yourself. The fastest method is probably to use pairs of >>>doubles and convert to your storage format when loading/storing. >> >>I wonder about the exponent sizes sometimes. The size of the >>observable universe divided by the Planc length is around 1.4E61, or >>representable with an exponent of ~204, well within 8 bits. I still >>look for business cases for anything beyond that. > > >Same issue as with (scaled integer) sizes with currency. It's easy to >pick a size that will handle any plausible amount of currency, or, in >this case, any plausible physical quantity, but you have to consider >intermediate results. Multiply a few physical quantities together on >your way to a final result, and you may need considerably more >exponent range to avoid overflow during the calculation, even though >all of the inputs and outputs fall well within the "reasonable" range. As a (still somewhat silly, but simple) example, consider computing the distance between two point in the universe, measuring merely in micrometers (forget about Planck length). All the inputs and outputs will be less than about 2**110, but you'll have to handle intermediate results of 2**220. And yes, there are obvious ways to deal with that if overflow is an issue, notably by manually scaling the inputs and results (convert the input to km, and the result back to um, for example), but that kinda defeats the point of having FP.
[toc] | [prev] | [next] | [standalone]
| From | Morten Reistad <first@last.name.invalid> |
|---|---|
| Date | 2016-02-16 21:43 +0100 |
| Message-ID | <h8ecpc-hnr.ln1@sambook.reistad.name> |
| In reply to | #33691 |
In article <60r6cb1gmrr1hgls467t7f2ratnmu2q5th@4ax.com>, Robert Wessel <robertwessel2@yahoo.com> wrote: >On Tue, 16 Feb 2016 12:28:29 -0600, Robert Wessel ><robertwessel2@yahoo.com> wrote: > >>On Tue, 16 Feb 2016 18:23:32 +0100, Morten Reistad >><first@last.name.invalid> wrote: >> >>>In article <n5o8u8$pln$1@speranza.aioe.org>, >>>Terje Mathisen <terje.mathisen@tmsw.no> wrote: >>>>Joe keane wrote: >>>>> I'd like to be able to have slightly less exponent, slightly more >>>>> mantissa. But it's so hard. >>>>> >>>>If you want something slightly different, then you probably have to >>>>implement it yourself. The fastest method is probably to use pairs of >>>>doubles and convert to your storage format when loading/storing. >>> >>>I wonder about the exponent sizes sometimes. The size of the >>>observable universe divided by the Planc length is around 1.4E61, or >>>representable with an exponent of ~204, well within 8 bits. I still >>>look for business cases for anything beyond that. >> >> >>Same issue as with (scaled integer) sizes with currency. It's easy to >>pick a size that will handle any plausible amount of currency, or, in >>this case, any plausible physical quantity, but you have to consider >>intermediate results. Multiply a few physical quantities together on >>your way to a final result, and you may need considerably more >>exponent range to avoid overflow during the calculation, even though >>all of the inputs and outputs fall well within the "reasonable" range. > > >As a (still somewhat silly, but simple) example, consider computing >the distance between two point in the universe, measuring merely in >micrometers (forget about Planck length). All the inputs and outputs >will be less than about 2**110, but you'll have to handle intermediate >results of 2**220. And yes, there are obvious ways to deal with that >if overflow is an issue, notably by manually scaling the inputs and >results (convert the input to km, and the result back to um, for >example), but that kinda defeats the point of having FP. I was commenting on needing more than 8 bits in the exponent. I.e. 2^255. You could still square the distance measured in angstroms for any point pair in the observable universe. -- mrr
[toc] | [prev] | [next] | [standalone]
| From | Robert Wessel <robertwessel2@yahoo.com> |
|---|---|
| Date | 2016-02-16 17:27 -0600 |
| Message-ID | <i8b7cb5nn8ioj863g7b90bljpuq47857sj@4ax.com> |
| In reply to | #33698 |
On Tue, 16 Feb 2016 21:43:29 +0100, Morten Reistad <first@last.name.invalid> wrote: >In article <60r6cb1gmrr1hgls467t7f2ratnmu2q5th@4ax.com>, >Robert Wessel <robertwessel2@yahoo.com> wrote: >>On Tue, 16 Feb 2016 12:28:29 -0600, Robert Wessel >><robertwessel2@yahoo.com> wrote: >> >>>On Tue, 16 Feb 2016 18:23:32 +0100, Morten Reistad >>><first@last.name.invalid> wrote: >>> >>>>In article <n5o8u8$pln$1@speranza.aioe.org>, >>>>Terje Mathisen <terje.mathisen@tmsw.no> wrote: >>>>>Joe keane wrote: >>>>>> I'd like to be able to have slightly less exponent, slightly more >>>>>> mantissa. But it's so hard. >>>>>> >>>>>If you want something slightly different, then you probably have to >>>>>implement it yourself. The fastest method is probably to use pairs of >>>>>doubles and convert to your storage format when loading/storing. >>>> >>>>I wonder about the exponent sizes sometimes. The size of the >>>>observable universe divided by the Planc length is around 1.4E61, or >>>>representable with an exponent of ~204, well within 8 bits. I still >>>>look for business cases for anything beyond that. >>> >>> >>>Same issue as with (scaled integer) sizes with currency. It's easy to >>>pick a size that will handle any plausible amount of currency, or, in >>>this case, any plausible physical quantity, but you have to consider >>>intermediate results. Multiply a few physical quantities together on >>>your way to a final result, and you may need considerably more >>>exponent range to avoid overflow during the calculation, even though >>>all of the inputs and outputs fall well within the "reasonable" range. >> >> >>As a (still somewhat silly, but simple) example, consider computing >>the distance between two point in the universe, measuring merely in >>micrometers (forget about Planck length). All the inputs and outputs >>will be less than about 2**110, but you'll have to handle intermediate >>results of 2**220. And yes, there are obvious ways to deal with that >>if overflow is an issue, notably by manually scaling the inputs and >>results (convert the input to km, and the result back to um, for >>example), but that kinda defeats the point of having FP. > >I was commenting on needing more than 8 bits in the exponent. I.e. >2^255. You could still square the distance measured in angstroms for >any point pair in the observable universe. My point was that intermediate results will often need much larger exponents. If you prefer, lets compute the volume of the universe instead, and you'll exceed 2**255 if the resolution is a few tens of meters. In any event, an exponent field of eight bits will get you only about 2**128, since about half the exponent values are going to be used for negative characteristics.
[toc] | [prev] | [next] | [standalone]
| From | Terje Mathisen <terje.mathisen@tmsw.no> |
|---|---|
| Date | 2016-02-17 08:35 +0100 |
| Message-ID | <na17rp$1dnn$1@gioia.aioe.org> |
| In reply to | #33699 |
Robert Wessel wrote: > On Tue, 16 Feb 2016 21:43:29 +0100, Morten Reistad >> I was commenting on needing more than 8 bits in the exponent. I.e. >> 2^255. You could still square the distance measured in angstroms for >> any point pair in the observable universe. > > > My point was that intermediate results will often need much larger > exponents. If you prefer, lets compute the volume of the universe > instead, and you'll exceed 2**255 if the resolution is a few tens of > meters. > > In any event, an exponent field of eight bits will get you only about > 2**128, since about half the exponent values are going to be used for > negative characteristics. That is exactly the same problem as for fixed-point financial calculations: You have to agree on what is the minimum resolution ever needed. I.e. for a typical FP format with both positive and negative exponents you have to make the zero point coincide with 2^(abs(max_negative_exponent) * Planck_length. For single/float this corresponds to 2^128*1.6e-35 or 54445178707350 meter (a little over two light days) which is an inconvenient length measurement unit. :-) Terje -- - <Terje.Mathisen at tmsw.no> "almost all programming can be viewed as an exercise in caching"
[toc] | [prev] | [next] | [standalone]
| From | nmm@wheeler.UUCP (Nick Maclaren) |
|---|---|
| Date | 2016-02-17 09:51 +0000 |
| Message-ID | <na1frv$usi$1@dont-email.me> |
| In reply to | #33699 |
In article <i8b7cb5nn8ioj863g7b90bljpuq47857sj@4ax.com>, Robert Wessel <robertwessel2@yahoo.com> wrote: >On Tue, 16 Feb 2016 21:43:29 +0100, Morten Reistad >> >>I was commenting on needing more than 8 bits in the exponent. I.e. >>2^255. You could still square the distance measured in angstroms for >>any point pair in the observable universe. > >My point was that intermediate results will often need much larger >exponents. If you prefer, lets compute the volume of the universe >instead, and you'll exceed 2**255 if the resolution is a few tens of >meters. Yes. And it's not just the square, either, because many algorithms use much higher order polynomials. This is also the basis of the old rule that the exponent range needs to be at least four times the mantissa precision (i.e. to ensure that X^4 doesn't underflow). I have seen programs overflow in IEEE 754 double precision purely due to this effect, and that's 11 bits, not 8. Regards, Nick Maclaren.
[toc] | [prev] | [next] | [standalone]
| From | Terje Mathisen <terje.mathisen@tmsw.no> |
|---|---|
| Date | 2016-02-17 11:42 +0100 |
| Message-ID | <na1iqc$do$1@gioia.aioe.org> |
| In reply to | #33703 |
Nick Maclaren wrote: > In article <i8b7cb5nn8ioj863g7b90bljpuq47857sj@4ax.com>, > Robert Wessel <robertwessel2@yahoo.com> wrote: >> My point was that intermediate results will often need much larger >> exponents. If you prefer, lets compute the volume of the universe >> instead, and you'll exceed 2**255 if the resolution is a few tens of >> meters. > > Yes. And it's not just the square, either, because many algorithms > use much higher order polynomials. This is also the basis of the > old rule that the exponent range needs to be at least four times the > mantissa precision (i.e. to ensure that X^4 doesn't underflow). This rule means that the smaller fp sizes like fp16 and fp8 really should not be used for complicated calculations, only as a storage format. > > I have seen programs overflow in IEEE 754 double precision purely > due to this effect, and that's 11 bits, not 8. fp16 is normally encoded as 1:5:10, so an 11-bit mantissa and the exponent would only cover 0-31, i.e. about 3X. Using 1:6:9 instead would work according to that rule. fp8 in 1:3:4 is even worse while 1:4:3 hits the 4X point exactly. Going even further down does not make too much sense. If you want to implement the full ieee754 rule set then you cannot have less than 3 mantissa bits and the exponent range reserves both endpoints for special values so 2 bits is effectively the minimum reasonable value. The nice thing about fp8 is that you can implement all two-operand fp operations as direct lookups in 64KB (256x256) texture maps, i.e. it should be dead simple to implement on a GPU. :-) Terje -- - <Terje.Mathisen at tmsw.no> "almost all programming can be viewed as an exercise in caching"
[toc] | [prev] | [next] | [standalone]
| From | nmm@wheeler.UUCP (Nick Maclaren) |
|---|---|
| Date | 2016-02-17 11:56 +0000 |
| Message-ID | <na1n5i$noa$1@dont-email.me> |
| In reply to | #33704 |
In article <na1iqc$do$1@gioia.aioe.org>, Terje Mathisen <terje.mathisen@tmsw.no> wrote: >> >>> My point was that intermediate results will often need much larger >>> exponents. If you prefer, lets compute the volume of the universe >>> instead, and you'll exceed 2**255 if the resolution is a few tens of >>> meters. >> >> Yes. And it's not just the square, either, because many algorithms >> use much higher order polynomials. This is also the basis of the >> old rule that the exponent range needs to be at least four times the >> mantissa precision (i.e. to ensure that X^4 doesn't underflow). > >This rule means that the smaller fp sizes like fp16 and fp8 really >should not be used for complicated calculations, only as a storage format. Precisely. As IEEE 754R originally intended, though I am not sure that the final standard says that. You will know that uses the 4x rule for all widths from 32 upwards. >> I have seen programs overflow in IEEE 754 double precision purely >> due to this effect, and that's 11 bits, not 8. > >fp16 is normally encoded as 1:5:10, so an 11-bit mantissa and the >exponent would only cover 0-31, i.e. about 3X. Using anything that small for calculation is a crazy idea. It's just about possible for summation of (say) pixel colours, but goes rapidly wrong for anything more. Regards, Nick Maclaren.
[toc] | [prev] | [next] | [standalone]
| From | BGB <cr88192@hotmail.com> |
|---|---|
| Date | 2016-02-17 09:56 -0600 |
| Message-ID | <na25j3$j29$1@news.albasani.net> |
| In reply to | #33705 |
On 2/17/2016 5:56 AM, Nick Maclaren wrote: > In article <na1iqc$do$1@gioia.aioe.org>, > Terje Mathisen <terje.mathisen@tmsw.no> wrote: >>> >>>> My point was that intermediate results will often need much larger >>>> exponents. If you prefer, lets compute the volume of the universe >>>> instead, and you'll exceed 2**255 if the resolution is a few tens of >>>> meters. >>> >>> Yes. And it's not just the square, either, because many algorithms >>> use much higher order polynomials. This is also the basis of the >>> old rule that the exponent range needs to be at least four times the >>> mantissa precision (i.e. to ensure that X^4 doesn't underflow). >> >> This rule means that the smaller fp sizes like fp16 and fp8 really >> should not be used for complicated calculations, only as a storage format. > > Precisely. As IEEE 754R originally intended, though I am not sure > that the final standard says that. You will know that uses the 4x > rule for all widths from 32 upwards. > >>> I have seen programs overflow in IEEE 754 double precision purely >>> due to this effect, and that's 11 bits, not 8. >> >> fp16 is normally encoded as 1:5:10, so an 11-bit mantissa and the >> exponent would only cover 0-31, i.e. about 3X. > > Using anything that small for calculation is a crazy idea. It's > just about possible for summation of (say) pixel colours, but goes > rapidly wrong for anything more. > for some use-cases (in graphics), it is actually not all that uncommon to shave the half-floats to 10 or 12 bits. this can allow, say, shoving a 3 element vector into a 32-bit word (10.10.10, 11.11.10, 10.12.10, ...). generally, one can alternate between using them as FP values and using them as integers. if using them as FP, it is more common to do intermediate calculations using float32, and if integers, good old 16 or 32-bit int. there is apparently some some variation as to whether FP16 implementations follow IEEE rules, ex: provide NaN/Inf and denormals. some implementations don't, opting either to make 0x0000 and 0x8000 special cases or to just ignore 0 as being special (treating it as an arbitrarily small value conventionally understood as zero). dropping these can allow a cheaper/faster implementation, and potentially increase the maximum usable value from 65535 to 131071 (though, another option is to treat anything in the extended range as undefined). I think typically FP8 variants omit NaN/Inf and denormals (maybe with a few special-case values).
[toc] | [prev] | [next] | [standalone]
| From | nmm@wheeler.UUCP (Nick Maclaren) |
|---|---|
| Date | 2016-02-17 16:14 +0000 |
| Message-ID | <na269g$tl4$1@dont-email.me> |
| In reply to | #33709 |
In article <na25j3$j29$1@news.albasani.net>, BGB <cr88192@hotmail.com> wrote: >>> >>> fp16 is normally encoded as 1:5:10, so an 11-bit mantissa and the >>> exponent would only cover 0-31, i.e. about 3X. >> >> Using anything that small for calculation is a crazy idea. It's >> just about possible for summation of (say) pixel colours, but goes >> rapidly wrong for anything more. > >for some use-cases (in graphics), it is actually not all that uncommon >to shave the half-floats to 10 or 12 bits. this can allow, say, shoving >a 3 element vector into a 32-bit word (10.10.10, 11.11.10, 10.12.10, ...). I know that, but that's storage only, not calculation - as you imply later. While the human eye can't see all that many gradations, most graphical operations on real images produce spurious edges and similar when calculated at such low precisions. That's soluble, but it's a hell of a lot easier to calculate in a higher precision. Regards, Nick Maclaren.
[toc] | [prev] | [next] | [standalone]
| From | Terje Mathisen <terje.mathisen@tmsw.no> |
|---|---|
| Date | 2016-02-18 07:42 +0100 |
| Message-ID | <na3p4h$545$1@gioia.aioe.org> |
| In reply to | #33709 |
BGB wrote: > for some use-cases (in graphics), it is actually not all that uncommon > to shave the half-floats to 10 or 12 bits. this can allow, say, shoving > a 3 element vector into a 32-bit word (10.10.10, 11.11.10, 10.12.10, ...). This is a standard (fixed-point) format used quite a lot, enough so that GPUs have special hw to crack them into 3 16 or 32-bit values for calculations. It is better than the normal 24/32-bit RGB/A when you don't need the Alpha channel. > > generally, one can alternate between using them as FP values and using > them as integers. > > if using them as FP, it is more common to do intermediate calculations > using float32, and if integers, good old 16 or 32-bit int. Right, you never do any significant calculations with so low resolution. > > there is apparently some some variation as to whether FP16 > implementations follow IEEE rules, ex: provide NaN/Inf and denormals. > some implementations don't, opting either to make 0x0000 and 0x8000 > special cases or to just ignore 0 as being special (treating it as an > arbitrarily small value conventionally understood as zero). As long as you handle these by expanding them to FP32 (which was done on Larrabee, the only GPU I've worked on), you get exactly the same Inf/NaN handling as the float format gets. (Which might of course include forcing all denormals to zero.) > > dropping these can allow a cheaper/faster implementation, and > potentially increase the maximum usable value from 65535 to 131071 > (though, another option is to treat anything in the extended range as > undefined). > > I think typically FP8 variants omit NaN/Inf and denormals (maybe with a > few special-case values). See above. If you implement calculations in FP8 then the cost of handling all the special cases should actually be quite small, since you can do the actual calculations with combinations of small lookup tables (separate exponent and mantissa, each needing 64-256 bytes, and a little bit a wired logic. The extreme case would combine them and use 7-bit by 7-bit lookup tables (16 KB) with the sign handled by wires, i.e. for FMUL8 you return the XOR of the input signs, for FADD/FSUB you store an indicator in the sign bit which is used to select the sign of the larger of the inputs. Terje -- - <Terje.Mathisen at tmsw.no> "almost all programming can be viewed as an exercise in caching"
[toc] | [prev] | [next] | [standalone]
| From | BGB <cr88192@hotmail.com> |
|---|---|
| Date | 2016-02-18 10:09 -0600 |
| Message-ID | <na4qmd$hdh$1@news.albasani.net> |
| In reply to | #33720 |
On 2/18/2016 12:42 AM, Terje Mathisen wrote: > BGB wrote: >> for some use-cases (in graphics), it is actually not all that uncommon >> to shave the half-floats to 10 or 12 bits. this can allow, say, shoving >> a 3 element vector into a 32-bit word (10.10.10, 11.11.10, 10.12.10, >> ...). > > This is a standard (fixed-point) format used quite a lot, enough so that > GPUs have special hw to crack them into 3 16 or 32-bit values for > calculations. It is better than the normal 24/32-bit RGB/A when you > don't need the Alpha channel. though, as noted, it is typically a linear value rather than a floating-point or log value. it sometimes makes sense to cram shaved half-float values into fewer bits (for HDR), but it is pro/con between this and RGBe. I have generally used this for CPU-side graphics processing though. apparently, a packed format like this, just storing scaled log-scale values, is apparently gaining popularity for higher-end digital cameras. though the ones I have had have only ever taken pictures as JPG's, often with surprisingly low quality settings (the camera vendor is content to have its max quality setting save an image as a JPEG at roughly 60-70% quality). though, 70% is sort of a magic number with JPEG, being the point at which typically there is the maximum space-savings relative to quality. higher quality, and size increases considerably, lower and artifacts start to become much more obvious (with relatively lower space savings), though if one sticks a 32GB or 64GB SD card in the camera, they "should" probably have the option of turning up to a higher quality level, or storing images in a closer to lossless format. >> >> generally, one can alternate between using them as FP values and using >> them as integers. >> >> if using them as FP, it is more common to do intermediate calculations >> using float32, and if integers, good old 16 or 32-bit int. > > Right, you never do any significant calculations with so low resolution. partly it is that the FPU doesn't natively support float16, so doing intermediate calculations as float32 is both faster and more accurate than trying to use emulated float16 calculations. the alternate route, namely partially ignoring that it is a float and doing calculations directly on the bits as an integer, is less accurate (in an absolute sense), but is faster. one possibility here is storing the values in a "folded" form: Y=(X^((X<<16)>>31)); //A (signed, 0 maps to 0) Y=(X^((X<<16)>>31))+32768; //B (0 maps to 32768) the advantage of doing this is that it is better behaved for interpolation, as interpolating between positive and negative values will pass through zero, rather than arbitrarily huge values. calculations here are generally done with 32-bit fixed-point calculations (ex: you generally need 32-bits to operate on 16-bit values as fixed point). >> >> there is apparently some some variation as to whether FP16 >> implementations follow IEEE rules, ex: provide NaN/Inf and denormals. >> some implementations don't, opting either to make 0x0000 and 0x8000 >> special cases or to just ignore 0 as being special (treating it as an >> arbitrarily small value conventionally understood as zero). > > As long as you handle these by expanding them to FP32 (which was done on > Larrabee, the only GPU I've worked on), you get exactly the same Inf/NaN > handling as the float format gets. (Which might of course include > forcing all denormals to zero.) apparently the non-IEEE half-float route is more popular in mobile GPUs and in MCU applications (as an alternative to single-precision and full-IEEE). in an MCU, typically any FPU functionality is emulatated either way (unless it is something fancy like a Cortex-M4 or similar). one example is VEX Robotics RobotC language, which apparently uses half-float as its native float type (and a 16-bit 'int' type, despite the code being run on a Cortex-M3). though, information conflicts, some stuff states it as being a 16-bit float type, and some other stuff indirectly implies it is float32 (accuracy tables show values which look like float32). my observations with actually using it look more like F16 though. >> >> dropping these can allow a cheaper/faster implementation, and >> potentially increase the maximum usable value from 65535 to 131071 >> (though, another option is to treat anything in the extended range as >> undefined). >> >> I think typically FP8 variants omit NaN/Inf and denormals (maybe with a >> few special-case values). > > See above. > > If you implement calculations in FP8 then the cost of handling all the > special cases should actually be quite small, since you can do the > actual calculations with combinations of small lookup tables (separate > exponent and mantissa, each needing 64-256 bytes, and a little bit a > wired logic. > > The extreme case would combine them and use 7-bit by 7-bit lookup tables > (16 KB) with the sign handled by wires, i.e. for FMUL8 you return the > XOR of the input signs, for FADD/FSUB you store an indicator in the sign > bit which is used to select the sign of the larger of the inputs. > it isn't so much about computational cost in the FP8 case, but rather that if you only have 8 or 16 exponent levels, the relative cost of supporting them is higher, vs just making a few values special case. say: 0x00: 0.0 0x7F: Inf NaN could either be omitted, or encoded as either 0x01 or 0x7E. In most cases where a NaN would arise, it may be simpler and cheaper simply to have it decay into being 0.0. cost/benefit could go either way with denormals I think. I haven't really used FP8 much in general (relative to FP10/FP12). Had used it for a few experiments in NN's, where NN's are difficult to make cheap both in terms of memory and computation. though, some newer designs may just use small fixed-point weights, if I mess more with NN's (making them not suck is hard). ex: it is hard to drive enough neurons quickly enough to do interesting stuff. like, a 256x256x64 cube is pretty hard to drive (even on a PC). one can bit-pack it down to about 16-bits per dendrite, and use a fixed 8 or 12 dendrites per neuron. still pretty steep though (and difficult to get much past a 20-30Hz tick). the goal would be to get something which could do interesting autonomous behaviors from a robot (and so could ideally run with a reasonable performance cost on an ARM11), and be competitive with finite-state machines. here, it is more limited to a 64x64x16 cube, using about 512 bits per neuron. generally one "face" will be used for inputs, and another for outputs. effort has been limited due to lack of compelling results though (same issue as genetic programming: it takes a long time to run, longer to fiddle-with and fine tune, and the results rarely get much beyond something I could hack together probably in a few minutes of coding). I guess I could test out, see how big of a net I could run on a RasPi2, or on a Xeon I have (possibly using multiple threads and running 8 cubes in parallel, for an effective 512x512x128 cube...). or use a thinner cube so that input-to-output latency is lower (an issue with these cubes is that it takes a while for changes in the inputs to propagate to the output). I am not actually sure what the "state of the art" is, my stuff had been limited to occasional small scale fiddling. or such...
[toc] | [prev] | [next] | [standalone]
| From | jim.brakefield@ieee.org |
|---|---|
| Date | 2016-02-18 12:33 -0800 |
| Message-ID | <644a3541-7b62-4a4f-8d71-446fd84f1d16@googlegroups.com> |
| In reply to | #33726 |
On Thursday, February 18, 2016 at 10:15:13 AM UTC-6, BGB wrote: > On 2/18/2016 12:42 AM, Terje Mathisen wrote: > > BGB wrote: > >> for some use-cases (in graphics), it is actually not all that uncommon > >> to shave the half-floats to 10 or 12 bits. this can allow, say, shoving > >> a 3 element vector into a 32-bit word (10.10.10, 11.11.10, 10.12.10, > >> ...). > > > > This is a standard (fixed-point) format used quite a lot, enough so that > > GPUs have special hw to crack them into 3 16 or 32-bit values for > > calculations. It is better than the normal 24/32-bit RGB/A when you > > don't need the Alpha channel. > > though, as noted, it is typically a linear value rather than a > floating-point or log value. > > it sometimes makes sense to cram shaved half-float values into fewer > bits (for HDR), but it is pro/con between this and RGBe. > > I have generally used this for CPU-side graphics processing though. > > > apparently, a packed format like this, just storing scaled log-scale > values, is apparently gaining popularity for higher-end digital cameras. > though the ones I have had have only ever taken pictures as JPG's, often > with surprisingly low quality settings (the camera vendor is content to > have its max quality setting save an image as a JPEG at roughly 60-70% > quality). > > though, 70% is sort of a magic number with JPEG, being the point at > which typically there is the maximum space-savings relative to quality. > higher quality, and size increases considerably, lower and artifacts > start to become much more obvious (with relatively lower space savings), > though if one sticks a 32GB or 64GB SD card in the camera, they "should" > probably have the option of turning up to a higher quality level, or > storing images in a closer to lossless format. > > > >> > >> generally, one can alternate between using them as FP values and using > >> them as integers. > >> > >> if using them as FP, it is more common to do intermediate calculations > >> using float32, and if integers, good old 16 or 32-bit int. > > > > Right, you never do any significant calculations with so low resolution. > > partly it is that the FPU doesn't natively support float16, so doing > intermediate calculations as float32 is both faster and more accurate > than trying to use emulated float16 calculations. > > > the alternate route, namely partially ignoring that it is a float and > doing calculations directly on the bits as an integer, is less accurate > (in an absolute sense), but is faster. > > one possibility here is storing the values in a "folded" form: > Y=(X^((X<<16)>>31)); //A (signed, 0 maps to 0) > Y=(X^((X<<16)>>31))+32768; //B (0 maps to 32768) > > the advantage of doing this is that it is better behaved for > interpolation, as interpolating between positive and negative values > will pass through zero, rather than arbitrarily huge values. > > calculations here are generally done with 32-bit fixed-point > calculations (ex: you generally need 32-bits to operate on 16-bit values > as fixed point). > > > >> > >> there is apparently some some variation as to whether FP16 > >> implementations follow IEEE rules, ex: provide NaN/Inf and denormals. > >> some implementations don't, opting either to make 0x0000 and 0x8000 > >> special cases or to just ignore 0 as being special (treating it as an > >> arbitrarily small value conventionally understood as zero). > > > > As long as you handle these by expanding them to FP32 (which was done on > > Larrabee, the only GPU I've worked on), you get exactly the same Inf/NaN > > handling as the float format gets. (Which might of course include > > forcing all denormals to zero.) > > > apparently the non-IEEE half-float route is more popular in mobile GPUs > and in MCU applications (as an alternative to single-precision and > full-IEEE). > > in an MCU, typically any FPU functionality is emulatated either way > (unless it is something fancy like a Cortex-M4 or similar). > > > one example is VEX Robotics RobotC language, which apparently uses > half-float as its native float type (and a 16-bit 'int' type, despite > the code being run on a Cortex-M3). > > though, information conflicts, some stuff states it as being a 16-bit > float type, and some other stuff indirectly implies it is float32 > (accuracy tables show values which look like float32). > > my observations with actually using it look more like F16 though. > > > >> > >> dropping these can allow a cheaper/faster implementation, and > >> potentially increase the maximum usable value from 65535 to 131071 > >> (though, another option is to treat anything in the extended range as > >> undefined). > >> > >> I think typically FP8 variants omit NaN/Inf and denormals (maybe with a > >> few special-case values). > > > > See above. > > > > If you implement calculations in FP8 then the cost of handling all the > > special cases should actually be quite small, since you can do the > > actual calculations with combinations of small lookup tables (separate > > exponent and mantissa, each needing 64-256 bytes, and a little bit a > > wired logic. > > > > The extreme case would combine them and use 7-bit by 7-bit lookup tables > > (16 KB) with the sign handled by wires, i.e. for FMUL8 you return the > > XOR of the input signs, for FADD/FSUB you store an indicator in the sign > > bit which is used to select the sign of the larger of the inputs. > > > > it isn't so much about computational cost in the FP8 case, but rather > that if you only have 8 or 16 exponent levels, the relative cost of > supporting them is higher, vs just making a few values special case. > > say: > 0x00: 0.0 > 0x7F: Inf > > NaN could either be omitted, or encoded as either 0x01 or 0x7E. > In most cases where a NaN would arise, it may be simpler and cheaper > simply to have it decay into being 0.0. > > cost/benefit could go either way with denormals I think. > > > > I haven't really used FP8 much in general (relative to FP10/FP12). > Had used it for a few experiments in NN's, where NN's are difficult to > make cheap both in terms of memory and computation. > > though, some newer designs may just use small fixed-point weights, if I > mess more with NN's (making them not suck is hard). > > ex: it is hard to drive enough neurons quickly enough to do interesting > stuff. like, a 256x256x64 cube is pretty hard to drive (even on a PC). > one can bit-pack it down to about 16-bits per dendrite, and use a fixed > 8 or 12 dendrites per neuron. still pretty steep though (and difficult > to get much past a 20-30Hz tick). > > the goal would be to get something which could do interesting autonomous > behaviors from a robot (and so could ideally run with a reasonable > performance cost on an ARM11), and be competitive with finite-state > machines. > > here, it is more limited to a 64x64x16 cube, using about 512 bits per > neuron. generally one "face" will be used for inputs, and another for > outputs. > > effort has been limited due to lack of compelling results though (same > issue as genetic programming: it takes a long time to run, longer to > fiddle-with and fine tune, and the results rarely get much beyond > something I could hack together probably in a few minutes of coding). > > > I guess I could test out, see how big of a net I could run on a RasPi2, > or on a Xeon I have (possibly using multiple threads and running 8 cubes > in parallel, for an effective 512x512x128 cube...). > > or use a thinner cube so that input-to-output latency is lower (an issue > with these cubes is that it takes a while for changes in the inputs to > propagate to the output). > > > I am not actually sure what the "state of the art" is, my stuff had been > limited to occasional small scale fiddling. > > > or such... Would expect that using a YUV or HSL representation with Y or I as a 16-bit float and UV or HS as integers (16-8-8 or 32-16-16) would give both sufficient color accuracy and the dynamic range of floats? Jim Brakefield
[toc] | [prev] | [next] | [standalone]
| From | Terje Mathisen <terje.mathisen@tmsw.no> |
|---|---|
| Date | 2016-02-18 22:08 +0100 |
| Message-ID | <na5bs2$11od$1@gioia.aioe.org> |
| In reply to | #33727 |
jim.brakefield@ieee.org wrote: > > Would expect that using a YUV or HSL representation with Y or I as a > 16-bit float and UV or HS as integers (16-8-8 or 32-16-16) would give > both sufficient color accuracy and the dynamic range of floats? That would seem even more like a storage format only, but there it would probably work about as well as a 48-bit (16:16:16) RGB fixed-point format. Terje -- - <Terje.Mathisen at tmsw.no> "almost all programming can be viewed as an exercise in caching"
[toc] | [prev] | [next] | [standalone]
| From | BGB <cr88192@hotmail.com> |
|---|---|
| Date | 2016-02-18 15:45 -0600 |
| Message-ID | <na5ed1$m5a$1@news.albasani.net> |
| In reply to | #33728 |
On 2/18/2016 3:08 PM, Terje Mathisen wrote: > jim.brakefield@ieee.org wrote: >> >> Would expect that using a YUV or HSL representation with Y or I as a >> 16-bit float and UV or HS as integers (16-8-8 or 32-16-16) would give >> both sufficient color accuracy and the dynamic range of floats? > > That would seem even more like a storage format only, but there it would > probably work about as well as a 48-bit (16:16:16) RGB fixed-point format. > HSL, probably. YUV, generally U are V need to be proportional to Y. it would then amount to essentially needing a YUVe format. that or UV are reinterpreted as being relative to a unit-length color vector (with an implicit y, *), with Y being reinterpreted as the length of that vector. *: similar to encoding normal vectors with only X and Y, where Z can be recreated by noting that x^2+y^2+z^2=1, thus z^2=1-x^2+y^2, or z=sqrt(1-x^2+y^2). would need a cheaper approximate though, like "y=(511-U-V)>>1;" or similar. even as such, it would likely still make it a bit more expensive to encode/decode than an ordinary YUV transform, so probably not worthwhile.
[toc] | [prev] | [next] | [standalone]
Page 1 of 3 [1] 2 3 Next page →
Back to top | Article view | comp.arch
csiph-web