-
Notifications
You must be signed in to change notification settings - Fork 10
Support for Julia v1.12 #196
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
base: main
Are you sure you want to change the base?
Conversation
Libtask.jl documentation for PR #196 is available at: |
The test suite now passes except for the test cases called |
These tests look slightly weird. They might be violating opaque closure assumptions, e.g. dynamic dispatch of |
This works, it doesn't answer why JuliaLang/julia#59222 fails, though. julia> g(xs::Tuple{Vararg{T}}) where T = 1
julia> (t::Tuple{typeof(g)})(xs::Tuple{Vararg{T}}) where T = t[1](xs)
julia> ir = Base.code_ircode_by_type(Tuple{Tuple{typeof(g)}, Tuple{Vararg{Symbol}}})[1][1]
julia> ir.argtypes[1] = Tuple{typeof(g)}
julia> oc = Core.OpaqueClosure(ir, g; isva=true, do_compile=true)
julia> oc(:a, :b) # works on 1.12 and 1.11 EDIT: I suspect that |
The case where this comes up is if, in a TapedTask, you have a dynamic call to a varargs function that might have a produce statement. In that case Your comment about the callable being in the captures is good though, because it made me realise that I don't need that to replicate the problem. This, too, segfaults: module MWE
g(xs...) = 1
ir = Base.code_ircode_by_type(Tuple{typeof(g), Symbol, Symbol})[1][1]
ir.argtypes[1] = Tuple{}
oc = Core.OpaqueClosure(ir; isva=true, do_compile=true)
oc(:a, :b) # segfault on 1.12
end |
Extra allocations might be due to: JuliaLang/julia#58780 |
With the workaround from JuliaLang/julia#59222 (comment) in place, tests now pass. However, something absolutely horrible has happened to performance and allocations. The benchmark suite is failing because it hasn't been updated to the new version of Turing (this happens on On v1.11.7:
On v1.12.0:
That's a 20-1000 fold slowdown. This makes Libtask essentially useless on v1.12. These benchmarks also pass, and show similar results, without the aforementioned workaround. Note that the fix for JuliaLang/julia#58780 is in 1.12.0, that should no longer be the issue. I'll see if I can boil this down to a simple example and use that to ask for advice from Julia devs. |
This might be the cause: chalk-lab/Mooncake.jl#714 (comment) |
Here's a quick snippet to check this: module MWE
using Libtask, BenchmarkTools
function f(x)
i = x .+ 1
j = x .- 1
ret = (i - j .^ 2)
produce(ret)
return ret
end
function wrap(x)
tt = TapedTask(nothing, f, x)
consume(tt)
return nothing
end
@btime wrap(randn(100))
end On 1.11.7 Since @serenity4 is working on a fix that might help, I'll wait for that before putting more effort into figuring out what is going on here. |
Work in progress, though most tests now pass. Current known issues are calling varargs functions and and more allocations than on v1.11.