Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Single tasking: Just Say No.


devel / comp.arch / The value of floating-point exceptions?

SubjectAuthor
* The value of floating-point exceptions?Marcus
+* Re: The value of floating-point exceptions?Marcus
|`* Re: The value of floating-point exceptions?Stephen Fuld
| +- Re: The value of floating-point exceptions?Marcus
| `* Re: The value of floating-point exceptions?luke.l...@gmail.com
|  `- Re: The value of floating-point exceptions?BGB
+* Re: The value of floating-point exceptions?John Dallman
|+* Re: The value of floating-point exceptions?Marcus
||`* Re: The value of floating-point exceptions?John Dallman
|| +- Re: The value of floating-point exceptions?MitchAlsup
|| `* Re: The value of floating-point exceptions?Quadibloc
||  `* Re: The value of floating-point exceptions?MitchAlsup
||   +* Re: The value of floating-point exceptions?Marcus
||   |+* Re: The value of floating-point exceptions?Ivan Godard
||   ||`* Re: The value of floating-point exceptions?Quadibloc
||   || +* Re: The value of floating-point exceptions?Ivan Godard
||   || |+* Re: The value of floating-point exceptions?Anton Ertl
||   || ||`* Re: The value of floating-point exceptions?MitchAlsup
||   || || `- Re: The value of floating-point exceptions?Quadibloc
||   || |`- Re: The value of floating-point exceptions?Terje Mathisen
||   || `* Re: The value of floating-point exceptions?MitchAlsup
||   ||  +* Re: The value of floating-point exceptions?Quadibloc
||   ||  |+* Re: The value of floating-point exceptions?MitchAlsup
||   ||  ||+- Re: The value of floating-point exceptions?BGB
||   ||  ||`* Re: The value of floating-point exceptions?Terje Mathisen
||   ||  || `* Re: The value of floating-point exceptions?BGB
||   ||  ||  `* Re: The value of floating-point exceptions?MitchAlsup
||   ||  ||   +* Re: The value of floating-point exceptions?Ivan Godard
||   ||  ||   |+* Re: The value of floating-point exceptions?BGB
||   ||  ||   ||`* Re: The value of floating-point exceptions?Terje Mathisen
||   ||  ||   || `- Re: The value of floating-point exceptions?BGB
||   ||  ||   |+* Re: The value of floating-point exceptions?MitchAlsup
||   ||  ||   ||`* Re: The value of floating-point exceptions?Marcus
||   ||  ||   || `- Re: The value of floating-point exceptions?BGB
||   ||  ||   |`* Re: The value of floating-point exceptions?EricP
||   ||  ||   | `* Re: The value of floating-point exceptions?Ivan Godard
||   ||  ||   |  `* Re: The value of floating-point exceptions?MitchAlsup
||   ||  ||   |   +* Re: Configurable rounding modes (was The value of floating-pointMarcus
||   ||  ||   |   |+- Re: Configurable rounding modes (was The value of floating-pointTerje Mathisen
||   ||  ||   |   |`* Re: Configurable rounding modes (was The value of floating-point exceptions?)MitchAlsup
||   ||  ||   |   | +- Re: Configurable rounding modes (was The value of floating-pointStephen Fuld
||   ||  ||   |   | `- Re: Configurable rounding modes (was The value of floating-pointMarcus
||   ||  ||   |   `* Re: The value of floating-point exceptions?EricP
||   ||  ||   |    `* Re: The value of floating-point exceptions?MitchAlsup
||   ||  ||   |     `- Re: The value of floating-point exceptions?Quadibloc
||   ||  ||   +* Re: The value of floating-point exceptions?Quadibloc
||   ||  ||   |`* Re: The value of floating-point exceptions?MitchAlsup
||   ||  ||   | `- Re: The value of floating-point exceptions?Quadibloc
||   ||  ||   `* Re: The value of floating-point exceptions?Marcus
||   ||  ||    +* Re: The value of floating-point exceptions?Thomas Koenig
||   ||  ||    |`* Re: The value of floating-point exceptions?MitchAlsup
||   ||  ||    | `- Re: The value of floating-point exceptions?Thomas Koenig
||   ||  ||    +* Re: The value of floating-point exceptions?MitchAlsup
||   ||  ||    |+* Re: The value of floating-point exceptions?Ivan Godard
||   ||  ||    ||`- Re: The value of floating-point exceptions?BGB
||   ||  ||    |+* Re: The value of floating-point exceptions?Quadibloc
||   ||  ||    ||`* Re: The value of floating-point exceptions?MitchAlsup
||   ||  ||    || +* Re: The value of floating-point exceptions?Ivan Godard
||   ||  ||    || |`* Re: The value of floating-point exceptions?MitchAlsup
||   ||  ||    || | `* Re: The value of floating-point exceptions?Ivan Godard
||   ||  ||    || |  +* Re: The value of floating-point exceptions?MitchAlsup
||   ||  ||    || |  |`- Re: The value of floating-point exceptions?Ivan Godard
||   ||  ||    || |  `* Re: The value of floating-point exceptions?Marcus
||   ||  ||    || |   +- Re: The value of floating-point exceptions?Quadibloc
||   ||  ||    || |   +* Re: The value of floating-point exceptions?Anton Ertl
||   ||  ||    || |   |`* Re: The value of floating-point exceptions?Michael S
||   ||  ||    || |   | `* Re: The value of floating-point exceptions?MitchAlsup
||   ||  ||    || |   |  `- Re: The value of floating-point exceptions?Terje Mathisen
||   ||  ||    || |   `* Re: The value of floating-point exceptions?Quadibloc
||   ||  ||    || |    +- Re: The value of floating-point exceptions?Quadibloc
||   ||  ||    || |    `* Re: The value of floating-point exceptions?Marcus
||   ||  ||    || |     `* Re: The value of floating-point exceptions?MitchAlsup
||   ||  ||    || |      `* Re: The value of floating-point exceptions?Marcus
||   ||  ||    || |       `- Re: The value of floating-point exceptions?MitchAlsup
||   ||  ||    || `- Re: Configurable rounding modes (was The value of floating-pointMarcus
||   ||  ||    |`* Re: Configurable rounding modes (was The value of floating-pointMarcus
||   ||  ||    | +* Re: Configurable rounding modes (was The value of floating-point exceptions?)MitchAlsup
||   ||  ||    | |`* Re: Configurable rounding modes (was The value of floating-pointIvan Godard
||   ||  ||    | | +* Re: Configurable rounding modes (was The value of floating-pointBGB
||   ||  ||    | | |`* Re: Configurable rounding modes (was The value of floating-pointMarcus
||   ||  ||    | | | `- Re: Configurable rounding modes (was The value of floating-pointBGB
||   ||  ||    | | +* Re: Configurable rounding modes (was The value of floating-point exceptions?)Quadibloc
||   ||  ||    | | |+- Re: Configurable rounding modes (was The value of floating-point exceptions?)Quadibloc
||   ||  ||    | | |`* Re: Configurable rounding modes (was The value of floating-pointIvan Godard
||   ||  ||    | | | `- Re: Configurable rounding modes (was The value of floating-point exceptions?)Quadibloc
||   ||  ||    | | `* Re: Configurable rounding modes (was The value of floating-point exceptions?)MitchAlsup
||   ||  ||    | |  `* Re: Configurable rounding modes (was The value of floating-pointIvan Godard
||   ||  ||    | |   `* Re: Configurable rounding modes (was The value of floating-point exceptions?)Quadibloc
||   ||  ||    | |    `* Re: Configurable rounding modes (was The value of floating-point exceptions?)Quadibloc
||   ||  ||    | |     +- Re: Configurable rounding modes (was The value of floating-point exceptions?)Quadibloc
||   ||  ||    | |     `- Re: Configurable rounding modes (was The value of floating-point exceptions?)Quadibloc
||   ||  ||    | `* Re: Configurable rounding modes (was The value of floating-pointBGB
||   ||  ||    |  `* Re: Configurable rounding modes (was The value of floating-point exceptions?)MitchAlsup
||   ||  ||    |   `- Re: Configurable rounding modes (was The value of floating-pointBGB
||   ||  ||    `* Re: The value of floating-point exceptions?antispam
||   ||  ||     +- Re: The value of floating-point exceptions?BGB
||   ||  ||     +* Re: The value of floating-point exceptions?Terje Mathisen
||   ||  ||     |+- Re: The value of floating-point exceptions?BGB
||   ||  ||     |`* Re: The value of floating-point exceptions?antispam
||   ||  ||     | `* Re: The value of floating-point exceptions?Quadibloc
||   ||  ||     |  +* Re: The value of floating-point exceptions?antispam
||   ||  ||     |  `* Re: The value of floating-point exceptions?MitchAlsup
||   ||  ||     `- Re: The value of floating-point exceptions?John Dallman
||   ||  |`* Re: The value of floating-point exceptions?John Dallman
||   ||  +* Re: The value of floating-point exceptions?Quadibloc
||   ||  `* Re: The value of floating-point exceptions?Thomas Koenig
||   |`* Re: The value of floating-point exceptions?Quadibloc
||   `- Re: The value of floating-point exceptions?Quadibloc
|`* Re: The value of floating-point exceptions?Marcus
+- Re: The value of floating-point exceptions?Terje Mathisen
+* Re: The value of floating-point exceptions?Ivan Godard
+- Re: The value of floating-point exceptions?BGB
+* Re: The value of floating-point exceptions?EricP
+* Re: The value of floating-point exceptions?Anton Ertl
+* Re: The value of floating-point exceptions?MitchAlsup
`- Re: The value of floating-point exceptions?antispam

Pages:12345678910
The value of floating-point exceptions?

<sd98c9$cln$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18986&group=comp.arch#18986

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: m.del...@this.bitsnbites.eu (Marcus)
Newsgroups: comp.arch
Subject: The value of floating-point exceptions?
Date: Wed, 21 Jul 2021 15:44:41 +0200
Organization: A noiseless patient Spider
Lines: 24
Message-ID: <sd98c9$cln$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 21 Jul 2021 13:44:41 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="b28e696dcafce0392e3c74d6cc33e41b";
logging-data="12983"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18vyrU7pNJCr0LycL4mFlRmUtdM70I13y4="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Cancel-Lock: sha1:/wmCjDfLGo2VwLZAXNU/yCPUJFU=
Content-Language: en-US
X-Mozilla-News-Host: snews://news.eternal-september.org:563
 by: Marcus - Wed, 21 Jul 2021 13:44 UTC

Hi!

I would like to ask a couple of simple questions in this group, related
to the IEEE 754 standard and floating-point exceptions.

(Some of you may know that I've been pondering this subject before in
other forums).

As we all know, support for floating-point exceptions comes with a cost
(sometimes significant, since it dictates many aspects of a HW
implementation for instance). If we imagine an alternative universe in
which the dominant floating-point standard did not require exceptions,
I suspect that most hardware (and language) implementations would most
likely be simpler, more energy efficient and more suitable for parallel
and pipelined floating-point operations.

My questions are:

1) What (in your opinion) are the benefits of floating-point exceptions?

2) In what situations have you had use for floating-point exceptions?

/Marcus

Re: The value of floating-point exceptions?

<sd98g4$cln$2@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18987&group=comp.arch#18987

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: m.del...@this.bitsnbites.eu (Marcus)
Newsgroups: comp.arch
Subject: Re: The value of floating-point exceptions?
Date: Wed, 21 Jul 2021 15:46:44 +0200
Organization: A noiseless patient Spider
Lines: 37
Message-ID: <sd98g4$cln$2@dont-email.me>
References: <sd98c9$cln$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 21 Jul 2021 13:46:44 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="b28e696dcafce0392e3c74d6cc33e41b";
logging-data="12983"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Ahkx9Zy5QRSZCL4uN1QFNael8LEdY/I0="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Cancel-Lock: sha1:KJUg7AYsdJkO32pTrzdjoqh5AtI=
In-Reply-To: <sd98c9$cln$1@dont-email.me>
Content-Language: en-US
 by: Marcus - Wed, 21 Jul 2021 13:46 UTC

On 2021-07-21 15:44, Marcus wrote:
> Hi!
>
> I would like to ask a couple of simple questions in this group, related
> to the IEEE 754 standard and floating-point exceptions.
>
> (Some of you may know that I've been pondering this subject before in
> other forums).
>
> As we all know, support for floating-point exceptions comes with a cost
> (sometimes significant, since it dictates many aspects of a HW
> implementation for instance). If we imagine an alternative universe in
> which the dominant floating-point standard did not require exceptions,
> I suspect that most hardware (and language) implementations would most
> likely be simpler, more energy efficient and more suitable for parallel
> and pipelined floating-point operations.
>
> My questions are:

To answer my own questions... In my fields which over the past 2-3
decades include 3D graphics, ray tracing, 3D polygonal mesh manipulation
algorithms, compression algorithms for triangle meshes, audio DSP, audio
synthesis, audio compression, space/satellite signal processing, image
processing and compression algorithms, AI / neural networks, image-based
eye- and head-tracking, least squares solvers, and so on, etc, I have to
say:

>
> 1) What (in your opinion) are the benefits of floating-point exceptions?
>

None

> 2) In what situations have you had use for floating-point exceptions?
>

None

Re: The value of floating-point exceptions?

<memo.20210721145746.10680O@jgd.cix.co.uk>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18988&group=comp.arch#18988

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: jgd...@cix.co.uk (John Dallman)
Newsgroups: comp.arch
Subject: Re: The value of floating-point exceptions?
Date: Wed, 21 Jul 2021 14:57 +0100 (BST)
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <memo.20210721145746.10680O@jgd.cix.co.uk>
References: <sd98c9$cln$1@dont-email.me>
Reply-To: jgd@cix.co.uk
Injection-Info: reader02.eternal-september.org; posting-host="84ad00083f1213bc19ba41760b121277";
logging-data="18865"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/bW/TQutVSli2lCkZ+sLWo5Os4aZUmHkk="
Cancel-Lock: sha1:VqPhTT2sBDlakk0EV5ydI2/6fnw=
 by: John Dallman - Wed, 21 Jul 2021 13:57 UTC

In article <sd98c9$cln$1@dont-email.me>, m.delete@this.bitsnbites.eu
(Marcus) wrote:

> 1) What (in your opinion) are the benefits of floating-point
> exceptions?

They allow detection of problems closer to the site of the bad code, or
when reading the bad data. The mathematical modeller I work on has many
iterative floating-point algorithms, and predicting what they will do for
large sets of input data is beyond human capabilities.

> 2) In what situations have you had use for floating-point
> exceptions?

Finding bugs of our own, compiler bugs and bad data in bug reports.

The lack of floating-point exceptions in actual implementations of ARM64
is one of my biggest worries about its increasing popularity.

John

Re: The value of floating-point exceptions?

<sd9a9h$ro6$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18989&group=comp.arch#18989

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: m.del...@this.bitsnbites.eu (Marcus)
Newsgroups: comp.arch
Subject: Re: The value of floating-point exceptions?
Date: Wed, 21 Jul 2021 16:17:21 +0200
Organization: A noiseless patient Spider
Lines: 43
Message-ID: <sd9a9h$ro6$1@dont-email.me>
References: <sd98c9$cln$1@dont-email.me>
<memo.20210721145746.10680O@jgd.cix.co.uk>
Mime-Version: 1.0
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 21 Jul 2021 14:17:22 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="b28e696dcafce0392e3c74d6cc33e41b";
logging-data="28422"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/wN0CMGuv6VlN18IPEWj+JAehCFPEO+OQ="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Cancel-Lock: sha1:UsKMOJQimRJUTiIbNJmW+fZ3Uos=
In-Reply-To: <memo.20210721145746.10680O@jgd.cix.co.uk>
Content-Language: en-US
 by: Marcus - Wed, 21 Jul 2021 14:17 UTC

On 2021-07-21 15:56, John Dallman wrote:
> In article <sd98c9$cln$1@dont-email.me>, m.delete@this.bitsnbites.eu
> (Marcus) wrote:
>
>> 1) What (in your opinion) are the benefits of floating-point
>> exceptions?
>
> They allow detection of problems closer to the site of the bad code, or
> when reading the bad data. The mathematical modeller I work on has many
> iterative floating-point algorithms, and predicting what they will do for
> large sets of input data is beyond human capabilities.
>
>> 2) In what situations have you had use for floating-point
>> exceptions?
>
> Finding bugs of our own, compiler bugs and bad data in bug reports.
>
> The lack of floating-point exceptions in actual implementations of ARM64
> is one of my biggest worries about its increasing popularity.
>
> John
>

Oh, interesting. It seems that Microsoft has recognized this. Quoting
their Windows ARM64 ABI conventions [1]:

"For processor variants that do have hardware floating-point exceptions,
the Windows kernel silently catches the exceptions and implicitly
disables them in the FPCR register. This trap ensures normalized
behavior across processor variants. Otherwise, code developed on a
platform without exception support may find itself taking unexpected
exceptions when running on a platform with support."

....which of course is the natural solution. In our software we do the
same thing (even disabling subnormals) in order to normalize on the
least common denominator, so to say (as soon as one target platform
lacks a feature, it needs to be disabled on _all_ platforms).

/Marcus

[1]
https://docs.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions?view=msvc-160#floating-point-exceptions

Re: The value of floating-point exceptions?

<sd9ap0$h7g$2@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18991&group=comp.arch#18991

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!aioe.org!uNkxFD/dgvFUE+WUQcvYbA.user.46.165.242.91.POSTED!not-for-mail
From: terje.ma...@tmsw.no (Terje Mathisen)
Newsgroups: comp.arch
Subject: Re: The value of floating-point exceptions?
Date: Wed, 21 Jul 2021 16:25:36 +0200
Organization: Aioe.org NNTP Server
Message-ID: <sd9ap0$h7g$2@gioia.aioe.org>
References: <sd98c9$cln$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="17648"; posting-host="uNkxFD/dgvFUE+WUQcvYbA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:60.0) Gecko/20100101
Firefox/60.0 SeaMonkey/2.53.8
X-Notice: Filtered by postfilter v. 0.9.2
 by: Terje Mathisen - Wed, 21 Jul 2021 14:25 UTC

Marcus wrote:
> Hi!
>
> I would like to ask a couple of simple questions in this group, related
> to the IEEE 754 standard and floating-point exceptions.
>
> (Some of you may know that I've been pondering this subject before in
> other forums).
>
> As we all know, support for floating-point exceptions comes with a cost
> (sometimes significant, since it dictates many aspects of a HW
> implementation for instance). If we imagine an alternative universe in
> which the dominant floating-point standard did not require exceptions,
> I suspect that most hardware (and language) implementations would most
> likely be simpler, more energy efficient and more suitable for parallel
> and pipelined floating-point operations.
>
> My questions are:
>
> 1) What (in your opinion) are the benefits of floating-point exceptions?

Mostly theoretical

>
> 2) In what situations have you had use for floating-point exceptions?

Never.

Terje

--
- <Terje.Mathisen at tmsw.no>
"almost all programming can be viewed as an exercise in caching"

Re: The value of floating-point exceptions?

<sd9b6k$2q4$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18992&group=comp.arch#18992

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: m.del...@this.bitsnbites.eu (Marcus)
Newsgroups: comp.arch
Subject: Re: The value of floating-point exceptions?
Date: Wed, 21 Jul 2021 16:32:52 +0200
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <sd9b6k$2q4$1@dont-email.me>
References: <sd98c9$cln$1@dont-email.me>
<memo.20210721145746.10680O@jgd.cix.co.uk>
Mime-Version: 1.0
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 21 Jul 2021 14:32:52 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="b28e696dcafce0392e3c74d6cc33e41b";
logging-data="2884"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+A6e4fd3leDa6BhRTM+wqjoEvhMY0T0EM="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Cancel-Lock: sha1:TaWal2QXO+1e4yPIIjIzlgVlTqk=
In-Reply-To: <memo.20210721145746.10680O@jgd.cix.co.uk>
Content-Language: en-US
 by: Marcus - Wed, 21 Jul 2021 14:32 UTC

On 2021-07-21 15:56, John Dallman wrote:
> In article <sd98c9$cln$1@dont-email.me>, m.delete@this.bitsnbites.eu
> (Marcus) wrote:
>
>> 1) What (in your opinion) are the benefits of floating-point
>> exceptions?
>
> They allow detection of problems closer to the site of the bad code, or
> when reading the bad data. The mathematical modeller I work on has many
> iterative floating-point algorithms, and predicting what they will do for
> large sets of input data is beyond human capabilities.
>
>> 2) In what situations have you had use for floating-point
>> exceptions?
>
> Finding bugs of our own, compiler bugs and bad data in bug reports.

For these use cases, would it not suffice with a compiler/software
solution similar to the sanitizers that are available in LLVM and GCC
for instance? E.g. see:

* https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
* https://dl.acm.org/doi/epdf/10.1145/3446804.3446848

I regularly enable sanitizers during test & development, and for most
purposes they tend to have an acceptable performance overhead.

> The lack of floating-point exceptions in actual implementations of ARM64
> is one of my biggest worries about its increasing popularity.
>
> John
>

Re: The value of floating-point exceptions?

<memo.20210721153537.10680P@jgd.cix.co.uk>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18993&group=comp.arch#18993

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: jgd...@cix.co.uk (John Dallman)
Newsgroups: comp.arch
Subject: Re: The value of floating-point exceptions?
Date: Wed, 21 Jul 2021 15:35 +0100 (BST)
Organization: A noiseless patient Spider
Lines: 29
Message-ID: <memo.20210721153537.10680P@jgd.cix.co.uk>
References: <sd9a9h$ro6$1@dont-email.me>
Reply-To: jgd@cix.co.uk
Injection-Info: reader02.eternal-september.org; posting-host="84ad00083f1213bc19ba41760b121277";
logging-data="3951"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/lmC7Xj+SmX4dnysWDzRPvaiyUOpWzhnM="
Cancel-Lock: sha1:GAccKZNjd1yZOPc3HQIMBG8Jbi0=
 by: John Dallman - Wed, 21 Jul 2021 14:35 UTC

In article <sd9a9h$ro6$1@dont-email.me>, m.delete@this.bitsnbites.eu
(Marcus) wrote:

> ...which of course is the natural solution.

It's the natural solution if you assume nobody will ever actually want
floating-point exceptions. A far more helpful solution would be what they
do on x86, which is to disable the exceptions by default and to provide a
CRT call to turn on the ones that you want.

> In our software we do the same thing (even disabling subnormals)
> in order to normalize on the least common denominator, so to say
> (as soon as one target platform lacks a feature, it needs to be
> disabled on _all_ platforms).

We're willing to try to make use of useful features of particular
platforms.

In our test harness, we turn on exceptions for overflow, invalid and
divide-by-zero, where we can. We leave denormal, inexact and underflow
disabled, since we want behaviour as much as possible like natural
numbers. We turn on flushing of denormals to zero where it's available.

The customers can use whatever floating-point handling they want, but we
warn them that exceptions on denormal, inexact or underflow will cause
problems.

John

Re: The value of floating-point exceptions?

<sd9fcj$2v8$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18997&group=comp.arch#18997

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: iva...@millcomputing.com (Ivan Godard)
Newsgroups: comp.arch
Subject: Re: The value of floating-point exceptions?
Date: Wed, 21 Jul 2021 08:44:18 -0700
Organization: A noiseless patient Spider
Lines: 66
Message-ID: <sd9fcj$2v8$1@dont-email.me>
References: <sd98c9$cln$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 21 Jul 2021 15:44:19 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="38e0bf959633f73a7114884d648647e8";
logging-data="3048"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18bwEBYf6KfY0s3jqbdtbLW"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Cancel-Lock: sha1:QOGv18CHsxQetTRWswaqc24TImM=
In-Reply-To: <sd98c9$cln$1@dont-email.me>
Content-Language: en-US
 by: Ivan Godard - Wed, 21 Jul 2021 15:44 UTC

It's not that the semantics of exceptions are useless, it's that the
IEEE standard's approach to them is mis-designed for modern
architectures and hence IEEE exceptions as a programming device are
effectively useless.

The definition of flags and modes in the standard makes them implicit
arguments to every instruction - which inherently linearizes the FP
instruction stream, while modern chips want to do a lot of FPs
concurrently. During my active time on the committee Kahan was still
plumping to use exceptions to support trap-value-replacement. You could
do that in Mathlab, but not in hardware. That linearization not only
breaks multi-issue and SIMD, it also precludes speculative execution of
FP ops in general - no computation overruns in loops for example.

Once you abandon value-replacement, exceptions become what the word
"exception" means in other contexts: a non-recoverable reporting
mechanism that things went off the rails somewhere. As such, as in any
debugging assist, the design as much as possible should serve to narrow
the scope of "somewhere" while not hindering computations that remain on
the rails.

In the Mill we do that by elimination the global flags and modes and
moving the event reporting into metadata attached to the result of the
failing computation. You can speculatively or concurrently do FP ops on
a Mill, and when the erroneous result finally must be used
non-speculatively (if it ever is), and you have not asked to ignore
bogus results, then the resulting fault can report fairly well where
things went bad. That really helps, not because of some numerical nicety
but because real programmers spend their lives chasing bugs.

So I use exceptions everywhere that an exception would indicate a bug.
However, even in debugging I don't use inexact; I have never used an
algorithm where I cared that rounding had happened, and in practice
inexact always gets set and so is just nuisance noise. Inexact was
intended to be a support for using FP for fixed-point calculations, but
if I had a fixed-point problem I would use DFP.

Ivan

On 7/21/2021 6:44 AM, Marcus wrote:
> Hi!
>
> I would like to ask a couple of simple questions in this group, related
> to the IEEE 754 standard and floating-point exceptions.
>
> (Some of you may know that I've been pondering this subject before in
> other forums).
>
> As we all know, support for floating-point exceptions comes with a cost
> (sometimes significant, since it dictates many aspects of a HW
> implementation for instance). If we imagine an alternative universe in
> which the dominant floating-point standard did not require exceptions,
> I suspect that most hardware (and language) implementations would most
> likely be simpler, more energy efficient and more suitable for parallel
> and pipelined floating-point operations.
>
> My questions are:
>
> 1) What (in your opinion) are the benefits of floating-point exceptions?
>
> 2) In what situations have you had use for floating-point exceptions?
>
>
> /Marcus

Re: The value of floating-point exceptions?

<memo.20210721164849.10680Q@jgd.cix.co.uk>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18998&group=comp.arch#18998

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: jgd...@cix.co.uk (John Dallman)
Newsgroups: comp.arch
Subject: Re: The value of floating-point exceptions?
Date: Wed, 21 Jul 2021 16:48 +0100 (BST)
Organization: A noiseless patient Spider
Lines: 58
Message-ID: <memo.20210721164849.10680Q@jgd.cix.co.uk>
References: <sd9b6k$2q4$1@dont-email.me>
Reply-To: jgd@cix.co.uk
Injection-Info: reader02.eternal-september.org; posting-host="84ad00083f1213bc19ba41760b121277";
logging-data="5136"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18GWfljAB2rNCmmkuTzgAGoZ0bDA5Zbwbo="
Cancel-Lock: sha1:Fe0FZX3RKk8JGuFXwSSHISCbm0I=
 by: John Dallman - Wed, 21 Jul 2021 15:48 UTC

In article <sd9b6k$2q4$1@dont-email.me>, m.delete@this.bitsnbites.eu
(Marcus) wrote:

> > Finding bugs of our own, compiler bugs and bad data in bug
> > reports.
>
> For these use cases, would it not suffice with a compiler/software
> solution similar to the sanitizers that are available in LLVM and
> GCC for instance? E.g. see:
>
> * https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
> * https://dl.acm.org/doi/epdf/10.1145/3446804.3446848

Possibly. An advantage of floating-point exceptions is that they work
when testing the *same* binary that will be delivered to the customer.

We've been using floating-point traps with this product since the 1980s,
and Valgrind for over a decade, and it is time to try out compiler
sanitisers. When I get a chance...

The UndefinedBehaviour sanitiser looks most useful for:

-fsanitize=alignment, since the platforms that were fussy about that are
all dead or nearly so.

-fsanitize=float-divide-by-zero and -fsanitize=integer-divide-by-zero are
a partial substitute for floating-point traps.

These also look worth a try: -fsanitize=builtin, -fsanitize=bounds,
-fsanitize=null, -fsanitize=pointer-overflow,
-fsanitize=signed-integer-overflow, and
-fsanitize=unsigned-integer-overflow.

Less useful ones are:

-fsanitize=float-cast-overflow, because to a very close approximation, we
don't convert floats or doubles to ints.

The NSan sanitiser will catch overflows, but it's not clear to me that it
will catch invalid operands. It's also going to be pretty slow, because
everything is doubles, forcing the shadow values to be 128-bit and thus
partially done in software.

> I regularly enable sanitizers during test & development, and for
> most purposes they tend to have an acceptable performance overhead.

I'm guessing you don't have a couple of hundred machines and VMs
operating distributed testing systems to get the overnight build tested
in time for a ship/don't-ship decision the following afternoon?

Sanitiser overhead is going to demand separate builds, that aren't
required to complete their testing in time for that ship/no-ship decision,
but still may be useful.

Thanks!

John

Re: The value of floating-point exceptions?

<sd9fn3$5ik$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18999&group=comp.arch#18999

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: cr88...@gmail.com (BGB)
Newsgroups: comp.arch
Subject: Re: The value of floating-point exceptions?
Date: Wed, 21 Jul 2021 10:49:53 -0500
Organization: A noiseless patient Spider
Lines: 42
Message-ID: <sd9fn3$5ik$1@dont-email.me>
References: <sd98c9$cln$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 21 Jul 2021 15:49:55 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="3075d4a3cee2ff33f013aff51378715f";
logging-data="5716"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+lJ3DO2vcAvZzEDSb3IyYQ"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.12.0
Cancel-Lock: sha1:fRr5/X/xO9A8gZ4CV9242VR8VV4=
In-Reply-To: <sd98c9$cln$1@dont-email.me>
Content-Language: en-US
 by: BGB - Wed, 21 Jul 2021 15:49 UTC

On 7/21/2021 8:44 AM, Marcus wrote:
> Hi!
>
> I would like to ask a couple of simple questions in this group, related
> to the IEEE 754 standard and floating-point exceptions.
>
> (Some of you may know that I've been pondering this subject before in
> other forums).
>
> As we all know, support for floating-point exceptions comes with a cost
> (sometimes significant, since it dictates many aspects of a HW
> implementation for instance). If we imagine an alternative universe in
> which the dominant floating-point standard did not require exceptions,
> I suspect that most hardware (and language) implementations would most
> likely be simpler, more energy efficient and more suitable for parallel
> and pipelined floating-point operations.
>
> My questions are:
>
> 1) What (in your opinion) are the benefits of floating-point exceptions?
>
> 2) In what situations have you had use for floating-point exceptions?
>

FWIW:
This was another feature I didn't bother with in BJX2;
If you want exceptions, they would need to be implemented in the
compiler as a "trap if you see a NaN here" instruction sequence.
But, this is unlikely, given their relative level of usefulness.

The compiler can go the other direction though, as I sit around
debugging some other arguably not-very-useful features:
__int128
Some arithmetic bugs/... showed up when "actually using it".
_BitInt(n), special where n>128, ...
eg, "_BitInt(768) ib0;", create a 768 bit integer value...
Decays into a basic integer type if n<=128.
Where 'n' is required to be greater than zero.
....

But, at least stuff like this can be sometimes useful...

Re: The value of floating-point exceptions?

<uGYJI.14172$Ei1.7654@fx07.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19002&group=comp.arch#19002

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!paganini.bofh.team!news.dns-netz.com!news.freedyn.net!newsreader4.netcologne.de!news.netcologne.de!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx07.iad.POSTED!not-for-mail
From: ThatWoul...@thevillage.com (EricP)
User-Agent: Thunderbird 2.0.0.24 (Windows/20100228)
MIME-Version: 1.0
Newsgroups: comp.arch
Subject: Re: The value of floating-point exceptions?
References: <sd98c9$cln$1@dont-email.me>
In-Reply-To: <sd98c9$cln$1@dont-email.me>
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 54
Message-ID: <uGYJI.14172$Ei1.7654@fx07.iad>
X-Complaints-To: abuse@UsenetServer.com
NNTP-Posting-Date: Wed, 21 Jul 2021 17:19:22 UTC
Date: Wed, 21 Jul 2021 13:19:17 -0400
X-Received-Bytes: 2961
 by: EricP - Wed, 21 Jul 2021 17:19 UTC

Marcus wrote:
> Hi!
>
> I would like to ask a couple of simple questions in this group, related
> to the IEEE 754 standard and floating-point exceptions.
>
> (Some of you may know that I've been pondering this subject before in
> other forums).
>
> As we all know, support for floating-point exceptions comes with a cost
> (sometimes significant, since it dictates many aspects of a HW
> implementation for instance). If we imagine an alternative universe in
> which the dominant floating-point standard did not require exceptions,
> I suspect that most hardware (and language) implementations would most
> likely be simpler, more energy efficient and more suitable for parallel
> and pipelined floating-point operations.
>
> My questions are:
>
> 1) What (in your opinion) are the benefits of floating-point exceptions?
>
> 2) In what situations have you had use for floating-point exceptions?
>
>
> /Marcus

Why do you believe the HW cost of exception support
is sometimes significant? It looks to me that as long as one
triggers these at Retire/Write-Back, precise exceptions are dirt cheap.

There is an initial cost for the first exception,
and an incremental cost for each one after that.

Consider a DSP with no exceptions, no MMU so no access faults,
no privileged mode, no integer divide-by-zero etc. Nothing.

It seems to me that the initial cost of adding a precise exception to
that is 1 bit in the uOp along with the result. When the uOp reaches
write-back, WB sees the exception flag and inhibits the register write,
and diddles a wire that flushes the pipeline the same as an
indirect branch, and jams an unconditional jump IP into the fetch unit,
which jams an "I'm an exception" uOp into the pipeline,
and starts fetching from the new address.

In short, most of the logic is already present to handle
indirect branches so the initial cost is a few gates and a long wire.

The additional cost of FP exceptions is also seems small.
The FP status flags have to travel with the FP result too,
which write-back writes to the committed status flags.
The additional cost of FP exceptions is carrying the exception mask
bits with the uOp, and a AND-OR on those bits in Retire/WB.

Re: The value of floating-point exceptions?

<2021Jul21.185816@mips.complang.tuwien.ac.at>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19003&group=comp.arch#19003

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ant...@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.arch
Subject: Re: The value of floating-point exceptions?
Date: Wed, 21 Jul 2021 16:58:16 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 41
Message-ID: <2021Jul21.185816@mips.complang.tuwien.ac.at>
References: <sd98c9$cln$1@dont-email.me>
Injection-Info: reader02.eternal-september.org; posting-host="b49d7fcff2fb833c3a4d66103d083e8a";
logging-data="21867"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/mGhD/fB7/4/60UqW0yt0M"
Cancel-Lock: sha1:OwTyVYy5Ew0cMqBSiqjEcs2Eht0=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Wed, 21 Jul 2021 16:58 UTC

Marcus <m.delete@this.bitsnbites.eu> writes:
>As we all know, support for floating-point exceptions comes with a cost
>(sometimes significant, since it dictates many aspects of a HW
>implementation for instance).

Unfortunately, wrt. IEEE FP "exception" has a different meaning (it's
a condition that, by default, results in setting a sticky flag) than
in computer architecture (a control-flow change). Which one do you
mean?

>If we imagine an alternative universe in
>which the dominant floating-point standard did not require exceptions,
>I suspect that most hardware (and language) implementations would most
>likely be simpler, more energy efficient and more suitable for parallel
>and pipelined floating-point operations.

Detecting IEEE exceptions is part of computation of the result; you
have to handle divide-by-zero, inexact, invalid, overflow, and
underflow conditions when computing the result. Ok, you then need to
propagate the flags such that a later instruction can read it, but
looking at the integer condition codes present in the dominant
architectures, that does not seem to be a big problem.

The dynamic rounding mode seems to be a bigger problem and has been
discussed here repeatedly.

>My questions are:
>
>1) What (in your opinion) are the benefits of floating-point exceptions?

Numerical experts use them for special purposes. I have seen and
forgotten examples that looked sensible to me.

>2) In what situations have you had use for floating-point exceptions?

None. I hardly use FP.

- anton
--
'Anyone trying for "industrial quality" ISA should avoid undefined behavior.'
Mitch Alsup, <c17fcd89-f024-40e7-a594-88a85ac10d20o@googlegroups.com>

Re: The value of floating-point exceptions?

<1046243b-30a7-4df1-a2d1-9a54d9e98313n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19005&group=comp.arch#19005

  copy link   Newsgroups: comp.arch
X-Received: by 2002:a05:620a:1304:: with SMTP id o4mr36621998qkj.366.1626892071691;
Wed, 21 Jul 2021 11:27:51 -0700 (PDT)
X-Received: by 2002:aca:c78d:: with SMTP id x135mr3425188oif.30.1626892071502;
Wed, 21 Jul 2021 11:27:51 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.arch
Date: Wed, 21 Jul 2021 11:27:51 -0700 (PDT)
In-Reply-To: <sd98c9$cln$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:291:29f0:401c:aaae:86e:918;
posting-account=H_G_JQkAAADS6onOMb-dqvUozKse7mcM
NNTP-Posting-Host: 2600:1700:291:29f0:401c:aaae:86e:918
References: <sd98c9$cln$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <1046243b-30a7-4df1-a2d1-9a54d9e98313n@googlegroups.com>
Subject: Re: The value of floating-point exceptions?
From: MitchAl...@aol.com (MitchAlsup)
Injection-Date: Wed, 21 Jul 2021 18:27:51 +0000
Content-Type: text/plain; charset="UTF-8"
 by: MitchAlsup - Wed, 21 Jul 2021 18:27 UTC

On Wednesday, July 21, 2021 at 8:44:44 AM UTC-5, Marcus wrote:
> Hi!
>
> I would like to ask a couple of simple questions in this group, related
> to the IEEE 754 standard and floating-point exceptions.
>
> (Some of you may know that I've been pondering this subject before in
> other forums).
>
> As we all know, support for floating-point exceptions comes with a cost
> (sometimes significant, since it dictates many aspects of a HW
> implementation for instance). If we imagine an alternative universe in
> which the dominant floating-point standard did not require exceptions,
> I suspect that most hardware (and language) implementations would most
> likely be simpler, more energy efficient and more suitable for parallel
> and pipelined floating-point operations.
>
> My questions are:
>
> 1) What (in your opinion) are the benefits of floating-point exceptions?
<
There are 6 people in the world who want FP exceptions with the semantic
anywhere close to what IEEE 754 specifies. It is these same 6 people (and
18 professors) that want rounding modes anywhere close to what was
specified.
<
Something like 99% of all FP applications, turn these features off and
live with overflow->infinity, underflow->zero, and I still don't know anyone
other than Kahan and Coonen that want inexact reported. 100% of
physics programs start with data that is ALREADY inexact........
>
> 2) In what situations have you had use for floating-point exceptions?
<
None:
<
3) Is making exception detection in HW hard at all ?
<
No, absolutely not. Detecting and raising exceptions in HW adds 0.0001%
complexity to the design and construction of HW FP units {In a processor
that has precise memory exceptions and recovers from branch mispredictions.}
<
It is for this reason that all HW provides FP exceptions--the cost is minuscule
at most and nearly zero at best.
>
>
> /Marcus

Re: The value of floating-point exceptions?

<68d65573-cf00-4b8b-87e3-9d67f40f9c4an@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19006&group=comp.arch#19006

  copy link   Newsgroups: comp.arch
X-Received: by 2002:ac8:7b52:: with SMTP id m18mr32395304qtu.131.1626892462708; Wed, 21 Jul 2021 11:34:22 -0700 (PDT)
X-Received: by 2002:aca:dac5:: with SMTP id r188mr26282987oig.78.1626892462522; Wed, 21 Jul 2021 11:34:22 -0700 (PDT)
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!tr2.eu1.usenetexpress.com!feeder.usenetexpress.com!tr2.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.arch
Date: Wed, 21 Jul 2021 11:34:22 -0700 (PDT)
In-Reply-To: <memo.20210721153537.10680P@jgd.cix.co.uk>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:291:29f0:401c:aaae:86e:918; posting-account=H_G_JQkAAADS6onOMb-dqvUozKse7mcM
NNTP-Posting-Host: 2600:1700:291:29f0:401c:aaae:86e:918
References: <sd9a9h$ro6$1@dont-email.me> <memo.20210721153537.10680P@jgd.cix.co.uk>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <68d65573-cf00-4b8b-87e3-9d67f40f9c4an@googlegroups.com>
Subject: Re: The value of floating-point exceptions?
From: MitchAl...@aol.com (MitchAlsup)
Injection-Date: Wed, 21 Jul 2021 18:34:22 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 39
 by: MitchAlsup - Wed, 21 Jul 2021 18:34 UTC

On Wednesday, July 21, 2021 at 9:35:40 AM UTC-5, John Dallman wrote:
> In article <sd9a9h$ro6$1...@dont-email.me>, m.de...@this.bitsnbites.eu
> (Marcus) wrote:
>
> > ...which of course is the natural solution.
> It's the natural solution if you assume nobody will ever actually want
> floating-point exceptions. A far more helpful solution would be what they
> do on x86, which is to disable the exceptions by default and to provide a
> CRT call to turn on the ones that you want.
<
I mentioned above that FP exceptions add essentially zero cost to the FP units.
<
What I did not mention, is that My 66000 allows the thread to manage its own
rounding modes and exception recognition. {It can only damage itself!}
<
> > In our software we do the same thing (even disabling subnormals)
> > in order to normalize on the least common denominator, so to say
> > (as soon as one target platform lacks a feature, it needs to be
> > disabled on _all_ platforms).
<
Once you buy off on FMAC units, denorms add almost zero cost (around 2%
for 64-bit FMACs) it makes no sense to set/assume denorms to zero.
This is NOT and argument that denorms were the right thing to put into
754 at the beginning. But its like the steering wheel location in a car--
its too late to change it now.
<
> We're willing to try to make use of useful features of particular
> platforms.
>
> In our test harness, we turn on exceptions for overflow, invalid and
> divide-by-zero, where we can. We leave denormal, inexact and underflow
> disabled, since we want behaviour as much as possible like natural
> numbers. We turn on flushing of denormals to zero where it's available.
>
> The customers can use whatever floating-point handling they want, but we
> warn them that exceptions on denormal, inexact or underflow will cause
> problems.
>
>
> John

Re: The value of floating-point exceptions?

<99f5f2f7-347c-48b7-a959-ca53372479a9n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19008&group=comp.arch#19008

  copy link   Newsgroups: comp.arch
X-Received: by 2002:a37:411:: with SMTP id 17mr36806202qke.225.1626893048573; Wed, 21 Jul 2021 11:44:08 -0700 (PDT)
X-Received: by 2002:a9d:6d83:: with SMTP id x3mr8507088otp.110.1626893048358; Wed, 21 Jul 2021 11:44:08 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!tr2.eu1.usenetexpress.com!feeder.usenetexpress.com!tr1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.arch
Date: Wed, 21 Jul 2021 11:44:08 -0700 (PDT)
In-Reply-To: <sd9fcj$2v8$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:291:29f0:401c:aaae:86e:918; posting-account=H_G_JQkAAADS6onOMb-dqvUozKse7mcM
NNTP-Posting-Host: 2600:1700:291:29f0:401c:aaae:86e:918
References: <sd98c9$cln$1@dont-email.me> <sd9fcj$2v8$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <99f5f2f7-347c-48b7-a959-ca53372479a9n@googlegroups.com>
Subject: Re: The value of floating-point exceptions?
From: MitchAl...@aol.com (MitchAlsup)
Injection-Date: Wed, 21 Jul 2021 18:44:08 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 74
 by: MitchAlsup - Wed, 21 Jul 2021 18:44 UTC

On Wednesday, July 21, 2021 at 10:44:22 AM UTC-5, Ivan Godard wrote:
> It's not that the semantics of exceptions are useless, it's that the
> IEEE standard's approach to them is mis-designed for modern
> architectures and hence IEEE exceptions as a programming device are
> effectively useless.
>
> The definition of flags and modes in the standard makes them implicit
> arguments to every instruction - which inherently linearizes the FP
> instruction stream, while modern chips want to do a lot of FPs
> concurrently.
<
Not really {when done right--which x86 did not do BTW}
<
As long as there is not a reader of the flags, the flags can be accumulated
with an OR gate from the writers in any exception free order.
<
As long as there is no writer to the mode bits, these can be passed en massé
to the function units. In fact since these mode bits are necessarily different
between threads on the same core, one has to pass the mode bits with each
instruction issued (at least to the stations.)
<
> During my active time on the committee Kahan was still
> plumping to use exceptions to support trap-value-replacement. You could
> do that in Mathlab, but not in hardware. That linearization not only
> breaks multi-issue and SIMD, it also precludes speculative execution of
> FP ops in general - no computation overruns in loops for example.
<
Yes, this was a step too far (way too far, essentially serializing FP)
<
However, I found ways to implement this at low cost--but the first cost to
lower is the raising of an exception has to come down from 1,000s of
instructions or cycles to 10s !! The exception control transfer has to be
efficient--within spitting distance of a subroutine call.
>
> Once you abandon value-replacement, exceptions become what the word
> "exception" means in other contexts: a non-recoverable reporting
> mechanism that things went off the rails somewhere. As such, as in any
> debugging assist, the design as much as possible should serve to narrow
> the scope of "somewhere" while not hindering computations that remain on
> the rails.
>
> In the Mill we do that by elimination the global flags and modes and
> moving the event reporting into metadata attached to the result of the
> failing computation. You can speculatively or concurrently do FP ops on
> a Mill, and when the erroneous result finally must be used
> non-speculatively (if it ever is), and you have not asked to ignore
> bogus results, then the resulting fault can report fairly well where
> things went bad. That really helps, not because of some numerical nicety
> but because real programmers spend their lives chasing bugs.
>
> So I use exceptions everywhere that an exception would indicate a bug.
> However, even in debugging I don't use inexact; I have never used an
> algorithm where I cared that rounding had happened, and in practice
> inexact always gets set and so is just nuisance noise. Inexact was
> intended to be a support for using FP for fixed-point calculations, but
> if I had a fixed-point problem I would use DFP.
<
But even when used to perform exact floating point arithmetic, the inexact
flag necessarily gets set !! by 754 mandated rules !! this is completely fubar !
<
At least My 66000 can perform these and not end up setting the inexact flag..
>

Re: The value of floating-point exceptions?

<66681b59-8d95-4aec-97e0-f14ccccabb2bn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19009&group=comp.arch#19009

  copy link   Newsgroups: comp.arch
X-Received: by 2002:ac8:4810:: with SMTP id g16mr12019330qtq.149.1626893325242;
Wed, 21 Jul 2021 11:48:45 -0700 (PDT)
X-Received: by 2002:a9d:6f84:: with SMTP id h4mr28190121otq.240.1626893325036;
Wed, 21 Jul 2021 11:48:45 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.arch
Date: Wed, 21 Jul 2021 11:48:44 -0700 (PDT)
In-Reply-To: <uGYJI.14172$Ei1.7654@fx07.iad>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:291:29f0:401c:aaae:86e:918;
posting-account=H_G_JQkAAADS6onOMb-dqvUozKse7mcM
NNTP-Posting-Host: 2600:1700:291:29f0:401c:aaae:86e:918
References: <sd98c9$cln$1@dont-email.me> <uGYJI.14172$Ei1.7654@fx07.iad>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <66681b59-8d95-4aec-97e0-f14ccccabb2bn@googlegroups.com>
Subject: Re: The value of floating-point exceptions?
From: MitchAl...@aol.com (MitchAlsup)
Injection-Date: Wed, 21 Jul 2021 18:48:45 +0000
Content-Type: text/plain; charset="UTF-8"
 by: MitchAlsup - Wed, 21 Jul 2021 18:48 UTC

On Wednesday, July 21, 2021 at 12:19:25 PM UTC-5, EricP wrote:
> Marcus wrote:
> > Hi!
> >
> > I would like to ask a couple of simple questions in this group, related
> > to the IEEE 754 standard and floating-point exceptions.
> >
> > (Some of you may know that I've been pondering this subject before in
> > other forums).
> >
> > As we all know, support for floating-point exceptions comes with a cost
> > (sometimes significant, since it dictates many aspects of a HW
> > implementation for instance). If we imagine an alternative universe in
> > which the dominant floating-point standard did not require exceptions,
> > I suspect that most hardware (and language) implementations would most
> > likely be simpler, more energy efficient and more suitable for parallel
> > and pipelined floating-point operations.
> >
> > My questions are:
> >
> > 1) What (in your opinion) are the benefits of floating-point exceptions?
> >
> > 2) In what situations have you had use for floating-point exceptions?
> >
> >
> > /Marcus
> Why do you believe the HW cost of exception support
> is sometimes significant? It looks to me that as long as one
> triggers these at Retire/Write-Back, precise exceptions are dirt cheap.
<
Essentially zero, compared to the cost of denorm support in the 2% range
{gates, area, power}.
>
> There is an initial cost for the first exception,
> and an incremental cost for each one after that.
>
> Consider a DSP with no exceptions, no MMU so no access faults,
> no privileged mode, no integer divide-by-zero etc. Nothing.
>
> It seems to me that the initial cost of adding a precise exception to
> that is 1 bit in the uOp along with the result. When the uOp reaches
> write-back, WB sees the exception flag and inhibits the register write,
> and diddles a wire that flushes the pipeline the same as an
> indirect branch, and jams an unconditional jump IP into the fetch unit,
> which jams an "I'm an exception" uOp into the pipeline,
> and starts fetching from the new address.
>
> In short, most of the logic is already present to handle
> indirect branches so the initial cost is a few gates and a long wire.
<
Once you can flush instructions from the pipe (like a branch does)
the HW overhead in the pipe is essentially zero. The HW overhead
in the FU is essentially zero. There is a standard that mandates them
so why not just take the easy route through this feature space.
<
IEEE 754-2019 compatible :: YES in all respects.
>
> The additional cost of FP exceptions is also seems small.
> The FP status flags have to travel with the FP result too,
> which write-back writes to the committed status flags.
> The additional cost of FP exceptions is carrying the exception mask
> bits with the uOp, and a AND-OR on those bits in Retire/WB.

Re: The value of floating-point exceptions?

<sd9rec$um6$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19010&group=comp.arch#19010

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: m.del...@this.bitsnbites.eu (Marcus)
Newsgroups: comp.arch
Subject: Re: The value of floating-point exceptions?
Date: Wed, 21 Jul 2021 21:10:04 +0200
Organization: A noiseless patient Spider
Lines: 81
Message-ID: <sd9rec$um6$1@dont-email.me>
References: <sd9b6k$2q4$1@dont-email.me>
<memo.20210721164849.10680Q@jgd.cix.co.uk>
Mime-Version: 1.0
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 21 Jul 2021 19:10:04 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="b28e696dcafce0392e3c74d6cc33e41b";
logging-data="31430"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/VduY56q3dKx/4BjEeNqE0i2KTjG0ykA8="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Cancel-Lock: sha1:9890bpTYuufpG3gFHeiQeIXijyI=
In-Reply-To: <memo.20210721164849.10680Q@jgd.cix.co.uk>
Content-Language: en-US
 by: Marcus - Wed, 21 Jul 2021 19:10 UTC

On 2021-07-21 17:47, John Dallman wrote:
> In article <sd9b6k$2q4$1@dont-email.me>, m.delete@this.bitsnbites.eu
> (Marcus) wrote:
>
>>> Finding bugs of our own, compiler bugs and bad data in bug
>>> reports.
>>
>> For these use cases, would it not suffice with a compiler/software
>> solution similar to the sanitizers that are available in LLVM and
>> GCC for instance? E.g. see:
>>
>> * https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
>> * https://dl.acm.org/doi/epdf/10.1145/3446804.3446848
>
> Possibly. An advantage of floating-point exceptions is that they work
> when testing the *same* binary that will be delivered to the customer.
>
> We've been using floating-point traps with this product since the 1980s,
> and Valgrind for over a decade, and it is time to try out compiler
> sanitisers. When I get a chance...

I strongly recommend it. I find that sanitizers are very useful and
accurate. It can be quite "hilarious" to run ubsan on old code bases
(lots of "this should never have worked" moments).

>
> The UndefinedBehaviour sanitiser looks most useful for:
>
> -fsanitize=alignment, since the platforms that were fussy about that are
> all dead or nearly so.
>
> -fsanitize=float-divide-by-zero and -fsanitize=integer-divide-by-zero are
> a partial substitute for floating-point traps.
>
> These also look worth a try: -fsanitize=builtin, -fsanitize=bounds,
> -fsanitize=null, -fsanitize=pointer-overflow,
> -fsanitize=signed-integer-overflow, and
> -fsanitize=unsigned-integer-overflow.
>
> Less useful ones are:
>
> -fsanitize=float-cast-overflow, because to a very close approximation, we
> don't convert floats or doubles to ints.
>
>
> The NSan sanitiser will catch overflows, but it's not clear to me that it
> will catch invalid operands. It's also going to be pretty slow, because
> everything is doubles, forcing the shadow values to be 128-bit and thus
> partially done in software.
>
>> I regularly enable sanitizers during test & development, and for
>> most purposes they tend to have an acceptable performance overhead.
>
> I'm guessing you don't have a couple of hundred machines and VMs
> operating distributed testing systems to get the overnight build tested
> in time for a ship/don't-ship decision the following afternoon?

I think it all depends on how you design your system. We have about 40
machines, each with 16-32 CPU cores (a total of about 2000 vCPU:s in
cloud terms), and they build and test about 50 different SW
configurations, in roughly 10-15 minutes (it's been a full time job the
last few years to keep that time at an acceptable level). My philosophy
has always been to test as much as possible /before/ a change goes into
mainline (a.k.a. "stable mainline" or "not rocket science" - don't break
stuff so that developers can't work at full speed).

BTW we recently activated sanitizers for all unit tests running
on those machines. Just buy more hardware ;-) (it's not quite that
simple, but the sentiment is: don't allow HW limitations to get in the
way of SW quality).

>
> Sanitiser overhead is going to demand separate builds, that aren't
> required to complete their testing in time for that ship/no-ship decision,
> but still may be useful.
>
> Thanks!
>
> John
>

Re: The value of floating-point exceptions?

<sd9t9r$bso$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19013&group=comp.arch#19013

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: m.del...@this.bitsnbites.eu (Marcus)
Newsgroups: comp.arch
Subject: Re: The value of floating-point exceptions?
Date: Wed, 21 Jul 2021 21:41:47 +0200
Organization: A noiseless patient Spider
Lines: 78
Message-ID: <sd9t9r$bso$1@dont-email.me>
References: <sd98c9$cln$1@dont-email.me>
<1046243b-30a7-4df1-a2d1-9a54d9e98313n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 21 Jul 2021 19:41:47 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="b28e696dcafce0392e3c74d6cc33e41b";
logging-data="12184"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+c39fyXzTsUZRDqtJ+9plLDJCHTHtjSow="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Cancel-Lock: sha1:3RMgNU7IQ+1LT/fk7zXNb+1rmiM=
In-Reply-To: <1046243b-30a7-4df1-a2d1-9a54d9e98313n@googlegroups.com>
Content-Language: en-US
 by: Marcus - Wed, 21 Jul 2021 19:41 UTC

On 2021-07-21 20:27, MitchAlsup wrote:
> On Wednesday, July 21, 2021 at 8:44:44 AM UTC-5, Marcus wrote:
>> Hi!
>>
>> I would like to ask a couple of simple questions in this group, related
>> to the IEEE 754 standard and floating-point exceptions.
>>
>> (Some of you may know that I've been pondering this subject before in
>> other forums).
>>
>> As we all know, support for floating-point exceptions comes with a cost
>> (sometimes significant, since it dictates many aspects of a HW
>> implementation for instance). If we imagine an alternative universe in
>> which the dominant floating-point standard did not require exceptions,
>> I suspect that most hardware (and language) implementations would most
>> likely be simpler, more energy efficient and more suitable for parallel
>> and pipelined floating-point operations.
>>
>> My questions are:
>>
>> 1) What (in your opinion) are the benefits of floating-point exceptions?
> <
> There are 6 people in the world who want FP exceptions with the semantic
> anywhere close to what IEEE 754 specifies. It is these same 6 people (and
> 18 professors) that want rounding modes anywhere close to what was
> specified.
> <
> Something like 99% of all FP applications, turn these features off and
> live with overflow->infinity, underflow->zero, and I still don't know anyone
> other than Kahan and Coonen that want inexact reported. 100% of
> physics programs start with data that is ALREADY inexact........

Thanks, that confirms my feelings.....

>>
>> 2) In what situations have you had use for floating-point exceptions?
> <
> None:
> <
> 3) Is making exception detection in HW hard at all ?
> <
> No, absolutely not. Detecting and raising exceptions in HW adds 0.0001%
> complexity to the design and construction of HW FP units {In a processor
> that has precise memory exceptions and recovers from branch mispredictions.}
> <
> It is for this reason that all HW provides FP exceptions--the cost is minuscule
> at most and nearly zero at best.

I admit that I am just a layman in this matter, but I think that there
are more dimensions to this problem, and the related costs.

For instance, the very notion of floating-point exceptions (be they
exact HW traps, inexact "something went wrong" traps, or sticky flags
that you can poll, or something else) requires that you can make some
use of them - for instance take some corrective action in software,
using means that usually depend on the programming language.

In certain classes of CPU and programming language combinations there
are straight forward ways of how to deal with this (e.g. HW traps +
language exceptions), but in other environments the answer is not as
simple.

For instance, how should an overflow exception be handled in a GPU
shader language? I'm pretty sure that no HW/language combination
supports that scenario today (and thus by definition can not be
IEEE 754 compliant), and I'm also pretty sure that the cost for adding
that support would be non-zero - not only for the GPU ALU pipeline, but
for the entire HW/driver/SW stack.

What's more - such support would most likely /get in the way/ for
programmers since even fewer than the 6 people that you mentioned
earlier would even be remotely interested in such functionality.

So the rebellion in me wants to say: "Ask not how hard it is to add
floating-point exceptions to a CPU pipeline - ask what the point is
of doing so."

/Marcus

Re: The value of floating-point exceptions?

<sd9u70$ibd$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19015&group=comp.arch#19015

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: m.del...@this.bitsnbites.eu (Marcus)
Newsgroups: comp.arch
Subject: Re: The value of floating-point exceptions?
Date: Wed, 21 Jul 2021 21:57:20 +0200
Organization: A noiseless patient Spider
Lines: 58
Message-ID: <sd9u70$ibd$1@dont-email.me>
References: <sd98c9$cln$1@dont-email.me>
<2021Jul21.185816@mips.complang.tuwien.ac.at>
Mime-Version: 1.0
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 21 Jul 2021 19:57:20 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="b28e696dcafce0392e3c74d6cc33e41b";
logging-data="18797"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/4gRkoE2Akx3anOV2vDpJnhWo/pnWEh88="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Cancel-Lock: sha1:pZg6GyLgLElPKOnUJw5AFkovSxI=
In-Reply-To: <2021Jul21.185816@mips.complang.tuwien.ac.at>
Content-Language: en-US
 by: Marcus - Wed, 21 Jul 2021 19:57 UTC

On 2021-07-21 18:58, Anton Ertl wrote:
> Marcus <m.delete@this.bitsnbites.eu> writes:
>> As we all know, support for floating-point exceptions comes with a cost
>> (sometimes significant, since it dictates many aspects of a HW
>> implementation for instance).
>
> Unfortunately, wrt. IEEE FP "exception" has a different meaning (it's
> a condition that, by default, results in setting a sticky flag) than
> in computer architecture (a control-flow change). Which one do you
> mean?

It does not matter for answering the questions. I am aware of the
different possibilities and interpretations. For instance I think that
some TI DSP:s use sticky flags rather than HW traps.

That said I see problems with both implementations (traps vs flags), if
nothing else from a programmer's point of view.

>
>> If we imagine an alternative universe in
>> which the dominant floating-point standard did not require exceptions,
>> I suspect that most hardware (and language) implementations would most
>> likely be simpler, more energy efficient and more suitable for parallel
>> and pipelined floating-point operations.
>
> Detecting IEEE exceptions is part of computation of the result; you
> have to handle divide-by-zero, inexact, invalid, overflow, and
> underflow conditions when computing the result. Ok, you then need to
> propagate the flags such that a later instruction can read it, but
> looking at the integer condition codes present in the dominant
> architectures, that does not seem to be a big problem.
>
> The dynamic rounding mode seems to be a bigger problem and has been
> discussed here repeatedly.

I agree - that's the second grudge that I have with the IEEE 754
standard. As a programmer I have gotten nothing but problems from the
dynamic rounding modes. As a hardware developer I have just ignored the
problem (I only implement a single rounding mode).

>
>> My questions are:
>>
>> 1) What (in your opinion) are the benefits of floating-point exceptions?
>
> Numerical experts use them for special purposes. I have seen and
> forgotten examples that looked sensible to me.
>
>> 2) In what situations have you had use for floating-point exceptions?
>
> None. I hardly use FP.

Same - except I use FP all the time.

>
> - anton
>

Re: The value of floating-point exceptions?

<12037dbc-580f-44a0-8054-c76f9844c11an@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19016&group=comp.arch#19016

  copy link   Newsgroups: comp.arch
X-Received: by 2002:ad4:4e73:: with SMTP id ec19mr37233659qvb.16.1626897978697;
Wed, 21 Jul 2021 13:06:18 -0700 (PDT)
X-Received: by 2002:a9d:7f14:: with SMTP id j20mr26017152otq.82.1626897978479;
Wed, 21 Jul 2021 13:06:18 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.arch
Date: Wed, 21 Jul 2021 13:06:18 -0700 (PDT)
In-Reply-To: <sd9t9r$bso$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:291:29f0:401c:aaae:86e:918;
posting-account=H_G_JQkAAADS6onOMb-dqvUozKse7mcM
NNTP-Posting-Host: 2600:1700:291:29f0:401c:aaae:86e:918
References: <sd98c9$cln$1@dont-email.me> <1046243b-30a7-4df1-a2d1-9a54d9e98313n@googlegroups.com>
<sd9t9r$bso$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <12037dbc-580f-44a0-8054-c76f9844c11an@googlegroups.com>
Subject: Re: The value of floating-point exceptions?
From: MitchAl...@aol.com (MitchAlsup)
Injection-Date: Wed, 21 Jul 2021 20:06:18 +0000
Content-Type: text/plain; charset="UTF-8"
 by: MitchAlsup - Wed, 21 Jul 2021 20:06 UTC

On Wednesday, July 21, 2021 at 2:41:50 PM UTC-5, Marcus wrote:
> On 2021-07-21 20:27, MitchAlsup wrote:
> > On Wednesday, July 21, 2021 at 8:44:44 AM UTC-5, Marcus wrote:
> >> Hi!
> >>
> >> I would like to ask a couple of simple questions in this group, related
> >> to the IEEE 754 standard and floating-point exceptions.
> >>
> >> (Some of you may know that I've been pondering this subject before in
> >> other forums).
> >>
> >> As we all know, support for floating-point exceptions comes with a cost
> >> (sometimes significant, since it dictates many aspects of a HW
> >> implementation for instance). If we imagine an alternative universe in
> >> which the dominant floating-point standard did not require exceptions,
> >> I suspect that most hardware (and language) implementations would most
> >> likely be simpler, more energy efficient and more suitable for parallel
> >> and pipelined floating-point operations.
> >>
> >> My questions are:
> >>
> >> 1) What (in your opinion) are the benefits of floating-point exceptions?
> > <
> > There are 6 people in the world who want FP exceptions with the semantic
> > anywhere close to what IEEE 754 specifies. It is these same 6 people (and
> > 18 professors) that want rounding modes anywhere close to what was
> > specified.
> > <
> > Something like 99% of all FP applications, turn these features off and
> > live with overflow->infinity, underflow->zero, and I still don't know anyone
> > other than Kahan and Coonen that want inexact reported. 100% of
> > physics programs start with data that is ALREADY inexact........
> Thanks, that confirms my feelings.....
> >>
> >> 2) In what situations have you had use for floating-point exceptions?
> > <
> > None:
> > <
> > 3) Is making exception detection in HW hard at all ?
> > <
> > No, absolutely not. Detecting and raising exceptions in HW adds 0.0001%
> > complexity to the design and construction of HW FP units {In a processor
> > that has precise memory exceptions and recovers from branch mispredictions.}
> > <
> > It is for this reason that all HW provides FP exceptions--the cost is minuscule
> > at most and nearly zero at best.
> I admit that I am just a layman in this matter, but I think that there
> are more dimensions to this problem, and the related costs.
>
> For instance, the very notion of floating-point exceptions (be they
> exact HW traps, inexact "something went wrong" traps, or sticky flags
> that you can poll, or something else) requires that you can make some
> use of them - for instance take some corrective action in software,
> using means that usually depend on the programming language.
>
> In certain classes of CPU and programming language combinations there
> are straight forward ways of how to deal with this (e.g. HW traps +
> language exceptions), but in other environments the answer is not as
> simple.
>
> For instance, how should an overflow exception be handled in a GPU
> shader language?
<
When I was doing a GPU, I actually ask the question in front of the majority
of the design team:: "What, exactly, does it mean when 1,357 FP calculations
all overflow in the same clock cycle ?" What do we want the semantics to be?"
<
Nobody had an answer...........which tells you more about the problem than
of the team......
<
> I'm pretty sure that no HW/language combination
> supports that scenario today (and thus by definition can not be
> IEEE 754 compliant), and I'm also pretty sure that the cost for adding
> that support would be non-zero - not only for the GPU ALU pipeline, but
> for the entire HW/driver/SW stack.
<
In a GPU you can isolate the thread with the exception and run the rest
to completion--then rerun the thread in isolation--you can get away with
this because of the embarrassingly large amounts of parallelism.
<
This, however, fails in GPGPU applications, so it provides no insight
en the large.
>
> What's more - such support would most likely /get in the way/ for
> programmers since even fewer than the 6 people that you mentioned
> earlier would even be remotely interested in such functionality.
>
> So the rebellion in me wants to say: "Ask not how hard it is to add
> floating-point exceptions to a CPU pipeline - ask what the point is
> of doing so."
<
The thing is that memory has exceptions, DIV has exceptions that are
already present, DECODE may have exceptions, Stores may have late
exceptions; and once the pipeline has been configured to deal with
memory and and the others, the infrastructure is already present.
<
So I ask:: "Why not" ???
<
It is only when you can get rid of memory exceptions that you can get
rid of the pipeline infrastructure. {On the other hand this is already a
"solved problem" in computer design, so it is not perceived as even
hard, just work.
>
> /Marcus

Re: The value of floating-point exceptions?

<jwvczrbwhpc.fsf-monnier+comp.arch@gnu.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19017&group=comp.arch#19017

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: monn...@iro.umontreal.ca (Stefan Monnier)
Newsgroups: comp.arch
Subject: Re: The value of floating-point exceptions?
Date: Wed, 21 Jul 2021 16:15:45 -0400
Organization: A noiseless patient Spider
Lines: 13
Message-ID: <jwvczrbwhpc.fsf-monnier+comp.arch@gnu.org>
References: <sd98c9$cln$1@dont-email.me>
<1046243b-30a7-4df1-a2d1-9a54d9e98313n@googlegroups.com>
<sd9t9r$bso$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="fc47cb0ebf557aa361a0ff27e6db2bef";
logging-data="17471"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+5q/dmzWv1sFQ4DxdgeWhe"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
Cancel-Lock: sha1:wE26QY1hJsj48pgVh5Xiv2x/WG4=
sha1:4I+mJj1uITXdRAtTp4CnTg2mA9E=
 by: Stefan Monnier - Wed, 21 Jul 2021 20:15 UTC

> For instance, the very notion of floating-point exceptions (be they
> exact HW traps, inexact "something went wrong" traps, or sticky flags
> that you can poll, or something else) requires that you can make some
> use of them - for instance take some corrective action in software,
> using means that usually depend on the programming language.

I always assumed (for no concrete reason) that the main users of those
flags are very special-purpose code such as the implementation of the
`sin` or `atan` functions, or the implementation of 128bit floats
primitives on top of 64bit float hardware ops, ...

Stefan

Re: The value of floating-point exceptions?

<2ee195ca-db32-49b2-b26f-0c82fcb6b7acn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19019&group=comp.arch#19019

  copy link   Newsgroups: comp.arch
X-Received: by 2002:a37:9244:: with SMTP id u65mr37068817qkd.46.1626898899588;
Wed, 21 Jul 2021 13:21:39 -0700 (PDT)
X-Received: by 2002:a4a:9751:: with SMTP id v17mr3888903ooi.54.1626898899326;
Wed, 21 Jul 2021 13:21:39 -0700 (PDT)
Path: i2pn2.org!i2pn.org!paganini.bofh.team!usenet.pasdenom.info!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.arch
Date: Wed, 21 Jul 2021 13:21:39 -0700 (PDT)
In-Reply-To: <jwvczrbwhpc.fsf-monnier+comp.arch@gnu.org>
Injection-Info: google-groups.googlegroups.com; posting-host=87.68.182.191; posting-account=ow8VOgoAAAAfiGNvoH__Y4ADRwQF1hZW
NNTP-Posting-Host: 87.68.182.191
References: <sd98c9$cln$1@dont-email.me> <1046243b-30a7-4df1-a2d1-9a54d9e98313n@googlegroups.com>
<sd9t9r$bso$1@dont-email.me> <jwvczrbwhpc.fsf-monnier+comp.arch@gnu.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <2ee195ca-db32-49b2-b26f-0c82fcb6b7acn@googlegroups.com>
Subject: Re: The value of floating-point exceptions?
From: already5...@yahoo.com (Michael S)
Injection-Date: Wed, 21 Jul 2021 20:21:39 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Michael S - Wed, 21 Jul 2021 20:21 UTC

On Wednesday, July 21, 2021 at 11:15:48 PM UTC+3, Stefan Monnier wrote:
> > For instance, the very notion of floating-point exceptions (be they
> > exact HW traps, inexact "something went wrong" traps, or sticky flags
> > that you can poll, or something else) requires that you can make some
> > use of them - for instance take some corrective action in software,
> > using means that usually depend on the programming language.
> I always assumed (for no concrete reason) that the main users of those
> flags are very special-purpose code such as the implementation of the
> `sin` or `atan` functions, or the implementation of 128bit floats
> primitives on top of 64bit float hardware ops, ...
>
>
> Stefan

I very certain that exceptions do not help sin or atan.
I am only like 95% certain that exceptions don't help your second case,
but I am not aware of environments that do anything like that in practice.

Re: The value of floating-point exceptions?

<b628b41b-bd0d-4f9d-9fc7-245d80069fecn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19020&group=comp.arch#19020

  copy link   Newsgroups: comp.arch
X-Received: by 2002:a37:d8c:: with SMTP id 134mr37374384qkn.433.1626899661677; Wed, 21 Jul 2021 13:34:21 -0700 (PDT)
X-Received: by 2002:a9d:6c8e:: with SMTP id c14mr7419455otr.5.1626899661270; Wed, 21 Jul 2021 13:34:21 -0700 (PDT)
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!tr2.eu1.usenetexpress.com!feeder.usenetexpress.com!tr2.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.arch
Date: Wed, 21 Jul 2021 13:34:21 -0700 (PDT)
In-Reply-To: <jwvczrbwhpc.fsf-monnier+comp.arch@gnu.org>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:291:29f0:401c:aaae:86e:918; posting-account=H_G_JQkAAADS6onOMb-dqvUozKse7mcM
NNTP-Posting-Host: 2600:1700:291:29f0:401c:aaae:86e:918
References: <sd98c9$cln$1@dont-email.me> <1046243b-30a7-4df1-a2d1-9a54d9e98313n@googlegroups.com> <sd9t9r$bso$1@dont-email.me> <jwvczrbwhpc.fsf-monnier+comp.arch@gnu.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <b628b41b-bd0d-4f9d-9fc7-245d80069fecn@googlegroups.com>
Subject: Re: The value of floating-point exceptions?
From: MitchAl...@aol.com (MitchAlsup)
Injection-Date: Wed, 21 Jul 2021 20:34:21 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 51
 by: MitchAlsup - Wed, 21 Jul 2021 20:34 UTC

On Wednesday, July 21, 2021 at 3:15:48 PM UTC-5, Stefan Monnier wrote:
> > For instance, the very notion of floating-point exceptions (be they
> > exact HW traps, inexact "something went wrong" traps, or sticky flags
> > that you can poll, or something else) requires that you can make some
> > use of them - for instance take some corrective action in software,
> > using means that usually depend on the programming language.
> I always assumed (for no concrete reason) that the main users of those
> flags are very special-purpose code such as the implementation of the
> `sin` or `atan` functions, or the implementation of 128bit floats
> primitives on top of 64bit float hardware ops, ...
<
Things like ATAN do the following--to avoid exceptions !!
<
double ATAN2( double y, double x )
{ // IEEE 754-2019 quality ATAN2
// deal with NANs
if( ISNAN( x ) ) return x;
if( ISNAN( y ) ) return y;
// deal with infinities
if( x == +∞ && |y|== +∞ ) return copysign( π/4, y );
if( x == +∞ ) return copysign( 0.0, y );
if( x == -∞ && |y|== +∞ ) return copysign( 3π/4, y );
if( x == -∞ ) return copysign( π, y );
if( |y|== +∞ ) return copysign( π/2, y );
// deal with signed zeros
if( x == 0.0 && y != 0.0 ) return copysign( π/2, y );
if( x >=+0.0 && y == 0.0 ) return copysign( 0.0, y );
if( x <=-0.0 && y == 0.0 ) return copysign( π, y );
// calculate ATAN2 high performance style
if( x > 0.0 )
{
if( y < 0.0 && |y| < |x| ) return - π/2 - ATAN( x / y );
if( y < 0.0 && |y| > |x| ) return + ATAN( y / x );
if( y > 0.0 && |y| < |x| ) return + ATAN( y / x );
if( y > 0.0 && |y| > |x| ) return + π/2 - ATAN( x / y );
}
if( x < 0.0 )
{
if( y < 0.0 && |y| > |x| ) return + π/2 + ATAN( x / y );
if( y < 0.0 && |y| > |x| ) return + π - ATAN( y / x );
if( y > 0.0 && |y| < |x| ) return + π - ATAN( y / x );
if( y > 0.0 && |y| > |x| ) return +3π/2 + ATAN( x / y );
}
}

>
>
> Stefan

Re: The value of floating-point exceptions?

<cd5efd13-63e6-4a24-8d4c-c1124bb13795n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19021&group=comp.arch#19021

  copy link   Newsgroups: comp.arch
X-Received: by 2002:a37:8407:: with SMTP id g7mr37358708qkd.123.1626902386870; Wed, 21 Jul 2021 14:19:46 -0700 (PDT)
X-Received: by 2002:aca:c78d:: with SMTP id x135mr3767289oif.30.1626902386576; Wed, 21 Jul 2021 14:19:46 -0700 (PDT)
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!tr3.eu1.usenetexpress.com!feeder.usenetexpress.com!tr3.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.arch
Date: Wed, 21 Jul 2021 14:19:46 -0700 (PDT)
In-Reply-To: <sd9fcj$2v8$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=217.147.94.29; posting-account=soFpvwoAAADIBXOYOBcm_mixNPAaxW9p
NNTP-Posting-Host: 217.147.94.29
References: <sd98c9$cln$1@dont-email.me> <sd9fcj$2v8$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <cd5efd13-63e6-4a24-8d4c-c1124bb13795n@googlegroups.com>
Subject: Re: The value of floating-point exceptions?
From: luke.lei...@gmail.com (luke.l...@gmail.com)
Injection-Date: Wed, 21 Jul 2021 21:19:46 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 73
 by: luke.l...@gmail.com - Wed, 21 Jul 2021 21:19 UTC

On Wednesday, July 21, 2021 at 4:44:22 PM UTC+1, Ivan Godard wrote:

> The definition of flags and modes in the standard makes them implicit
> arguments to every instruction - which inherently linearizes the FP
> instruction stream, while modern chips want to do a lot of FPs
> concurrently.

i solved this with data-dependent fail-first. the same trick
shouuld be possible with VVM on an OoO engine by relying on
"Precise Shadowing"

> During my active time on the committee Kahan was still
> plumping to use exceptions to support trap-value-replacement. You could
> do that in Mathlab, but not in hardware. That linearization not only
> breaks multi-issue and SIMD, it also precludes speculative execution of
> FP ops in general - no computation overruns in loops for example.

not quite true. it breaks "systems which don't properly do Shadowing"
and, yes, SIMD is inherently and by design incapable of linear Shadowing.

by "Shadowing" i am referring (in Mitch's Scoreboard 2nd Chapter) to the
possibility of some operation causing irreversible damage, so what is done
is: the instruction *and all downstream instructions* are "Shadowed",
i.e. *all* are prevented and prohibited from writing (to memory, to regfiles)
until such time as it has been determined that the opportunity for "damage"
is 100% determined.

if "no" then the "Shadow" is dropped, and the instruction *and all downstream*
instructions - whether they be multi-issue or single-issue - are permitted
to write.

if "yes" (e.g. an FP exception) then the *instructions are cancelled*, that one
*and* all down-stream ones.

where that all goes to s**t is SIMD. SIMD inherently and by design is
completely incapable of even recognising the concept that some random
number of its elements had an exception.

which makes SIMD worse than useless, it makes it a massive hindrance.

where this can be "fixed" is if you have something called "Data-Dependent
Fail-First". like LOAD/STORE ffirst, you allow speculative execution in
a linear and sequential fashion. anything that could raise an exception
TRUNCATES the execution - automatically - to the point where it *would not*
have occurred.

this can also even be done on Predicated SIMD, by creating an automatic
(implicit) predicate mask, made up of the bits which did *not* fail, looking
for the first bit in that (implicit) mask, throwing away everything beyond
that point and ANDing it with the "real" Predicate mask on the SIMD
back-end ALUs.
> In the Mill we do that by elimination the global flags and modes and
> moving the event reporting into metadata attached to the result of the
> failing computation. You can speculatively or concurrently do FP ops on
> a Mill, and when the erroneous result finally must be used
> non-speculatively (if it ever is), and you have not asked to ignore
> bogus results, then the resulting fault can report fairly well where
> things went bad. That really helps, not because of some numerical nicety
> but because real programmers spend their lives chasing bugs.

i suspect that the Mill, which has those "result invalid" tags, could also
do the same trick, spotting when the exception occurred and invalidating
all downstream results from that point onwards.

all that would then be needed would be a way to report back to the
program exactly what that point was, and the program may either run
a TRAP or the programmer may explicitly check for that point...

.... but what did *not* need to happen was that the parallel execution
of a batch of operations gets poisoned by explicit error checking,
drastically slowing down inner loops.
l.

Re: The value of floating-point exceptions?

<sdae90$l5m$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19029&group=comp.arch#19029

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: sfu...@alumni.cmu.edu.invalid (Stephen Fuld)
Newsgroups: comp.arch
Subject: Re: The value of floating-point exceptions?
Date: Wed, 21 Jul 2021 17:31:26 -0700
Organization: A noiseless patient Spider
Lines: 47
Message-ID: <sdae90$l5m$1@dont-email.me>
References: <sd98c9$cln$1@dont-email.me> <sd98g4$cln$2@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 22 Jul 2021 00:31:28 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="1bdac7a8f0efb5f411756678f1786262";
logging-data="21686"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18xZPBC33h6fee6LV/ItqtPtIPMhCM8FzY="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.12.0
Cancel-Lock: sha1:uejcRUK2gHIBLTJ2kvA4J2BLOfs=
In-Reply-To: <sd98g4$cln$2@dont-email.me>
Content-Language: en-US
 by: Stephen Fuld - Thu, 22 Jul 2021 00:31 UTC

On 7/21/2021 6:46 AM, Marcus wrote:
> On 2021-07-21 15:44, Marcus wrote:
>> Hi!
>>
>> I would like to ask a couple of simple questions in this group, related
>> to the IEEE 754 standard and floating-point exceptions.
>>
>> (Some of you may know that I've been pondering this subject before in
>> other forums).
>>
>> As we all know, support for floating-point exceptions comes with a cost
>> (sometimes significant, since it dictates many aspects of a HW
>> implementation for instance). If we imagine an alternative universe in
>> which the dominant floating-point standard did not require exceptions,
>> I suspect that most hardware (and language) implementations would most
>> likely be simpler, more energy efficient and more suitable for parallel
>> and pipelined floating-point operations.
>>
>> My questions are:
>
> To answer my own questions... In my fields which over the past 2-3
> decades include 3D graphics, ray tracing, 3D polygonal mesh manipulation
> algorithms, compression algorithms for triangle meshes, audio DSP, audio
> synthesis, audio compression, space/satellite signal processing, image
> processing and compression algorithms, AI / neural networks, image-based
> eye- and head-tracking, least squares solvers, and so on, etc, I have to
> say:

Without in any way deprecating your experience, which is much greater
than mine, it seems to be oriented toward the kinds of situations where
errors are "contained" either in space or time. E.g. if an audio DSP
messes up, it probably won't be noticed by the vast majority of users,
and in any event, its effect will be gone in a small fraction of a second.

Contrast this with the types of applications where errors might
propagate or expand either in space or time, and thus cause noticeable
problems. I am thinking of perhaps FE modeling, or physics simulations.
John Dallman could probably provide more and better examples.

Thus your response might be biased toward the "they don't matter" side
of the question.

--
- Stephen Fuld
(e-mail address disguised to prevent spam)

Pages:12345678910
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor