-
Notifications
You must be signed in to change notification settings - Fork 182
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
[xls][mlir] Add missing MLIR dialect ops #1843
base: main
Are you sure you want to change the base?
Conversation
Xls_Bits:$input | ||
); | ||
let results = (outs | ||
Xls_Bits:$result |
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.
Am I correct in saying that the element type of $result should always be i1? If so, can this please be encoded as a constraint?
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.
You are correct.
Here I was mirroring the behavior of all other ops that produce single-bit results (eq, ne, sge, ...) with the exception of them providing a builder with an I1 return type default.
I guess for the sake of your scalarize-setup I can't just have a return type of I1.
Do you prefer a simple verifier for this, or a new Xls_Bit
type (that is either I1 or a tensor thereof) which then could also be used for better typing of the comparison ops down the road?
d6a0bb2
to
07b97b8
Compare
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.
Looks good with James's comments addressed.
Regarding the Ok this sent me on a bit of a journey :) I had actually tried With your review I dug into this a bit more. Adding the constraint
This makes little sense, because no result types should be inferable. Also, I tracked this down to a bug that triggers some UB inside the MLIR TableGen See upstream PR here: In short: Do you want to keep this as-is, or wait for upstream to propagate down and use |
07b97b8
to
d0213ca
Compare
LLVM fix merged upstream. This should not be merged until an LLVM version with this is included is pinned: llvm/llvm-project@7aebacb |
d0213ca
to
bda12fc
Compare
Rebased. Required upstream commit is now available. |
bda12fc
to
f728967
Compare
Adds the following XLS-supported ops to the MLIR dialect: - nand, nor - and_reduce, or_reduce, xor_reduce - umulp, smulp - gate Note that for the partial product operations, operands of different bit widths and operands of different bit width than the result are explicitly allowed.
f728967
to
b6c8c36
Compare
I saw this got the "Reviewing Internally" label. Please hold-off merging this for a bit - I will address the final review above once #1856 is merged. |
@jpienaar
Adds the following XLS-supported ops to the MLIR dialect:
Note that for the partial product operations, operands of different bit widths and operands of different bit width than the result are explicitly allowed.
Please double check the following in the tablegen ODS for partial product ops:
Is this a sane way of constraining the two result values to have the same type? Is there a different constraint that matches better? Seems like a bit of a hack to use this with the "identity transform expression" "$_self" :)