Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion test/ADFixtures/src/ADFixtures.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import ForwardDiff, ReverseDiff, Enzyme, Mooncake

export scenarios, backends, broken_scenario_names,
backend_broken_scenarios, backend_plain_scenarios, backend_skip_scenarios,
direct_compile_failures,
direct_compile_failures, benchmark_crashes,
benchmarked_backends, exclusion_reason,
FlooredDepletion,
supports, unsupported_scenarios
Expand Down
23 changes: 23 additions & 0 deletions test/ADFixtures/src/registry.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3759,6 +3759,8 @@ function exclusion_reason(name, backend)
return "skipped on this backend in the registry"
name in get(direct_compile_failures(), backend, Set{String}()) &&
return "this backend does not compile its direct call"
name in get(benchmark_crashes(), backend, Set{String}()) &&
return "this backend crashes when the gradient is repeated"
return nothing
end

Expand All @@ -3785,6 +3787,27 @@ function direct_compile_failures()
)
end

@doc raw"""
benchmark_crashes()

Per-backend scenario names the benchmarks cannot time, because the
backend's gradient, repeated many times, crashes Julia.
One gradient is right, so the tests still run them.
Enzyme's batched forward mode can leave a new array without a valid header
while it allocates its tangents, so a garbage collection during a later
gradient stops Julia with a segmentation fault, which no `try` catches
(EnzymeAD/Enzyme.jl#3698, #1054).
Any scenario that copies a view of its parameters can hit it; these are the
ones that crashed the Enzyme forward cell of the grid, with their twins.
"""
function benchmark_crashes()
names = [
"Convolution ragged kernel of views into the parameters",
"Recurrence modifier with Bool and Int fields beside floats",
]
return Dict("Enzyme forward" => Set([names; "NoAdjoint " .* names]))
end

"""
Per-backend scenario names whose call takes plain AD by design, so the
analytic reverse pass does not run: a coupling's local derivative in two
Expand Down
8 changes: 8 additions & 0 deletions test/ad/scenarios.jl
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,15 @@ end
ADFixtures.backend_broken_scenarios(),
ADFixtures.backend_plain_scenarios(),
ADFixtures.direct_compile_failures(),
ADFixtures.benchmark_crashes(),
)
# The benchmarks leave out a scenario whose repeated gradients crash,
# while the tests, which take one gradient, still run it: the skip
# lists, which the tests read, are empty above.
views = "Convolution ragged kernel of views into the parameters"
for name in (views, "NoAdjoint " * views)
@test ADFixtures.exclusion_reason(name, "Enzyme forward") !== nothing
end
for list in lists
for (backend, entries) in list
@test backend in backends
Expand Down
Loading