Skip to content

Add challenge 73: Bilateral Filter (Medium)#193

Open
claude[bot] wants to merge 1 commit intomainfrom
add-challenge-73-bilateral-filter
Open

Add challenge 73: Bilateral Filter (Medium)#193
claude[bot] wants to merge 1 commit intomainfrom
add-challenge-73-bilateral-filter

Conversation

@claude
Copy link
Contributor

@claude claude bot commented Feb 24, 2026

Summary

  • Adds challenge 73: Bilateral Filter (Medium difficulty)
  • The bilateral filter is an edge-preserving image smoother: for each pixel it computes a weighted average of its neighbors, combining a spatial Gaussian (proximity) with a range Gaussian (intensity similarity), so sharp edges are preserved while flat regions are smoothed
  • This is fundamentally different from the existing Gaussian blur (challenge 28), which uses a fixed precomputed kernel — bilateral filter weights are data-dependent and change per pixel

What this teaches

  • Data-dependent stencil weights: unlike convolution, the filter kernel varies at every pixel based on local intensity differences
  • 2D stencil with halo memory regions: efficient solutions tile the image into shared memory blocks with border halos
  • Per-pixel normalization: each output pixel divides by the sum of its weights (non-linear, cannot be expressed as a simple convolution)
  • Algorithm design tradeoffs: naive O(N²R²) per-pixel loops vs. shared-memory tiling to amortize global memory bandwidth

Test plan

  • 10 functional tests covering: single pixel, 2×2 zeros, 3×3 edge case, 4×4 negatives, 16×16 and 64×64 power-of-2, 100×100 and 255×255 non-power-of-2, 512×512 and 1000×1000 realistic sizes
  • Performance test: 2,048×2,048 image with radius=5
  • Validated CUDA solution passes on NVIDIA TESLA T4 via run_challenge.py --action run
  • All 6 framework starters present (CUDA, PyTorch, Triton, JAX, CuTe, Mojo)
  • Pre-commit linting passes (black, isort, flake8, clang-format)
  • Checklist in CLAUDE.md verified

🤖 Generated with Claude Code

Adds a new medium-difficulty challenge implementing the bilateral filter —
an edge-preserving image smoothing operation where per-pixel weights combine
a spatial Gaussian and an intensity-range Gaussian, preventing blurring across
sharp edges.

This teaches GPU programmers about data-dependent stencil weights, 2D halo
memory access patterns, and per-pixel normalization — concepts not covered by
any existing challenge (Gaussian blur uses fixed precomputed kernels).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

0 participants