This is an archive of the discontinued LLVM Phabricator instance.

[mlir][LLVM] Allow scalable vectors in ShuffleVectorOp
ClosedPublic

Authored by jsetoain on Jan 27 2022, 7:59 AM.

Details

Summary

The current implementation of ShuffleVectorOp assumes all vectors are
scalable. LLVM IR allows shufflevector operations on scalable vectors,
and the current translation between LLVM Dialect and LLVM IR does the
rigth thing when the shuffle mask is all zeroes. This is required to
do a splat operation on a scalable vector, but it doesn't make sense
for scalable vectors outside of that operation, i.e.: with non-all zero
masks.

Diff Detail

Event Timeline

jsetoain created this revision.Jan 27 2022, 7:59 AM
jsetoain requested review of this revision.Jan 27 2022, 7:59 AM

This is a WiP for now. This patch comes with an issues I'd like to discuss (and fix) before it gets approved. The discussion thread is: Llvm.shufflevector operations for scalable vectors

jsetoain updated this revision to Diff 407182.Feb 9 2022, 9:20 AM

Rebase on main

jsetoain updated this revision to Diff 409569.Feb 17 2022, 3:10 AM

Add constraint for shuffles on scalable vectors

looks good, except the error reported in verify

mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
1934

I don't quite understand the error text (starting with "on").
Can you please rephrase?

jsetoain updated this revision to Diff 410763.Feb 23 2022, 3:41 AM

Change error message

jsetoain marked an inline comment as done.Feb 23 2022, 3:46 AM
jsetoain added inline comments.
mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
1934

In the end, the output would be something like "llvm.shufflevector` op on scalable vectors...", but you are right, I shouldn't abuse error handling like that. Phrasing still feels a bit awkward to me, but I hope it's clearer this way.

aartbik accepted this revision.Feb 23 2022, 9:47 AM
This revision is now accepted and ready to land.Feb 23 2022, 9:47 AM
This revision was automatically updated to reflect the committed changes.
jsetoain marked an inline comment as done.