EnzymeAD / Enzyme.jl

Julia bindings for the Enzyme automatic differentiator
https://enzyme.mit.edu
MIT License
422 stars 58 forks source link

Avoid undefref error in validation.jl #1523

Closed vchuravy closed 3 weeks ago

vchuravy commented 3 weeks ago

Otherwise:

UndefVarError: `libcuda` not defined
Stack trace

Here is what happened, the most recent locations are first:

    check_ir!(job::GPUCompiler.CompilerJob{Enzyme.Compiler.EnzymeTarget, Enzyme.Compiler.EnzymeCompilerParams}, errors::Vector{Tuple{String, Vector{Base.StackTraces.StackFrame}, Any}}, imported::Set{String}, inst::LLVM.CallInst, calls::Vector{Any}) @ validation.jl:430
    check_ir!(job::GPUCompiler.CompilerJob{Enzyme.Compiler.EnzymeTarget, Enzyme.Compiler.EnzymeCompilerParams}, errors::Vector{Tuple{String, Vector{Base.StackTraces.StackFrame}, Any}}, imported::Set{String}, f::LLVM.Function) @ validation.jl:323
    check_ir!(job::GPUCompiler.CompilerJob{Enzyme.Compiler.EnzymeTarget, Enzyme.Compiler.EnzymeCompilerParams}, errors::Vector{Tuple{String, Vector{Base.StackTraces.StackFrame}, Any}}, mod::LLVM.Module) @ validation.jl:293
    check_ir @ validation.jl:157
    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) @ compiler.jl:4631
    codegen @ compiler.jl:4592
    _thunk(job::GPUCompiler.CompilerJob{Enzyme.Compiler.EnzymeTarget, Enzyme.Compiler.EnzymeCompilerParams}, postopt::Bool) @ compiler.jl:5968
    _thunk @ compiler.jl:5968
    cached_compilation @ compiler.jl:6006
    (::Enzyme.Compiler.var"#1222#1223"{DataType, DataType, Enzyme.API.CDerivativeMode, Tuple{Bool, Bool}, Int64, Bool, Bool, UInt64, DataType})(ctx::LLVM.Context) @ compiler.jl:6073
    JuliaContext(f::Enzyme.Compiler.var"#1222#1223"{DataType, DataType, Enzyme.API.CDerivativeMode, Tuple{Bool, Bool}, Int64, Bool, Bool, UInt64, DataType}; kwargs::@Kwargs{}) @ driver.jl:52
    JuliaContext(f::Function) @ driver.jl:42
    #s1967#1221 @ compiler.jl:6024
    var"#s1967#1221"(FA::Any, A::Any, TT::Any, Mode::Any, ModifiedBetween::Any, width::Any, ReturnPrimal::Any, ShadowInit::Any, World::Any, ABI::Any, ::Any, ::Type, ::Type, ::Type, tt::Any, ::Type, ::Type, ::Type, ::Type, ::Type, ::Any) @ 
    (::Core.GeneratedFunctionStub)(::UInt64, ::LineNumberNode, ::Any, ::Vararg{Any}) @ boot.jl:602
    autodiff @ Enzyme.jl:234
    autodiff(mode::EnzymeCore.ReverseMode{true, EnzymeCore.FFIABI, false}, f::typeof(Main.var"workspace#7".final_energy!), ::Type{EnzymeCore.Active}, args::EnzymeCore.Duplicated{Main.var"workspace#7".Burgers}) @ Enzyme.jl:303
    [This cell: line 3](https://dj4earth.github.io/MPE24/Burgers_tutorial/burgers_tutorial.html#f152117a-578c-451f-86ce-4acd1a669bfd)
github-actions[bot] commented 3 weeks ago

Benchmark Results

main 6bc50c78679b00... main/6bc50c78679b00...
basics/overhead 4.03 ± 0.001 ns 4.03 ± 0.001 ns 1
time_to_load 0.346 ± 0.0018 s 0.346 ± 0.0023 s 0.999

Benchmark Plots

A plot of the benchmark results have been uploaded as an artifact to the workflow run for this PR. Go to "Actions"->"Benchmark a pull request"->[the most recent run]->"Artifacts" (at the bottom).