Skip to content

Add resident GPU Gaussian image filtering - #179

Merged
rsasaki0109 merged 1 commit into
mainfrom
codex/gpu-gaussian-blur
Oct 13, 2026
Merged

rsasaki0109 merged 1 commit into
mainfrom
codex/gpu-gaussian-blur

Conversation

@rsasaki0109

Copy link
Copy Markdown
Owner

Gaussian blur was available only on CPU, requiring image readback before weighted filtering in an otherwise resident GPU image pipeline.

Add gaussian_blur_gpu and the optional two-timestamp profiled variant under gpu-image. GpuGaussianBlurOptions supports independent 3/5/7 kernels, finite positive sigmas, all 1..=4 logical channels and five borders. The host prepares two tiny CPU-compatible coefficient vectors; the two weighted image passes execute on GPU in one submission. Q8/Q15 kernels, unrounded horizontal sums and two-u32-limb Q15 final sums preserve the existing specialized CPU u8 bytes exactly.

Returned images retain metadata and independent ownership and compose with gray/Sobel/AI operations. Private scratch uses 4*channels bytes per pixel; output writes use physical RGBA8. Transfers remain explicit, with no image payload readback, repeated image upload or host wait inside the filter. Dimensions, arithmetic, scratch/uniform/binding/workgroup capacities and optional profiler ownership/capacity reject before resource/cache allocation. Unsupported scratch sizes return an error; placement remains caller-controlled.

Validation:

  • Six native Gaussian tests: 3,240 exact CPU conditions / 3,176,550 logical bytes, including asymmetric kernels/sigmas, strips, all borders and logical channels.
  • Extreme sigmas, constant-255 Q15 mass and unused RGBA components; a 1025x1025 grid-stride case; exact reduced device/uniform/scratch bounds; invalid runtime/options/profiler allocation checks; ROI metadata, retained/concurrent output and dirty scratch reuse.
  • Complete GPU-image library regression: 79 passed, 13 intentional ignored measurements. Facade Gaussian/resident gray-edge-AI smoke, Clippy all features/targets, formatting, feature-free GPU and GPU-image WASM builds passed.
  • Two isolated release surveys, 12 cases each, four stages, three warmups and 20 rotating paired rounds with exact output checks. Compared with reused parallel CPU workspace/output, resident 7x7 1080p grayscale is 3.21-4.23x faster and 4K RGB is 2.03-2.26x faster. Upload/readback reduces gains; light grayscale cases remain faster on CPU. Full tables and within-survey intervals retain every adverse result.

A private CPU resize helper now compiles only for its actual resize/test consumers, fixing the dead-code lint when only filter/analysis reference features are enabled. No production dependency, core model, CPU Gaussian behavior or unsafe boundary changes. Existing Vision-chain defaults remain.

Evidence: C:/Users/rsasa/Workspace/SpatialRust/notes/2026-10-13_gpu_gaussian_blur.md. Architecture, ROADMAP and CHANGELOG describe the API and arithmetic/transfer boundaries. Follows merged PR #178.

@rsasaki0109
rsasaki0109 merged commit b91f64e 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