Skip to content

Enzyme crash in Lux.jl when using sin as activation function #2788

Description

@se-schmitt

See LuxDL/Lux.jl#1554

MWE:

using Lux, Random, Optimisers, Enzyme, Printf

cdev = cpu_device()
# xdev = reactant_device()
xdev = cpu_device()
rng = Random.default_rng()
Random.seed!(rng, 0)

X, Y = rand32(rng, 10, 24), rand32(rng, 1, 24)

model = Chain(
    Dense(10, 10, sin),
    Dense(10,  1, sin)
)

ps, st = Lux.setup(rng, model)

ts = Training.TrainState(model, ps, st, AdamW())
(_, loss_j, _, ts) = Training.single_train_step!(AutoEnzyme(), MSELoss(), (X, Y), ts)

Julia crash:

$ julia mwe.jl 
error: Linking globals named 'julia_sin_25307': symbol multiply defined!

Version info:

Julia Version 1.11.7
Commit f2b3dbda30a (2025-09-08 12:10 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 12 × AMD Ryzen 5 8540U w/ Radeon 740M Graphics
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, znver3)
Threads: 1 default, 0 interactive, 1 GC (on 12 virtual cores)

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