Skip to content

Commit

Permalink
Mark some 1.11 tests as broken (#2237)
Browse files Browse the repository at this point in the history
* Mark some 1.11 tests as broken

* fixup

* fix

* fix

* fix

* fix

* Update runtests.jl
  • Loading branch information
wsmoses authored Dec 31, 2024
1 parent fb36b65 commit 8a1dd04
Showing 1 changed file with 33 additions and 7 deletions.
40 changes: 33 additions & 7 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3077,11 +3077,17 @@ end
@inbounds w[1] * x[1]
end

Enzyme.autodiff(Reverse, inactiveArg, Active, Duplicated(w, dw), Const(x), Const(false))
@static if VERSION < v"1.11-"
Enzyme.autodiff(Reverse, inactiveArg, Active, Duplicated(w, dw), Const(x), Const(false))

@test x [3.0]
@test w [1.0]
@test dw [3.0]
@test x [3.0]
@test w [1.0]
@test dw [3.0]
else
# TODO broken should not throw
@test_throws Enzyme.Compiler.EnzymeRuntimeActivityError Enzyme.autodiff(Reverse, inactiveArg, Active, Duplicated(w, dw), Const(x), Const(false))
Enzyme.autodiff(set_runtime_activity(Reverse), inactiveArg, Active, Duplicated(w, dw), Const(x), Const(false))
end

x = Float32[3]

Expand All @@ -3093,13 +3099,21 @@ end
res
end

dw = Enzyme.autodiff(Reverse, loss, Active, Active(1.0), Const(x), Const(false))[1]
@static if VERSION < v"1.11-"
dw = Enzyme.autodiff(Reverse, loss, Active, Active(1.0), Const(x), Const(false))[1]

else
# TODO broken should not throw
@test_throws Enzyme.Compiler.EnzymeRuntimeActivityError Enzyme.autodiff(Reverse, loss, Active, Active(1.0), Const(x), Const(false))[1]
dw = Enzyme.autodiff(set_runtime_activity(Reverse), loss, Active, Active(1.0), Const(x), Const(false))[1]
end

@test x [3.0]
@test dw[1] 3.0

c = ones(3)
inner(e) = c .+ e

fres = Enzyme.autodiff(Enzyme.Forward, Const(inner), Duplicated{Vector{Float64}}, Duplicated([0., 0., 0.], [1., 1., 1.]))[1]
@test c [1.0, 1.0, 1.0]
@test fres [1.0, 1.0, 1.0]
Expand Down Expand Up @@ -3613,10 +3627,22 @@ const objective3 = params -> mixture_loglikelihood3(params, data)
-13.935687326484112,
-38.00044665702692,
12.87712891527131]
@test expected Enzyme.gradient(Reverse, objective1, params0)[1]
@static if VERSION < v"1.11-"
@test expected Enzyme.gradient(Reverse, objective1, params0)[1]
else
# TODO broken should not throw
@test_throws Enzyme.Compiler.EnzymeRuntimeActivityError Enzyme.gradient(Reverse, objective1, params0)[1]
@test expected Enzyme.gradient(set_runtime_activity(Reverse), objective1, params0)[1]
end
# objective2 fails from runtime activity requirements
# @test expected ≈ Enzyme.gradient(Reverse, objective2, params0)[1]
@test expected Enzyme.gradient(Reverse, objective3, params0)[1]
@static if VERSION < v"1.11-"
@test expected Enzyme.gradient(Reverse, objective3, params0)[1]
else
# TODO broken should not throw
@test_throws Enzyme.Compiler.EnzymeRuntimeActivityError Enzyme.gradient(Reverse, objective3, params0)[1]
@test expected Enzyme.gradient(set_runtime_activity(Reverse), objective3, params0)[1]
end
end

struct HarmonicAngle
Expand Down

0 comments on commit 8a1dd04

Please sign in to comment.