[Mlir-commits] [mlir] [MLIR] support dynamic indexing of `vector.maskedload` in `VectorEmulateNarrowTypes` (PR #115070)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Nov 7 09:14:05 PST 2024


================
@@ -53,6 +53,7 @@ static FailureOr<Operation *> getCompressedMaskOp(OpBuilder &rewriter,
                                                   Location loc, Value mask,
                                                   int origElements, int scale,
                                                   int intraDataOffset = 0) {
+  assert(intraDataOffset < scale && "intraDataOffset must be less than scale");
----------------
lialan wrote:

* `origElements` is the number of elements of the subbyte vector
* `scale` is `byte-emulated element type size  / original element type size`. For example, if the original elem type is `i2`, then the `scale` is `sizeof(i8)/sizeof(i2) = 4`.
* `intraDataOffset` is the element offset into the emulated byte. For example, to extract the second slice of `vector<3xi2>` out from a `vector<3x3xi2>` (here we assume the subbyte type elements are stored in memory packed), we would need to load 2 bytes (the first and second byte), and extract  bit `[7, 14)` out from it. so the first 3 elements are irrelevant in this case, hence `intraDataOffset == 3` in such case.

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


More information about the Mlir-commits mailing list