-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Derived Applicative
instance causes synthesis speed to blow up
#2814
Comments
Even simpler:
|
More of an FYI: On GHC 9.10 both are equally fast. With the |
On GHC 9.4, commenting out clash-compiler/clash-prelude/src/Clash/Sized/Vector.hs Lines 326 to 328 in 3b755b9
coerce based version go through. Achieving a similar number of transformations, and similar speed, as we do on GHC 9.10.Note that on GHC 9.10 the above rule never fires. |
Something to check: perhaps it's due to loss of sharing in the |
I would love to move on GHC 9.10, but I'm out of the loop on where Clash is on GHC compatibility. I thought 9.4 or 9.6 was the last working version? |
We have a README.md in the root of the repo with a section GHC compatibility. Both Clash 1.8 and master support GHC 9.8. In fact, for master we also run CI for GHC 9.10, so it has some support. Perhaps we just forgot to update that table to list GHC 9.10. It would appear the READMEs on the 1.8 branch and the v1.8.1 tag are outdated; that's unfortunate. But the one on the |
Ah, right, it was the Cabal/Stack issue of not picking up the |
In the following Clash circuit, the
MATRIX_APPLICATIVE_COERCE
preprocessor flag enables anApplicative
instance for the includedMatrix
type that is equivalent to what one would get withderiving via (Compose (Vec n) (Vec m))
. With the flag disabled, thepure
implementation is still the same as the derived one would be, but(<*>)
is implemented directly asliftA2 (<*>)
.With
liftA2 (<*>)
, synthesis finishes in less than 4 seconds on my notebook. With thecoerce
-based implementation, it finishes in 1m46s. And this, of course, is a cut-down version of a much more complex circuit where the synthesis time goes from ~1 minute to something that I didn't even bother waiting out.The text was updated successfully, but these errors were encountered: