Skip to content

data corruption in struct #603

@tpapp

Description

@tpapp

MWE:

using Enzyme

# make a test problem
struct Foo
    D::Vector{Float64}
end
const N = 5                      # dimension for MWE
(f::Foo)(x) = mapreduce((D, x) -> log(D) + exp(x), +, f.D, x)

ℓ = Foo(fill(2.0, N)) # note the 2.0.D                   # before AD: filled with 2.0s
x = zeros(N)
∂ℓ_∂x = zero(x)
Enzyme.autodiff(Reverse, ℓ, Enzyme.Active, Enzyme.Duplicated(x, ∂ℓ_∂x))
ℓ.D                   # after AD: filled with 2.5s
(EnzymeMWE) pkg> st
Status `~/research/spouses-time-allocation/tmp/EnzymeMWE/Project.toml`
  [7da242da] Enzyme v0.10.17

julia> versioninfo()
Julia Version 1.8.5
Commit 17cfb8e65e* (2023-01-08 06:45 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 8 × 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, tigerlake)
  Threads: 8 on 8 virtual cores

(Issue I mentioned in #584 (comment))

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions