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

Igor Wodiany llvmlistbot at llvm.org
Mon Apr 6 04:15:16 PDT 2026


================
@@ -1415,6 +1415,71 @@ LogicalResult spirv::INTELSubgroupBlockWriteOp::verify() {
   return success();
 }
 
+//===----------------------------------------------------------------------===//
+// spirv.INTEL.MaskedGather
+//===----------------------------------------------------------------------===//
+
+LogicalResult spirv::INTELMaskedGatherOp::verify() {
+  auto ptrVecType = cast<spirv::VectorOfPointerType>(getPtrVector().getType());
+  auto resultType = cast<VectorType>(getResult().getType());
+  unsigned numElems = resultType.getNumElements();
+
+  // Verify pointee type matches result element type.
+  if (ptrVecType.getElementType().getPointeeType() !=
+      resultType.getElementType())
+    return emitOpError(
+        "pointer pointee type must match result vector element type");
+
+  // Verify element counts match.
+  if (ptrVecType.getNumElements() != numElems)
+    return emitOpError(
+        "ptr_vector must have the same number of elements as result");
+
+  // Verify mask is a vector of i1.
+  auto maskType = cast<VectorType>(getMask().getType());
+  if (!maskType.getElementType().isInteger(1))
+    return emitOpError("mask must be a vector of i1");
+  if (maskType.getNumElements() != numElems)
+    return emitOpError("mask must have the same number of elements as result");
+
+  // Verify fill_empty matches result type.
+  if (getFillEmpty().getType() != resultType)
+    return emitOpError("fill_empty must have the same type as result");
+
+  return success();
+}
+
+//===----------------------------------------------------------------------===//
+// spirv.INTEL.MaskedScatter
+//===----------------------------------------------------------------------===//
+
+LogicalResult spirv::INTELMaskedScatterOp::verify() {
----------------
IgWod wrote:

Same comments as above.

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


More information about the Mlir-commits mailing list