-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Break type stability of Rational with unrelated function (0.5-specific) #18465
Comments
CC @ajkeller34 |
I am equal parts amused and disturbed. I'll take a look, but at first glance I have no idea why that would happen... |
I suspect this is not your fault at all, and that it's uncovered some latent bug. I could be wrong, though. |
Which version of Julia? |
I can reproduce the error with:
|
possibly related to #18449 |
It is indeed precompilation-dependent. |
This appears to be fixed on current master (but not 0.5). The same situation seems to apply to JuliaNLSolvers/Optim.jl#283. However, the probable fix (#18413) is probably not trivially backportable? If so, this probably needs to be a priority for point-releases on 0.5. |
Yes, I believe I see what is wrong. I believe it is also broken on master, but just shifted (due to some code I neglected to put back after the rearrangement in #18413) |
I was surprised by "Break type"; -> "Breaks type" I guess better for title? [Isn't it ALWAYS better to have type stability? Can you think of a counterexample, and thus you would want to modify code from type stable to unstable?] |
It actually breaks many functions. For instance, loading a package in a fresh julia session
There are many packages for which |
Is there a plan to deal with this for 5.1? It seems to slowly pop up in more and more places. Can we revert the offending commit? While the commit message says it fixed a performance bug, this is also a pretty significant and unintuitive performance bug. |
I may have even seen a dispatch error EDIT: nvm |
closed by #18869, as long as it doesn't break anything in upcoming pkgeval runs |
Why reopen? |
(is it not fixed by #18869 ?) |
|
On 0.5.0 it's certainly showing a type instability |
On 8d4ef37: julia> import Primes
julia> f(x) = log(x);
julia> @code_warntype f(1.0)
Variables:
#self#::#f
x::Float64
Body:
begin
return $(Expr(:invoke, LambdaInfo for log(::Float64), :(Main.log), :(x)))
end::Float64 which is the same thing I see if I don't import Primes. But the generated code is still bad, so it seems #18869 did not fully resolve this issue. |
Just compiled a release-0.5. Seems that the original case has the same issue.... |
dup #265? |
Like #265, this is fixed in 0.6, but otherwise I don't really see the connection. AFAICT, |
Looks like fixed in 0.6 |
Unitful breaks the type-stability of
Rational
:If you comment out this line and this function, then it's back to normal. Indeed, just the signature of the latter function (i.e., defining a blank body) is sufficient to break the type-stability of
Rational
.What I find curious is that the latter function does not obviously have anything to do with
Rational
. Seems to suggest some kind of corruption.The text was updated successfully, but these errors were encountered: