leventov / yarr

Yer another array library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tests/blur.hs does not compile

idontgetoutmuch opened this issue · comments

$ make blur
ghc --make -Odph -rtsopts -threaded -fno-liberate-case -funbox-strict-fields -funfolding-keeness-factor1000 -fllvm -optlo-O3 -fexpose-all-unfoldings -fsimpl-tick-factor=500 -ddump-simpl -dsuppress-all -o blur blur.hs > blur-core.hs

blur.hs:52:9:
    No instance for (InlinableArity (S N2))
      arising from a use of ‘loadSlicesP’
    In the second argument of ‘($)’, namely
      ‘loadSlicesP ffill caps delayedBlurred blurred’
    In a stmt of a 'do' block:
      bench "par blur" 10 (extent image)
      $ loadSlicesP ffill caps delayedBlurred blurred
    In the expression:
      do { [imageFile] <- getArgs;
           anyImage <- readImage imageFile;
           (image :: UArray (SE F) L Dim2 (VecList N3 Int)) <- compute
                                                                 (loadS fill)
                                                               $ mapElems fromIntegral
                                                                 $ readRGBVectors anyImage;
           let delayedBlurred
                 = mapElems truncate' $ unsafeMapSlices blur image;
           .... }
make: *** [blur] Error 1

This used to compile pre the move to fixed-vector 0.7.0.0.

Just had a chase down a rabbit hole. @idontgetoutmuch it no longer compiles cause instances for InlinableArity are no longer in scope. Here is the commit that broke it on line 59 of yarr/Data/Yarr/Utils/FixedVector.hs file: bbb3d4e#diff-3a9fb1c25d46c68c8479a8f6e356b94cL59

@idontgetoutmuch Finally was able to compare it to massiv. Had to make yarr to compile with GHC 8.2
Here is the results of adjusted blur.hs

Yarr   seq blur:	18.0  ±  0.1  ms,   89.8  ±  0.7  tics per index (10 repeats)
Yarr   par blur:	 5.06 ±  0.98 ms,   25.2  ±  4.9  tics per index (10 repeats)
Massiv Seq blur:	12.4  ±  1.6  ms,   61.0  ±  6.3  tics per index (10 repeats)
Massiv Par blur:	 4.88 ±  0.78 ms,   24.3  ±  3.9  tics per index (10 repeats)

Please, let me know if you'd like me to submit a PR with a fix for this issue and compilation for GHC 8.2