This is an archive of the discontinued LLVM Phabricator instance.

[mlir][spirv] Relax restriction on pointer type for CooperativeMatrix load/store
ClosedPublic

Authored by ThomasRaoux on Jul 30 2020, 5:53 PM.

Details

Summary

This change allow CooperativeMatrix Load/Store operations to use pointer type that may not match the matrix element type. This allow us to declare buffer with a larger type size than the matrix element type. This follows SPIR-V spec and this is needed to be able to use cooperative matrix in combination with shared local memory efficiently.

Diff Detail

Event Timeline

ThomasRaoux created this revision.Jul 30 2020, 5:53 PM
ThomasRaoux requested review of this revision.Jul 30 2020, 5:53 PM
mravishankar accepted this revision.Jul 30 2020, 6:52 PM
mravishankar added inline comments.
mlir/include/mlir/Dialect/SPIRV/SPIRVCooperativeMatrixOps.td
114

nit : we can make the IR a bit nicer by saying

: !spv.ptr<..> as !spv.coopmatrix

cause it is effectively casting while loading...

248–250

nit: please fix indentation.

mlir/lib/Dialect/SPIRV/SPIRVOps.cpp
2836

Are we using the PhysicalStorageBuffer? Maybe just have Workgroup and StorageBuffer for now?

This revision is now accepted and ready to land.Jul 30 2020, 6:52 PM
ThomasRaoux marked an inline comment as done.Jul 30 2020, 7:56 PM
ThomasRaoux added inline comments.
mlir/include/mlir/Dialect/SPIRV/SPIRVCooperativeMatrixOps.td
114

Sure, changed it.

mlir/lib/Dialect/SPIRV/SPIRVOps.cpp
2836

Is there a point limiting it? We are not using it right now but if anybody wants to use it, it should just work.