Lunderberg commented on a change in pull request #8528:
URL: https://github.com/apache/tvm/pull/8528#discussion_r679154816
##########
File path: src/tir/ir/expr.cc
##########
@@ -618,8 +619,38 @@ Load::Load(DataType dtype, Var buffer_var, PrimExpr index,
PrimExpr predicate, S
ICHECK(buffer_var.defined());
ICHECK(predicate.defined());
ICHECK(index.defined());
- ICHECK_EQ(dtype.lanes(), index.dtype().lanes());
- ICHECK_EQ(dtype.lanes(), predicate.dtype().lanes());
+
+ // Assume that the array elements have 1 lane, unless a type
+ // annotation tells us otherwise.
+ int element_lanes = 1;
+ auto pointer_type = tir::GetPointerType(buffer_var->type_annotation);
+ if (pointer_type.first) {
+ // Cannot check element type of array, as it may be different than
+ // the loaded type in some cases.
+ //
+ // 1. Booleans use DataType::Int(8) while stored, and the codegens
+ // handle cast to boolean.
+ //
+ // 2. The StorageRewrite pass can merge multiple allocations at
+ // the same scope, regardless of element type. The codegen is
+ // then responsible for casting to the output type.
+
+ // ICHECK(dtype.element_of() == pointer_type.second.element_of())
Review comment:
Good call, and I will change them to an explicit TODO.
Edit: And did similarly for the corresponding check in `Store::Store`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]