Change order of function definition in matrix multiplication code#833
Conversation
This should safeguard against generated functions being generated earlier than method definitions they need.
The generator in a generated function only has access to methods in the world age of when the method is defined. |
|
Yes, the part that I don't understand is why did it work before 😄 . One of the many mysteries of generated functions. |
As far as I know precompiled modules are loaded into the main session as a single world age. That is, functions within the module behave as if they were all defined at the same time. So the order shouldn't matter unless the generated function is actually called during precompilation itself. In what circumstances did the bug manifest? |
c42f
left a comment
There was a problem hiding this comment.
Looks fine to me btw. Would be nice to know why it's necessary, but 🤷♂️
|
Maybe by running with |
|
Ah of course, that would do it! I knew I'd encountered this kind of thing before in some package. I remember now it was Uniful.jl and there was a need to run with |
Matrix multiplication was invoked from pyjulia with |
This is a bugfix for a bug introduced in #814 . In some circumstances generated functions from
matrix_multiply_add.jldon't see methods ofgen_by_accessanduplo_accessdefined inmatrix_multiply.jl(generated functions somehow get instantiated in an earlier world age). This moves all required methods so that they are defined earlier. Unfortunately I don't know how to make a test for this.Thanks @krzysztofrzecki for discovering this problem!