Skip to content
This repository has been archived by the owner on Dec 18, 2020. It is now read-only.

Change data types, adding some fixed width #15

Merged
merged 2 commits into from
Jan 20, 2020
Merged

Conversation

Bastacyclop
Copy link
Member

This will be useful for image processing applications in particular.

@Bastacyclop Bastacyclop requested a review from a team January 16, 2020 11:41
@Bastacyclop
Copy link
Member Author

In particular float becomes f32 and float4 becomes vec(4, f32) to avoid confusing vector width and bit width.

@Bastacyclop Bastacyclop requested a review from a team January 20, 2020 09:18
Copy link
Member

@michel-steuwer michel-steuwer left a 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)
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member Author

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?

Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member Author

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?

@Bastacyclop Bastacyclop merged commit c0b768b into master Jan 20, 2020
@Bastacyclop Bastacyclop deleted the fixed-width-types branch January 20, 2020 14:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants