Lunderberg commented on a change in pull request #9727:
URL: https://github.com/apache/tvm/pull/9727#discussion_r808071250
##########
File path: src/tir/analysis/device_constraint_utils.cc
##########
@@ -223,6 +225,23 @@ class ApplyDeviceConstraintsMutator : public
StmtExprMutator {
any_change = true;
}
new_buffer_map.Set(param, new_buffer);
+
+ // Rewrite the pre-flattened buffers to account for constraint.
+ // This only has an impact if the IRModule being analyzed has
+ // already been run through the StorageFlatten or FlattenBuffer
+ // passes.
+ if (auto opt = prim_func->preflattened_buffer_map.Get(param)) {
+ Buffer pf_buffer = opt.value();
+ if (pf_buffer.same_as(buffer)) {
Review comment:
That's correct. The preflattened buffer can be the same as the buffer
itself if the tensor was 1-d, and is then backed by a flattened 1-d buffer.
The check here is trying to avoid breaking reference equality of `Buffer`
objects, should the input primfunc have reference equality.
--
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]