Thu, 17 Sep 2020 06:39:30 -0000 (UTC)

Related articles |
---|

[5 earlier articles] |

Re: Algorithm Optimization mwmarkland@gmail.com (mwmarkland@gmail.com) (2020-09-16) |

Re: Algorithm Optimization rick.c.hodgin@gmail.com (Rick C. Hodgin) (2020-09-16) |

Re: Algorithm Optimization derek@_NOSPAM_knosof.co.uk (Derek M. Jones) (2020-09-16) |

Re: Algorithm Optimization gah4@u.washington.edu (gah4) (2020-09-16) |

Re: Algorithm Optimization richard.nospam@gmail.com (Richard Harnden) (2020-09-16) |

Re: Algorithm Optimization DrDiettrich1@netscape.net (Hans-Peter Diettrich) (2020-09-17) |

Re: Algorithm Optimization tkoenig@netcologne.de (Thomas Koenig) (2020-09-17) |

Re: Algorithm Optimization minforth@arcor.de (A. K.) (2020-09-21) |

Re: Algorithm Optimization DrDiettrich1@netscape.net (Hans-Peter Diettrich) (2020-12-13) |

Re: Algorithm Optimization gah4@u.washington.edu (gah4) (2020-12-20) |

From: | Thomas Koenig <tkoenig@netcologne.de> |

Newsgroups: | comp.compilers |

Date: | Thu, 17 Sep 2020 06:39:30 -0000 (UTC) |

Organization: | news.netcologne.de |

References: | 20-09-032 20-09-037 20-09-040 |

Injection-Info: | gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="52729"; mail-complaints-to="abuse@iecc.com" |

Keywords: | optimize, arithmetic |

Posted-Date: | 19 Sep 2020 21:06:10 EDT |

gah4 <gah4@u.washington.edu> schrieb:

*> On Wednesday, September 16, 2020 at 8:14:44 AM UTC-7,*

*> mwmar...@gmail.com wrote:*

*>*

*> (snip)*

*>*

*>> This approaches the issue more from a "I want to replace serial*

*>> algorithms with parallel algorithms." if I recall correctly so it may*

*>> not be exactly what you are looking for.*

*>*

*> That might make more sense. So, an algorithm that it mathematically*

*> equivalent, but not necessarily numerically equivalent.*

Hic sunt dracones.

Re-arranging mathematically equivalent operation can lead to

surprising side effects, and are prohibited by many language

standards. Yet, compilers very often have optimizations to switch

off the guarantees of these standards, and they are often used by

users ignorant of the issues (and for benchmarks).

An example is Kahan summation, which is an algorithm for reducing

numerical errors in summing up terms. It is mathematically

equivalent to straightforward summation, so a compiler which

operates on mathematical equivalence across statements

can in fact convert Kahan summation back to simple summation.

This, of course, loses the benefit that the programmer (presumably)

wanted.

Gcc, for example, will happily do that transformation if given

the -funsafe-math-optimization flag (which, despite what the name

implies, is neither fun nor safe). The problem is that this is one

of the flags enabled with the catch-all option with the suggestive

name -Ofast.

Post a followup to this message

Return to the
comp.compilers page.

Search the
comp.compilers archives again.