Skip to content
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

IntAttr vs IntegerAttr #24

Open
Dinistro opened this issue Dec 22, 2021 · 7 comments
Open

IntAttr vs IntegerAttr #24

Dinistro opened this issue Dec 22, 2021 · 7 comments

Comments

@Dinistro
Copy link
Collaborator

Currently, IntAttr is defined in builtin but there is also a IntegerAttr. I think we should either remove IntAttr or rename it to something else.
This caused quite some confusion, e.g., https://github.com/compiling-techniques/ChocoPyCompiler/pull/75/files

@math-fehr
Copy link
Collaborator

I would prefer not removing IntAttr, because its purpose is to encapsulate a python int.
However, we can indeed rename it to something else!

@Dinistro
Copy link
Collaborator Author

There is no rush for such a thing. I just wanted to write this down somewhere.

@K-W-Li
Copy link
Collaborator

K-W-Li commented Jun 17, 2022

At first sight I thought it was like Haskell's Int (bounded) and Integer (unbounded) but looks the other way round.

@K-W-Li
Copy link
Collaborator

K-W-Li commented Jun 17, 2022

Can we make the bounded integer inherit from unbounded integer? So we can access the value by ".data.value" instead of ".data.data.value"

@math-fehr
Copy link
Collaborator

Hey! A bit of explanation on the IntAttr versus IntegerAttr.
An IntAttr is an attribute that only contains an integer.
An IntegerAttr is an attribute that contains an IntAttr and an IntegerType. This is a way to have a typed integer.
The problem is that the naming is not that great. One proposition Michel had was to change IntegerAttr to ValueAttr, which makes more sense in my opinion! The only problem is that we would need to write some more code for the translation to MLIR.

@webmiche
Copy link
Collaborator

Or maybe TypedIntegerValue?

@PapyChacal
Copy link
Collaborator

Walking the issues for some reason; forgot this even was a problem as I got through it myself, but it would make sense to solve that still!
I would be in favor of keeping IntegerAttr as-is for MLIR consistency; IntAttr being the xDSL novelty, we could make this one more explicit? Like IntegerValueAttr or something in that direction?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants