Skip to content
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

inference regression against julia 1.4-dev #147

Open
shashi opened this issue Oct 2, 2019 · 1 comment
Open

inference regression against julia 1.4-dev #147

shashi opened this issue Oct 2, 2019 · 1 comment

Comments

@shashi
Copy link

shashi commented Oct 2, 2019

calling rand with a no-op context causes Anys. Might exacerbate #91

julia> using Cassette

julia> Cassette.@context Foo;

julia> @code_typed Cassette.overdub(Foo(), rand)
CodeInfo(
1%1 = $(Expr(:foreigncall, :(:jl_threadid), Int16, svec(), 0, :(:ccall)))::Int16%2 = (Core.Intrinsics.sext_int)(Int64, %1)::Int64%3 = (Core.Intrinsics.add_int)(%2, 1)::Int64%4 = invoke Cassette.overdub(_2::Cassette.Context{nametype(Foo),Nothing,Nothing,Cassette.var"##PassType#427",Nothing,Nothing}, Random.default_rng::typeof(Random.default_rng), %3::Int64)::Any%5 = Cassette.overdub(##overdub_context#425, rand, %4, Random.Float64)::Any
└──      return %5
) => Any

Works on Julia 1.1/1.2 + Cassette master

@vchuravy
Copy link
Member

vchuravy commented Oct 8, 2019

Nailed this down to a sequence of type-instable code within Radom.make_seed:

s = read(::Base.OrCmds,::Type{String})::Any
x = parse(UInt64, s, base=16)::UInt64

When this code gets overdubbed, we call a generator:

code_warntype(Cassette.overdub, Tuple{typeof(Foo()), typeof(parse), Type{UInt64}, Any})
ERROR: cannot call @generated function `overdub(overdub_context::Cassette.Context, overdub_arguments...) in Cassette at /home/vchuravy/src/Cassette/src/overdub.jl:524` with abstract argument types: Tuple{Cassette.Context{nametype(Foo),Nothing,Nothing,Cassette.var"##PassType#427",Nothing,Nothing},typeof(parse),Type{UInt64},Any}

:/ this unveils a pretty drastic limitation of Cassette (that at least to me, wasn't obvious).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants