Gentoo Archives: gentoo-dev

From: "Diego Elio Pettenò" <flameeyes@×××××××××.eu>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] GCC 4.7 unmasking
Date: Mon, 25 Feb 2013 22:11:45
Message-Id: 512BE185.9080605@flameeyes.eu
In Reply to: Re: [gentoo-dev] GCC 4.7 unmasking by Rich Freeman
1 On 25/02/2013 22:57, Rich Freeman wrote:
2 > A sword that cuts two ways - judging understanding by an email is a
3 > dubious proposition, otherwise we wouldn't need job interviews. :)
4 > It is just as likely that we're simply miscommunicating.
5
6 Did you not just say there:
7
8 "Calculating scroll bar movement is
9 exactly the sort of thing that this flag was actually designed for -
10 you don't care if it is off by 1/100th of a pixel."
11
12 or am I mistaken? If I'm not mistaken, that phrase is really not
13 understanding it.
14
15 The calculation that goes in painting on screen a scrollbar are hardly
16 something you expect -ffast-math to be designed for. Can you defend your
17 statement in any way?
18
19 > Define what you mean by "building *by itself*" - I don't want to
20 > assume I understand what you're getting at here. I certainly wasn't
21 > suggesting that you could be able to run CFLAGS="-O2 -ffast-math"
22 > emerge chromium and get anything usable.
23
24 Which is exactly what Tom complained about.
25
26 > -ffast-math is a flag that
27 > should be applied to specific functions or even parts of functions
28 > where there is an understood performance vs accuracy tradeoff.
29
30 Of course dealing with flags _per functions_ is not possible, as flags
31 apply at the very least to a translation unit...
32
33 > If you're just using it to calculate how many pixels down it is, it
34 > certainly shouldn't be that inaccurate.
35
36 But you're not just calculating how many pixels down to draw it...
37 you're calculating a bunch of parameters, including shades, shadows,
38 sub-pixel positioning, ....
39
40 > If you're using it to do
41 > pointer arithmetic or something then you're just going to get
42 > segfaults.
43
44 Uh.. no. Pointer arithmetic is, by and of itself, integer arithmetic.
45 That's not going to be influenced by -ffast-math.
46
47 Vastly, -ffast-math deals with floating-point arithmetic, which can be
48 sped up significantly ignoring some of the rules imposed by
49 floating-point arithmetic by IEEE/ISO standards. Breaking which, though,
50 can lead to seriously messed up results.
51
52 > There are arithmetic functions in computing that are
53 > discrete/functional in nature, and there are those which relate more
54 > to real-world measurements. Adding a 0.001% error to a hash
55 > calculation breaks a hash. Adding 0.001% error to a scientific
56 > calculation where all the components have 1% measurement error is
57 > insignificant.
58
59 But if you add 1% error to hundreds of small calculations ... well, you
60 should get the point, don't you?
61
62 There are decent use cases for -ffast-math... none of which involve a
63 desktop system, in my opinion.
64
65 --
66 Diego Elio Pettenò — Flameeyes
67 flameeyes@×××××××××.eu — http://blog.flameeyes.eu/

Replies

Subject Author
Re: [gentoo-dev] GCC 4.7 unmasking Rich Freeman <rich0@g.o>