Skip to content

test(jpeg-metal): benchmark retained single-image sessions - #103

Closed
jcwal1516 wants to merge 1 commit into
mainfrom
perf/audit-00-metal-jpeg-single-baselines
Closed

jcwal1516 wants to merge 1 commit into
mainfrom
perf/audit-00-metal-jpeg-single-baselines

Conversation

@jcwal1516

Copy link
Copy Markdown
Member

The existing JPEG Metal full-decode benchmark uses the queued submission API. This adds a baseline for the synchronous Decoder::decode_to_device_with_session path that task09 will optimize.

The new matrix retains the decoder and backend session across calls, validates Metal residency and exact native pixels before timing, and returns a fresh surface on each iteration. It covers 420 with/without restart markers, 422, and 444 in Gray/RGB/RGBA; a whole-image scaled control; a 444 region-scaled control; and a real four-distinct-image batch using retained decoders and a reusable caller-owned output buffer. Partial-image controls are explicitly labeled as global-runtime calls because their public API does not accept a backend session.

A separate manual diagnostic counts actual shared/private Metal buffer allocations before download. The runtime is initialized outside those counts, and pixels are checked afterward. A pure regression test records the existing fail-closed pool behavior after an owner panic. No production ownership, codec behavior, API, dependencies, or routing change is included.

Known baseline gap: the initially proposed generated 420 restart region-scaled control differs from native at 545 of 6912 output bytes, maximum difference 39. Full-image and whole-image scaled probes pass. The evidence retains that failure; this PR does not fix or validate that partial 420 route, and uses 444 as the exact-parity region-scaled control. No tolerance was widened.

Validation: all 15 smoke probes passed exact native pixel comparison; scoped tests/bench Clippy, formatting, diff review, the allocation diagnostic, and the panic regression passed. The committed baseline at 070ef29 completed all 15 rows with 50 samples, 3-second warmup, and 10-second requested measurement in release-bench on Apple M4 Pro. The allocation diagnostic confirms 2 private + 5 shared buffers per Gray call and 3 private + 5 shared per RGB/RGBA call across the four sampling fixtures. Counts exclude runtime setup and download but include the returned shared output. No acceleration claim is made by this prerequisite. CUDA validation remains deferred until the end at the user's request. Exact-head manual GitHub Metal validation remains a premerge gate.

@jcwal1516 jcwal1516 closed this Sep 9, 2026
@jcwal1516
jcwal1516 deleted the perf/audit-00-metal-jpeg-single-baselines branch September 10, 2026 01:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant