[Mlir-commits] [mlir] [mlir][spirv] Add verification for Bias operand (PR #134231)

Jakub Kuderski llvmlistbot at llvm.org
Thu Apr 3 06:54:42 PDT 2025


================
@@ -42,6 +42,36 @@ static LogicalResult verifyImageOperands(Operation *imageOp,
   // The order we process operands is important. In case of multiple argument
   // taking operands, the arguments are ordered starting with operands having
   // smaller-numbered bits first.
+  if (spirv::bitEnumContainsAny(attr.getValue(), spirv::ImageOperands::Bias)) {
+    if (!isa<spirv::ImplicitLodOpInterface>(imageOp))
+      return imageOp->emitError(
+          "Bias is only valid with implicit-lod instructions");
+
+    if (index + 1 > operands.size())
+      return imageOp->emitError("Bias operand requires 1 argument");
+
+    if (!isa<mlir::FloatType>(operands[index].getType()))
----------------
kuhar wrote:

```suggestion
    if (!isa<FloatType>(operands[index].getType()))
```

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


More information about the Mlir-commits mailing list