This is an archive of the discontinued LLVM Phabricator instance.

[MLIR][GPU] Detect bounds with `arith.minsi ` in loops-to-gpu
ClosedPublic

Authored by csigg on Aug 22 2022, 1:40 AM.

Details

Summary

Previously, arith.constant, arith.muli and affine.min were supported when deriving upper loop bounds when converting parallel loops to GPU.

Diff Detail

Event Timeline

csigg created this revision.Aug 22 2022, 1:40 AM
csigg requested review of this revision.Aug 22 2022, 1:40 AM
akuegel accepted this revision.Aug 22 2022, 1:44 AM
This revision is now accepted and ready to land.Aug 22 2022, 1:44 AM
This revision was landed with ongoing or failed builds.Aug 22 2022, 2:14 AM
This revision was automatically updated to reflect the committed changes.
bondhugula added a subscriber: bondhugula.EditedOct 4 2022, 5:56 AM

@csigg, the code you've added here yields a warning:

459fd3fb342d5 mlir/lib/Conversion/SCFToGPU/SCFToGPU.cpp     (Christian Sigg       2022-08-22 10:39:49 +0200 347)         if (lhs.value() < 0 != rhs.value() < 0)
... In function ‘mlir::Value deriveStaticUpperBound(mlir::Value, mlir::PatternRewriter&)’:
...mlir/lib/Conversion/SCFToGPU/SCFToGPU.cpp:347:25: warning: suggest parentheses around comparison in operand of ‘!=’ [-Wparentheses]
  347 |         if (lhs.value() <  0 != rhs.value() < 0)
      |             ~~~~~~~~~~~~^~~~

with

gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0.

csigg added a comment.Oct 4 2022, 11:59 AM

@csigg, the code you've added here yields a warning:

Thanks for letting me know. I pushed 63022c4 to fix the warning.