This is an automated email from the ASF dual-hosted git repository.
tqchen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push:
new 8a914e5892 [TIR] Fix trivial index map [] -> [0] (#18154)
8a914e5892 is described below
commit 8a914e58925557741aca6d7453e5d94004254079
Author: wrongtest <[email protected]>
AuthorDate: Thu Jul 24 19:59:47 2025 +0800
[TIR] Fix trivial index map [] -> [0] (#18154)
fix trivial index map [] -> [0]
Co-authored-by: wrongtest <[email protected]>
---
src/tir/ir/index_map.cc | 2 +-
src/tir/schedule/primitive/layout_transformation.cc | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/tir/ir/index_map.cc b/src/tir/ir/index_map.cc
index c722af555a..3b91c5e84b 100644
--- a/src/tir/ir/index_map.cc
+++ b/src/tir/ir/index_map.cc
@@ -218,7 +218,7 @@ Array<Range> IndexMapNode::MapRanges(const Array<Range>&
ranges, arith::Analyzer
}
}
auto output_dtype = [&]() {
- int max_bits = 0;
+ int max_bits = ranges.empty() ? 32 : 0;
for (const auto& range : ranges) {
max_bits = std::max(max_bits, range->extent.dtype().bits());
}
diff --git a/src/tir/schedule/primitive/layout_transformation.cc
b/src/tir/schedule/primitive/layout_transformation.cc
index 5cce3ea775..8931c0e71c 100644
--- a/src/tir/schedule/primitive/layout_transformation.cc
+++ b/src/tir/schedule/primitive/layout_transformation.cc
@@ -1464,6 +1464,10 @@ void TransformBlockLayout(ScheduleState self, const
StmtSRef& block_sref,
}
// Step 6: Do the actual replacement
+ if (scope_sref->StmtAs<BlockNode>()) {
+ ICHECK(new_loop_vars.empty()) << "Invalid block to loop replacement due to
layout transform "
+ << index_map;
+ }
self->Replace(scope_sref, body, {{block, new_block}});
}