Skip to content

Commit 7731a8b

Browse files
committed
Remove benchmark caching
1 parent 06b3457 commit 7731a8b

File tree

2 files changed

+35
-77
lines changed

2 files changed

+35
-77
lines changed

.github/workflows/time-sfmbal-benchmark-runner.yml

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ on:
2828
description: Commit SHA used in cache key
2929
required: true
3030
type: string
31+
orchestrator_run_id:
32+
description: Orchestrator run ID for cache-busting
33+
required: true
34+
type: string
3135

3236
permissions:
3337
contents: read
@@ -100,14 +104,14 @@ jobs:
100104
run: |
101105
set -euo pipefail
102106
mkdir -p benchmark-cache
103-
cp benchmark-results-tbbON.json "benchmark-cache/${{ inputs.os_name }}-${{ inputs.arch }}-tbbON-${{ inputs.target_sha }}.json"
107+
cp benchmark-results-tbbON.json "benchmark-cache/${{ inputs.os_name }}-${{ inputs.arch }}-tbbON-${{ inputs.target_sha }}-${{ inputs.orchestrator_run_id }}.json"
104108
105109
- name: Save benchmark cache (TBB=ON)
106110
uses: actions/cache/save@v4
107111
continue-on-error: true
108112
with:
109-
path: benchmark-cache/${{ inputs.os_name }}-${{ inputs.arch }}-tbbON-${{ inputs.target_sha }}.json
110-
key: timeSFMBAL-benchmark-v4-${{ inputs.os_name }}-${{ inputs.arch }}-tbbON-${{ inputs.target_sha }}
113+
path: benchmark-cache/${{ inputs.os_name }}-${{ inputs.arch }}-tbbON-${{ inputs.target_sha }}-${{ inputs.orchestrator_run_id }}.json
114+
key: timeSFMBAL-benchmark-v4-${{ inputs.os_name }}-${{ inputs.arch }}-tbbON-${{ inputs.target_sha }}-${{ inputs.orchestrator_run_id }}
111115

112116
# ── TBB=OFF ──
113117
- name: Clean build directory
@@ -138,14 +142,14 @@ jobs:
138142
run: |
139143
set -euo pipefail
140144
mkdir -p benchmark-cache
141-
cp benchmark-results-tbbOFF.json "benchmark-cache/${{ inputs.os_name }}-${{ inputs.arch }}-tbbOFF-${{ inputs.target_sha }}.json"
145+
cp benchmark-results-tbbOFF.json "benchmark-cache/${{ inputs.os_name }}-${{ inputs.arch }}-tbbOFF-${{ inputs.target_sha }}-${{ inputs.orchestrator_run_id }}.json"
142146
143147
- name: Save benchmark cache (TBB=OFF)
144148
uses: actions/cache/save@v4
145149
continue-on-error: true
146150
with:
147-
path: benchmark-cache/${{ inputs.os_name }}-${{ inputs.arch }}-tbbOFF-${{ inputs.target_sha }}.json
148-
key: timeSFMBAL-benchmark-v4-${{ inputs.os_name }}-${{ inputs.arch }}-tbbOFF-${{ inputs.target_sha }}
151+
path: benchmark-cache/${{ inputs.os_name }}-${{ inputs.arch }}-tbbOFF-${{ inputs.target_sha }}-${{ inputs.orchestrator_run_id }}.json
152+
key: timeSFMBAL-benchmark-v4-${{ inputs.os_name }}-${{ inputs.arch }}-tbbOFF-${{ inputs.target_sha }}-${{ inputs.orchestrator_run_id }}
149153

150154
benchmark_linux_arm64:
151155
if: inputs.runner_id == 'linux-arm64'
@@ -214,14 +218,14 @@ jobs:
214218
run: |
215219
set -euo pipefail
216220
mkdir -p benchmark-cache
217-
cp benchmark-results-tbbON.json "benchmark-cache/${{ inputs.os_name }}-${{ inputs.arch }}-tbbON-${{ inputs.target_sha }}.json"
221+
cp benchmark-results-tbbON.json "benchmark-cache/${{ inputs.os_name }}-${{ inputs.arch }}-tbbON-${{ inputs.target_sha }}-${{ inputs.orchestrator_run_id }}.json"
218222
219223
- name: Save benchmark cache (TBB=ON)
220224
uses: actions/cache/save@v4
221225
continue-on-error: true
222226
with:
223-
path: benchmark-cache/${{ inputs.os_name }}-${{ inputs.arch }}-tbbON-${{ inputs.target_sha }}.json
224-
key: timeSFMBAL-benchmark-v4-${{ inputs.os_name }}-${{ inputs.arch }}-tbbON-${{ inputs.target_sha }}
227+
path: benchmark-cache/${{ inputs.os_name }}-${{ inputs.arch }}-tbbON-${{ inputs.target_sha }}-${{ inputs.orchestrator_run_id }}.json
228+
key: timeSFMBAL-benchmark-v4-${{ inputs.os_name }}-${{ inputs.arch }}-tbbON-${{ inputs.target_sha }}-${{ inputs.orchestrator_run_id }}
225229

226230
# ── TBB=OFF ──
227231
- name: Clean build directory
@@ -252,14 +256,14 @@ jobs:
252256
run: |
253257
set -euo pipefail
254258
mkdir -p benchmark-cache
255-
cp benchmark-results-tbbOFF.json "benchmark-cache/${{ inputs.os_name }}-${{ inputs.arch }}-tbbOFF-${{ inputs.target_sha }}.json"
259+
cp benchmark-results-tbbOFF.json "benchmark-cache/${{ inputs.os_name }}-${{ inputs.arch }}-tbbOFF-${{ inputs.target_sha }}-${{ inputs.orchestrator_run_id }}.json"
256260
257261
- name: Save benchmark cache (TBB=OFF)
258262
uses: actions/cache/save@v4
259263
continue-on-error: true
260264
with:
261-
path: benchmark-cache/${{ inputs.os_name }}-${{ inputs.arch }}-tbbOFF-${{ inputs.target_sha }}.json
262-
key: timeSFMBAL-benchmark-v4-${{ inputs.os_name }}-${{ inputs.arch }}-tbbOFF-${{ inputs.target_sha }}
265+
path: benchmark-cache/${{ inputs.os_name }}-${{ inputs.arch }}-tbbOFF-${{ inputs.target_sha }}-${{ inputs.orchestrator_run_id }}.json
266+
key: timeSFMBAL-benchmark-v4-${{ inputs.os_name }}-${{ inputs.arch }}-tbbOFF-${{ inputs.target_sha }}-${{ inputs.orchestrator_run_id }}
263267

264268
benchmark_macos_arm64:
265269
if: inputs.runner_id == 'macos-arm64'
@@ -326,14 +330,14 @@ jobs:
326330
run: |
327331
set -euo pipefail
328332
mkdir -p benchmark-cache
329-
cp benchmark-results-tbbON.json "benchmark-cache/${{ inputs.os_name }}-${{ inputs.arch }}-tbbON-${{ inputs.target_sha }}.json"
333+
cp benchmark-results-tbbON.json "benchmark-cache/${{ inputs.os_name }}-${{ inputs.arch }}-tbbON-${{ inputs.target_sha }}-${{ inputs.orchestrator_run_id }}.json"
330334
331335
- name: Save benchmark cache (TBB=ON)
332336
uses: actions/cache/save@v4
333337
continue-on-error: true
334338
with:
335-
path: benchmark-cache/${{ inputs.os_name }}-${{ inputs.arch }}-tbbON-${{ inputs.target_sha }}.json
336-
key: timeSFMBAL-benchmark-v4-${{ inputs.os_name }}-${{ inputs.arch }}-tbbON-${{ inputs.target_sha }}
339+
path: benchmark-cache/${{ inputs.os_name }}-${{ inputs.arch }}-tbbON-${{ inputs.target_sha }}-${{ inputs.orchestrator_run_id }}.json
340+
key: timeSFMBAL-benchmark-v4-${{ inputs.os_name }}-${{ inputs.arch }}-tbbON-${{ inputs.target_sha }}-${{ inputs.orchestrator_run_id }}
337341

338342
# ── TBB=OFF ──
339343
- name: Clean build directory
@@ -364,11 +368,11 @@ jobs:
364368
run: |
365369
set -euo pipefail
366370
mkdir -p benchmark-cache
367-
cp benchmark-results-tbbOFF.json "benchmark-cache/${{ inputs.os_name }}-${{ inputs.arch }}-tbbOFF-${{ inputs.target_sha }}.json"
371+
cp benchmark-results-tbbOFF.json "benchmark-cache/${{ inputs.os_name }}-${{ inputs.arch }}-tbbOFF-${{ inputs.target_sha }}-${{ inputs.orchestrator_run_id }}.json"
368372
369373
- name: Save benchmark cache (TBB=OFF)
370374
uses: actions/cache/save@v4
371375
continue-on-error: true
372376
with:
373-
path: benchmark-cache/${{ inputs.os_name }}-${{ inputs.arch }}-tbbOFF-${{ inputs.target_sha }}.json
374-
key: timeSFMBAL-benchmark-v4-${{ inputs.os_name }}-${{ inputs.arch }}-tbbOFF-${{ inputs.target_sha }}
377+
path: benchmark-cache/${{ inputs.os_name }}-${{ inputs.arch }}-tbbOFF-${{ inputs.target_sha }}-${{ inputs.orchestrator_run_id }}.json
378+
key: timeSFMBAL-benchmark-v4-${{ inputs.os_name }}-${{ inputs.arch }}-tbbOFF-${{ inputs.target_sha }}-${{ inputs.orchestrator_run_id }}

.github/workflows/time-sfmbal-benchmark.yml

Lines changed: 13 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -118,34 +118,8 @@ jobs:
118118
});
119119
}
120120
121-
// Helper: check whether an exact cache key exists.
122-
const cacheExists = async (key) => {
123-
const resp = await github.rest.actions.getActionsCacheList({
124-
owner: context.repo.owner,
125-
repo: context.repo.repo,
126-
key,
127-
});
128-
return resp.data.actions_caches.some((c) => c.key === key);
129-
};
130-
131-
// Check cache and dispatch only uncached benchmark worker runs.
132-
// Each worker produces both TBB=ON and TBB=OFF results, so we
133-
// skip dispatch only when both cache entries are present.
121+
// Dispatch all benchmark worker runs.
134122
for (const spec of specs) {
135-
const keyON = `timeSFMBAL-benchmark-v4-${spec.os_name}-${spec.arch}-tbbON-${spec.sha}`;
136-
const keyOFF = `timeSFMBAL-benchmark-v4-${spec.os_name}-${spec.arch}-tbbOFF-${spec.sha}`;
137-
const [hitON, hitOFF] = await Promise.all([
138-
cacheExists(keyON),
139-
cacheExists(keyOFF),
140-
]);
141-
if (hitON && hitOFF) {
142-
core.info(
143-
`Cache hit for ${spec.role} ${spec.id} (both TBB variants), skipping dispatch.`
144-
);
145-
spec.conclusion = "skipped_cached";
146-
continue;
147-
}
148-
149123
spec.group_token = `${groupId}-${spec.role}-${spec.id}`;
150124
await github.rest.actions.createWorkflowDispatch({
151125
owner: context.repo.owner,
@@ -159,6 +133,7 @@ jobs:
159133
arch: spec.arch,
160134
checkout_ref: spec.checkout_ref,
161135
target_sha: spec.sha,
136+
orchestrator_run_id: String(context.runId),
162137
},
163138
});
164139
}
@@ -282,15 +257,15 @@ jobs:
282257
id: restore_head
283258
uses: actions/cache/restore@v4
284259
with:
285-
path: benchmark-cache/${{ matrix.os_name }}-${{ matrix.arch }}-tbb${{ matrix.tbb }}-${{ needs.context.outputs.head_sha }}.json
286-
key: timeSFMBAL-benchmark-v4-${{ matrix.os_name }}-${{ matrix.arch }}-tbb${{ matrix.tbb }}-${{ needs.context.outputs.head_sha }}
260+
path: benchmark-cache/${{ matrix.os_name }}-${{ matrix.arch }}-tbb${{ matrix.tbb }}-${{ needs.context.outputs.head_sha }}-${{ github.run_id }}.json
261+
key: timeSFMBAL-benchmark-v4-${{ matrix.os_name }}-${{ matrix.arch }}-tbb${{ matrix.tbb }}-${{ needs.context.outputs.head_sha }}-${{ github.run_id }}
287262

288263
- name: Restore base benchmark cache
289264
id: restore_base
290265
uses: actions/cache/restore@v4
291266
with:
292-
path: benchmark-cache/${{ matrix.os_name }}-${{ matrix.arch }}-tbb${{ matrix.tbb }}-${{ needs.context.outputs.base_sha }}.json
293-
key: timeSFMBAL-benchmark-v4-${{ matrix.os_name }}-${{ matrix.arch }}-tbb${{ matrix.tbb }}-${{ needs.context.outputs.base_sha }}
267+
path: benchmark-cache/${{ matrix.os_name }}-${{ matrix.arch }}-tbb${{ matrix.tbb }}-${{ needs.context.outputs.base_sha }}-${{ github.run_id }}.json
268+
key: timeSFMBAL-benchmark-v4-${{ matrix.os_name }}-${{ matrix.arch }}-tbb${{ matrix.tbb }}-${{ needs.context.outputs.base_sha }}-${{ github.run_id }}
294269

295270
- name: Stage collected files
296271
shell: bash
@@ -299,13 +274,13 @@ jobs:
299274
mkdir -p artifact
300275
echo "head cache-hit: ${{ steps.restore_head.outputs.cache-hit }}"
301276
echo "base cache-hit: ${{ steps.restore_base.outputs.cache-hit }}"
302-
if [[ "${{ steps.restore_head.outputs.cache-hit }}" == "true" ]] && [[ -f "benchmark-cache/${{ matrix.os_name }}-${{ matrix.arch }}-tbb${{ matrix.tbb }}-${{ needs.context.outputs.head_sha }}.json" ]]; then
303-
cp "benchmark-cache/${{ matrix.os_name }}-${{ matrix.arch }}-tbb${{ matrix.tbb }}-${{ needs.context.outputs.head_sha }}.json" "artifact/head-${{ matrix.id }}.json"
277+
if [[ "${{ steps.restore_head.outputs.cache-hit }}" == "true" ]] && [[ -f "benchmark-cache/${{ matrix.os_name }}-${{ matrix.arch }}-tbb${{ matrix.tbb }}-${{ needs.context.outputs.head_sha }}-${{ github.run_id }}.json" ]]; then
278+
cp "benchmark-cache/${{ matrix.os_name }}-${{ matrix.arch }}-tbb${{ matrix.tbb }}-${{ needs.context.outputs.head_sha }}-${{ github.run_id }}.json" "artifact/head-${{ matrix.id }}.json"
304279
else
305280
: > "artifact/head-miss-${{ matrix.id }}.txt"
306281
fi
307-
if [[ "${{ steps.restore_base.outputs.cache-hit }}" == "true" ]] && [[ -f "benchmark-cache/${{ matrix.os_name }}-${{ matrix.arch }}-tbb${{ matrix.tbb }}-${{ needs.context.outputs.base_sha }}.json" ]]; then
308-
cp "benchmark-cache/${{ matrix.os_name }}-${{ matrix.arch }}-tbb${{ matrix.tbb }}-${{ needs.context.outputs.base_sha }}.json" "artifact/base-${{ matrix.id }}.json"
282+
if [[ "${{ steps.restore_base.outputs.cache-hit }}" == "true" ]] && [[ -f "benchmark-cache/${{ matrix.os_name }}-${{ matrix.arch }}-tbb${{ matrix.tbb }}-${{ needs.context.outputs.base_sha }}-${{ github.run_id }}.json" ]]; then
283+
cp "benchmark-cache/${{ matrix.os_name }}-${{ matrix.arch }}-tbb${{ matrix.tbb }}-${{ needs.context.outputs.base_sha }}-${{ github.run_id }}.json" "artifact/base-${{ matrix.id }}.json"
309284
else
310285
: > "artifact/base-miss-${{ matrix.id }}.txt"
311286
fi
@@ -379,39 +354,18 @@ jobs:
379354
PY
380355
cat benchmark-comment.md >> "$GITHUB_STEP_SUMMARY"
381356
382-
- name: Post or update PR comment
357+
- name: Post PR comment
383358
if: needs.context.outputs.should_comment == 'true'
384359
uses: actions/github-script@v7
385360
with:
386361
script: |
387362
const fs = require("fs");
388-
const marker = "<!-- time-sfmbal-benchmark -->";
389363
const body = fs.readFileSync("benchmark-comment.md", "utf8");
390364
const issue_number = Number("${{ needs.context.outputs.pr_number }}");
391365
392-
const comments = await github.paginate(github.rest.issues.listComments, {
366+
await github.rest.issues.createComment({
393367
owner: context.repo.owner,
394368
repo: context.repo.repo,
395369
issue_number,
396-
per_page: 100,
370+
body,
397371
});
398-
399-
const existing = comments.find(
400-
(comment) => comment.user?.type === "Bot" && comment.body?.includes(marker)
401-
);
402-
403-
if (existing) {
404-
await github.rest.issues.updateComment({
405-
owner: context.repo.owner,
406-
repo: context.repo.repo,
407-
comment_id: existing.id,
408-
body,
409-
});
410-
} else {
411-
await github.rest.issues.createComment({
412-
owner: context.repo.owner,
413-
repo: context.repo.repo,
414-
issue_number,
415-
body,
416-
});
417-
}

0 commit comments

Comments
 (0)