[Mlir-commits] [mlir] [mlir][SPIR-V] Add support for SPV_INTEL_long_composites extension (PR #195685)

Jakub Kuderski llvmlistbot at llvm.org
Tue May 5 09:47:58 PDT 2026


================
@@ -125,11 +125,45 @@ LogicalResult spirv::Deserializer::sliceInstruction(
   return success();
 }
 
+void spirv::Deserializer::mergeLongCompositeContinuations(
+    spirv::Opcode opcode, ArrayRef<uint32_t> &operands,
+    SmallVectorImpl<uint32_t> &mergedStorage) {
+  std::optional<spirv::Opcode> continuationOp = getContinuationOpcode(opcode);
+  if (!continuationOp)
+    return;
+
+  auto binarySize = binary.size();
+  auto isNextContinuation = [&]() {
+    if (curOffset >= binarySize)
+      return false;
+    uint32_t wordCount = binary[curOffset] >> 16;
+    if (wordCount == 0 || curOffset + wordCount > binarySize)
+      return false;
+    return extractOpcode(binary[curOffset]) == *continuationOp;
+  };
+
+  if (!isNextContinuation())
+    return;
+
+  mergedStorage.assign(operands.begin(), operands.end());
+  do {
+    spirv::Opcode contOpcode;
+    ArrayRef<uint32_t> contOperands;
+    if (failed(sliceInstruction(contOpcode, contOperands, *continuationOp)))
+      return;
+    mergedStorage.append(contOperands.begin(), contOperands.end());
----------------
kuhar wrote:

use llvm::append_range

https://github.com/llvm/llvm-project/pull/195685


More information about the Mlir-commits mailing list