comp-imaging / ProxImaL

A domain-specific language for image optimization.
MIT License
112 stars 29 forks source link

Optimize the direct FFT method in `least_square` algorithm with Halide #88

Closed antonysigma closed 11 months ago

antonysigma commented 1 year ago

Note to self: The algorithm least_square(x, b) has a direct frequency domain inversion method, utilizing the Halide-accelerated FFT interface. However, the current implementation requires context switch between Halide/C++ domain and Numpy/Python domain, introducing overhead.

The internal buffer lifetime, namely self.ftmp_halide, could have been managed in the Halide/C++ domain to reduce code bloat.

Roadmap:

  1. [x] Implement Halide-accelerated pipeline least_squares_direct(input, b, freq_diag, output)
  2. [x] Expose the algorithm to Python with Pybind11.
  3. [x] Eliminate the code related to temporary buffer management, namely self.ftmp_halide.
  4. [ ] Sanity check the new feature with proximal/examples/test_deconv.py.

https://github.com/comp-imaging/ProxImaL/blob/44eef8c95886d37f193e9a733e867910edf76c02/proximal/prox_fns/sum_squares.py#L198-L231