-
Notifications
You must be signed in to change notification settings - Fork 120
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
Use representation types for expressions and shapes #455
Use representation types for expressions and shapes #455
Conversation
Fix true / false patterns
It accidentally consisted of zeros instead of -1
GHC 8.8 doesn't believe anymore that the type family |
&& and || are now defined in terms of if-then-else &&! and ||! are strict variants of them, which do not short circuit
src/Data/Array/Accelerate/Type.hs
Outdated
type Tup8 a b c d e f g h = (((((((((), a), b), c), d), e), f), g), h) | ||
type Tup9 a b c d e f g h i = ((((((((((), a), b), c), d), e), f), g), h), i) | ||
type Tup16 a b c d e f g h | ||
i j k l m n o p = ((((((((((((((((((), a), b), c), d), e), f), g), h), i), j), k), l), m), n), o), p)) |
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.
I believe there is a redundant pair of outer parentheses here :)
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.
Thanks, good catch!
Previously defined in accelerate-llvm
This may duplicate work
Description
Before this PR, the types of expressions would refer to surface types. This PR changes that: internally the type now regards the representation type, similar to what I did previously on Acc in #449. A quick summary of the changes:
Exp
,PreOpenExp
fromAST.hs
regards representation types.Smart.hs
, we introducedSmartExp
to capture the recursion. Its type argument regards representation types. To hide this change to the user, we wrap this innewtype Exp t = Exp (SmartExp (EltRepr t))
.Pair
andNil
.Vec n t
) are now more explicit in the AST. Creating vectors or extracting data from them is achieved by converting the vector from/to a tuple. This is done usingVecPack
andVecUnpack
.V2_
,V3_
,V4_
,V8_
andV16_
Pattern.hs
Elt (Vec n t)
for different single types, we have now have only one instance. We use type classVecElt
to denote which single types can be stored in a Vec.Complex
can be used on all types instead of only floating point numbers.Motivation and context
This change should make the internals of Accelerate easier, as it is easier to reason in terms of representation types, and in terms of variables of a scalar type.
How has this been tested?
The tests are all passing :)
Types of changes
Checklist: