This is an archive of the discontinued LLVM Phabricator instance.

[mlir][gpu] Unroll ops on vectors which map to intrinsic calls
ClosedPublic

Authored by csigg on Oct 20 2022, 5:57 AM.

Details

Summary

Unroll ops that map to intrinsics when lowering to LLVM, because intrinsics don't support vector operands/results.

Diff Detail

Event Timeline

csigg created this revision.Oct 20 2022, 5:57 AM
Herald added a project: Restricted Project. · View Herald Transcript
csigg requested review of this revision.Oct 20 2022, 5:57 AM
csigg updated this revision to Diff 469200.Oct 20 2022, 6:05 AM

Nothing.

Just passing by :). It looks like this is scalarizing a vector operation which sounds like a generic utility that might be worth moving out of GPU? Perhaps VectorUtils.h is a good place?

I'm also wondering if we already have something like that already since we have some vector unrolling transformations to unroll multi-dim vectors into 1-d vectors. Maybe the can be extended and parametrized to how many dims we want to unroll, including all of them? Otherwise, we may want to call this scalarizeVectorOp or something like that?

Hopefully that helps!

Thanks Diego.

I think the vector unroll code should be the generic one, and these rewrites are merely to cope with intrinsics not being available for vectors.

I like scalarizeVectorOp.

csigg updated this revision to Diff 469491.Oct 21 2022, 12:47 AM

Rename to scalarizeVectorOp.

csigg updated this revision to Diff 471051.Oct 27 2022, 1:11 AM

Switch from lambda to template function: uglier formatting, but no uncommon c++ pattern.

herhut accepted this revision.Oct 27 2022, 11:58 AM
herhut added inline comments.
mlir/lib/Conversion/GPUCommon/GPUOpsLowering.h
88

nit: operating on

This revision is now accepted and ready to land.Oct 27 2022, 11:58 AM
csigg updated this revision to Diff 471441.Oct 28 2022, 1:32 AM

Fix comment.

This revision was landed with ongoing or failed builds.Oct 28 2022, 1:33 AM
This revision was automatically updated to reflect the committed changes.