Repository navigation
upscale: AVX-512 permute gather, inline YCbCr, hoisted broadcasts (55 to 37 ms) - #147
Merged
Merged
Conversation
…12 permutes Scaling up, the column table steps by 0 or 1 source pixel per output pixel, so 16 outputs read at most 16 consecutive source floats: two loads cover the window, one ConcatPermute per tap (index vectors precomputed per frame) picks the lanes. The same trick replaces the scalar x-interpolation of the analysis. Falls back to the scalar gather without AVX-512 or when the table does not fit. Ryzen 9 7950X, one core, 720p to 1080p, EASU+RCAS 55.2 -> 45.1 ms, EASU alone 45.7 -> 34.8 ms (interleaved with the v0.23.0 build). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
color.YCbCrToRGB per pixel with YOffset/COffset calls becomes an inlinable copy of the same integer arithmetic over row slices, chroma indexed by the subsampling shift. Tested against the standard library on all 2^24 inputs, and against At() for every subsampling ratio on a sub-image with an odd origin. Ryzen 9 7950X, one core, 720p to 1080p: EASU+RCAS 44.5 -> ~41 ms. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…of the EASU vector block The constants, the row-dependent y offsets and the x offsets (tapDX - ppx, a per-frame table) were rebuilt for every vector of 16 pixels; they are now made once per row or once per frame. Ryzen 9 7950X, one core, 720p to 1080p, EASU+RCAS ~40.4 -> ~37.2 ms, EASU alone ~30.2 -> ~28.4 ms (interleaved). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The arm64 vector lane could not cover the branch that only exists where the permute gather does. The selection now lives in usePerm, defined per architecture (an empty stub off amd64), and the amd64 test covers the refusal. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
tannevaled
added a commit
that referenced
this pull request
Nov 29, 2026
… re-measured at the merged code (#150) * ci: the vector coverage gate no longer depends on the runner's CPU main went red on the merge commit of #149 (run 46292291989, job "test, GOEXPERIMENT=simd (ubuntu-latest)": upscale coverage 94.4% < 100%) although the same tree had 21 green checks on the pull request. upscale/easu_perm_amd64.go, added by #147, runs only with AVX-512, and a hosted amd64 runner has it or not from one job to the next. Reproduced on a Ryzen 9 7950X at 0a15a86: 100.0% natively, 94.5% under GODEBUG=cpu.avx512f=off, the only functions below 100% being usePerm and permGather. The gate was a draw since #147. tools/covgate (cobra, a module of its own, 100% covered, parser fuzzed) requires every block of the profile and excuses the blocks of one named file only when /proc/cpuinfo lacks the named flag, printing a warning that counts the statements that were not measured. An unreadable cpuinfo, an empty profile and a malformed line are refusals, not passes. Not solved here: on a runner without AVX-512 the permute gather is not executed at all, so a commit can be released with that kernel untested by CI. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * README: the upscale speed table as measured at the merged code The table merged with #149 was measured one commit before its head. At 0a15a86 on the same core (Ryzen 9 7950X, core 9, interleaved runs) the Scaler takes 28.7 to 29.3 ms per frame, not 26.2: the only non-test difference is the integer position of an output pixel (72c6376), and why it costs 10 % with the per-pixel code unchanged is not established. Multicore figures re-measured: 14.5, 7.5, 5.4 and 3.6 ms at 2, 4, 8 and 16 workers; with several workers -benchmem reports 0 allocs/op and 1 to 522 B/op. covgate also says, on a CPU that has the flag, that the file is held like the rest, so the job log states which of the two the runner was. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #141.
EASU+RCAS 720p to 1080p, one core of a Ryzen 9 7950X (AVX-512, 16 lanes), GOEXPERIMENT=simd, ms per frame, interleaved runs:
ConcatPermute, per-phase index table)At()/COffset)blockyccis checked againstcolor.YCbCrToRGBon all 2^24 inputs; every subsampling ratio and an odd-origin sub-image are checked againstAt().No API change.
🤖 Generated with Claude Code