Skip to content

[MLIR][Quant] Added default to QuantizationFlags#844

Open
tr00 wants to merge 1 commit intoaie-publicfrom
tarik.quant-flag-none
Open

[MLIR][Quant] Added default to QuantizationFlags#844
tr00 wants to merge 1 commit intoaie-publicfrom
tarik.quant-flag-none

Conversation

@tr00
Copy link
Copy Markdown

@tr00 tr00 commented Mar 12, 2026

Added QuantizationFlags::None to be more robust than unsigned integer value 0.

Comment on lines 38 to 43
enum FlagValue {
None = 0,
// Indicates that the storage type should be interpreted as a signed
// integer. The default is to interpret it as an unsigned value.
Signed = 1,
};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO the even better approach would be to get rid of this flag completely, its unclear to me why it exists, it seems like it just duplicates information from the storage type

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But what about signless integer types? Then the sign is not encoded in the type.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to just not use signless integer type as storage type if sign of it is relevant

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm of the same opinion, as it's creating confusion when the storage type is itself signed, but this flag is set to 0. Should we consider storageType or override with this flag?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe as a first measure, we could add a check to verifyInvariants() in QuantTypes.cpp that ensures storageType and flag agree.

@jorickert jorickert requested a review from ilango100 March 12, 2026 13:44
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

Successfully merging this pull request may close these issues.

3 participants