AccelerateHS / AccelerateHS/accelerate
Arbitrarily sized stencils
- Dominant language
- Haskell
- Stars
- 1k
- Forks
- 135
- PR merge metrics
- No merged PRs in 30d
Description
It should be possible to implement stencils of arbitrary size, where the size may not be known until runtime. This would look something like:
```haskell
stencil'
:: (Shape sh, Elt a, Elt b)
=> Exp sh -> Boundary (Array sh a)
-> (Acc (Array sh a) -> Acc (Scalar b))
-> Acc (Array sh a)
-> Acc (Array sh b)
```
This would be used like the existing stencils, but instead of a (nested) tuple, the summary function passed an array to summarise.
As a motivating example, a Gaussian blur:
```haskell
gaussianBlur :: Exp DIM2 -> Acc (Array DIM2 Float) -> Acc (Array DIM2 Float)
gaussianBlur blurRegionSize = stencil' blurRegionSize (function $ const 0) goBlur
where
goBlur = sum . flatten . zipWith (*) gaussCoefficients
gaussCoefficients :: Acc (Array DIM2 Float) -- shape gaussCoefficients == blurRegionSize
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.