Walking around the compiler
bernsteinbear.com
Walking around the compiler
1–10 of 12 posts
Re: Walking around the compiler
#2how?
Re: Walking around the compiler
#3> surely the optimizer can reason that the float_abs operation produces a positive number! how?
The actual bug-fix linked to in the footnote does it in a slightly different way: it says "as I'm walking through optimizing my tree of expressions, if I see 'abs(abs(X))' then simplify the tree to just 'abs(X)'".
Re: Walking around the compiler
#4Re: Walking around the compiler
#5I don't understand why this article invents and explains a phony ranged-float fix when the real fix from the footnotes would have been just as simple to explain. The deception needlessly undermines the main point of the article, which I completely agree with.
Re: Walking around the compiler
#6Re: Walking around the compiler
#7 case float_abs(_):
- return float
+ return float.with_range(low=0, high=None)
to me, looks like a risky change. I would fear this could introduce a bug when computing isNaN(abs(NaN))
That should return true, but with that change, I fear it could return false because it informs the optimizer that abs never returns a NaN.Re: Walking around the compiler
#8I don't understand why this article invents and explains a phony ranged-float fix when the real fix from the footnotes would have been just as simple to explain. The deception needlessly undermines the main point of the article, which I completely agree with.
Re: Walking around the compiler
#9> surely the optimizer can reason that the float_abs operation produces a positive number! how?
By having knowledge baked into it about its properties (which it can validly do because the behaviour of the float_abs operation is specified by the language; it's not calling an arbitrary external function). The blog post sketches out one approach to this: as the optimizer is working on a tree of expressions, it has attached to the nodes extra information about the values in it (e.g. "this is a constant X" or "this…
Which language? Where? I just googled for float_abs and got nothing.
Re: Walking around the compiler
#10Earlier quoted context omitted.
By having knowledge baked into it about its properties (which it can validly do because the behaviour of the float_abs operation is specified by the language; it's not calling an arbitrary external function). The blog post sketches out one approach to this: as the optimizer is working on a tree of expressions, it has attached to the nodes extra information about the values in it (e.g. "this is a constant X" or "this…
> the behaviour of the float_abs operation is specified by the language Which language? Where? I just googled for float_abs and got nothing.