From 05f28b4a1ec88f3080775450783115b81e20a2d5 Mon Sep 17 00:00:00 2001 From: Matthew Date: Thu, 17 Jun 2021 09:17:53 -0600 Subject: [PATCH] revert a change to lower_tvm_builtin.cc from #6126 --- src/tir/transforms/lower_tvm_builtin.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/tir/transforms/lower_tvm_builtin.cc b/src/tir/transforms/lower_tvm_builtin.cc index 0e2e612e3ae8d..906e78e00548f 100644 --- a/src/tir/transforms/lower_tvm_builtin.cc +++ b/src/tir/transforms/lower_tvm_builtin.cc @@ -114,6 +114,16 @@ class BuiltinLower : public StmtExprMutator { op = stmt.as(); // Get constant allocation bound. int64_t nbytes = GetVectorBytes(op->dtype); + if (device_type_.defined()) { + if (const auto* dev_type = device_type_.as()) { + if (dev_type->value == kDLCPU) { + int32_t constant_size = op->constant_allocation_size(); + if (constant_size > 0 && constant_size * nbytes < runtime::kMaxStackAlloca) { + return stmt; + } + } + } + } PrimExpr total_bytes = make_const(op->extents[0].dtype(), nbytes); for (size_t i = 0; i < op->extents.size(); ++i) { total_bytes = total_bytes * op->extents[i];