-
Notifications
You must be signed in to change notification settings - Fork 150
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
Add blackbox for 'Clash.Sized.Vector.iterateI' #1354
Conversation
c08bb41
to
2b28a49
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of questions about things, but generally looks good. One question that didn't make sense being tagged in a particular area: does this work in Verilog / SystemVerilog? Some parts are explicitly VHDL instead of any backend, but other parts seem to be over every backend.
Yes this works for all HDLs. The changes regarding the this are just an improvement on the DSL that was donated/upstreamed by Chris over at #1352. I haven't used any of those function for the |
2b28a49
to
cd7fca4
Compare
cd7fca4
to
04b01d5
Compare
Thanks for the review @alex-mckenna! I've implemented your suggestions. |
04b01d5
to
aafe13e
Compare
Converting to draft PR. The following example makes Clash get stuck in an infinite loop: module Test where
import Clash.Prelude
f :: forall n. KnownNat n => Index (n + 1) -> Int -> Int
f n = foldl (.) id lanes
where
lanes :: Vec (n + 1) (Int -> Int)
lanes = map (\i -> if i < n then id else id) (iterateI succ 0)
topEntity :: Int -> Int
topEntity = f (1 :: Index 5) |
3a5ce52
to
4076b79
Compare
a73b9d7
to
05bd738
Compare
05bd738
to
871504c
Compare
Prevents huge expressions, therefore improving compilation times
Prevents huge expressions, therefore improving compilation times
Prevents huge expressions, therefore improving compilation times
Prevents huge expressions, therefore improving compilation times
7b5f5b5
to
3f96233
Compare
3f96233
to
68491e8
Compare
Prevents infinite loops in certain cases
68491e8
to
8d0b872
Compare
Testing on a private, bigger codebase revealed a 20% speedup @christiaanb :). I've applied the review suggestions, so I think this is good to go. (If merging, it's probably best to create a merge commit for this one, as there's quite a lot of info in this thread.) |
Any reason not to backport to 1.2? |
It's a bit of work, most of which I've done in |
( Case vec elTy [(pat, Var el)] | ||
, Case vec restTy [(pat, Var rest)] ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@martijnbastiaan Doesn't this duplicate (at least compiler) work for the vec
term?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly / probably. How would you write it?
There should also be a "quick" path that just extract the element if it sees a data constructor.
PR #1354 makes code in the wild fail
Adds blackbox (and associated reduceNonRepPrim/evaluator rule) for
Clash.Sized.Vector.iterateI
. Works around #1240.