This is an automated email from the ASF dual-hosted git repository.
spectrometerHBH pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm-tirx.git
The following commit(s) were added to refs/heads/main by this push:
new 7aa3ea86a [Transform] Preserve view pointer types in
LowerTensorLayouts (#169)
7aa3ea86a is described below
commit 7aa3ea86a3966b5fe148c7582a4070664a47d7fa
Author: Lei Wang <[email protected]>
AuthorDate: Wed Nov 4 01:59:51 2026 +0800
[Transform] Preserve view pointer types in LowerTensorLayouts (#169)
---
src/tirx/transform/lower_tensor_layouts.cc | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/tirx/transform/lower_tensor_layouts.cc
b/src/tirx/transform/lower_tensor_layouts.cc
index 28e5fef31..41fd2530d 100644
--- a/src/tirx/transform/lower_tensor_layouts.cc
+++ b/src/tirx/transform/lower_tensor_layouts.cc
@@ -118,7 +118,12 @@ class LayoutApplier : public
StmtExprMutatorWithConstraintContext {
if (auto mapped = VarRemapGetExpected(root).value(); mapped !=
nullptr) {
root = mapped.as_or_throw<Var>();
}
- return root.as_or_throw<TensorVar>().data();
+ Expr data = root.as_or_throw<TensorVar>().data();
+ // Preserve a view's pointer type when resolving its physical storage.
+ if (!ffi::StructuralEqual()(data->ty, op->ty)) {
+ return reinterpret(op->ty, std::move(data), op->loc);
+ }
+ return data;
}
}
return StmtExprMutatorWithConstraintContext::Mutate_(op, inplace_mode);