Skip to content

Commit

Permalink
Enhance LoopVectorizer for vectorizing by 0. Found at least one case …
Browse files Browse the repository at this point in the history
…from testtopi/tests/python/test_topi_transform.py::test_tile.
  • Loading branch information
yongfeng-nv committed Feb 24, 2020
1 parent 7fa292b commit 15b4e8f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/tir/pass/vectorize_loop.cc
Original file line number Diff line number Diff line change
Expand Up @@ -524,9 +524,13 @@ class LoopVectorizer : public StmtMutator {
CHECK(is_zero(op->min));
int lanes = 0;
bool succ = arith::GetConstInt(op->extent, &lanes);
if (!succ || lanes < 1) {
if (!succ || lanes < 0) {
LOG(FATAL) << "Failed to vectorize loop with extent " << op->extent;
}
if (lanes == 0) {
// Nothing to run. This may happen when a tensor has 0-sized dimension.
return Stmt();
}
return Vectorizer(op->loop_var, lanes)(op->body);
} else {
return StmtMutator::VisitStmt_(op);
Expand Down

0 comments on commit 15b4e8f

Please sign in to comment.