Skip to content

Enzyme errors on simple example from documentation #2696

@mrarat

Description

@mrarat

The code below is an example from Enzyme docs:

using Enzyme

rosenbrock_inp(x) = (1.0 - x[1])^2 + 100.0 * (x[2] - x[1]^2)^2

gradient(ReverseWithPrimal, rosenbrock_inp, [1.0, 2.0])

The code above results in an error:

ERROR: UndefVarError: `scoped_no_alias_aa!` not defined in `Enzyme.Compiler`
Suggestion: check for spelling errors or missing imports.
Stacktrace:
  [1] (::Enzyme.Compiler.var"#optimize!##0#optimize!##1"{LLVM.Module, LLVM.TargetMachine})(pm::LLVM.ModulePassManager)
    @ Enzyme.Compiler C:\Users\user\.julia\packages\Enzyme\Ah2fT\src\compiler\optimize.jl:460
  [2] LLVM.ModulePassManager(::Enzyme.Compiler.var"#optimize!##0#optimize!##1"{}; kwargs::@Kwargs{})
    @ LLVM C:\Users\user\.julia\packages\LLVM\iza6e\src\passmanager.jl:33
  [3] ModulePassManager
    @ C:\Users\user\.julia\packages\LLVM\iza6e\src\passmanager.jl:30 [inlined]
  [4] optimize!(mod::LLVM.Module, tm::LLVM.TargetMachine)
    @ Enzyme.Compiler C:\Users\user\.julia\packages\Enzyme\Ah2fT\src\compiler\optimize.jl:455
  [5] compile_unhooked(output::Symbol, job::GPUCompiler.CompilerJob{…})
    @ Enzyme.Compiler C:\Users\user\.julia\packages\Enzyme\Ah2fT\src\compiler.jl:4771
  [6] compile(target::Symbol, job::GPUCompiler.CompilerJob; kwargs::@Kwargs{})
    @ GPUCompiler C:\Users\user\.julia\packages\GPUCompiler\Gp8bZ\src\driver.jl:67
  [7] compile
    @ C:\Users\user\.julia\packages\GPUCompiler\Gp8bZ\src\driver.jl:55 [inlined]
  [8] _thunk(job::GPUCompiler.CompilerJob{…}, postopt::Bool)
    @ Enzyme.Compiler C:\Users\user\.julia\packages\Enzyme\Ah2fT\src\compiler.jl:5956
  [9] _thunk
    @ C:\Users\user\.julia\packages\Enzyme\Ah2fT\src\compiler.jl:5954 [inlined]
 [10] cached_compilation
    @ C:\Users\user\.julia\packages\Enzyme\Ah2fT\src\compiler.jl:6011 [inlined]
 [11] thunkbase(mi::Core.MethodInstance, World::UInt64, FA::Type{…}, A::Type{…}, TT::Type, Mode::Enzyme.API.CDerivativeMode, width::Int64, ModifiedBetween::NTuple{…} where N, ReturnPrimal::Bool, ShadowInit::Bool, ABI::Type, ErrIfFuncWritten::Bool, RuntimeActivity::Bool, StrongZero::Bool, edges::Vector{…})
    @ Enzyme.Compiler C:\Users\user\.julia\packages\Enzyme\Ah2fT\src\compiler.jl:6127
 [12] thunk_generator(world::UInt64, source::Union{…}, FA::Type, A::Type, TT::Type, Mode::Enzyme.API.CDerivativeMode, Width::Int64, ModifiedBetween::NTuple{…} where N, ReturnPrimal::Bool, ShadowInit::Bool, ABI::Type, ErrIfFuncWritten::Bool, RuntimeActivity::Bool, StrongZero::Bool, self::Any, fakeworld::Any, fa::Type, a::Type, tt::Type, mode::Type, width::Type, modifiedbetween::Type, returnprimal::Type, shadowinit::Type, abi::Type, erriffuncwritten::Type, runtimeactivity::Type, strongzero::Type)
    @ Enzyme.Compiler C:\Users\user\.julia\packages\Enzyme\Ah2fT\src\compiler.jl:6271
 [13] autodiff
    @ C:\Users\user\.julia\packages\Enzyme\Ah2fT\src\Enzyme.jl:502 [inlined]
 [14] autodiff
    @ C:\Users\user\.julia\packages\Enzyme\Ah2fT\src\Enzyme.jl:542 [inlined]
 [15] macro expansion
    @ C:\Users\user\.julia\packages\Enzyme\Ah2fT\src\sugar.jl:336 [inlined]
 [16] gradient(::ReverseMode{true, false, false, FFIABI, false, false}, ::typeof(rosenbrock_inp), ::Vector{Float64})
    @ Enzyme C:\Users\user\.julia\packages\Enzyme\Ah2fT\src\sugar.jl:273
 [17] top-level scope
    @ c:\Code\MWE\Enzyme_SimpleCrash\src2.jl:5
Some type information was truncated. Use `show(err)` to see complete types.

julia> versioninfo()
Julia Version 1.12.1
Commit ba1e628ee4 (2025-10-17 13:02 UTC)
Build Info:
  Official https://julialang.org release
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 14 × Intel(R) Core(TM) Ultra 7 165U
  WORD_SIZE: 64
  LLVM: libLLVM-18.1.7 (ORCJIT, alderlake)
  GC: Built with stock GC
Threads: 10 default, 1 interactive, 10 GC (on 14 virtual cores)
Environment:
  JULIA_EDITOR = code
  JULIA_VSCODE_REPL = 1
  JULIA_NUM_THREADS = 10

(Enzyme_SimpleCrash) pkg> st
Status `C:\Code\MWE\Enzyme_SimpleCrash\Project.toml`
  [7da242da] Enzyme v0.13.90

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