From 3349d8d746b686b1ddb3d3eb6973a1ae40cdbeb8 Mon Sep 17 00:00:00 2001 From: Zhiwen Mo Date: Tue, 11 Nov 2025 18:11:18 +0800 Subject: [PATCH 1/3] fix --- src/op/parallel.cc | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/src/op/parallel.cc b/src/op/parallel.cc index 95817d179..81777aa53 100644 --- a/src/op/parallel.cc +++ b/src/op/parallel.cc @@ -649,37 +649,8 @@ Fragment ParallelOpNode::CompleteBufferFragment(const Buffer &buffer) const { DivideUnusedIterators(indice_map_[buffer], loop_vars_, &analyzer_)); auto bijective_indice = indice_map_[buffer]; bijective_indice.push_back(rep_b); - Layout layout_before_inv = Layout(loop_vars_, bijective_indice); - - // Pre-check cardinality to guard non-bijective combinations after adding - // rep_b. - PrimExpr in_prod = 1; - for (const auto &iv : loop_vars_) - in_prod *= iv->dom->extent; - PrimExpr out_prod = 1; - for (const auto &d : layout_before_inv->OutputShape()) - out_prod *= d; - - if (!analyzer_.CanProveEqual(in_prod, out_prod)) { - DLOG(WARNING) << " Non-bijective mapping after appending rep_b; falling " - "back to no-rep inversion."; - Layout ind_inv_fallback = - Layout(loop_vars_, indice_map_[buffer])->Inverse(); - PrimExpr indice_rep_extent = 1; - PrimExpr loop_rep_extent = loop_layout_->ReplicateExtent(); - PrimExpr dest_buffer_rep_extent = indice_rep_extent * loop_rep_extent; - Array fwd2; - for (size_t i = 0; i < buffer->shape.size(); i++) { - fwd2.push_back(InputPlaceholder(i)); - } - PrimExpr thd_b = loop_layout_->ForwardThread( - ind_inv_fallback->Forward(fwd2), std::nullopt); - return Fragment(buffer->shape, {}, thd_b, dest_buffer_rep_extent, - std::nullopt) - ->CondenseReplicateVar(); - } + Layout ind_inv = Layout(loop_vars_, bijective_indice)->Inverse(); - Layout ind_inv = layout_before_inv->Inverse(); PrimExpr indice_rep_extent = ind_inv->InputShape().back(); // this is the size of rep_b PrimExpr loop_rep_extent = loop_layout_->ReplicateExtent(); From e4e55dee5582e0efd035921c586a17b3cec67e11 Mon Sep 17 00:00:00 2001 From: Zhiwen Mo Date: Tue, 11 Nov 2025 19:15:20 +0800 Subject: [PATCH 2/3] Fix logging level in LayoutNode::InverseWithLevel method from WARNING to DLOG for symbolic layout fallback. --- src/layout/layout.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/layout/layout.cc b/src/layout/layout.cc index de428fc59..ff573052d 100644 --- a/src/layout/layout.cc +++ b/src/layout/layout.cc @@ -250,7 +250,7 @@ std::pair LayoutNode::InverseWithLevel() const { if (!is_static_shape) { // Runtime guards keep dynamic tails safe, so we allow NoCheck here and // warn. - LOG(WARNING) << "Layout::Inverse on symbolic layout, falling back to " + DLOG(WARNING) << "Layout::Inverse on symbolic layout, falling back to " "NoCheck; symbolic dims: " << symbolic_dims; } From 4f6e654b48af99c3c12cd8465362d5e0497791d3 Mon Sep 17 00:00:00 2001 From: Zhiwen Mo Date: Tue, 11 Nov 2025 19:15:40 +0800 Subject: [PATCH 3/3] lint fix --- src/layout/layout.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/layout/layout.cc b/src/layout/layout.cc index ff573052d..892f13770 100644 --- a/src/layout/layout.cc +++ b/src/layout/layout.cc @@ -251,8 +251,8 @@ std::pair LayoutNode::InverseWithLevel() const { // Runtime guards keep dynamic tails safe, so we allow NoCheck here and // warn. DLOG(WARNING) << "Layout::Inverse on symbolic layout, falling back to " - "NoCheck; symbolic dims: " - << symbolic_dims; + "NoCheck; symbolic dims: " + << symbolic_dims; } arith::IterMapResult res = arith::DetectIterMap(forward_index_, getVarMap(), 1, level, &analyzer);