diff --git a/Project.toml b/Project.toml index 0d14d72d57..0fc873ef6a 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Enzyme" uuid = "7da242da-08ed-463a-9acd-ee780be4f1d9" authors = ["William Moses ", "Valentin Churavy "] -version = "0.13.131" +version = "0.13.132" [deps] CEnum = "fa961155-64e5-5f13-b03f-caf6b980ea82" @@ -42,7 +42,7 @@ BFloat16s = "0.2, 0.3, 0.4, 0.5, 0.6" CEnum = "0.4, 0.5" ChainRulesCore = "1" EnzymeCore = "0.8.16" -Enzyme_jll = "0.0.251" +Enzyme_jll = "0.0.252" GPUArraysCore = "0.1.6, 0.2" GPUCompiler = "1.6.2" LLVM = "9.1" diff --git a/test/basic.jl b/test/basic.jl index 585240493c..c667a73d0a 100644 --- a/test/basic.jl +++ b/test/basic.jl @@ -702,3 +702,31 @@ f_typed_global(x) = x^2 * TYPED_VAL @test Enzyme.autodiff(Reverse, f_mutable_global, Active, Active(3.0))[1][1] ≈ 12.0 @test Enzyme.autodiff(Reverse, f_typed_global, Active, Active(3.0))[1][1] ≈ 12.0 end + +import Enzyme + +function wlj(x::Real, lower::Bool, upper::Real) + lbounded, ubounded = lower, isfinite(upper) + return if lbounded && ubounded + (log(x/upper) / one(x)), 0.0 + elseif lbounded + log(x), 0.0 + elseif ubounded + log(x), 0.0 + else + x, 0.0 + end +end + +struct Foo + upper::Float64 +end +function (f::Foo)(rx::AbstractArray) + return [first(wlj(rx[], true, f.upper))] +end + +@testset "NoNeed result" begin + x = [0.5] + f = Foo(1.0) + @test Enzyme.jacobian(Enzyme.Reverse, f, x)[1][1] ≈ 2.0 +end