This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Floating constants for import-llvm
ClosedPublic

Authored by shraiysh on Dec 26 2019, 11:17 AM.

Details

Summary

mlir-translate -import-llvm test.ll was going into segmentation fault if test.ll had float or double constants.
For example,

%3 = fadd double 3.030000e+01, %0

Now, it is handled in Importer::getConstantAsAttr (similar behaviour as normal integers)
Added tests for FP arithmetic

Diff Detail

Event Timeline

shraiysh created this revision.Dec 26 2019, 11:17 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 26 2019, 11:17 AM
mehdi_amini accepted this revision.Dec 26 2019, 3:08 PM
This revision is now accepted and ready to land.Dec 26 2019, 3:08 PM
shraiysh updated this revision to Diff 235385.Dec 26 2019, 8:49 PM

The order of instructions in the test for FP arithmetic wasn't right. Fixed it.

Also, @mehdi_amini I do not have permissions to commit. It would be great if you could commit this.

ftynse accepted this revision.Dec 27 2019, 1:48 AM

Thanks!
I would also add an error message in cases where constant conversion failed and made sure the callers of getConstantAsAttr are aware that it can return null (there may be x86_fp80 and fp128 values, that are not supported in MLIR at all). Fine for a separate commit.

This revision was automatically updated to reflect the committed changes.

The author on the landed commit has somehow changed to @ftynse. Was this intended?

That's the side effect of Phabricator/Arcanist: it replaces the original author with whoever commits the patch. Apparently, it cannot show me the email of the original author due to some privacy concerns, so I cannot manually amend the commit unless the email is available somewhere else, e.g. in the signed-of-by field.

I would also add an error message in cases where constant conversion failed and made sure the callers of getConstantAsAttr are aware that it can return null (there may be x86_fp80 and fp128 values, that are not supported in MLIR at all). Fine for a separate commit.

Sure!

That's the side effect of Phabricator/Arcanist: it replaces the original author with whoever commits the patch. Apparently, it cannot show me the email of the original author due to some privacy concerns, so I cannot manually amend the commit unless the email is available somewhere else, e.g. in the signed-of-by field.

For future reference, is there anything I can do to make sure my name is shown in the author field?

Thanks.

If there's a name and an email available in the revision description, I'll take that. Maybe mehdi_amini has a better idea.

It is the responsibility of the person landing the patch to properly include the author in the patch, if necessary asking the author in the reviews for how they want it to appear.

By the way: arc patch honors the commit author when the patch is created with arcanist. This revision was uploaded in the web interface this is why you didn't get it automatically @ftynse

@shraiysh you may want to try to use arc diff to upload your patch in the future.

shraiysh added a comment.EditedDec 27 2019, 9:14 AM

Thanks for the clarification. I will use arc in my future patches.