[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 10:47:08 PDT 2026


================
@@ -213,6 +213,42 @@ void Serializer::processCapability() {
                           {static_cast<uint32_t>(cap)});
 }
 
+void Serializer::addLongCompositesCapability() {
+  if (longCompositesEmitted)
+    return;
+  longCompositesEmitted = true;
----------------
kuhar wrote:

Possible duplicate `OpCapability LongCompositesINTEL` / `OpExtension SPV_INTEL_long_composites`.

`addLongCompositesCapability()` unconditionally appends both an `OpCapability` and an `OpExtension` to `capabilities`/`extensions` once a split happens. But `processCapability()` (lines 210-214) and `processExtension()` (lines 265-282) have already iterated over `module.getVceTriple()`. If the input IR already declares `LongCompositesINTEL` / `SPV_INTEL_long_composites` in its VCE triple (the natural thing to do once an MLIR producer becomes aware of the limit), the binary will contain two `OpCapability LongCompositesINTEL` and two `OpExtension "SPV_INTEL_long_composites"` instructions.

The SPIR-V spec doesn't strictly forbid duplicates, but `spirv-val` flags duplicate capabilities and several validators reject them.

Also, there is no test that exercises this path (long composite + IR already declares the capability/extension). Adding one would have caught this.

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


More information about the Mlir-commits mailing list