Skip to content

Reduce resident GPU Canny gradient memory by half - #181

Merged
rsasaki0109 merged 1 commit into
mainfrom
codex/gpu-canny-compact-gradients
Oct 13, 2026
Merged

rsasaki0109 merged 1 commit into
mainfrom
codex/gpu-canny-compact-gradients

Conversation

@rsasaki0109

Copy link
Copy Markdown
Owner

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.

@rsasaki0109
rsasaki0109 merged commit 2ebcdf1 into main Oct 13, 2026
125 checks passed
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