-
Notifications
You must be signed in to change notification settings - Fork 78
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
dialects: (llvm) Add a bunch of float methods #3781
base: alexarice/default-prop-in-dict
Are you sure you want to change the base?
Conversation
47272fd
to
73d8169
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## alexarice/default-prop-in-dict #3781 +/- ##
==================================================================
- Coverage 91.26% 91.25% -0.01%
==================================================================
Files 461 461
Lines 57521 57561 +40
Branches 5543 5546 +3
==================================================================
+ Hits 52495 52528 +33
- Misses 3603 3608 +5
- Partials 1423 1425 +2 ☔ View full report in Codecov by Sentry. |
Do we have an mlir integration test for llvm ops? If not I feel it would be useful. |
3a9d650
to
7c83cf7
Compare
Added! |
55813c5
to
bf4562f
Compare
xdsl/dialects/llvm.py
Outdated
attributes=attrs if attrs is not None else {}, | ||
) | ||
|
||
def print(self, printer: Printer): |
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.
I don't think this is necessary, the assembly format from before should still work
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.
xdsl.utils.exceptions.PyRDLOpDefinitionError: ('Error during the parsing of the assembly format: ', (Span[38:38](text=''), "fastmathFlags properties are missing from the declarative format. If this is intentional, consider using 'ParsePropInAttrDict' IRDL option."))
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.
Have you considered using the 'ParsePropInAttrDict' IRDL option?
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.
Got it working, thanks!
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.
Ah, no it doesnt! Because fastmath=none
flags are not supposed to be printed at all!
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 sounds like a bug in assembly format then
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.
Hmmmm, yeah maybe we could hide attributes if they are the default value
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 should have been happening anyway, but I think I must have missed a case somehow
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.
bbec3c8
to
f9e9a99
Compare
117e9eb
to
d018456
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.
This should be working with assembly format and I'd prefer to get the bugged fixed rather than introducing custom parsing for something that shouldn't need it
d018456
to
f1c4442
Compare
But it doesn't. And fixing the assembly format is outside the scope of this PR. I'm not able to fix the assembly format today. |
cb55182
to
8a3c409
Compare
8a3c409
to
774aee4
Compare
Rebased on top of #3783, @alexarice can you okay now? |
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.
Will leave the parent PR up to give people time to review.
|
||
|
||
@irdl_op_definition | ||
class SIToFPOp(GenericCastOp): |
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.
These are currently very unconstrained but this isn't technically wrong
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.
I think it kinda is, you can't cast from a float with this. Added a verify check.
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.
The custom verifier is verify_
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.
Damn, LinkageAttr
also uses the wrong verifier then. Just copied from there as I'm never sure which one to use 🙃
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.
It's different for attributes
774aee4
to
f256fae
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.
I'd prefer to either revert to how it was before or check the input and output types with constraints
|
||
|
||
@irdl_op_definition | ||
class SIToFPOp(GenericCastOp): |
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.
The custom verifier is verify_
if not isinstance(self.arg.type, IntegerType): | ||
raise VerifyException("Expected integer type as input") | ||
if not isinstance(self.result.type, AnyFloat): | ||
raise VerifyException("Expected output to be a float") |
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.
I don't really understand why you would check input and output types in a custom verifier
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.
because then I can subclass the main conversion thingy class and keep the remaining bits.
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.
The only shared functionality seems to be the assembly format
Could you stop resolving discussions please, makes it hard to check what's happened |
Adds the following llvm floating point operations:
llvm.fadd
llvm.fsub
llvm.fmul
llvm.fdiv
llvm.frem
llvm.sitofp
llvm.fpext
Closes #3780
I also took the liberty to sort the dialect lists alphabetically