Skip to content

arith_ext: add lowering to arith operations#715

Merged
copybara-service[bot] merged 1 commit into
google:mainfrom
inbelic:inbelic/lower-arith-ext
Jun 12, 2024
Merged

arith_ext: add lowering to arith operations#715
copybara-service[bot] merged 1 commit into
google:mainfrom
inbelic:inbelic/lower-arith-ext

Conversation

@inbelic

@inbelic inbelic commented Jun 3, 2024

Copy link
Copy Markdown
Contributor

Following up on #711

@AlexanderViand-Intel AlexanderViand-Intel left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This looks good to me (but does need a rebase/squash) :)

Comment thread lib/Dialect/ArithExt/IR/ArithExtOps.td
Comment thread lib/Dialect/ArithExt/IR/ArithExtOps.td
@inbelic inbelic force-pushed the inbelic/lower-arith-ext branch from bf95bb5 to ebbbcef Compare June 11, 2024 08:24

@AlexanderViand-Intel AlexanderViand-Intel left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks for the update/rebase!

@j2kun j2kun added the pull_ready Indicates whether a PR is ready to pull. The copybara worker will import for internal testing label Jun 11, 2024

// Using DRR to generate the lowering patterns for specific operations

defvar DefGE = ConstantEnumCase<Arith_CmpIPredicateAttr, "uge">;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I wonder if we will always want this to be unsigned (uge = unsigned greater equal) vs signed. I feel that perhaps we should all agree on the semantics of arith_ext ops on this front, i.e., that we always take the representative in [0, modulus) for modular operations.

Still happy to submit and revisit this later.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I agree we should discuss this further.

I think if we let it be signed then we will have similar confusion/issue with using RemSI where it treats both operands as signed and we generally don't want the second operand to be signed.

FWIW, in the context of HEaan, they do make the assumption that it is an unsigned input.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I was planning to spend some time in the next meeting on discussing how we model modular arithmetic, and data-type semantics in general, and I think the signedness question would be a good addition to the list :)

@asraa asraa left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dialect: mod_arith pull_ready Indicates whether a PR is ready to pull. The copybara worker will import for internal testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants