This is an archive of the discontinued LLVM Phabricator instance.

Fix handling of special and large vals in expand pattern for `round`
ClosedPublic

Authored by ramiro050 on Apr 14 2023, 5:01 PM.

Details

Summary

The current expand pattern for math.round does not handle the
special values -0.0, +-inf, and +-nan correctly. It also does not
properly handle values with magnitude |x| >= 2^23. Lastly, the pattern
generates invalid IR when the input to math.round is a vector. This
patch fixes these issues.

Diff Detail

Event Timeline

ramiro050 created this revision.Apr 14 2023, 5:01 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 14 2023, 5:01 PM
ramiro050 requested review of this revision.Apr 14 2023, 5:01 PM
ramiro050 added inline comments.Apr 14 2023, 5:04 PM
mlir/test/Dialect/Math/expand-math.mlir
196

If support for f64 is needed, I'm happy to add that.

ramiro050 edited the summary of this revision. (Show Details)Apr 14 2023, 5:05 PM
rsuderman accepted this revision.Apr 18 2023, 10:19 AM

Without f64 should be fine. If this becomes an issue we can clean it up after.

This revision is now accepted and ready to land.Apr 18 2023, 10:19 AM