This is an archive of the discontinued LLVM Phabricator instance.

[mlir][LLVMIR] Change ShuffleVectorOp to use assembly format
ClosedPublic

Authored by Mogball on Aug 17 2022, 9:35 AM.

Details

Summary

This patch moves LLVM::ShuffleVectorOp to assembly format and in the
process drops the extra type that can be inferred (both operand types
are required to be the same) and switches to a dense integer array.

The syntax change:

// Before
%0 = llvm.shufflevector %0, %1 [0 : i32, 0 : i32, 0 : i32, 0 : i32] : vector<4xf32>, vector<4xf32>
// After
%0 = llvm.shufflevector %0, %1 [0, 0, 0, 0] : vector<4xf32>

Diff Detail

Event Timeline

Mogball created this revision.Aug 17 2022, 9:35 AM
Mogball requested review of this revision.Aug 17 2022, 9:35 AM
dcaballe accepted this revision.Aug 17 2022, 10:33 AM

Thanks for improving this op, Jeff! Other than the i64->i32 comment, LGTM. Please, give some time for others to take a look. Thanks.

mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
796

I think the mask should be I32, not I64, per LangRef doc. Of maybe the doc is not up-to-date?

This revision is now accepted and ready to land.Aug 17 2022, 10:33 AM
rriddle added inline comments.Aug 17 2022, 10:36 AM
mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
796

+1, this should be i32.

mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
2071
Mogball added inline comments.Aug 17 2022, 10:44 AM
mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
796

Yes, it should be i32. Let me change that.

Mogball marked 3 inline comments as done.Aug 17 2022, 11:09 AM
Mogball updated this revision to Diff 453356.Aug 17 2022, 11:14 AM

Change to i32

Mogball updated this revision to Diff 453688.Aug 18 2022, 9:45 AM

rebase onto main

Mogball edited the summary of this revision. (Show Details)Aug 18 2022, 9:45 AM
This revision was landed with ongoing or failed builds.Aug 18 2022, 9:46 AM
This revision was automatically updated to reflect the committed changes.
tpopp added a subscriber: tpopp.Aug 18 2022, 10:07 AM

Drive by nit... The important parts to me in regards to this change are:

  1. The change to the assembly format
  2. The change in types that break C++ code interacting with this class

So I was surprised to see various breakages from a CL with a subject that alone sounded like it just changed an implementation detail. Obviously, it's not a big deal, but I just wanted to mention it :)