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

Mark some 1.11 tests as broken #2237

Merged
merged 7 commits into from
Dec 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading