-
Notifications
You must be signed in to change notification settings - Fork 35
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
overdubbed method doesn't infer #13
Comments
Yes, I think it remains to be seen how we can make it possible for inference to avoid triggering the limit trigger rules. |
Which inference limit/rule is this running into? Can it be resolved with custom |
With the inference spoofing heuristics from JuliaLang/julia#24852 / #25 this gets quite a bit further (the final code_warntype(unsafe_load, Tuple{Ptr{Float32}})
using Cassette
Cassette.@context Ctx
code_warntype(Cassette.overdub(Ctx, unsafe_load), Tuple{Ptr{Float32}}) Original IR:
Overdubbed:
|
closed by #41 julia> using Cassette
julia> Cassette.@context Ctx
julia> ctx = Ctx()
Ctx{Cassette.Unused,0x0000000000006ba5,Cassette.Unused,Nothing}(Cassette.Unused(), Val{0x0000000000006ba5}(), Cassette.Unused(), nothing)
julia> foo(ptr::Ptr{T}, i) where {T} = Base.unsafe_load(ptr, i)::T
foo (generic function with 1 method)
julia> x = rand(Float32,1);
julia> ptr = pointer(x);
julia> ctx = Ctx();^C
julia> @code_warntype Cassette.overdub_execute(ctx, foo, ptr, 1)
Variables:
ctx<optimized out>
args::Tuple{typeof(foo),Ptr{Float32},Int64}
output<optimized out>
Body:
begin
Core.SSAValue(17) = (Core.getfield)(args::Tuple{typeof(foo),Ptr{Float32},Int64}, 2)::Ptr{Float32}
Core.SSAValue(18) = (Core.getfield)(args::Tuple{typeof(foo),Ptr{Float32},Int64}, 3)::Int64
Core.SSAValue(35) = (Base.pointerref)(Core.SSAValue(17), Core.SSAValue(18), 1)::Float32
return Core.SSAValue(35)
end::Float32 |
For lack of better title (I haven't looked into the issue, only reduced it).
Repro:
Original IR:
Overdubbed IR:
The text was updated successfully, but these errors were encountered: