[Mlir-commits] [mlir] [mlir][spirv] Add basic support for SPV_EXT_replicated_composites (PR #147067)
Jakub Kuderski
llvmlistbot at llvm.org
Wed Jul 9 11:06:24 PDT 2025
================
@@ -1109,6 +1109,41 @@ uint32_t Serializer::prepareConstantFp(Location loc, FloatAttr floatAttr,
return resultID;
}
+uint32_t Serializer::prepareConstantCompositeReplicate(Location loc,
+ Type resultType,
+ Attribute valueAttr) {
+
+ std::pair<Attribute, Type> valueTypePair{valueAttr, resultType};
+ if (uint32_t id = getConstantCompositeReplicateID(valueTypePair)) {
+ return id;
+ }
+
+ uint32_t typeID = 0;
+ if (failed(processType(loc, resultType, typeID))) {
+ return 0;
+ }
+
+ auto elementType = dyn_cast<CompositeType>(resultType).getElementType(0);
+ Type valueType = dyn_cast<TypedAttr>(valueAttr).getType();
+
+ uint32_t constandID;
+ if (elementType == valueType) {
+ constandID = prepareConstant(loc, elementType, valueAttr);
+ } else {
+ constandID = prepareConstantCompositeReplicate(loc, elementType, valueAttr);
+ }
+
+ uint32_t resultID = getNextID();
+ SmallVector<uint32_t> operands = {typeID, resultID, constandID};
----------------
kuhar wrote:
also here
https://github.com/llvm/llvm-project/pull/147067
More information about the Mlir-commits
mailing list