Skip to content
New issue

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

Error for JVP by Enzyme #628

Closed
prbzrg opened this issue May 7, 2024 · 16 comments
Closed

Error for JVP by Enzyme #628

prbzrg opened this issue May 7, 2024 · 16 comments

Comments

@prbzrg
Copy link
Contributor

prbzrg commented May 7, 2024

Error:

┌ Warning: Using fallback BLAS replacements for (["sgemm_64_"]), performance may be degraded
└ @ Enzyme.Compiler C:\Users\prbzr\.julia\packages\GPUCompiler\kqxyC\src\utils.jl:59
ERROR: LoadError: Enzyme execution failed.
Mismatched activity for:   %value_phi346 = phi {} addrspace(10)* [ %283, %L1102 ], [ %getfield, %L1080 ] const val:   %getfield = load atomic {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %getfield_addr unordered, align 8, !dbg !137, !tbaa !135, !alias.scope !152, !noalias !155, !nonnull !106, !dereferenceable !160, !align !161
 value=Unknown object of type Vector{Float32}
You may be using a constant variable as temporary storage for active memory (https://enzyme.mit.edu/julia/stable/faq/#Activity-of-temporary-storage). If not, please open an issue, and either rewrite this variable to not be conditionally active or use Enzyme.API.runtimeActivity!(true) as a workaround for now

Stacktrace:
  [1] <=
    @ .\int.jl:514
  [2] in
    @ .\range.jl:1439
  [3] map
    @ .\tuple.jl:318
  [4] iterate
    @ .\multidimensional.jl:402
  [5] macro expansion
    @ .\simdloop.jl:70
  [6] copyto!
    @ .\broadcast.jl:1003
  [7] copyto!
    @ .\broadcast.jl:956
  [8] materialize!
    @ .\broadcast.jl:914
  [9] materialize!
    @ .\broadcast.jl:911
 [10] __nonuniform_fast_broadcast!
    @ C:\Users\prbzr\.julia\packages\LuxLib\VDD3J\src\utils.jl:165
 [11] __apply_bias_activation!!
    @ C:\Users\prbzr\.julia\packages\LuxLib\VDD3J\src\utils.jl:131
 [12] __fused_dense_bias_activation_impl
    @ C:\Users\prbzr\.julia\packages\LuxLib\VDD3J\src\impl\fused_dense.jl:31
 [13] fused_dense_bias_activation
    @ C:\Users\prbzr\.julia\packages\LuxLib\VDD3J\src\api\dense.jl:46
 [14] fused_dense_bias_activation
    @ C:\Users\prbzr\.julia\packages\LuxLib\VDD3J\src\api\dense.jl:38
 [15] Dense
    @ C:\Users\prbzr\.julia\packages\Lux\GZSwV\src\layers\basic.jl:218
 [16] apply
    @ C:\Users\prbzr\.julia\packages\LuxCore\8lRV2\src\LuxCore.jl:180

Stacktrace:
 [1] throwerr(cstr::Cstring)
   @ Enzyme.Compiler C:\Users\prbzr\.julia\packages\Enzyme\iGAtf\src\compiler.jl:1323
in expression starting at D:\Codes\Mine\bug-report\br-4\br-4.jl:10

Code:

using Lux, Random, ComponentArrays, Enzyme, DifferentiationInterface

nn = Dense(10 => 10, tanh)
ps, st = Lux.setup(Random.default_rng(), nn)
ps = ComponentArray(ps)
r = rand(Float32, 10, 20)

snn = StatefulLuxLayer(nn, ps, st)

DifferentiationInterface.value_and_pushforward(snn, AutoEnzyme(Enzyme.Forward), r, r)

Environment:

Status `D:\Codes\Mine\bug-report\br-4\Project.toml`
  [b0b7db55] ComponentArrays v0.15.11
  [a0c0ee7d] DifferentiationInterface v0.3.4
  [7da242da] Enzyme v0.12.2
  [b2108857] Lux v0.5.42
  [9a3f8284] Random
Status `D:\Codes\Mine\bug-report\br-4\Manifest.toml`
  [47edcb42] ADTypes v1.1.0
  [79e6a3ab] Adapt v4.0.4
  [4fba245c] ArrayInterface v7.10.0
  [a9b6321e] Atomix v0.1.0
  [62783981] BitTwiddlingConvenienceFunctions v0.1.5
  [fa961155] CEnum v0.5.0
  [2a0fbf3d] CPUSummary v0.2.4
  [d360d2e6] ChainRulesCore v1.23.0
  [fb6a15b2] CloseOpenIntervals v0.1.12
  [bbf7d656] CommonSubexpressions v0.3.0
  [34da2185] Compat v4.15.0
  [b0b7db55] ComponentArrays v0.15.11
  [2569d6c7] ConcreteStructs v0.2.3
  [187b0558] ConstructionBase v1.5.5
  [adafc99b] CpuId v0.3.1
  [163ba53b] DiffResults v1.1.0
  [b552c78f] DiffRules v1.15.1
  [a0c0ee7d] DifferentiationInterface v0.3.4
  [ffbed154] DocStringExtensions v0.9.3
  [7da242da] Enzyme v0.12.2
  [f151be2c] EnzymeCore v0.7.2
  [e2ba6199] ExprTools v0.1.10
  [7034ab61] FastBroadcast v0.2.8
  [9aa1b823] FastClosures v0.3.2
  [1a297f60] FillArrays v1.11.0
  [f6369f11] ForwardDiff v0.10.36
  [d9f16b24] Functors v0.4.10
  [46192b85] GPUArraysCore v0.1.6
  [61eb1bfa] GPUCompiler v0.26.4
  [615f187c] IfElse v0.1.1
  [92d709cd] IrrationalConstants v0.2.2
  [692b3bcd] JLLWrappers v1.5.0
  [63c18a36] KernelAbstractions v0.9.18
⌅ [929cbde3] LLVM v6.6.3
  [10f19ff3] LayoutPointers v0.1.15
  [2ab3a3ac] LogExpFunctions v0.3.27
  [b2108857] Lux v0.5.42
  [bb33d45b] LuxCore v0.1.14
  [34f89e08] LuxDeviceUtils v0.1.20
  [82251201] LuxLib v0.3.20
  [1914dd2f] MacroTools v0.5.13
  [d125e4d3] ManualMemory v0.1.8
  [872c559c] NNlib v0.9.14
  [77ba4419] NaNMath v1.0.2
  [d8793406] ObjectFile v0.4.1
  [65ce6f38] PackageExtensionCompat v1.0.2
  [570af359] PartialFunctions v1.2.0
  [f517fe37] Polyester v0.7.13
  [1d0040c9] PolyesterWeave v0.2.1
  [aea7be01] PrecompileTools v1.2.1
  [21216c6a] Preferences v1.4.3
  [189a3867] Reexport v1.2.2
  [ae029012] Requires v1.3.0
  [94e857df] SIMDTypes v0.1.0
  [6c6a2e73] Scratch v1.2.1
  [efcf1570] Setfield v1.1.1
  [276daf66] SpecialFunctions v2.4.0
  [aedffcd0] Static v0.8.10
  [0d7ed370] StaticArrayInterface v1.5.0
  [90137ffa] StaticArrays v1.9.3
  [1e83bf80] StaticArraysCore v1.4.2
  [7792a7ef] StrideArraysCore v0.5.6
  [53d494c1] StructIO v0.3.0
  [8290d209] ThreadingUtilities v0.5.2
  [a759f4b9] TimerOutputs v0.5.23
  [013be700] UnsafeAtomics v0.2.1
  [d80eeb9a] UnsafeAtomicsLLVM v0.1.3
  [d49dbf32] WeightInitializers v0.1.7
  [7cc45869] Enzyme_jll v0.0.105+0
  [dad2f222] LLVMExtra_jll v0.0.29+0
  [efe28fd5] OpenSpecFun_jll v0.5.5+0
  [0dad84c5] ArgTools v1.1.1
  [56f22d72] Artifacts
  [2a0f44e3] Base64
  [ade2ca70] Dates
  [f43a241f] Downloads v1.6.0
  [7b1f6079] FileWatching
  [9fa8497b] Future
  [b77e0a4c] InteractiveUtils
  [4af54fe1] LazyArtifacts
  [b27032c2] LibCURL v0.6.4
  [76f85450] LibGit2
  [8f399da3] Libdl
  [37e2e46d] LinearAlgebra
  [56ddb016] Logging
  [d6f4376e] Markdown
  [ca575930] NetworkOptions v1.2.0
  [44cfe95a] Pkg v1.10.0
  [de0858da] Printf
  [3fa0cd96] REPL
  [9a3f8284] Random
  [ea8e919c] SHA v0.7.0
  [9e88b42a] Serialization
  [6462fe0b] Sockets
  [2f01184e] SparseArrays v1.10.0
  [10745b16] Statistics v1.10.0
  [4607b0f0] SuiteSparse
  [fa267f1f] TOML v1.0.3
  [a4e569a6] Tar v1.10.0
  [8dfed614] Test
  [cf7118a7] UUIDs
  [4ec0a83e] Unicode
  [e66e0078] CompilerSupportLibraries_jll v1.1.1+0
  [deac9b47] LibCURL_jll v8.4.0+0
  [e37daf67] LibGit2_jll v1.6.4+0
  [29816b5a] LibSSH2_jll v1.11.0+1
  [c8ffd9c3] MbedTLS_jll v2.28.2+1
  [14a3606d] MozillaCACerts_jll v2023.1.10
  [4536629a] OpenBLAS_jll v0.3.23+4
  [05823500] OpenLibm_jll v0.8.1+2
  [bea87d4a] SuiteSparse_jll v7.2.1+1
  [83775a58] Zlib_jll v1.2.13+1
  [8e850b90] libblastrampoline_jll v5.8.0+1
  [8e850ede] nghttp2_jll v1.52.0+1
  [3f19e933] p7zip_jll v17.4.0+2
Info Packages marked with ⌅ have new versions available but compatibility constraints restrict them from upgrading. To see why use `status --outdated -m`
Julia Version 1.10.3
Commit 0b4590a550 (2024-04-30 10:59 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 12 × Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, skylake)
Threads: 12 default, 2 interactive, 7 GC (on 12 virtual cores)
@wsmoses
Copy link
Contributor

wsmoses commented May 11, 2024

@avik-pal @prbzrg this error appears to be due to the use of DI

Calling Enzyme directly works fine.

firstapply(model, x, p, st) = first(Lux.apply(model, x, p, st))
Enzyme.autodiff(Forward, firstapply, Duplicated, Const(nn), Const(r), Duplicated(ps, make_zero(ps)), Const(st))

@wsmoses
Copy link
Contributor

wsmoses commented May 11, 2024

Ah never mind you were differentiating wrt the input not model?

@wsmoses
Copy link
Contributor

wsmoses commented May 11, 2024

In any case you can disable that by enabling runtime activity as specified with Enzyme.API.runtimeActivity!(true) after importing Enzyme

@prbzrg
Copy link
Contributor Author

prbzrg commented May 12, 2024

After adding Enzyme.API.runtimeActivity!(true), it works.

@avik-pal
Copy link
Member

@wsmoses is this something that needs to be handled on Lux end (for being able to disable runtime activity)?

@wsmoses
Copy link
Contributor

wsmoses commented May 13, 2024

So this definitely shouldn't be required (even though the workaround suggested in the error message resolve this issue). It is clearly coming from broadcasting, so hopefully we can resolve it on a deep dive.

@wsmoses
Copy link
Contributor

wsmoses commented May 26, 2024

@avik-pal this was already resolved in an Enzyme bump iirc, yes?

@avik-pal
Copy link
Member

Yes this works currently.

@prbzrg
Copy link
Contributor Author

prbzrg commented May 27, 2024

But the error isn't resolved for me.

using Lux, Random, ComponentArrays, Enzyme, DifferentiationInterface

# Enzyme.API.runtimeActivity!(true)

nn = Dense(10 => 10, tanh)
ps, st = Lux.setup(Random.default_rng(), nn)
ps = ComponentArray(ps)
r = rand(Float32, 10, 20)

snn = StatefulLuxLayer{true}(nn, ps, st)

DifferentiationInterface.value_and_pushforward(snn, AutoEnzyme(Enzyme.Forward), r, r)
┌ Warning: Using fallback BLAS replacements for (["sgemm_64_"]), performance may be degraded
└ @ Enzyme.Compiler C:\Users\prbzr\.julia\packages\GPUCompiler\nWT2N\src\utils.jl:59
ERROR: LoadError: Enzyme execution failed.
Mismatched activity for:   %value_phi141 = phi {} addrspace(10)* [ %82, %L416 ], [ %getfield, %L394 ] const val:   %getfield = load atomic {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %getfield_addr unordered, align 8, !dbg !91, !tbaa !89, !alias.scope !106, !noalias !109, !nonnull !60, !dereferenceable !114, !align !115
 value=Unknown object of type Vector{Float32}
 llvalue=  %getfield = load atomic {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %getfield_addr unordered, align 8, !dbg !91, !tbaa !89, !alias.scope !106, !noalias !109, !nonnull !60, !dereferenceable !114, !align !115
You may be using a constant variable as temporary storage for active memory (https://enzyme.mit.edu/julia/stable/faq/#Activity-of-temporary-storage). If not, please open an issue, and either rewrite this variable to not be conditionally active or use Enzyme.API.runtimeActivity!(true) as a workaround for now

Stacktrace:
  [1] <=
    @ .\int.jl:514
  [2] in
    @ .\range.jl:1439
  [3] map
    @ .\tuple.jl:318
  [4] iterate
    @ .\multidimensional.jl:402
  [5] macro expansion
    @ .\simdloop.jl:70
  [6] copyto!
    @ .\broadcast.jl:1003
  [7] copyto!
    @ .\broadcast.jl:956
  [8] materialize!
    @ .\broadcast.jl:914
  [9] materialize!
    @ .\broadcast.jl:911
 [10] __nonuniform_fast_broadcast!
    @ C:\Users\prbzr\.julia\packages\LuxLib\VRICL\src\utils.jl:130
 [11] __apply_bias_activation!!
    @ C:\Users\prbzr\.julia\packages\LuxLib\VRICL\src\utils.jl:100
 [12] __fused_dense_bias_activation_impl
    @ C:\Users\prbzr\.julia\packages\LuxLib\VRICL\src\impl\fused_dense.jl:31
 [13] fused_dense_bias_activation
    @ C:\Users\prbzr\.julia\packages\LuxLib\VRICL\src\api\dense.jl:46
 [14] fused_dense_bias_activation
    @ C:\Users\prbzr\.julia\packages\LuxLib\VRICL\src\api\dense.jl:38
 [15] Dense
    @ C:\Users\prbzr\.julia\packages\Lux\PsbZF\src\layers\basic.jl:218
 [16] apply
    @ C:\Users\prbzr\.julia\packages\LuxCore\qiHPC\src\LuxCore.jl:179

Stacktrace:
 [1] throwerr(cstr::Cstring)
   @ Enzyme.Compiler C:\Users\prbzr\.julia\packages\Enzyme\UZsMX\src\compiler.jl:1332
in expression starting at D:\Codes\Mine\bug-report\br-4\br-4.jl:12
Status `D:\Codes\Mine\bug-report\br-4\Project.toml`
  [b0b7db55] ComponentArrays v0.15.13
  [a0c0ee7d] DifferentiationInterface v0.4.0
  [7da242da] Enzyme v0.12.8
  [b2108857] Lux v0.5.51
  [9a3f8284] Random
Status `D:\Codes\Mine\bug-report\br-4\Manifest.toml`
  [47edcb42] ADTypes v1.2.1
  [7d9f7c33] Accessors v0.1.36
  [79e6a3ab] Adapt v4.0.4
  [dce04be8] ArgCheck v2.3.0
  [4fba245c] ArrayInterface v7.10.0
  [a9b6321e] Atomix v0.1.0
  [198e06fe] BangBang v0.4.2
  [62783981] BitTwiddlingConvenienceFunctions v0.1.5
  [fa961155] CEnum v0.5.0
  [2a0fbf3d] CPUSummary v0.2.5
  [d360d2e6] ChainRulesCore v1.23.0
  [ae650224] ChunkSplitters v2.4.2
  [fb6a15b2] CloseOpenIntervals v0.1.12
  [bbf7d656] CommonSubexpressions v0.3.0
  [34da2185] Compat v4.15.0
  [b0b7db55] ComponentArrays v0.15.13
  [a33af91c] CompositionsBase v0.1.2
  [2569d6c7] ConcreteStructs v0.2.3
  [187b0558] ConstructionBase v1.5.5
  [adafc99b] CpuId v0.3.1
  [163ba53b] DiffResults v1.1.0
  [b552c78f] DiffRules v1.15.1
  [a0c0ee7d] DifferentiationInterface v0.4.0
  [ffbed154] DocStringExtensions v0.9.3
  [7da242da] Enzyme v0.12.8
  [f151be2c] EnzymeCore v0.7.3
  [e2ba6199] ExprTools v0.1.10
⌅ [7034ab61] FastBroadcast v0.2.8
  [9aa1b823] FastClosures v0.3.2
  [1a297f60] FillArrays v1.11.0
  [f6369f11] ForwardDiff v0.10.36
  [d9f16b24] Functors v0.4.10
  [46192b85] GPUArraysCore v0.1.6
  [61eb1bfa] GPUCompiler v0.26.5
  [615f187c] IfElse v0.1.1
  [22cec73e] InitialValues v0.3.1
  [3587e190] InverseFunctions v0.1.14
  [92d709cd] IrrationalConstants v0.2.2
  [692b3bcd] JLLWrappers v1.5.0
  [63c18a36] KernelAbstractions v0.9.19
  [929cbde3] LLVM v7.1.0
  [10f19ff3] LayoutPointers v0.1.15
  [2ab3a3ac] LogExpFunctions v0.3.27
  [b2108857] Lux v0.5.51
  [bb33d45b] LuxCore v0.1.15
  [34f89e08] LuxDeviceUtils v0.1.20
  [82251201] LuxLib v0.3.26
  [1914dd2f] MacroTools v0.5.13
  [d125e4d3] ManualMemory v0.1.8
  [872c559c] NNlib v0.9.17
  [77ba4419] NaNMath v1.0.2
  [d8793406] ObjectFile v0.4.1
  [67456a42] OhMyThreads v0.5.2
  [65ce6f38] PackageExtensionCompat v1.0.2
  [570af359] PartialFunctions v1.2.0
  [f517fe37] Polyester v0.7.14
  [1d0040c9] PolyesterWeave v0.2.1
  [aea7be01] PrecompileTools v1.2.1
  [21216c6a] Preferences v1.4.3
  [189a3867] Reexport v1.2.2
  [ae029012] Requires v1.3.0
  [94e857df] SIMDTypes v0.1.0
  [6c6a2e73] Scratch v1.2.1
  [efcf1570] Setfield v1.1.1
  [276daf66] SpecialFunctions v2.4.0
  [91464d47] StableTasks v0.1.5
  [aedffcd0] Static v0.8.10
  [0d7ed370] StaticArrayInterface v1.5.0
  [90137ffa] StaticArrays v1.9.4
  [1e83bf80] StaticArraysCore v1.4.2
  [7792a7ef] StrideArraysCore v0.5.6
  [53d494c1] StructIO v0.3.0
  [ed4db957] TaskLocalValues v0.1.1
  [1c621080] TestItems v0.1.1
  [8290d209] ThreadingUtilities v0.5.2
  [a759f4b9] TimerOutputs v0.5.24
  [013be700] UnsafeAtomics v0.2.1
  [d80eeb9a] UnsafeAtomicsLLVM v0.1.4
  [d49dbf32] WeightInitializers v0.1.7
⌅ [7cc45869] Enzyme_jll v0.0.114+0
  [dad2f222] LLVMExtra_jll v0.0.29+0
  [efe28fd5] OpenSpecFun_jll v0.5.5+0
  [0dad84c5] ArgTools v1.1.1
  [56f22d72] Artifacts
  [2a0f44e3] Base64
  [ade2ca70] Dates
  [f43a241f] Downloads v1.6.0
  [7b1f6079] FileWatching
  [9fa8497b] Future
  [b77e0a4c] InteractiveUtils
  [4af54fe1] LazyArtifacts
  [b27032c2] LibCURL v0.6.4
  [76f85450] LibGit2
  [8f399da3] Libdl
  [37e2e46d] LinearAlgebra
  [56ddb016] Logging
  [d6f4376e] Markdown
  [ca575930] NetworkOptions v1.2.0
  [44cfe95a] Pkg v1.10.0
  [de0858da] Printf
  [3fa0cd96] REPL
  [9a3f8284] Random
  [ea8e919c] SHA v0.7.0
  [9e88b42a] Serialization
  [6462fe0b] Sockets
  [2f01184e] SparseArrays v1.10.0
  [10745b16] Statistics v1.10.0
  [4607b0f0] SuiteSparse
  [fa267f1f] TOML v1.0.3
  [a4e569a6] Tar v1.10.0
  [8dfed614] Test
  [cf7118a7] UUIDs
  [4ec0a83e] Unicode
  [e66e0078] CompilerSupportLibraries_jll v1.1.1+0
  [deac9b47] LibCURL_jll v8.4.0+0
  [e37daf67] LibGit2_jll v1.6.4+0
  [29816b5a] LibSSH2_jll v1.11.0+1
  [c8ffd9c3] MbedTLS_jll v2.28.2+1
  [14a3606d] MozillaCACerts_jll v2023.1.10
  [4536629a] OpenBLAS_jll v0.3.23+4
  [05823500] OpenLibm_jll v0.8.1+2
  [bea87d4a] SuiteSparse_jll v7.2.1+1
  [83775a58] Zlib_jll v1.2.13+1
  [8e850b90] libblastrampoline_jll v5.8.0+1
  [8e850ede] nghttp2_jll v1.52.0+1
  [3f19e933] p7zip_jll v17.4.0+2
Info Packages marked with ⌅ have new versions available but compatibility constraints restrict them from upgrading. To see why use `status --outdated -m`
Julia Version 1.10.3
Commit 0b4590a550 (2024-04-30 10:59 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 12 × Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, skylake)
Threads: 12 default, 2 interactive, 7 GC (on 12 virtual cores)

@wsmoses
Copy link
Contributor

wsmoses commented May 27, 2024 via email

@prbzrg
Copy link
Contributor Author

prbzrg commented May 27, 2024

  [7da242da] Enzyme v0.12.8
(br-4) pkg> st --outdated
Status `D:\Codes\Mine\bug-report\br-4\Project.toml`

(br-4) pkg> st --outdated -m
Status `D:\Codes\Mine\bug-report\br-4\Manifest.toml`
⌅ [7034ab61] FastBroadcast v0.2.8 (<v0.3.0): LuxLib
⌅ [7cc45869] Enzyme_jll v0.0.114+0 (<v0.0.116+0): Enzyme

@prbzrg
Copy link
Contributor Author

prbzrg commented May 27, 2024

(br-4) pkg> add Enzyme_jll@0.0.116
   Resolving package versions...
ERROR: Unsatisfiable requirements detected for package Enzyme_jll [7cc45869]:
 Enzyme_jll [7cc45869] log:
 ├─possible versions are: 0.0.1-0.0.116 or uninstalled
 ├─restricted to versions 0.0.116 by an explicit requirement, leaving only versions: 0.0.116
 └─restricted by compatibility requirements with Enzyme [7da242da] to versions: [0.0.1, 0.0.3, 0.0.5-0.0.9, 0.0.11-0.0.13, 0.0.15-0.0.25, 0.0.28-0.0.30, 0.0.32-0.0.33, 0.0.38, 0.0.41-0.0.43, 0.0.47-0.0.48, 0.0.53, 0.0.57, 0.0.71, 0.0.74-0.0.75, 0.0.78, 0.0.80, 0.0.86, 0.0.88-0.0.89, 0.0.96, 0.0.98, 0.0.102, 0.0.104-0.0.109, 0.0.111, 0.0.114] — no versions left
   └─Enzyme [7da242da] log:
     ├─possible versions are: 0.1.0-0.12.8 or uninstalled
     └─restricted to versions * by an explicit requirement, leaving only versions: 0.1.0-0.12.8

(br-4) pkg> add FastBroadcast@0.3
   Resolving package versions...
   Installed FastBroadcast ─ v0.3.0
   Installed LuxLib ──────── v0.3.14
   Installed Lux ─────────── v0.5.39
    Updating `D:\Codes\Mine\bug-report\br-4\Project.toml`
  [7034ab61] + FastBroadcast v0.3.0
⌃ [b2108857]  Lux v0.5.51  v0.5.39
    Updating `D:\Codes\Mine\bug-report\br-4\Manifest.toml`
  [7d9f7c33] - Accessors v0.1.36
  [dce04be8] - ArgCheck v2.3.0
  [198e06fe] - BangBang v0.4.2
  [ae650224] - ChunkSplitters v2.4.2
  [a33af91c] - CompositionsBase v0.1.2
  [7034ab61]  FastBroadcast v0.2.8  v0.3.0
  [22cec73e] - InitialValues v0.3.1
  [3587e190] - InverseFunctions v0.1.14
⌃ [b2108857]  Lux v0.5.51  v0.5.39
⌃ [82251201]  LuxLib v0.3.26  v0.3.14
  [67456a42] - OhMyThreads v0.5.2
  [91464d47] - StableTasks v0.1.5
  [ed4db957] - TaskLocalValues v0.1.1
  [1c621080] - TestItems v0.1.1
        Info Packages marked with ⌃ have new versions available and may be upgradable.
Precompiling project...
  6 dependencies successfully precompiled in 18 seconds. 107 already precompiled.

@prbzrg
Copy link
Contributor Author

prbzrg commented May 28, 2024

After update, it isn't resolved yet:

┌ Warning: Using fallback BLAS replacements for (["sgemm_64_"]), performance may be degraded
└ @ Enzyme.Compiler C:\Users\prbzr\.julia\packages\GPUCompiler\nWT2N\src\utils.jl:59
ERROR: LoadError: Enzyme execution failed.
Mismatched activity for:   %value_phi141 = phi {} addrspace(10)* [ %82, %L416 ], [ %getfield, %L394 ] const val:   %getfield = load atomic {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %getfield_addr unordered, align 8, !dbg !91, !tbaa !89, !alias.scope !106, !noalias !109, !nonnull !60, !dereferenceable !114, !align !115
 value=Unknown object of type Vector{Float32}
 llvalue=  %getfield = load atomic {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %getfield_addr unordered, align 8, !dbg !91, !tbaa !89, !alias.scope !106, !noalias !109, !nonnull !60, !dereferenceable !114, !align !115
You may be using a constant variable as temporary storage for active memory (https://enzyme.mit.edu/julia/stable/faq/#Activity-of-temporary-storage). If not, please open an issue, and either rewrite this variable to not be conditionally active or use Enzyme.API.runtimeActivity!(true) as a workaround for now

Stacktrace:
  [1] <=
    @ .\int.jl:514
  [2] in
    @ .\range.jl:1439
  [3] map
    @ .\tuple.jl:318
  [4] iterate
    @ .\multidimensional.jl:402
  [5] macro expansion
    @ .\simdloop.jl:70
  [6] copyto!
    @ .\broadcast.jl:1003
  [7] copyto!
    @ .\broadcast.jl:956
  [8] materialize!
    @ .\broadcast.jl:914
  [9] materialize!
    @ .\broadcast.jl:911
 [10] __nonuniform_fast_broadcast!
    @ C:\Users\prbzr\.julia\packages\LuxLib\VRICL\src\utils.jl:130
 [11] __apply_bias_activation!!
    @ C:\Users\prbzr\.julia\packages\LuxLib\VRICL\src\utils.jl:100
 [12] __fused_dense_bias_activation_impl
    @ C:\Users\prbzr\.julia\packages\LuxLib\VRICL\src\impl\fused_dense.jl:31
 [13] fused_dense_bias_activation
    @ C:\Users\prbzr\.julia\packages\LuxLib\VRICL\src\api\dense.jl:46
 [14] fused_dense_bias_activation
    @ C:\Users\prbzr\.julia\packages\LuxLib\VRICL\src\api\dense.jl:38
 [15] Dense
    @ C:\Users\prbzr\.julia\packages\Lux\PsbZF\src\layers\basic.jl:218
 [16] apply
    @ C:\Users\prbzr\.julia\packages\LuxCore\qiHPC\src\LuxCore.jl:179

Stacktrace:
 [1] throwerr(cstr::Cstring)
   @ Enzyme.Compiler C:\Users\prbzr\.julia\packages\Enzyme\F71IJ\src\compiler.jl:1338
in expression starting at D:\Codes\Mine\bug-report\br-4\br-4.jl:12
Status `D:\Codes\Mine\bug-report\br-4\Project.toml`
  [b0b7db55] ComponentArrays v0.15.13
  [a0c0ee7d] DifferentiationInterface v0.5.0
  [7da242da] Enzyme v0.12.9
  [b2108857] Lux v0.5.51
  [9a3f8284] Random
Status `D:\Codes\Mine\bug-report\br-4\Manifest.toml`
  [47edcb42] ADTypes v1.2.1
  [7d9f7c33] Accessors v0.1.36
  [79e6a3ab] Adapt v4.0.4
  [dce04be8] ArgCheck v2.3.0
  [4fba245c] ArrayInterface v7.10.0
  [a9b6321e] Atomix v0.1.0
  [198e06fe] BangBang v0.4.2
  [62783981] BitTwiddlingConvenienceFunctions v0.1.5
  [fa961155] CEnum v0.5.0
  [2a0fbf3d] CPUSummary v0.2.5
  [d360d2e6] ChainRulesCore v1.23.0
  [ae650224] ChunkSplitters v2.4.2
  [fb6a15b2] CloseOpenIntervals v0.1.12
  [bbf7d656] CommonSubexpressions v0.3.0
  [34da2185] Compat v4.15.0
  [b0b7db55] ComponentArrays v0.15.13
  [a33af91c] CompositionsBase v0.1.2
  [2569d6c7] ConcreteStructs v0.2.3
  [187b0558] ConstructionBase v1.5.5
  [adafc99b] CpuId v0.3.1
  [163ba53b] DiffResults v1.1.0
  [b552c78f] DiffRules v1.15.1
  [a0c0ee7d] DifferentiationInterface v0.5.0
  [ffbed154] DocStringExtensions v0.9.3
  [7da242da] Enzyme v0.12.9
  [f151be2c] EnzymeCore v0.7.3
  [e2ba6199] ExprTools v0.1.10
⌅ [7034ab61] FastBroadcast v0.2.8
  [9aa1b823] FastClosures v0.3.2
  [1a297f60] FillArrays v1.11.0
  [f6369f11] ForwardDiff v0.10.36
  [d9f16b24] Functors v0.4.10
  [46192b85] GPUArraysCore v0.1.6
  [61eb1bfa] GPUCompiler v0.26.5
  [615f187c] IfElse v0.1.1
  [22cec73e] InitialValues v0.3.1
  [3587e190] InverseFunctions v0.1.14
  [92d709cd] IrrationalConstants v0.2.2
  [692b3bcd] JLLWrappers v1.5.0
  [63c18a36] KernelAbstractions v0.9.19
  [929cbde3] LLVM v7.1.0
  [10f19ff3] LayoutPointers v0.1.15
  [2ab3a3ac] LogExpFunctions v0.3.27
  [b2108857] Lux v0.5.51
  [bb33d45b] LuxCore v0.1.15
  [34f89e08] LuxDeviceUtils v0.1.20
  [82251201] LuxLib v0.3.26
  [1914dd2f] MacroTools v0.5.13
  [d125e4d3] ManualMemory v0.1.8
  [872c559c] NNlib v0.9.17
  [77ba4419] NaNMath v1.0.2
  [d8793406] ObjectFile v0.4.1
  [67456a42] OhMyThreads v0.5.2
  [65ce6f38] PackageExtensionCompat v1.0.2
  [570af359] PartialFunctions v1.2.0
  [f517fe37] Polyester v0.7.14
  [1d0040c9] PolyesterWeave v0.2.1
  [aea7be01] PrecompileTools v1.2.1
  [21216c6a] Preferences v1.4.3
  [189a3867] Reexport v1.2.2
  [ae029012] Requires v1.3.0
  [94e857df] SIMDTypes v0.1.0
  [6c6a2e73] Scratch v1.2.1
  [efcf1570] Setfield v1.1.1
  [0a514795] SparseMatrixColorings v0.3.2
  [276daf66] SpecialFunctions v2.4.0
  [91464d47] StableTasks v0.1.5
  [aedffcd0] Static v0.8.10
  [0d7ed370] StaticArrayInterface v1.5.0
  [90137ffa] StaticArrays v1.9.4
  [1e83bf80] StaticArraysCore v1.4.2
  [7792a7ef] StrideArraysCore v0.5.6
  [53d494c1] StructIO v0.3.0
  [ed4db957] TaskLocalValues v0.1.1
  [1c621080] TestItems v0.1.1
  [8290d209] ThreadingUtilities v0.5.2
  [a759f4b9] TimerOutputs v0.5.24
  [013be700] UnsafeAtomics v0.2.1
  [d80eeb9a] UnsafeAtomicsLLVM v0.1.4
  [d49dbf32] WeightInitializers v0.1.7
  [7cc45869] Enzyme_jll v0.0.117+0
  [dad2f222] LLVMExtra_jll v0.0.29+0
  [efe28fd5] OpenSpecFun_jll v0.5.5+0
  [0dad84c5] ArgTools v1.1.1
  [56f22d72] Artifacts
  [2a0f44e3] Base64
  [ade2ca70] Dates
  [f43a241f] Downloads v1.6.0
  [7b1f6079] FileWatching
  [9fa8497b] Future
  [b77e0a4c] InteractiveUtils
  [4af54fe1] LazyArtifacts
  [b27032c2] LibCURL v0.6.4
  [76f85450] LibGit2
  [8f399da3] Libdl
  [37e2e46d] LinearAlgebra
  [56ddb016] Logging
  [d6f4376e] Markdown
  [ca575930] NetworkOptions v1.2.0
  [44cfe95a] Pkg v1.10.0
  [de0858da] Printf
  [3fa0cd96] REPL
  [9a3f8284] Random
  [ea8e919c] SHA v0.7.0
  [9e88b42a] Serialization
  [6462fe0b] Sockets
  [2f01184e] SparseArrays v1.10.0
  [10745b16] Statistics v1.10.0
  [4607b0f0] SuiteSparse
  [fa267f1f] TOML v1.0.3
  [a4e569a6] Tar v1.10.0
  [8dfed614] Test
  [cf7118a7] UUIDs
  [4ec0a83e] Unicode
  [e66e0078] CompilerSupportLibraries_jll v1.1.1+0
  [deac9b47] LibCURL_jll v8.4.0+0
  [e37daf67] LibGit2_jll v1.6.4+0
  [29816b5a] LibSSH2_jll v1.11.0+1
  [c8ffd9c3] MbedTLS_jll v2.28.2+1
  [14a3606d] MozillaCACerts_jll v2023.1.10
  [4536629a] OpenBLAS_jll v0.3.23+4
  [05823500] OpenLibm_jll v0.8.1+2
  [bea87d4a] SuiteSparse_jll v7.2.1+1
  [83775a58] Zlib_jll v1.2.13+1
  [8e850b90] libblastrampoline_jll v5.8.0+1
  [8e850ede] nghttp2_jll v1.52.0+1
  [3f19e933] p7zip_jll v17.4.0+2
Info Packages marked with ⌅ have new versions available but compatibility constraints restrict them from upgrading. To see why use `status --outdated -m`
(br-4) pkg> st --outdated
Status `D:\Codes\Mine\bug-report\br-4\Project.toml`

(br-4) pkg> st --outdated -m
Status `D:\Codes\Mine\bug-report\br-4\Manifest.toml`
⌅ [7034ab61] FastBroadcast v0.2.8 (<v0.3.0): LuxLib

@wsmoses
Copy link
Contributor

wsmoses commented May 28, 2024 via email

@prbzrg
Copy link
Contributor Author

prbzrg commented May 28, 2024

@prbzrg
Copy link
Contributor Author

prbzrg commented May 28, 2024

By enabling GC logging and Debug logging, for the code:

using Lux, Random, ComponentArrays, Enzyme, DifferentiationInterface, Logging

GC.enable_logging(true)

debuglogger = Logging.ConsoleLogger(Logging.Debug)
Logging.global_logger(debuglogger)

Enzyme.API.printall!(true)
# Enzyme.API.runtimeActivity!(true)

nn = Dense(10 => 10, tanh)
ps, st = Lux.setup(Random.default_rng(), nn)
ps = ComponentArray(ps)
r = rand(Float32, 10, 20)

snn = StatefulLuxLayer{true}(nn, ps, st)

DifferentiationInterface.value_and_pushforward(snn, AutoEnzyme(Enzyme.Forward), r, r)

The output is

https://paste.mozilla.org/dnkhjihr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants