This is an archive of the discontinued LLVM Phabricator instance.

[mlir][arith] Add comparison-based integration tests
ClosedPublic

Authored by kuhar on Sep 19 2022, 7:39 AM.

Details

Summary

Introduces a simple framework for runtime tests of the wide integer emulation.

In these tests, we are only interested in checking that both wide and narrow calculation
produce the same results, and do not check for exact results. This allows us to cover
more of the input space, as we do not have to hardcode each of the expected outputs.

Introduce common helper functions to check the results, print a message on mismatch,
and sample the input space.

Implement runtime comparrison tests for arith.muli and arith.shrui.

Diff Detail

Event Timeline

kuhar created this revision.Sep 19 2022, 7:39 AM
Herald added a project: Restricted Project. · View Herald Transcript
kuhar requested review of this revision.Sep 19 2022, 7:39 AM
kuhar added a comment.Sep 19 2022, 7:42 AM

This is how the first 300 samples from xhash look like:

antiagainst accepted this revision.Sep 19 2022, 9:41 AM

Wonderful! Love it. :)

mlir/test/Integration/Dialect/Arithmetic/CPU/test-wide-int-emulation-compare-results-i16.mlir
97

The results of these for loops aren't used. We don't need to yield them?

143

Same here.

This revision is now accepted and ready to land.Sep 19 2022, 9:41 AM
antiagainst added inline comments.Sep 19 2022, 9:47 AM
mlir/test/Integration/Dialect/Arithmetic/CPU/test-wide-int-emulation-compare-results-i16.mlir
97

nvm, I misread it.

kuhar updated this revision to Diff 461576.Sep 20 2022, 8:34 AM

Rebased. Fixed a typo.

kuhar marked 3 inline comments as done.Sep 20 2022, 8:34 AM
This revision was landed with ongoing or failed builds.Sep 20 2022, 8:40 AM
This revision was automatically updated to reflect the committed changes.