-
Notifications
You must be signed in to change notification settings - Fork 70
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
Change _zero_algebra -> zero_algebra #1504
Conversation
Makes inference worse in some "unrelated" place, thus making the tests fail. (I have seen this happening before. I still don't know why.) |
Running these failing tests in the REPL does not fail, so this kind of weird to debug. |
Here's a theory why: code which calls If this guess is right, then anything that now fails inference should be checked as to whether it directly or indirectly leads to calls to |
I can reproduce this in the REPL:
This goes away if I change the last line of But Could this be a bug in |
The function _zero_algebra was renamed to zero_algebra some time ago, but not all places calling it were updated.
eac38b0
to
bc6ed4c
Compare
Yeah, more (random) inference errors. |
Fascinating. With this patch,
fails because inside OK, I can reduce this to
There, it fails to infer the full return type for
without the PR I see
Narrowing it down:
Will dig more later. |
I found a very simple example that differs between master and this branch: julia> y = [AcbField(64)(1)]
1-element Vector{AcbFieldElem}:
1.0000000000000000000
julia> @code_warntype real.(y)
MethodInstance for (::var"##dotfunction#234#8")(::Vector{AcbFieldElem})
from (::var"##dotfunction#234#8")(x1) @ Main none:0
Arguments
#self#::Core.Const(var"##dotfunction#234#8"())
x1::Vector{AcbFieldElem}
Body::Any
1 ─ %1 = Base.broadcasted(Main.real, x1)::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Nothing, typeof(real), Tuple{Vector{AcbFieldElem}}}
│ %2 = Base.materialize(%1)::Any
└── return %2 on this branch, while on master: julia> @code_warntype real.(y)
MethodInstance for (::var"##dotfunction#225#1")(::Vector{AcbFieldElem})
from (::var"##dotfunction#225#1")(x1) @ Main none:0
Arguments
#self#::Core.Const(var"##dotfunction#225#1"())
x1::Vector{AcbFieldElem}
Body::Vector{ArbFieldElem}
1 ─ %1 = Base.broadcasted(Main.real, x1)::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Nothing, typeof(real), Tuple{Vector{AcbFieldElem}}}
│ %2 = Base.materialize(%1)::Vector{ArbFieldElem}
└── return %2 This then makes inference fail in Line 731 in b3c2264
|
@lgoettgens thanks. Unfortunately that seems to be a dead end: code_warntype(Base.materialize, (Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Nothing, typeof(real), Tuple{Vector{AcbFieldElem}}}, )) prints perfectly inferred information in both branches. I tried using And according to Aaargh! |
Hah, I just tried with Julia 1.11.0-rc2 and there it works (both Lars example and also the elliptic curve example). But it's not as if all was great: with that Julia, I get an inference failure with
which works fine in Julia 1.10 (both with my branch and with master). Seems we just can't have nice things sigh |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1504 +/- ##
==========================================
+ Coverage 75.69% 75.79% +0.10%
==========================================
Files 357 358 +1
Lines 113691 113692 +1
==========================================
+ Hits 86059 86174 +115
+ Misses 27632 27518 -114
|
The function _zero_algebra was renamed to zero_algebra some time ago, but not all places calling it were updated.
I found this because it caused a bunch of invalidations in code found while investigating #746 (indirectly, of course, as any actual call to
_zero_algebra
could not have worked).