From d2ea7fdb6d12df1410d33c745fd0dd8b04401109 Mon Sep 17 00:00:00 2001 From: dabaiji Date: Mon, 22 Jun 2020 16:14:54 +0800 Subject: [PATCH] fix inefficient auto tiling for axis with tail and remove duplicated check --- src/poly/tiling_analyzer.cc | 2 -- src/poly/tiling_solver.cc | 9 +++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/poly/tiling_analyzer.cc b/src/poly/tiling_analyzer.cc index eb33c8a..1eb5aad 100644 --- a/src/poly/tiling_analyzer.cc +++ b/src/poly/tiling_analyzer.cc @@ -444,12 +444,10 @@ int64_t TileCandidate::CalActualTile(const CalAlignInfo *align_info) { void TileCandidate::UpdateMemoryAfterBuffer(const BufferEntry *buf, MemInferInfo *mem_infer_info) { CHECK(buf); CHECK(mem_infer_info); - CHECK(buf); const auto fix_size = buf->shape.as(); if (fix_size == nullptr) { std::stringstream ss; ss << "Buffer " << buf->name << " contains dynamic shape " << buf->shape << ", skip."; - analyzer_->logger_.AppendLog(DO_TILING, ss); return; } diff --git a/src/poly/tiling_solver.cc b/src/poly/tiling_solver.cc index fa3680f..a30542d 100644 --- a/src/poly/tiling_solver.cc +++ b/src/poly/tiling_solver.cc @@ -936,16 +936,17 @@ bool TraverseSolver::DoTiling(const TileInfo *info) { if (!mem_ok) continue; success = true; - if (dst % t == 0) { + auto tail = dst % t; + if (tail == 0) { if (deviation > best_no_iso_devs) continue; ss << "factor " << t << " has " << deviation << " deviation, update to no isolate factor"; best_no_iso_val = t; best_no_iso_devs = deviation; } else { if (deviation > best_devs) continue; - if (analyzer_.scop_->pragma_allow_tail_tiling_) { - auto tail = dst - dst / t * t; - if (tail % GetMaxAlignBytes(axis->data_size) != 0) continue; + if (analyzer_.scop_->pragma_allow_tail_tiling_ && tail < GetMaxAlignBytes(axis->data_size)) { + ss << "factor " << t << " has " << tail << " tail that may disable multicore, skip."; + continue; } ss << "factor " << t << " has " << deviation << " deviation, update to isolate factor"; best_val = t; -- GitLab