Closed KristofferC closed 5 years ago
Thanks.
This tends to be that I broke one of the unwritten rules of when you are allowed to run Expr(:isdefined, :foo)
and hit the fallback SSAValue
from https://github.com/JuliaLang/julia/pull/31786.
Something will need to be added to: https://github.com/oxinabox/MagneticReadHead.jl/blob/077943b3dac27f41c40e451a7341c25892ab98bd/src/pass.jl#L64 to handle whatever the cause of this is.
I am really struggling to make a MVE of this. I can reproduct this with Plots, but so far not with anything simpler.
I am pretty sure
I need to sit down with someone who understands the optimizer (pokes @keno) and dig into which of its assumptions I am violating.
I am going to close #61 and #62 just to keep the converstation in one place
Best MWE:
using MagneticReadHead, TimerOutputs
t = TimerOutput()
@run print_timer(t)
MWE:
using MagneticReadHead
function danger19()
y=2
function inner()
h=y
y=12
return h
end
inner()
end
@run danger19()
https://github.com/oxinabox/MagneticReadHead.jl/pull/57
solves the danger19
MWE,
but not the others.
Don't think this should have been closed.
My latest MWE is
@run TimerOutputs.print_header(stdout, 0.5, 0.1, 3, 3, 7, false, true, 11, true, "oio")
The extra confoudning thing is if I copy and paste the corresponding section of code directy into the REPL the call to
@run print_header(stdout, 0.5, 0.1, 3, 3, 7, false, true, 11, true, "oio")
works fine
I tried on the CSV.jl example and it doesn't crash but it never seems to finish running either (waited 6-7 min).
@KristofferC was this with #68?
I am not particularly superised, there are some performance blackholes with compilation.
I belive they are just the extreme case of the sprand
one you commented in the CompiledFrames thread.
A simple one is
julia> foo() = Complex.(rand(1,2), rand(1,2)) * rand(Int, 2,1);
julia> @btime foo();
297.770 ns (9 allocations: 720 bytes)
julia> @btime Debugger.@run foo();
15.472 ms (46982 allocations: 1.78 MiB)
julia> @time MagneticReadHead.@run foo()
<Hangs for over 30 minutes before I stopped watching>
I think they are either bugs Cassette or in the compiler, At some point I will switch off Cassette and on to IRTools I think. IRTools, being a bit simpler, plays nicer with the compiler. See https://github.com/JuliaDiff/ChainRules.jl/pull/37
If you like you could try a few:
set_uninstrumented!(Base); set_uninstrumented!(CSV.Parsers)
etc.
But that would throw off any benchmarks.
Sorry, yes with #68 (I meant to comment on that PR)
and it does indeed solve it.
Tried
on master of MRH.
See also #61 and #62