This is an archive of the discontinued LLVM Phabricator instance.

[MLIR] Expose `getAsValues` in `StaticValueUtils.h` (NFC)
ClosedPublic

Authored by chelini on Sep 22 2022, 9:36 AM.

Details

Summary

The utility function should live in StaticValueUtils.h as it provides
a convenient way to convert a vector of OpFoldResults into a vector of
Values.

Event Timeline

chelini created this revision.Sep 22 2022, 9:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 22 2022, 9:36 AM
chelini requested review of this revision.Sep 22 2022, 9:36 AM
nicolasvasilache accepted this revision.Sep 23 2022, 4:11 AM
This revision is now accepted and ready to land.Sep 23 2022, 4:11 AM
ftynse added a subscriber: ftynse.Sep 23 2022, 5:59 AM
ftynse added inline comments.
mlir/include/mlir/Dialect/Utils/StaticValueUtils.h
83–84

Nit: please document that this expects constant values to be IntegerAttributes and that it will create Index-typed constants.

chelini updated this revision to Diff 462825.Sep 26 2022, 12:01 AM

Update comments.

chelini marked an inline comment as done.Sep 26 2022, 12:05 AM
This revision was landed with ongoing or failed builds.Sep 26 2022, 12:37 AM
This revision was automatically updated to reflect the committed changes.
chelini reopened this revision.Sep 26 2022, 9:03 AM
This revision is now accepted and ready to land.Sep 26 2022, 9:03 AM
chelini updated this revision to Diff 462934.Sep 26 2022, 9:03 AM

Fix shared libs build.

This revision was landed with ongoing or failed builds.Sep 26 2022, 9:09 AM
This revision was automatically updated to reflect the committed changes.
cota added a comment.Sep 26 2022, 12:32 PM

This change introduces a circular build dependence: DialectUtils <- ArithmeticUtils <- ArithDialect <- DialectUtils.

chelini: can you either revert or break the cycle? I don't see a trivial way of doing the latter.

This change introduces a circular build dependence: DialectUtils <- ArithmeticUtils <- ArithDialect <- DialectUtils.

chelini: can you either revert or break the cycle? I don't see a trivial way of doing the latter.

Reverted. Thanks for catching this.

akuegel added a subscriber: akuegel.EditedSep 26 2022, 11:49 PM

This change introduces a circular build dependence: DialectUtils <- ArithmeticUtils <- ArithDialect <- DialectUtils.

chelini: can you either revert or break the cycle? I don't see a trivial way of doing the latter.

I think you talk about the Bazel build, right? Actually I think the ArithDialect to DialectUtils dependency is unused. Yesterday when this change landed first, I had the Bazel build working by removing that unused dependency.
Please check https://github.com/llvm/llvm-project/commit/ec8f08ce08c26f6db61b142ba40590c3c1d158a0 and https://github.com/llvm/llvm-project/commit/b4cc363e86e7506e41560af333b12beefd9f4bbd

@chelini if you roll forward, please consider updating the Bazel BUILD files like I did in the two revisions mentioned above

@chelini if you roll forward, please consider updating the Bazel BUILD files like I did in the two revisions mentioned above

The Bazel build isn't officially supported by the LLVM community and should not be considered a strong motive for reverting patches, nor it should be a requirement that people build with Bazel *before* landing their patches on generic LLVM code.

If the Bazel community wants to have that kind of support in LLVM, then they'll need a new round of RFCs and convince everyone that this is a good idea. IMO, this will not happen any time soon.

@chelini, if this is the last problem with your patch, feel free to re-land it and let the Bazel folks fix this upstream on their end.

cheers,
--renato

@chelini if you roll forward, please consider updating the Bazel BUILD files like I did in the two revisions mentioned above

The Bazel build isn't officially supported by the LLVM community and should not be considered a strong motive for reverting patches, nor it should be a requirement that people build with Bazel *before* landing their patches on generic LLVM code.

If the Bazel community wants to have that kind of support in LLVM, then they'll need a new round of RFCs and convince everyone that this is a good idea. IMO, this will not happen any time soon.

@chelini, if this is the last problem with your patch, feel free to re-land it and let the Bazel folks fix this upstream on their end.

cheers,
--renato

Sorry, I didn't intend to say that it is required to fix the Bazel build when relanding the change. My intent was just to say it would be nice if that is done, given that it is just applying the two patches I pointed to. We can certainly also do this ourselves.

chelini reopened this revision.Sep 27 2022, 3:20 AM
This revision is now accepted and ready to land.Sep 27 2022, 3:20 AM
cota accepted this revision.Sep 27 2022, 7:26 AM

@akuegel is right, my apologies. I wrongly assumed that in Cmake, ArithDialect depends on DialectUtils, just like it (unnecessarily) does in Bazel. I confirm that removing that superfluous dependence fixes the cycle in Bazel.

@chelini: please feel free to reland this and I will update the Bazel files.

cota added a comment.Sep 27 2022, 7:29 AM

@rengolin: AFAIK we do not want dependency cycles in the build system (Cmake or otherwise). I wrongly thought I was reporting one such case.

chelini updated this revision to Diff 463232.Sep 27 2022, 7:34 AM

Update Bazel build as suggested.

@cota and @akuegel please have a look a the latest changes. If you are happy with them please land it. Thanks!

This revision was automatically updated to reflect the committed changes.