-
-
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
Precompile fails when multiple methods fit the supplied signature #38149
Comments
No code change is needed, but the use-case in that issue doesn't appear to be tested directly. Closes #38149
You can force both to be cached using the pattern in #41958. Just pick a signature that isn't covered by one of the more specific methods. |
No code change is needed, but the use-case in that issue doesn't appear to be tested directly. Closes #38149
@timholy, I guess this doesn't exactly solve the issue here, because currently the So I guess we could either:
Do you have a sense for which one of those would be easier? I'm going to re-open the issue for now, since I think the suggestion you've provided won't help until we do one of the above. |
Probably the most robust approach would be to pick the least-specific method. Start checking here: Line 390 in 8987bc2
|
Thanks Tim. Just to confirm my understanding: that would be the approach to fix it in |
In principle, we should probably just iterate all matches, rather than getting exactly one match from jl_get_specialization1 |
No code change is needed, but the use-case in that issue doesn't appear to be tested directly. Closes JuliaLang#38149
No code change is needed, but the use-case in that issue doesn't appear to be tested directly. Closes JuliaLang#38149
This is a more in-depth explanation of the precompile failures seen in
Case 4
in #28808 (comment).precompile(f, (Any,...))
fails incorrectly for methods marked@nospecialize
when the function in question has other, more specific methods defined.An explanation follows.
As you can see, here,
precompile
works correctly for@nospecialize
functions, when there is only one method:However, when the function contains multiple methods, with one more specific than the other,
precompile(foo, (Any,Any))
fails, incorrectly:This causes several static compilation failures in our production binary, meaning we end up compiling them again in production.
I tried stepping through the function in GDB to identify what's going on, and
precompile(M.foo, (Any,Any))
ends up returning false on 2928, here:julia/src/gf.c
Lines 2924 to 2931 in 12328e2
Hopefully this helps someone make sense of the failure? I couldn't quite make sense of it myself.
Thanks!
The text was updated successfully, but these errors were encountered: