This is an archive of the discontinued LLVM Phabricator instance.

[mlirv][spirv] Add KHR Cooperative Matrix type and extension
ClosedPublic

Authored by kuhar on Jul 10 2023, 12:21 PM.

Details

Summary

Start plumbing through support for the SPV_KHR_cooperative_matrix
extension: https://github.com/KhronosGroup/SPIRV-Registry/blob/master/extensions/KHR/SPV_KHR_cooperative_matrix.html.

Register the extension, add new coop matrix type, and add
spirv.KHR.CooperativeMatrixLength op to exercise it.

Make sure that mixing of the KHR and NV coop matrix extensions is not
allowed. Make cast verification more robust.

Diff Detail

Event Timeline

kuhar created this revision.Jul 10 2023, 12:21 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 10 2023, 12:21 PM
kuhar requested review of this revision.Jul 10 2023, 12:21 PM
kuhar edited the summary of this revision. (Show Details)Jul 10 2023, 12:22 PM
kuhar updated this revision to Diff 538769.Jul 10 2023, 12:23 PM

Clean up

kuhar updated this revision to Diff 538771.Jul 10 2023, 12:25 PM

Drop some unnecessary auto

qedawkins accepted this revision.Jul 11 2023, 9:42 PM

Might want to wait for @antiagainst to take a look as well.

mlir/include/mlir/Dialect/SPIRV/IR/SPIRVCooperativeMatrixOps.td
33

nit: attribute

mlir/test/Dialect/SPIRV/IR/types.mlir
453

The extension documentation indicates that only 0, 1, and 2 are valid uses. Should we verify that as a part of the type?

This revision is now accepted and ready to land.Jul 11 2023, 9:42 PM
kuhar added inline comments.Jul 11 2023, 9:51 PM
mlir/test/Dialect/SPIRV/IR/types.mlir
453

Good point, although we should probably name these (MatrixA, MatrixB, MatrixAcc) instead of using plain integers, just like we do with the scope part.

kuhar updated this revision to Diff 539674.Jul 12 2023, 12:21 PM

Add a new enum attribute to represent coop matrix use.
Fix a typo.

kuhar marked 2 inline comments as done.Jul 12 2023, 12:21 PM
antiagainst accepted this revision.Jul 12 2023, 5:29 PM

Nice work, thanks Jakub!

mlir/test/Dialect/SPIRV/IR/types.mlir
453

Yes, the symbolic ones certainly are better.