Skip to content

Overdubbing things using llvmcall fail #138

@oxinabox

Description

@oxinabox

@KristofferC found this fun bug in MagneticReadHead
oxinabox/MagneticReadHead.jl#60

I have mare a reproducer that does not have MRH involved.
So I think it is a Cassette problem.

This reproduces in 0.2.4 and current master.

MWE:

using Cassette, Tensors

Cassette.@context Ctx

# This overdub does nothing
function Cassette.overdub(ctx::Ctx, f, args...)
    if Cassette.canrecurse(ctx, f, args...)
        Cassette.recurse(ctx, f, args...)

    else 
        Cassette.fallback(ctx, f, args...)
    end
end

t = rand(Tensor{2,3})

Cassette.@overdub Ctx() t+t

Output:

ERROR: this intrinsic must be compiled to be called
Stacktrace:
 [1] call(::Cassette.Context{nametype(Ctx),Nothing,Nothing,getfield(Cassette, Symbol("##PassType#365")),Nothing,Nothing}, ::Function, ::Tuple{String,String}, ::Type, ::Type, ::Vararg{Any,N} where N) at /Users/oxinabox/.julia/packages/Cassette/qs8Qq/src/context.jl:447
 [2] fallback(::Cassette.Context{nametype(Ctx),Nothing,Nothing,getfield(Cassette, Symbol("##PassType#365")),Nothing,Nothing}, ::Function, ::Vararg{Any,N} where N) at /Users/oxinabox/.julia/packages/Cassette/qs8Qq/src/context.jl:445
 [3] overdub(::Cassette.Context{nametype(Ctx),Nothing,Nothing,getfield(Cassette, Symbol("##PassType#365")),Nothing,Nothing}, ::Function, :
:Tuple{String,String}, ::Type, ::Type, ::NTuple{9,VecElement{Float64}}, ::Vararg{NTuple{9,VecElement{Float64}},N} where N) at ./REPL[19]:6
 [4] macro expansion at /Users/oxinabox/.julia/packages/SIMD/nqizO/src/SIMD.jl:602 [inlined]
 [5] llvmwrap at /Users/oxinabox/.julia/packages/SIMD/nqizO/src/SIMD.jl:583 [inlined]
 [6] recurse(::Cassette.Context{nametype(Ctx),Nothing,Nothing,getfield(Cassette, Symbol("##PassType#365")),Nothing,Nothing}, ::typeof(SIMD
.llvmwrap), ::Type{Val{:+}}, ::SIMD.Vec{9,Float64}, ::SIMD.Vec{9,Float64}, ::Type{Float64}) at /Users/oxinabox/.julia/packages/Cassette/qs8Qq/src/overdub.jl:0
 [7] overdub(::Cassette.Context{nametype(Ctx),Nothing,Nothing,getfield(Cassette, Symbol("##PassType#365")),Nothing,Nothing}, ::Function, :
:Type, ::SIMD.Vec{9,Float64}, ::SIMD.Vec{9,Float64}, ::Type) at ./REPL[19]:3
 [8] llvmwrap at /Users/oxinabox/.julia/packages/SIMD/nqizO/src/SIMD.jl:583 [inlined]
 [9] overdub at ./REPL[19]:3 [inlined]
 [10] + at /Users/oxinabox/.julia/packages/SIMD/nqizO/src/SIMD.jl:1057 [inlined]
 [11] overdub at ./REPL[19]:3 [inlined]
 [12] + at /Users/oxinabox/.julia/packages/Tensors/hQW1A/src/simd.jl:98 [inlined]
 [13] recurse(::Cassette.Context{nametype(Ctx),Nothing,Nothing,getfield(Cassette, Symbol("##PassType#365")),Nothing,Nothing}, ::typeof(+),
 ::Tensor{2,3,Float64,9}, ::Tensor{2,3,Float64,9}) at /Users/oxinabox/.julia/packages/Cassette/qs8Qq/src/overdub.jl:0
 [14] overdub(::Cassette.Context{nametype(Ctx),Nothing,Nothing,getfield(Cassette, Symbol("##PassType#365")),Nothing,Nothing}, ::Function,
::Tensor{2,3,Float64,9}, ::Tensor{2,3,Float64,9}) at ./REPL[19]:3
 [15] recurse(::Cassette.Context{nametype(Ctx),Nothing,Nothing,getfield(Cassette, Symbol("##PassType#365")),Nothing,Nothing}, ::getfield(M
ain, Symbol("##38#39"))) at /Users/oxinabox/.julia/packages/Cassette/qs8Qq/src/overdub.jl:677
 [16] top-level scope at none:0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions