Repository navigation
upscale/gpu: FSR 1.0 on the GPU (Metal, Vulkan) as a nested module - #151
Merged
Merged
Conversation
A module of its own, github.com/go-avkit/avkit/upscale/gpu, requiring avkit v0.25.0: EASU+RCAS on Metal (go-macos/metal) and Vulkan (go-gfx/vulkan, SPIR-V from go-gfx/wgsl), held to upscale.ErrorBound of fsrref. Source positions come from fsrref.Phase tables and 8-bit values from a float32(i)/255 table, because GPU float arithmetic is not exact there. CI job gpu. Refs #141 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This was referenced Nov 29, 2026
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.
Adds
upscale/gpu, a nested module (github.com/go-avkit/avkit/upscale/gpu, requires avkit v0.25.0) that runs FSR 1.0 EASU+RCAS on the GPU: Metal via go-macos/metal, Vulkan via go-gfx/vulkan with SPIR-V from go-gfx/wgsl. API:gpu.Open(),(*Scaler).Upscale(dst, src),Close();ErrUnsupportedwhen no device. Sources with alpha are refused (ErrAlpha). Limits and options are those ofupscale.Scaler.Refs #141
Accuracy against
fsrref.Upscale(noise, edges, gradient, black, white; sharpness -1, 0, 0.2, 1.5; 662520 samples; float result before quantisation; boundupscale.ErrorBound= 2e-4):TestPhaseTies(saturated diagonal edge on the odd:odd sizes, plus 640x8 to 1920x24): 0 outside on both, worst 4.2e-07.Two things GPUs do not do exactly are taken out of the shader: the source position comes from per-column/row tables built from
fsrref.Phase, andu8/255from a hostfloat32(i)/255table (GPU division is not correctly rounded; it gave errors up to 0.04 on near-equal lumas).Timing (
BenchmarkGPU720to1080, 1280x720 YCbCr 4:2:0 to 1920x1080 RGBA, sharpness 0.2), fractal, Ryzen 7950X, RADV NAVI32,taskset -c 9, load about 1.4: 5.77 to 5.87 ms per frame with upload and readback; dispatch alone about 2.0 ms. Mac timings were deferred: the 1-minute load was 50 to 90. No player comparison and no AMD sample comparison was made.Tests and CI: device tests skip visibly with no GPU and fail when
AVKIT_GPU_REQUIRE=1and none is found. The Vulkan sequencing runs against a fake device (failure at every step, nothing left allocated).mutsweep: 23 of 23 caught. New CI jobgpu(gofmt, build, vet, test; ubuntu and macOS).