Enable inset/extract/construct composite ops as well as access chain for cooperative matrix. ConstantComposite requires more change and will be done in a separate patch.
Also fix the getNumElements function for coopMatrix per feedback from Jeff Bolz. The number of element is implementation dependent so it cannot be known at compile time.
Details
Diff Detail
Event Timeline
mlir/include/mlir/Dialect/SPIRV/SPIRVTypes.h | ||
---|---|---|
143 | Could you add a comment to getNumElements to mention that this method being false is a pre-condition? (With that actually it would be nice to rename this as hasCompileTimeKnownNumElements or something so that we don't always use it as the negate form. But a minor issue.) | |
mlir/test/Dialect/SPIRV/Serialization/cooperative-matrix.mlir | ||
100 | Can we return %1 here so we can check the return type too? Right now it's hidden. | |
mlir/test/Dialect/SPIRV/composite-ops.mlir | ||
25 | I think this should only take one operand. |
Nice, thanks! Just one more nit.
mlir/test/Dialect/SPIRV/Serialization/cooperative-matrix.mlir | ||
---|---|---|
96 | Note that according to the spec: "Cooperative matrix types (or types containing them) can only be allocated in Function or Private storage classes." So here we cannot have a pointer pointing to a coop matrix in a StorageBuffer. We should use Function/Private here. Although this is test; still would be nice to be valid. So later when we enforce this rule these tests can still pass as-is. :) | |
mlir/test/Dialect/SPIRV/cooperative-matrix.mlir | ||
98 | Same here. |
mlir/test/Dialect/SPIRV/Serialization/cooperative-matrix.mlir | ||
---|---|---|
96 | Good point, I changed it. |
mlir/lib/Dialect/SPIRV/SPIRVOps.cpp | ||
---|---|---|
1138 | nit: Merge this if into the else. |
Could you add a comment to getNumElements to mention that this method being false is a pre-condition? (With that actually it would be nice to rename this as hasCompileTimeKnownNumElements or something so that we don't always use it as the negate form. But a minor issue.)