-
Notifications
You must be signed in to change notification settings - Fork 2
Change data types, adding some fixed width #15
Conversation
In particular |
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 would still like to see a reply to the comment 💬 I made.
|
||
object float16 extends VectorType(16, float) | ||
object vec { | ||
def apply(size: Nat, elemType: DataType) = VectorType(size, elemType) |
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.
Do we want to enforce here that size
is a Cst
and that it is one of: 2, 3, 4, 8, 16
?
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.
Maybe we want to write some vector-width generic code with types such as nFunT(w => f32 ->: vec(w, f32)
? Although you could still use VectorType(w, f32)
if you wanted.
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 feel like such checks would be better suited when you try to generate code with a specific backend/target?
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.
This form of polymorphism is dangerous anyway because the type suggests that we can build a VectorType(w, f32)
for all w: Nat
. But that isn't true.
We will have to be looking a bit more carefully how to define the VectorType
on the formal side, I guess.
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.
Maybe we can open an issue about that? There is also the issue that elemType
should be a ScalarType
ideally but we have no way of creating ScalarTypeIdentifiers
for example.
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.
Maybe we want subtyping constraints (#11) but also nat constraints?
This will be useful for image processing applications in particular.