Hi, I'm still getting to grips with Julia and haven't even looked at
which things are done by "julia itself" and which are pushed down into
the LLVM.
On Mar 19, 9:42 am, Jonas Rauch <
jonas.ra...@googlemail.com> wrote:
> right? This would mean, that it would be very quick. Plus, it does not
> matter so much that some expressions are suboptimal, because the compiler
> should get rid of things like a*1, a*0 or b+0.
For what it's worth, as someone working with automatic differentiation
on a different project that goes via LLVM, expressions of various
_floating point_ types like a*0.0 don't get optimised away by LLVM
without using unsafe-math. (This is because things like this aren't
valid in cases where a or b are "special values" such as NaN.) I
looked at the possibility of writing LLVM code to apply those rules,
but personally decided to do the transfomation before lowering LLVM to
LLVM because it was clearer which 0's, 1's, etc, had arisen from
autodifferentiation as opposed to other constants in the code. (This
is because I'm trying to use the "mostly true" rule that applying
these simplifications will only produce a different derivative in
cases where the original function will contain a special value (NaN,
Inf, +0.0 vs -0.0, etc) so that you can be "mostly certain" that
everything's ok if you both check the original function evaluation and
the computed derivative, and it does lead to a very significant
reduction in "pointless" FP instructions.
Of course, it may be that Julia is applying those transformations
higher up, in which case this issue doesn't even occur.
Anyway, hope this helps,
David Tweed
> > On Sun, Mar 18, 2012 at 2:43 PM, Jonas Rauch <
jonas.ra...@googlemail.com>
> >
jonas.ra...@googlemail.com>
> >
jonas.ra...@googlemail.com>
> sd.jl
> 2KViewDownload