From 88c48c1a66709bd1af84a378de06091092fbafd5 Mon Sep 17 00:00:00 2001 From: Guillaume Dalle <22795598+gdalle@users.noreply.github.com> Date: Sat, 5 Oct 2024 09:40:22 +0200 Subject: [PATCH] More type stability tests (#543) * More type stability tests * Remove old kwarg * Don't test everything for now * Use fill! * LTS JET --- .../src/misc/zero_backends.jl | 2 +- .../test/Back/ForwardDiff/test.jl | 3 +- .../test/Misc/ZeroBackends/test.jl | 22 +- .../src/test_differentiation.jl | 22 +- .../src/tests/type_stability_eval.jl | 272 +++++++++++++----- .../test/zero_backends.jl | 21 +- 6 files changed, 248 insertions(+), 94 deletions(-) diff --git a/DifferentiationInterface/src/misc/zero_backends.jl b/DifferentiationInterface/src/misc/zero_backends.jl index 8008b020d..ade80890f 100644 --- a/DifferentiationInterface/src/misc/zero_backends.jl +++ b/DifferentiationInterface/src/misc/zero_backends.jl @@ -4,7 +4,7 @@ end (rz::ReturnZero)(i) = zero(rz.template) -_zero!(x::AbstractArray) = x .= zero(eltype(x)) +_zero!(x::AbstractArray) = fill!(x, zero(eltype(x))) ## Forward diff --git a/DifferentiationInterface/test/Back/ForwardDiff/test.jl b/DifferentiationInterface/test/Back/ForwardDiff/test.jl index 8be107a85..d0640a8a5 100644 --- a/DifferentiationInterface/test/Back/ForwardDiff/test.jl +++ b/DifferentiationInterface/test/Back/ForwardDiff/test.jl @@ -38,8 +38,7 @@ test_differentiation( test_differentiation( AutoForwardDiff(; chunksize=5); correctness=false, - type_stability=true, - preparation_type_stability=true, + type_stability=(; preparation=true, prepared_op=true, unprepared_op=false), logging=LOGGING, ); diff --git a/DifferentiationInterface/test/Misc/ZeroBackends/test.jl b/DifferentiationInterface/test/Misc/ZeroBackends/test.jl index 9c96a5d73..38f21aaf2 100644 --- a/DifferentiationInterface/test/Misc/ZeroBackends/test.jl +++ b/DifferentiationInterface/test/Misc/ZeroBackends/test.jl @@ -19,11 +19,19 @@ end ## Type stability test_differentiation( - zero_backends, - default_scenarios(; include_constantified=true); + AutoZeroForward(), + default_scenarios(; include_batchified=false, include_constantified=true); correctness=false, type_stability=true, - preparation_type_stability=true, + logging=LOGGING, +) + +test_differentiation( + AutoZeroReverse(), + default_scenarios(; include_batchified=false, include_constantified=true); + correctness=false, + # TODO: set unprepared_op=true after ignoring DataFrames + type_stability=(; preparation=true, prepared_op=true, unprepared_op=false), logging=LOGGING, ) @@ -32,10 +40,9 @@ test_differentiation( SecondOrder(AutoZeroForward(), AutoZeroReverse()), SecondOrder(AutoZeroReverse(), AutoZeroForward()), ], - default_scenarios(); + default_scenarios(; include_batchified=false, include_constantified=true); correctness=false, - type_stability=true, - preparation_type_stability=true, + type_stability=(; preparation=true, prepared_op=true, unprepared_op=true), first_order=false, logging=LOGGING, ) @@ -44,8 +51,7 @@ test_differentiation( AutoSparse.(zero_backends, coloring_algorithm=GreedyColoringAlgorithm()), default_scenarios(; include_constantified=true); correctness=false, - type_stability=true, - preparation_type_stability=true, + type_stability=(; preparation=true, prepared_op=true, unprepared_op=false), excluded=[:pushforward, :pullback, :gradient, :derivative, :hvp, :second_derivative], logging=LOGGING, ) diff --git a/DifferentiationInterfaceTest/src/test_differentiation.jl b/DifferentiationInterfaceTest/src/test_differentiation.jl index 97363d45d..7003ac761 100644 --- a/DifferentiationInterfaceTest/src/test_differentiation.jl +++ b/DifferentiationInterfaceTest/src/test_differentiation.jl @@ -29,7 +29,7 @@ Cross-test a list of `backends` on a list of `scenarios`, running a variety of d Testing: - `correctness=true`: whether to compare the differentiation results with the theoretical values specified in each scenario -- `type_stability=false`: whether to check type stability of operators with JET.jl (thanks to `JET.@test_opt`) +- `type_stability=false`: whether to check type stability of operators with JET.jl (thanks to `JET.@test_opt`). It can be either a `Bool` or a more detailed named tuple `(; preparation, prepared_op, unprepared_op)` to specify which variants should be analyzed. - `sparsity`: whether to check sparsity of the jacobian / hessian - `detailed=false`: whether to print a detailed or condensed test log @@ -51,8 +51,7 @@ function test_differentiation( scenarios::Vector{<:Scenario}=default_scenarios(); # testing correctness::Bool=true, - type_stability::Bool=false, - preparation_type_stability::Bool=false, + type_stability=false, call_count::Bool=false, sparsity::Bool=false, detailed=false, @@ -73,10 +72,12 @@ function test_differentiation( scenarios; first_order, second_order, input_type, output_type, excluded ) + bool_type_stability = (type_stability == true || type_stability isa NamedTuple) + title_additions = (correctness != false ? " + correctness" : "") * (call_count ? " + calls" : "") * - (type_stability ? " + types" : "") * + (bool_type_stability ? " + type stability" : "") * (sparsity ? " + sparsity" : "") title = "Testing" * title_additions[3:end] @@ -115,13 +116,14 @@ function test_differentiation( adapted_backend, scen; isapprox, atol, rtol, scenario_intact ) end - type_stability && @testset "Type stability" begin + kwargs_type_stability = if type_stability isa NamedTuple + type_stability + else + (; preparation=false, prepared_op=type_stability, unprepared_op=false) + end + bool_type_stability && @testset "Type stability" begin @static if VERSION >= v"1.7" - test_jet( - adapted_backend, - scen; - test_preparation=preparation_type_stability, - ) + test_jet(adapted_backend, scen; kwargs_type_stability...) end end sparsity && @testset "Sparsity" begin diff --git a/DifferentiationInterfaceTest/src/tests/type_stability_eval.jl b/DifferentiationInterfaceTest/src/tests/type_stability_eval.jl index d6427a387..74a8da024 100644 --- a/DifferentiationInterfaceTest/src/tests/type_stability_eval.jl +++ b/DifferentiationInterfaceTest/src/tests/type_stability_eval.jl @@ -26,125 +26,261 @@ for op in [ S2in = Scenario{op,:in,:in} if op in [:derivative, :gradient, :jacobian] - @eval function test_jet(ba::AbstractADType, scen::$S1out; test_preparation::Bool) + @eval function test_jet( + ba::AbstractADType, + scen::$S1out; + preparation::Bool, + prepared_op::Bool, + unprepared_op::Bool, + ) @compat (; f, x, contexts) = deepcopy(scen) prep = $prep_op(f, ba, x, contexts...) - test_preparation && JET.@test_opt $prep_op(f, ba, x, contexts...) - JET.@test_opt $op(f, prep, ba, x, contexts...) - JET.@test_call $op(f, prep, ba, x, contexts...) - JET.@test_opt $val_and_op(f, prep, ba, x, contexts...) - JET.@test_call $val_and_op(f, prep, ba, x, contexts...) + preparation && JET.@test_opt $prep_op(f, ba, x, contexts...) + prepared_op && JET.@test_opt $op(f, prep, ba, x, contexts...) + prepared_op && JET.@test_call $op(f, prep, ba, x, contexts...) + prepared_op && JET.@test_opt $val_and_op(f, prep, ba, x, contexts...) + prepared_op && JET.@test_call $val_and_op(f, prep, ba, x, contexts...) + unprepared_op && JET.@test_opt $op(f, ba, x, contexts...) + unprepared_op && JET.@test_call $op(f, ba, x, contexts...) + unprepared_op && JET.@test_opt $val_and_op(f, ba, x, contexts...) + unprepared_op && JET.@test_call $val_and_op(f, ba, x, contexts...) + return nothing end - @eval function test_jet(ba::AbstractADType, scen::$S1in; test_preparation::Bool) + @eval function test_jet( + ba::AbstractADType, + scen::$S1in; + preparation::Bool, + prepared_op::Bool, + unprepared_op::Bool, + ) @compat (; f, x, res1, contexts) = deepcopy(scen) prep = $prep_op(f, ba, x, contexts...) - test_preparation && JET.@test_opt $prep_op(f, ba, x, contexts...) - JET.@test_opt $op!(f, res1, prep, ba, x, contexts...) - JET.@test_call $op!(f, res1, prep, ba, x, contexts...) - JET.@test_opt $val_and_op!(f, res1, prep, ba, x, contexts...) - JET.@test_call $val_and_op!(f, res1, prep, ba, x, contexts...) + preparation && JET.@test_opt $prep_op(f, ba, x, contexts...) + prepared_op && JET.@test_opt $op!(f, res1, prep, ba, x, contexts...) + prepared_op && JET.@test_call $op!(f, res1, prep, ba, x, contexts...) + prepared_op && JET.@test_opt $val_and_op!(f, res1, prep, ba, x, contexts...) + prepared_op && JET.@test_call $val_and_op!(f, res1, prep, ba, x, contexts...) + unprepared_op && JET.@test_opt $op!(f, res1, ba, x, contexts...) + unprepared_op && JET.@test_call $op!(f, res1, ba, x, contexts...) + unprepared_op && JET.@test_opt $val_and_op!(f, res1, ba, x, contexts...) + unprepared_op && JET.@test_call $val_and_op!(f, res1, ba, x, contexts...) + return nothing end op == :gradient && continue - @eval function test_jet(ba::AbstractADType, scen::$S2out; test_preparation::Bool) + @eval function test_jet( + ba::AbstractADType, + scen::$S2out; + preparation::Bool, + prepared_op::Bool, + unprepared_op::Bool, + ) @compat (; f, x, y, contexts) = deepcopy(scen) prep = $prep_op(f, y, ba, x, contexts...) - test_preparation && JET.@test_opt $prep_op(f, y, ba, x, contexts...) - JET.@test_opt $op(f, y, prep, ba, x, contexts...) - JET.@test_call $op(f, y, prep, ba, x, contexts...) - JET.@test_opt $val_and_op(f, y, prep, ba, x, contexts...) - JET.@test_call $val_and_op(f, y, prep, ba, x, contexts...) + preparation && JET.@test_opt $prep_op(f, y, ba, x, contexts...) + prepared_op && JET.@test_opt $op(f, y, prep, ba, x, contexts...) + prepared_op && JET.@test_call $op(f, y, prep, ba, x, contexts...) + prepared_op && JET.@test_opt $val_and_op(f, y, prep, ba, x, contexts...) + prepared_op && JET.@test_call $val_and_op(f, y, prep, ba, x, contexts...) + unprepared_op && JET.@test_opt $op(f, y, ba, x, contexts...) + unprepared_op && JET.@test_call $op(f, y, ba, x, contexts...) + unprepared_op && JET.@test_opt $val_and_op(f, y, ba, x, contexts...) + unprepared_op && JET.@test_call $val_and_op(f, y, ba, x, contexts...) + return nothing end - @eval function test_jet(ba::AbstractADType, scen::$S2in; test_preparation::Bool) + @eval function test_jet( + ba::AbstractADType, + scen::$S2in; + preparation::Bool, + prepared_op::Bool, + unprepared_op::Bool, + ) @compat (; f, x, y, res1, contexts) = deepcopy(scen) prep = $prep_op(f, y, ba, x, contexts...) - test_preparation && JET.@test_opt $prep_op(f, y, ba, x, contexts...) - JET.@test_opt $op!(f, y, res1, prep, ba, x, contexts...) - JET.@test_call $op!(f, y, res1, prep, ba, x, contexts...) - JET.@test_opt $val_and_op!(f, y, res1, prep, ba, x, contexts...) - JET.@test_call $val_and_op!(f, y, res1, prep, ba, x, contexts...) + preparation && JET.@test_opt $prep_op(f, y, ba, x, contexts...) + prepared_op && JET.@test_opt $op!(f, y, res1, prep, ba, x, contexts...) + prepared_op && JET.@test_call $op!(f, y, res1, prep, ba, x, contexts...) + prepared_op && JET.@test_opt $val_and_op!(f, y, res1, prep, ba, x, contexts...) + prepared_op && JET.@test_call $val_and_op!(f, y, res1, prep, ba, x, contexts...) + unprepared_op && JET.@test_opt $op!(f, y, res1, ba, x, contexts...) + unprepared_op && JET.@test_call $op!(f, y, res1, ba, x, contexts...) + unprepared_op && JET.@test_opt $val_and_op!(f, y, res1, ba, x, contexts...) + unprepared_op && JET.@test_call $val_and_op!(f, y, res1, ba, x, contexts...) + return nothing end elseif op in [:second_derivative, :hessian] - @eval function test_jet(ba::AbstractADType, scen::$S1out; test_preparation::Bool) + @eval function test_jet( + ba::AbstractADType, + scen::$S1out; + preparation::Bool, + prepared_op::Bool, + unprepared_op::Bool, + ) @compat (; f, x, contexts) = deepcopy(scen) prep = $prep_op(f, ba, x, contexts...) - test_preparation && JET.@test_opt $prep_op(f, ba, x, contexts...) - JET.@test_opt $op(f, prep, ba, x, contexts...) - JET.@test_call $op(f, prep, ba, x, contexts...) - JET.@test_opt $val_and_op(f, prep, ba, x, contexts...) - JET.@test_call $val_and_op(f, prep, ba, x, contexts...) + preparation && JET.@test_opt $prep_op(f, ba, x, contexts...) + prepared_op && JET.@test_opt $op(f, prep, ba, x, contexts...) + prepared_op && JET.@test_call $op(f, prep, ba, x, contexts...) + prepared_op && JET.@test_opt $val_and_op(f, prep, ba, x, contexts...) + prepared_op && JET.@test_call $val_and_op(f, prep, ba, x, contexts...) + unprepared_op && JET.@test_opt $op(f, ba, x, contexts...) + unprepared_op && JET.@test_call $op(f, ba, x, contexts...) + unprepared_op && JET.@test_opt $val_and_op(f, ba, x, contexts...) + unprepared_op && JET.@test_call $val_and_op(f, ba, x, contexts...) + return nothing end - @eval function test_jet(ba::AbstractADType, scen::$S1in; test_preparation::Bool) + @eval function test_jet( + ba::AbstractADType, + scen::$S1in; + preparation::Bool, + prepared_op::Bool, + unprepared_op::Bool, + ) @compat (; f, x, res1, res2, contexts) = deepcopy(scen) prep = $prep_op(f, ba, x, contexts...) - test_preparation && JET.@test_opt $prep_op(f, ba, x, contexts...) - JET.@test_opt $op!(f, res2, prep, ba, x, contexts...) - JET.@test_call $op!(f, res2, prep, ba, x, contexts...) - JET.@test_opt $val_and_op!(f, res1, res2, prep, ba, x, contexts...) - JET.@test_call $val_and_op!(f, res1, res2, prep, ba, x, contexts...) + preparation && JET.@test_opt $prep_op(f, ba, x, contexts...) + prepared_op && JET.@test_opt $op!(f, res2, prep, ba, x, contexts...) + prepared_op && JET.@test_call $op!(f, res2, prep, ba, x, contexts...) + prepared_op && + JET.@test_opt $val_and_op!(f, res1, res2, prep, ba, x, contexts...) + prepared_op && + JET.@test_call $val_and_op!(f, res1, res2, prep, ba, x, contexts...) + unprepared_op && JET.@test_opt $op!(f, res2, ba, x, contexts...) + unprepared_op && JET.@test_call $op!(f, res2, ba, x, contexts...) + unprepared_op && JET.@test_opt $val_and_op!(f, res1, res2, ba, x, contexts...) + unprepared_op && JET.@test_call $val_and_op!(f, res1, res2, ba, x, contexts...) + return nothing end elseif op in [:pushforward, :pullback] - @eval function test_jet(ba::AbstractADType, scen::$S1out; test_preparation::Bool) + @eval function test_jet( + ba::AbstractADType, + scen::$S1out; + preparation::Bool, + prepared_op::Bool, + unprepared_op::Bool, + ) @compat (; f, x, tang, contexts) = deepcopy(scen) prep = $prep_op(f, ba, x, tang, contexts...) - test_preparation && JET.@test_opt $prep_op(f, ba, x, tang, contexts...) - JET.@test_opt $op(f, prep, ba, x, tang, contexts...) - JET.@test_call $op(f, prep, ba, x, tang, contexts...) - JET.@test_opt $val_and_op(f, prep, ba, x, tang, contexts...) - JET.@test_call $val_and_op(f, prep, ba, x, tang, contexts...) + preparation && JET.@test_opt $prep_op(f, ba, x, tang, contexts...) + prepared_op && JET.@test_opt $op(f, prep, ba, x, tang, contexts...) + prepared_op && JET.@test_call $op(f, prep, ba, x, tang, contexts...) + prepared_op && JET.@test_opt $val_and_op(f, prep, ba, x, tang, contexts...) + prepared_op && JET.@test_call $val_and_op(f, prep, ba, x, tang, contexts...) + unprepared_op && JET.@test_opt $op(f, ba, x, tang, contexts...) + unprepared_op && JET.@test_call $op(f, ba, x, tang, contexts...) + unprepared_op && JET.@test_opt $val_and_op(f, ba, x, tang, contexts...) + unprepared_op && JET.@test_call $val_and_op(f, ba, x, tang, contexts...) + return nothing end - @eval function test_jet(ba::AbstractADType, scen::$S1in; test_preparation::Bool) + @eval function test_jet( + ba::AbstractADType, + scen::$S1in; + preparation::Bool, + prepared_op::Bool, + unprepared_op::Bool, + ) @compat (; f, x, tang, res1, res2, contexts) = deepcopy(scen) prep = $prep_op(f, ba, x, tang, contexts...) - test_preparation && JET.@test_opt $prep_op(f, ba, x, tang, contexts...) - JET.@test_opt $op!(f, res1, prep, ba, x, tang, contexts...) - JET.@test_call $op!(f, res1, prep, ba, x, tang, contexts...) - JET.@test_opt $val_and_op!(f, res1, prep, ba, x, tang, contexts...) - JET.@test_call $val_and_op!(f, res1, prep, ba, x, tang, contexts...) + preparation && JET.@test_opt $prep_op(f, ba, x, tang, contexts...) + prepared_op && JET.@test_opt $op!(f, res1, prep, ba, x, tang, contexts...) + prepared_op && JET.@test_call $op!(f, res1, prep, ba, x, tang, contexts...) + prepared_op && + JET.@test_opt $val_and_op!(f, res1, prep, ba, x, tang, contexts...) + prepared_op && + JET.@test_call $val_and_op!(f, res1, prep, ba, x, tang, contexts...) + unprepared_op && JET.@test_opt $op!(f, res1, ba, x, tang, contexts...) + unprepared_op && JET.@test_call $op!(f, res1, ba, x, tang, contexts...) + unprepared_op && JET.@test_opt $val_and_op!(f, res1, ba, x, tang, contexts...) + unprepared_op && JET.@test_call $val_and_op!(f, res1, ba, x, tang, contexts...) + return nothing end - @eval function test_jet(ba::AbstractADType, scen::$S2out; test_preparation::Bool) + @eval function test_jet( + ba::AbstractADType, + scen::$S2out; + preparation::Bool, + prepared_op::Bool, + unprepared_op::Bool, + ) @compat (; f, x, y, tang, contexts) = deepcopy(scen) prep = $prep_op(f, y, ba, x, tang, contexts...) - test_preparation && JET.@test_opt $prep_op(f, y, ba, x, tang, contexts...) - JET.@test_opt $op(f, y, prep, ba, x, tang, contexts...) - JET.@test_call $op(f, y, prep, ba, x, tang, contexts...) - JET.@test_opt $val_and_op(f, y, prep, ba, x, tang, contexts...) - JET.@test_call $val_and_op(f, y, prep, ba, x, tang, contexts...) + preparation && JET.@test_opt $prep_op(f, y, ba, x, tang, contexts...) + prepared_op && JET.@test_opt $op(f, y, prep, ba, x, tang, contexts...) + prepared_op && JET.@test_call $op(f, y, prep, ba, x, tang, contexts...) + prepared_op && JET.@test_opt $val_and_op(f, y, prep, ba, x, tang, contexts...) + prepared_op && JET.@test_call $val_and_op(f, y, prep, ba, x, tang, contexts...) + unprepared_op && JET.@test_opt $op(f, y, ba, x, tang, contexts...) + unprepared_op && JET.@test_call $op(f, y, ba, x, tang, contexts...) + unprepared_op && JET.@test_opt $val_and_op(f, y, ba, x, tang, contexts...) + unprepared_op && JET.@test_call $val_and_op(f, y, ba, x, tang, contexts...) + return nothing end - @eval function test_jet(ba::AbstractADType, scen::$S2in; test_preparation::Bool) + @eval function test_jet( + ba::AbstractADType, + scen::$S2in; + preparation::Bool, + prepared_op::Bool, + unprepared_op::Bool, + ) @compat (; f, x, y, tang, res1, contexts) = deepcopy(scen) prep = $prep_op(f, y, ba, x, tang, contexts...) - test_preparation && JET.@test_opt $prep_op(f, y, ba, x, tang, contexts...) - JET.@test_opt $op!(f, y, res1, prep, ba, x, tang, contexts...) - JET.@test_call $op!(f, y, res1, prep, ba, x, tang, contexts...) - JET.@test_opt $val_and_op!(f, y, res1, prep, ba, x, tang, contexts...) - JET.@test_call $val_and_op!(f, y, res1, prep, ba, x, tang, contexts...) + preparation && JET.@test_opt $prep_op(f, y, ba, x, tang, contexts...) + prepared_op && JET.@test_opt $op!(f, y, res1, prep, ba, x, tang, contexts...) + prepared_op && JET.@test_call $op!(f, y, res1, prep, ba, x, tang, contexts...) + prepared_op && + JET.@test_opt $val_and_op!(f, y, res1, prep, ba, x, tang, contexts...) + prepared_op && + JET.@test_call $val_and_op!(f, y, res1, prep, ba, x, tang, contexts...) + unprepared_op && JET.@test_opt $op!(f, y, res1, ba, x, tang, contexts...) + unprepared_op && JET.@test_call $op!(f, y, res1, ba, x, tang, contexts...) + unprepared_op && + JET.@test_opt $val_and_op!(f, y, res1, ba, x, tang, contexts...) + unprepared_op && + JET.@test_call $val_and_op!(f, y, res1, ba, x, tang, contexts...) + return nothing end elseif op in [:hvp] - @eval function test_jet(ba::AbstractADType, scen::$S1out; test_preparation::Bool) + @eval function test_jet( + ba::AbstractADType, + scen::$S1out; + preparation::Bool, + prepared_op::Bool, + unprepared_op::Bool, + ) @compat (; f, x, tang, contexts) = deepcopy(scen) prep = $prep_op(f, ba, x, tang, contexts...) - test_preparation && JET.@test_opt $prep_op(f, ba, x, tang, contexts...) - JET.@test_opt $op(f, prep, ba, x, tang, contexts...) - JET.@test_call $op(f, prep, ba, x, tang, contexts...) + preparation && JET.@test_opt $prep_op(f, ba, x, tang, contexts...) + prepared_op && JET.@test_opt $op(f, prep, ba, x, tang, contexts...) + prepared_op && JET.@test_call $op(f, prep, ba, x, tang, contexts...) + unprepared_op && JET.@test_opt $op(f, ba, x, tang, contexts...) + unprepared_op && JET.@test_call $op(f, ba, x, tang, contexts...) + return nothing end - @eval function test_jet(ba::AbstractADType, scen::$S1in; test_preparation::Bool) + @eval function test_jet( + ba::AbstractADType, + scen::$S1in; + preparation::Bool, + prepared_op::Bool, + unprepared_op::Bool, + ) @compat (; f, x, tang, res1, res2, contexts) = deepcopy(scen) prep = $prep_op(f, ba, x, tang, contexts...) - test_preparation && JET.@test_opt $prep_op(f, ba, x, tang, contexts...) - JET.@test_opt $op!(f, res2, prep, ba, x, tang, contexts...) - JET.@test_call $op!(f, res2, prep, ba, x, tang, contexts...) + preparation && JET.@test_opt $prep_op(f, ba, x, tang, contexts...) + prepared_op && JET.@test_opt $op!(f, res2, prep, ba, x, tang, contexts...) + prepared_op && JET.@test_call $op!(f, res2, prep, ba, x, tang, contexts...) + unprepared_op && JET.@test_opt $op!(f, res2, ba, x, tang, contexts...) + unprepared_op && JET.@test_call $op!(f, res2, ba, x, tang, contexts...) + return nothing end end end diff --git a/DifferentiationInterfaceTest/test/zero_backends.jl b/DifferentiationInterfaceTest/test/zero_backends.jl index ee5ee8304..92e53d5a1 100644 --- a/DifferentiationInterfaceTest/test/zero_backends.jl +++ b/DifferentiationInterfaceTest/test/zero_backends.jl @@ -11,24 +11,35 @@ LOGGING = get(ENV, "CI", "false") == "false" ## Type stability test_differentiation( - [AutoZeroForward(), AutoZeroReverse()], - zero.(default_scenarios()); + AutoZeroForward(), + zero.(default_scenarios(; include_batchified=false)); + correctness=true, + type_stability=(; preparation=true, prepared_op=true, unprepared_op=true), + logging=LOGGING, +) + +test_differentiation( + AutoZeroReverse(), + zero.(default_scenarios(; include_batchified=false)); correctness=true, type_stability=true, - preparation_type_stability=true, logging=LOGGING, ) ## Benchmark data1 = benchmark_differentiation( - [AutoZeroForward()], default_scenarios(; include_constantified=true); logging=LOGGING + [AutoZeroForward()], + default_scenarios(; include_batchified=false, include_constantified=true); + logging=LOGGING, ); struct FakeBackend <: ADTypes.AbstractADType end ADTypes.mode(::FakeBackend) = ADTypes.ForwardMode() -data2 = benchmark_differentiation([FakeBackend()], default_scenarios(); logging=false); +data2 = benchmark_differentiation( + [FakeBackend()], default_scenarios(; include_batchified=false); logging=false +); @testset "Benchmarking DataFrame" begin for col in eachcol(data1)