We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
MWE:
using Enzyme, ForwardDiff using LinearSolve, LinearAlgebra, Test n = 4 A = rand(n, n); dA = zeros(n, n); dA2 = zeros(n, n); b1 = rand(n); db1 = zeros(n); db12 = zeros(n); function fbatch(y, A, b1; alg = LUFactorization()) prob = LinearProblem(A, b1) sol1 = solve(prob, alg) s1 = sol1.u y[1] = norm(s1) nothing end y = [0.0] dy1 = [1.0] dy2 = [1.0] Enzyme.autodiff(Reverse, fbatch, BatchDuplicated(y, (dy1, dy2)), BatchDuplicated(copy(A), (dA, dA2)), BatchDuplicated(copy(b1), (db1, db12))) dA2 = ForwardDiff.gradient(x->f(x,eltype(x).(b1)), copy(A)) db12 = ForwardDiff.gradient(x->f(eltype(x).(A),x), copy(b1)) @test_broken dA ≈ dA_2 @test_broken dA2 ≈ dA_2 @test_broken db1 ≈ db1_2 @test_broken db12 ≈ db1_2
output3.txt
Bottom is:
ERROR: LLVM error: function failed verification (4) Stacktrace: [1] handle_error(reason::Cstring) @ LLVM C:\Users\accou\.julia\packages\LLVM\lq6lJ\src\core\context.jl:134 [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}, forceAnonymousTape::Bool, typeInfo::Enzyme.FnTypeInfo, uncacheable_args::Vector{Bool}, augmented::Ptr{Nothing}, atomicAdd::Bool) @ Enzyme.API C:\Users\accou\.julia\packages\Enzyme\VS5jo\src\api.jl:128 [3] enzyme!(job::GPUCompiler.CompilerJob{Enzyme.Compiler.EnzymeTarget, Enzyme.Compiler.EnzymeCompilerParams}, mod::LLVM.Module, primalf::LLVM.Function, TT::Type, mode::Enzyme.API.CDerivativeMode, width::Int64, parallel::Bool, actualRetType::Type, wrap::Bool, modifiedBetween::NTuple{4, Bool}, returnPrimal::Bool, jlrules::Vector{String}, expectedTapeType::Type) @ Enzyme.Compiler C:\Users\accou\.julia\packages\Enzyme\VS5jo\src\compiler.jl:7714 [4] codegen(output::Symbol, job::GPUCompiler.CompilerJob{Enzyme.Compiler.EnzymeTarget, Enzyme.Compiler.EnzymeCompilerParams}; libraries::Bool, deferred_codegen::Bool, optimize::Bool, toplevel::Bool, strip::Bool, validate::Bool, only_entry::Bool, parent_job::Nothing) @ Enzyme.Compiler C:\Users\accou\.julia\packages\Enzyme\VS5jo\src\compiler.jl:9274 [5] codegen @ C:\Users\accou\.julia\packages\Enzyme\VS5jo\src\compiler.jl:8879 [inlined] [6] _thunk(job::GPUCompiler.CompilerJob{Enzyme.Compiler.EnzymeTarget, Enzyme.Compiler.EnzymeCompilerParams}, postopt::Bool) @ Enzyme.Compiler C:\Users\accou\.julia\packages\Enzyme\VS5jo\src\compiler.jl:9826 [7] _thunk @ C:\Users\accou\.julia\packages\Enzyme\VS5jo\src\compiler.jl:9826 [inlined] [8] cached_compilation @ C:\Users\accou\.julia\packages\Enzyme\VS5jo\src\compiler.jl:9860 [inlined] [9] (::Enzyme.Compiler.var"#475#476"{DataType, DataType, DataType, Enzyme.API.CDerivativeMode, NTuple{4, Bool}, Int64, Bool, Bool, UInt64, DataType})(ctx::LLVM.Context) @ Enzyme.Compiler C:\Users\accou\.julia\packages\Enzyme\VS5jo\src\compiler.jl:9923 [10] JuliaContext(f::Enzyme.Compiler.var"#475#476"{DataType, DataType, DataType, Enzyme.API.CDerivativeMode, NTuple{4, Bool}, Int64, Bool, Bool, UInt64, DataType}) @ GPUCompiler C:\Users\accou\.julia\packages\GPUCompiler\2mJjc\src\driver.jl:47 [11] #s292#474 @ C:\Users\accou\.julia\packages\Enzyme\VS5jo\src\compiler.jl:9878 [inlined] [12] var"#s292#474"(FA::Any, A::Any, TT::Any, Mode::Any, ModifiedBetween::Any, width::Any, ReturnPrimal::Any, ShadowInit::Any, World::Any, ABI::Any, ::Any, #unused#::Type, #unused#::Type, #unused#::Type, tt::Any, #unused#::Type, #unused#::Type, #unused#::Type, #unused#::Type, #unused#::Type, #unused#::Any) @ Enzyme.Compiler .\none:0 [13] (::Core.GeneratedFunctionStub)(::Any, ::Vararg{Any}) @ Core .\boot.jl:602 [14] autodiff(::ReverseMode{false, FFIABI}, ::Const{typeof(fbatch)}, ::Type{Const{Nothing}}, ::BatchDuplicated{Vector{Float64}, 2}, ::Vararg{Any}) @ Enzyme C:\Users\accou\.julia\packages\Enzyme\VS5jo\src\Enzyme.jl:207 [15] autodiff(::ReverseMode{false, FFIABI}, ::Const{typeof(fbatch)}, ::BatchDuplicated{Vector{Float64}, 2}, ::BatchDuplicated{Matrix{Float64}, 2}, ::Vararg{Any}) @ Enzyme C:\Users\accou\.julia\packages\Enzyme\VS5jo\src\Enzyme.jl:236 [16] autodiff(::ReverseMode{false, FFIABI}, ::typeof(fbatch), ::BatchDuplicated{Vector{Float64}, 2}, ::BatchDuplicated{Matrix{Float64}, 2}, ::Vararg{Any}) @ Enzyme C:\Users\accou\.julia\packages\Enzyme\VS5jo\src\Enzyme.jl:222 [17] top-level scope @ c:\Users\accou\OneDrive\Computer\Desktop\test.jl:141
The text was updated successfully, but these errors were encountered:
Discovered as part of SciML/LinearSolve.jl#377.
Sorry, something went wrong.
Can you retry, I think this was fixed by #1083
Fix enzyme batch mode
e56227a
Fixes EnzymeAD/Enzyme.jl#1075
Successfully merging a pull request may close this issue.
MWE:
output3.txt
Bottom is:
The text was updated successfully, but these errors were encountered: