[Mlir-commits] [mlir] [mlir][vector] Clarify the semantics of BroadcastOp (PR #101928)
Andrzej WarzyĆski
llvmlistbot at llvm.org
Tue Aug 6 02:06:02 PDT 2024
================
@@ -2391,12 +2391,28 @@ mlir::vector::isBroadcastableTo(Type srcType, VectorType dstVectorType,
// (all leading dimensions are simply duplicated).
int64_t lead = dstRank - srcRank;
for (int64_t r = 0; r < srcRank; ++r) {
+ bool mismatch = false;
----------------
banach-space wrote:
Naming is hard ... Here's an attempt to explain:
1. `mismatch` - bool to model whether a mismatch in dims has been found. I am introducing this to be able to replace logic like this:
```cpp
if (complex_conditions_for_fixed_width_widh_dims || complex_conditions_for_scalable_flags)
// Do sth when dims mismatch
```
with something like this:
```cpp
if (complex_conditions_for_fixed_width_dims)
mismatch = true;
if (complex_conditions_for_scalable_flags)
mismatch = true;
if (mismatch)
// Do sth when dims mismatch
```
2. `mismatchingDims` - pointer to the result. If `! = nullptr` then we'll use it to pass the first dimension that mismatched. I'll add `!=nullptr` to disambiguate a bit.
https://github.com/llvm/llvm-project/pull/101928
More information about the Mlir-commits
mailing list