This is an archive of the discontinued LLVM Phabricator instance.

[mlir][linalg] Cleanup LinalgOp usage in promotion.
ClosedPublic

Authored by gysit on Jun 1 2021, 4:45 AM.

Details

Summary

Replace the uses of deprecated Structured Op Interface methods in Promotion.cpp. This patch is based on https://reviews.llvm.org/D103394.

Diff Detail

Event Timeline

gysit created this revision.Jun 1 2021, 4:45 AM
gysit requested review of this revision.Jun 1 2021, 4:45 AM
stella.stamenova added inline comments.
mlir/lib/Dialect/Linalg/Transforms/Promotion.cpp
335

Since operandNumber is already an int64_t, this cast is unnecessary.

I would not consider this an NFC and I think the title should be updated to not include the NFC designation. It might not be changing the intended functionality, but it is changing the logic (and functions called) to achieve the result.

mlir/lib/Dialect/Linalg/Transforms/Promotion.cpp
327

I thought getOperandNumber returned an unsigned? I would expect assigning an unsigned value to an int64_t to generate a warning.

gysit updated this revision to Diff 349308.Jun 2 2021, 9:58 AM

Address comment.

gysit added inline comments.Jun 2 2021, 10:13 AM
mlir/lib/Dialect/Linalg/Transforms/Promotion.cpp
327

I will check if there is an error but I believe the cast happens implicitly here:

c.f. "The compiler doesn't warn about implicit conversions between signed and unsigned integral types." taken from https://docs.microsoft.com/en-us/cpp/cpp/type-conversions-and-type-safety-modern-cpp?view=msvc-160

335

Thanks for the hint!

mlir/lib/Dialect/Linalg/Transforms/Promotion.cpp
327

The Visual Studio compiler, clang and gcc often behave very differently and raise different warnings. They are also all supported by llvm/mlir/etc. Generally, though, the expectation is that the code will be warning-free when building with clang, so I would recommend trying that to see if there are any warnings.

nicolasvasilache retitled this revision from [mlir][linalg] Cleanup LinalgOp usage in promotion (NFC). to [mlir][linalg] Cleanup LinalgOp usage in promotion..Jun 3 2021, 12:06 AM
nicolasvasilache accepted this revision.Jun 3 2021, 2:16 AM
This revision is now accepted and ready to land.Jun 3 2021, 2:16 AM
gysit updated this revision to Diff 349513.Jun 3 2021, 3:59 AM

Rebase.

This revision was landed with ongoing or failed builds.Jun 3 2021, 4:26 AM
This revision was automatically updated to reflect the committed changes.