[Mlir-commits] [mlir] [mlir][TensorToSPIRV] Add check for `tensor.extract` in TensorToSPIRV (PR #107110)

Jakub Kuderski llvmlistbot at llvm.org
Tue Sep 3 07:01:10 PDT 2024


================
@@ -45,6 +45,9 @@ class TensorExtractPattern final
                   ConversionPatternRewriter &rewriter) const override {
     auto tensorType = cast<RankedTensorType>(extractOp.getTensor().getType());
 
+    if (!tensorType.getElementType().isIntOrFloat())
+      return rewriter.notifyMatchFailure(extractOp,
+                                         "only integers and floats supported");
----------------
kuhar wrote:

This looks fine, but I wonder if this should really be `if (!isa<spirv::ScalarType>(tensorType.getElementType))` to also reject invalid integer/float types? For example `i128` shouldn't be supported.

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


More information about the Mlir-commits mailing list