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

v1.6 only LLVM-level error #414

Closed
ChrisRackauckas opened this issue Aug 13, 2022 · 2 comments
Closed

v1.6 only LLVM-level error #414

ChrisRackauckas opened this issue Aug 13, 2022 · 2 comments

Comments

@ChrisRackauckas
Copy link
Contributor

MWE:

using Enzyme, ForwardDiff

p = rand(3)
y = rand(3)
tmp1 = rand(3)
tmp2 = rand(3)
tmp3 = rand(3*4)
tmp3 = SubArray(tmp3, axes(tmp3))
tmp3 = reinterpret(ForwardDiff.Dual{ForwardDiff.Tag{Nothing, Float64}, Float64, 3},tmp3)
tmp4 = rand(3*4)
tmp4 = SubArray(tmp4, axes(tmp4))
tmp4 = reinterpret(ForwardDiff.Dual{ForwardDiff.Tag{Nothing, Float64}, Float64, 3},tmp4)

t = 0.0

function dudt(u, p, t)
    u .* p
end

tester = function (out, u, _p, t)
    out .= dudt(u, _p, t)
    nothing
end

Enzyme.autodiff(tester, Enzyme.Duplicated(tmp3, tmp4),
                Enzyme.DuplicatedNoNeed(y, tmp1),
                Enzyme.Duplicated(p, tmp2), Enzyme.Const(t))

error.txt

@wsmoses
Copy link
Member

wsmoses commented Aug 13, 2022

Can you retry on latest main? I see a Julia-level error.


Cannot deduce type of store   store i64 0, i64 addrspace(13)* %63, align 8, !dbg !140, !tbaa !132

Caused by:
Stacktrace:
 [1] setindex!
   @ ./array.jl:843
 [2] setindex!
   @ ./subarray.jl:341
 [3] _setindex_ra!
   @ ./reinterpretarray.jl:491
 [4] setindex!
   @ ./reinterpretarray.jl:446
 [5] copyto_unaliased!
   @ ./abstractarray.jl:970

Stacktrace:
  [1] julia_error(cstr::Cstring, val::Ptr{LLVM.API.LLVMOpaqueValue}, errtype::Enzyme.API.ErrorType, data::Ptr{Nothing})
    @ Enzyme.Compiler /mnt/Data/git/Enzyme.jl/src/compiler.jl:2755
  [2] EnzymeCreatePrimalAndGradient(logic::Enzyme.Logic, todiff::LLVM.Function, retType::Enzyme.API.CDIFFE_TYPE, constant_args::Vector{Enzyme.API.CDIFFE_TYPE}, TA::Enzyme.TypeAnalysis, returnValue::Bool, dretUsed::Bool, mode::Enzyme.API.CDerivativeMode, width::Int64, additionalArg::Ptr{Nothing}, typeInfo::Enzyme.FnTypeInfo, uncacheable_args::Vector{Bool}, augmented::Ptr{Nothing}, atomicAdd::Bool)
    @ Enzyme.API /mnt/Data/git/Enzyme.jl/src/api.jl:111
  [3] enzyme!(job::GPUCompiler.CompilerJob{Enzyme.Compiler.EnzymeTarget, Enzyme.Compiler.EnzymeCompilerParams, GPUCompiler.FunctionSpec{var"#1#2", Tuple{Base.ReinterpretArray{ForwardDiff.Dual{ForwardDiff.Tag{Nothing, Float64}, Float64, 3}, 1, Float64, SubArray{Float64, 1, Vector{Float64}, Tuple{Base.OneTo{Int64}}, true}, false}, Vector{Float64}, Vector{Float64}, Float64}}}, mod::LLVM.Module, primalf::LLVM.Function, adjoint::GPUCompiler.FunctionSpec{var"#1#2", Tuple{Duplicated{Base.ReinterpretArray{ForwardDiff.Dual{ForwardDiff.Tag{Nothing, Float64}, Float64, 3}, 1, Float64, SubArray{Float64, 1, Vector{Float64}, Tuple{Base.OneTo{Int64}}, true}, false}}, DuplicatedNoNeed{Vector{Float64}}, Duplicated{Vector{Float64}}, Const{Float64}}}, mode::Enzyme.API.CDerivativeMode, width::Int64, parallel::Bool, actualRetType::Type, dupClosure::Bool, wrap::Bool, modifiedBetween::Bool, returnPrimal::Bool)
    @ Enzyme.Compiler /mnt/Data/git/Enzyme.jl/src/compiler.jl:3458
  [4] codegen(output::Symbol, job::GPUCompiler.CompilerJob{Enzyme.Compiler.EnzymeTarget, Enzyme.Compiler.EnzymeCompilerParams, GPUCompiler.FunctionSpec{var"#1#2", Tuple{Base.ReinterpretArray{ForwardDiff.Dual{ForwardDiff.Tag{Nothing, Float64}, Float64, 3}, 1, Float64, SubArray{Float64, 1, Vector{Float64}, Tuple{Base.OneTo{Int64}}, true}, false}, Vector{Float64}, Vector{Float64}, Float64}}}; libraries::Bool, deferred_codegen::Bool, optimize::Bool, ctx::LLVM.Context, strip::Bool, validate::Bool, only_entry::Bool, parent_job::Nothing)
    @ Enzyme.Compiler /mnt/Data/git/Enzyme.jl/src/compiler.jl:4366
  [5] _thunk(job::GPUCompiler.CompilerJob{Enzyme.Compiler.EnzymeTarget, Enzyme.Compiler.EnzymeCompilerParams, GPUCompiler.FunctionSpec{var"#1#2", Tuple{Base.ReinterpretArray{ForwardDiff.Dual{ForwardDiff.Tag{Nothing, Float64}, Float64, 3}, 1, Float64, SubArray{Float64, 1, Vector{Float64}, Tuple{Base.OneTo{Int64}}, true}, false}, Vector{Float64}, Vector{Float64}, Float64}}})
    @ Enzyme.Compiler /mnt/Data/git/Enzyme.jl/src/compiler.jl:4766
  [6] cached_compilation(job::GPUCompiler.CompilerJob, key::UInt64, specid::UInt64)
    @ Enzyme.Compiler /mnt/Data/git/Enzyme.jl/src/compiler.jl:4804
  [7] #s618#97
    @ /mnt/Data/git/Enzyme.jl/src/compiler.jl:4864 [inlined]
  [8] var"#s618#97"(F::Any, Fn::Any, DF::Any, A::Any, TT::Any, Mode::Any, ModifiedBetween::Any, width::Any, specid::Any, ReturnPrimal::Any, ::Any, #unused#::Type, f::Any, df::Any, #unused#::Type, tt::Any, #unused#::Type, #unused#::Type, #unused#::Type, #unused#::Type, #unused#::Any)
    @ Enzyme.Compiler ./none:0
  [9] (::Core.GeneratedFunctionStub)(::Any, ::Vararg{Any, N} where N)
    @ Core ./boot.jl:571
 [10] thunk
    @ /mnt/Data/git/Enzyme.jl/src/compiler.jl:4892 [inlined]
 [11] thunk (repeats 2 times)
    @ /mnt/Data/git/Enzyme.jl/src/compiler.jl:4885 [inlined]
 [12] autodiff(::Enzyme.ReverseMode, ::var"#1#2", ::Type{Const{Nothing}}, ::Duplicated{Base.ReinterpretArray{ForwardDiff.Dual{ForwardDiff.Tag{Nothing, Float64}, Float64, 3}, 1, Float64, SubArray{Float64, 1, Vector{Float64}, Tuple{Base.OneTo{Int64}}, true}, false}}, ::Vararg{Any, N} where N)
    @ Enzyme /mnt/Data/git/Enzyme.jl/src/Enzyme.jl:293
 [13] autodiff(::Enzyme.ReverseMode, ::var"#1#2", ::Duplicated{Base.ReinterpretArray{ForwardDiff.Dual{ForwardDiff.Tag{Nothing, Float64}, Float64, 3}, 1, Float64, SubArray{Float64, 1, Vector{Float64}, Tuple{Base.OneTo{Int64}}, true}, false}}, ::DuplicatedNoNeed{Vector{Float64}}, ::Vararg{Any, N} where N)
    @ Enzyme /mnt/Data/git/Enzyme.jl/src/Enzyme.jl:327
 [14] autodiff(::var"#1#2", ::Duplicated{Base.ReinterpretArray{ForwardDiff.Dual{ForwardDiff.Tag{Nothing, Float64}, Float64, 3}, 1, Float64, SubArray{Float64, 1, Vector{Float64}, Tuple{Base.OneTo{Int64}}, true}, false}}, ::DuplicatedNoNeed{Vector{Float64}}, ::Duplicated{Vector{Float64}}, ::Vararg{Any, N} where N)
    @ Enzyme /mnt/Data/git/Enzyme.jl/src/Enzyme.jl:420
 [15] top-level scope
    @ /mnt/Data/git/Enzyme.jl/ll6er.jl:25
in expression starting at /mnt/Data/git/Enzyme.jl/ll6er.jl:25

@ChrisRackauckas
Copy link
Contributor Author

Yes, it's a Julia-level error on Main

@wsmoses wsmoses closed this as completed Aug 23, 2022
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