[Mlir-commits] [mlir] [mlir][Vector] Refactor VectorEmulateNarrowType.cpp (PR #123529)
Andrzej Warzyński
llvmlistbot at llvm.org
Mon Mar 10 08:59:24 PDT 2025
================
@@ -1091,6 +1091,38 @@ struct ConvertVectorMaskedLoad final
}
};
+/// Check whether `subByteVecTy` fits wthin a vector of `multiByteScalarTy`
+///
+/// "Fitting" means that `subByteVecTy` (a vector of sub-byte elements, e.g.
+/// vector<4xi4>), can fit within N scalar elements of type `multiByteScalarTy`
+/// (a multi-byte scalar, e.g. i16), where N is some integer.
+///
+/// Put differently, this method checks whether this would be valid:
+///
+/// vector.bitcast subByteVecTy into vector<N x multiByteScalarTy>
+///
+/// EXAMPLES:
+/// * vector<4xi4> -> i16 - yes (N = 1)
+/// * vector<4xi4> -> i8 - yes (N = 2)
+/// * vector<3xi4> -> i8 - no (N would have to be 1.5)
+/// * vector<3xi2> -> i16 - no (N would have to be 0.5)
+static bool isSubByteVecFittable(VectorType subByteVecTy,
----------------
banach-space wrote:
Naming is hard! Thanks for the suggestion. How about: `fitsInMultiByteContainerTy`:
* dropped `size` as we are not passing `size`, and
* replaced `Scalar` with `Container` to solidify the intent (while it is a "scalar", it's a special scalar that is meant to be a container 😅 )
WDYT? Please give me your honest answer, it's important to make this clear for everyone.
https://github.com/llvm/llvm-project/pull/123529
More information about the Mlir-commits
mailing list