[Mlir-commits] [mlir] [mlir][Vector] Add a rewrite pattern for better low-precision bitcast… (PR #66387)

Nicolas Vasilache llvmlistbot at llvm.org
Mon Sep 18 05:56:28 PDT 2023


nicolasvasilache wrote:

> Food for thoughts: I wonder if this rewrite is at all useful if the input type of the `trunci` is as hostile for the LLVM backend (w.r.t. legalization and lowering) as the output type of `trunci`.
> 
> E.g., Does it make sense to do this rewrite for `trunci i13 to i5`?

Indeed, this is what the following captures:
```
    // TODO: consider relaxing this restriction in the future if we find ways
    // to really work with subbyte elements across the MLIR/LLVM boundary.
    int64_t resultBitwidth = targetVectorType.getElementTypeBitWidth();
    if (resultBitwidth % 8 != 0)
      return rewriter.notifyMatchFailure(bitCastOp, "bitwidth is not k * 8");
```


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


More information about the Mlir-commits mailing list