-
Notifications
You must be signed in to change notification settings - Fork 14
arith.cpmf to neura.fcmp #169
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
base: main
Are you sure you want to change the base?
Conversation
| switch (arith_cmp_type) { | ||
| case arith::CmpIPredicate::eq: | ||
| cmp_type = "eq"; // == | ||
| break; | ||
| case arith::CmpIPredicate::ne: | ||
| cmp_type = "ne"; // != | ||
| break; | ||
| case arith::CmpIPredicate::slt: | ||
| cmp_type = "slt"; // < | ||
| break; | ||
| case arith::CmpIPredicate::sle: | ||
| cmp_type = "sle"; // <= | ||
| break; | ||
| case arith::CmpIPredicate::sgt: | ||
| cmp_type = "sgt"; // > | ||
| break; | ||
| case arith::CmpIPredicate::sge: | ||
| cmp_type = "sge"; // >= | ||
| break; | ||
| case arith::CmpIPredicate::ult: | ||
| cmp_type = "ult"; // unsigned < | ||
| break; | ||
| case arith::CmpIPredicate::ule: | ||
| cmp_type = "ule"; // unsigned <= | ||
| break; | ||
| case arith::CmpIPredicate::ugt: | ||
| cmp_type = "ugt"; // unsigned > | ||
| break; | ||
| case arith::CmpIPredicate::uge: | ||
| cmp_type = "uge"; // unsigned >= | ||
| break; |
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.
Plz help refactor these via the same way as you used for floating-point cmp, i.e.,
StringRef predicate_str = arith::stringifyCmpFPredicate(predicate_enum);
StringAttr predicate_attr = rewriter.getStringAttr(predicate_str);
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.
This also needs fix?
|
Can you also check the to see how to support interpreter for the fcmp? It basically verify the functionality by emulating the execution of newly added operations. Plz let me know if anything is unclear to you. Thanks~! |
Added missing newline at the end of the file and restored previous comments.
I apologize for the delay caused by some matters recently. I have now resubmitted it. |
| StringRef predicate_str = arith::stringifyCmpFPredicate(predicate_enum); | ||
|
|
||
| StringAttr predicate_attr = rewriter.getStringAttr(predicate_str); | ||
| // Converts arith CmpFOp to Neura FCmpOp. |
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.
Comment also needs indent.
| switch (arith_cmp_type) { | ||
| case arith::CmpIPredicate::eq: | ||
| cmp_type = "eq"; // == | ||
| break; | ||
| case arith::CmpIPredicate::ne: | ||
| cmp_type = "ne"; // != | ||
| break; | ||
| case arith::CmpIPredicate::slt: | ||
| cmp_type = "slt"; // < | ||
| break; | ||
| case arith::CmpIPredicate::sle: | ||
| cmp_type = "sle"; // <= | ||
| break; | ||
| case arith::CmpIPredicate::sgt: | ||
| cmp_type = "sgt"; // > | ||
| break; | ||
| case arith::CmpIPredicate::sge: | ||
| cmp_type = "sge"; // >= | ||
| break; | ||
| case arith::CmpIPredicate::ult: | ||
| cmp_type = "ult"; // unsigned < | ||
| break; | ||
| case arith::CmpIPredicate::ule: | ||
| cmp_type = "ule"; // unsigned <= | ||
| break; | ||
| case arith::CmpIPredicate::ugt: | ||
| cmp_type = "ugt"; // unsigned > | ||
| break; | ||
| case arith::CmpIPredicate::uge: | ||
| cmp_type = "uge"; // unsigned >= | ||
| break; |
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.
This also needs fix?
add conversion code about arith.cmpf to neura.fcmp in ArithToNeuraPass.app.
Add the test in arith2neura,with the name of cmpf.mlir.