This is an archive of the discontinued LLVM Phabricator instance.

[MLIR][GPU] Add constant propagator for gpu.launch op
ClosedPublic

Authored by bondhugula on Sep 17 2021, 12:20 PM.

Details

Summary

Add a constant propagator for gpu.launch op in cases where the
grid/thread IDs can be trivially determined to take a single constant
value of zero.

Diff Detail

Event Timeline

bondhugula created this revision.Sep 17 2021, 12:20 PM
bondhugula requested review of this revision.Sep 17 2021, 12:20 PM
bondhugula added a reviewer: ThomasRaoux.
ThomasRaoux accepted this revision.Sep 17 2021, 2:27 PM
ThomasRaoux added inline comments.
mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
568

nit: you can do return success(simplified);

This revision is now accepted and ready to land.Sep 17 2021, 2:27 PM

Minor update: use success(bool).

bondhugula marked an inline comment as done.Sep 17 2021, 11:36 PM
This revision was automatically updated to reflect the committed changes.
rriddle added inline comments.Sep 20 2021, 10:39 AM
mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
540–543

You should be able to use m_One in place of this.

Nice, thanks! I just have a nit about the comment. In case you touch this again anyway.

mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
534

This comment for me read as if this only applies if all of them are one. Maybe when the range of a thread or block ID?

bondhugula added inline comments.Sep 21 2021, 1:45 AM
mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
534

Thanks. I'll take care of this and the other comment from River below in an NFC PR in an hour.

bondhugula marked 2 inline comments as done.Sep 21 2021, 2:02 AM

Done - taken care of by D110136.