Skip to content

Commit a760c8f

Browse files
seabbs-botclaude
andauthored
Time only the convolution body for a revision whose fixtures predate the suite (#1061)
Kit 0.5.2's history workflow times each tag with that tag's own test/ADFixtures, but with the pushed commit's benchmark script. v0.1.0's fixtures lack the registry calls the script makes, so every bench cell failed to load the script. Such a revision now times the convolution body alone. The kit side is EpiAware/EpiAwarePackageTools.jl#623. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 30bcc63 commit a760c8f

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

‎benchmark/benchmarks.jl‎

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ end
4747
using ADFixtures
4848
import DifferentiationInterface as DI
4949

50+
# The history workflow times each tag with that tag's own `test/ADFixtures`
51+
# (EpiAwarePackageTools 0.5.2). Fixtures from before this suite's registry
52+
# calls, those of v0.1.0, cannot build its gradient grid or matrix cases,
53+
# so such a revision times the convolution body alone.
54+
const _CURRENT_FIXTURES = isdefined(ADFixtures, :benchmarked_backends)
55+
_CURRENT_FIXTURES || @warn "test/ADFixtures predates this suite: " *
56+
"timing the convolution body alone"
57+
5058
# `BENCHMARK_TIER`: `pr`, the default when unset or empty, is small enough
5159
# for a pull request job; `full` times everything below. `pr` leaves out the
5260
# registry scenarios, the `NoAdjoint` and `loop` arms, the forward modes and
@@ -78,7 +86,8 @@ const _PR_BACKENDS = ("ForwardDiff", "Mooncake reverse", "Enzyme reverse")
7886
# `BENCHMARK_MATRIX=false` also leaves out the matrix cases' gradients,
7987
# so a job times only the registry grid; the `primal` groups follow
8088
# `BENCHMARK_BACKENDS` alone.
81-
const _ALL_BACKENDS = ADFixtures.benchmarked_backends()
89+
const _ALL_BACKENDS = _CURRENT_FIXTURES ?
90+
ADFixtures.benchmarked_backends() : NamedTuple[]
8291
const _SELECTED = let spec = strip(get(ENV, "BENCHMARK_BACKENDS", ""))
8392
if isempty(spec)
8493
nothing
@@ -88,7 +97,7 @@ const _SELECTED = let spec = strip(get(ENV, "BENCHMARK_BACKENDS", ""))
8897
)
8998
known = Set(["primal"; [e.name for e in _ALL_BACKENDS]])
9099
unknown = setdiff(names, known)
91-
isempty(unknown) || error(
100+
isempty(unknown) || !_CURRENT_FIXTURES || error(
92101
"unknown BENCHMARK_BACKENDS $(join(sort!(collect(unknown)), ", "))"
93102
)
94103
names
@@ -100,7 +109,7 @@ end
100109
# `BENCHMARK_BACKENDS`.
101110
const _ONLY = let only = String(strip(get(ENV, "BENCHMARK_AD_BACKEND", "")))
102111
isempty(only) || only in [e.name for e in _ALL_BACKENDS] ||
103-
error("unknown BENCHMARK_AD_BACKEND $only")
112+
!_CURRENT_FIXTURES || error("unknown BENCHMARK_AD_BACKEND $only")
104113
only
105114
end
106115
_selected(name) = !(_AD_ONLY && name == "primal") &&
@@ -168,7 +177,8 @@ using ADFixtures: MatrixCases
168177

169178
# Left out with `BENCHMARK_MATRIX=false` (see `BENCHMARK_BACKENDS` above)
170179
# and in the `ad` tier.
171-
const _MATRIX = get(ENV, "BENCHMARK_MATRIX", "true") != "false" && !_AD_ONLY
180+
const _MATRIX = get(ENV, "BENCHMARK_MATRIX", "true") != "false" &&
181+
!_AD_ONLY && _CURRENT_FIXTURES
172182
# The `pr` tier times only the `rule` arm, on its three backends.
173183
const _MATRIX_ARMS = _FULL ? ("rule", "NoAdjoint", "loop") : ("rule",)
174184
const _MATRIX_BACKENDS = _FULL ? BENCHMARK_BACKENDS :

0 commit comments

Comments
 (0)