Repository navigation
Reduce resident GPU Canny gradient memory by half - #181
Merged
Merged
Conversation
This was referenced Oct 13, 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.
Pack resident GPU Canny's bounded signed derivatives into one u32 and retain a separate u32 magnitude, reducing each gradient from 16 to 8 bytes without changing edges or public options. A 4K call saves 66,355,200 private scratch bytes; scratch becomes 20N+8 (aperture 3) or 28N (5/7). Planning and destination receipts reflect the smaller binding, with the same explicit transfers and five/six passes.
Validation: 864 exact CPU/frozen-GPU/compact-GPU edge conditions, independent gradient/NMS/BFS snapshots, all 65,536 signed component values and 326,401 raw rounding values, extremal kernels, capacity limits, ROI, profiling, concurrency and resident chain reuse. GPU-image regression: 87 passed, 15 explicit measurements ignored. GPU all-feature/all-target Clippy, facade chain, feature-free GPU, GPU-image WASM and formatting checks passed.
Two isolated paired release surveys compare the actual frozen PR #180 shader with the compact shader. At 4K, resident completed-call ratios are 1.22–1.84x and full upload/readback ratios 1.04–1.12x under default 64 MiB pool budgets. Smaller full calls show no established speed gain, and resident results vary. The measurements include resource acquisition and completion; they do not isolate shader throughput or imply automatic CPU/GPU placement. See notes/2026-10-13_gpu_canny_compact_gradients.md for all samples' summaries, intervals and conditions.