Comments (4)
With the inference spoofing heuristics from JuliaLang/julia#24852 / #25 this gets quite a bit further (the final Overdub
call wrapping the typeassert
is gone), but still fails to infer pointerref
. I reduced it a little more:
code_warntype(unsafe_load, Tuple{Ptr{Float32}})
using Cassette
Cassette.@context Ctx
code_warntype(Cassette.overdub(Ctx, unsafe_load), Tuple{Ptr{Float32}})
Original IR:
Variables:
p::Ptr{Float32}
Body:
begin
# meta: location pointer.jl unsafe_load 105
SSAValue(2) = (Base.pointerref)(p::Ptr{Float32}, 1, 1)::Float32
# meta: pop location
return SSAValue(2)
end::Float32
Overdubbed:
Variables:
o<optimized out>
x1::Ptr{Float32}
Body:
begin
# stripped the meta nodes and useless goto's
SSAValue(202) = (typeassert)(1, Int64)::Int64
SSAValue(332) = (pointerref)(x1::Ptr{Float32}, SSAValue(202), 1)::Any
return SSAValue(332)
end::Any
from cassette.jl.
Yes, I think it remains to be seen how we can make it possible for inference to avoid triggering the limit trigger rules.
from cassette.jl.
Which inference limit/rule is this running into? Can it be resolved with custom InferenceParam
s?
from cassette.jl.
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
from cassette.jl.
Related Issues (20)
- Something with tagging is broken in 1.4 HOT 1
- Inference issues with accessing hcat-ed arrays
- Tag new version HOT 5
- Internal error when overdubbing HTTP.request HOT 1
- Open discussion - support for dynamic pass creation HOT 3
- Overdubbing not working when function called from within `@threads for` loop HOT 2
- Code using Cassette fails for nightly builds HOT 2
- Discriminating overdub calls for "same" function/args HOT 1
- Is there a way to bail out of overdubbing? HOT 2
- TagBot trigger issue HOT 10
- Errors on Julia v1.6 HOT 3
- less helpful stacktraces on 1.6 HOT 3
- Error compiling Cubature.hcubature in context Traceur.Trace
- Default value to `reflect` should be `Base.current_world` HOT 1
- Cassette and AbstractInterpeter
- Cassette compilation fails as of Julia commit 6ce28008ba6db324b171909fa8e641fe8bce9db4 HOT 1
- Error in overdub with StaticArrays.jl HOT 5
- Error on ColorTypes HOT 2
- Very high TTFX HOT 1
- nightly failing to precompile with `ERROR: LoadError: invalid struct allocation` HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cassette.jl.