-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] Init block not discoverable after sch.blockize #16889
Labels
needs-triage
PRs or issues that need to be investigated by maintainers to find the right assignees to address it
type: bug
Comments
nautasolva
added
needs-triage
PRs or issues that need to be investigated by maintainers to find the right assignees to address it
type: bug
labels
Apr 16, 2024
I think you are supposed to call
|
For my usage scenario I need to keep the |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
needs-triage
PRs or issues that need to be investigated by maintainers to find the right assignees to address it
type: bug
When used on a block with a init statement, blockize creates a separate init block that is not discoverable by any means. This hinders further scheduling, like tensorizing the init block.
Expected behavior
When using
blockize
on a loop that contains an init statement, the init is moved to a new block<block>_init
that should be discoverable withget_block
orget_children_blocks
on the newly created outer block.Actual behavior
Init block exists in the TIR module but does not seem to be registered by the schedule.
get_block("<block>_init>")
fails withInternalError: Check failed: (it != self_->stmt2ref.end()) is false
Stacktrace
Traceback (most recent call last):
File "/home/dev/tvm_upstream/../tvm/playground/blockize_init_bug.py", line 31, in
a_init = sch.get_block("A_init")
File "/home/dev/tvm_upstream/python/tvm/tir/schedule/type_checker.py", line 340, in wrap
return func(*args, *kwargs)
File "/home/dev/tvm_upstream/python/tvm/tir/schedule/schedule.py", line 499, in get_block
return _ffi_api.ScheduleGetBlock( # type: ignore # pylint: disable=no-member
File "/home/dev/tvm_upstream/python/tvm/_ffi/ctypes/packed_func.py", line 239, in call
raise_last_ffi_error()
File "/home/dev/tvm_upstream/python/tvm/ffi/base.py", line 481, in raise_last_ffi_error
raise py_err
File "/home/dev/tvm_upstream/src/tir/schedule/traced_schedule.cc", line 128, in tvm::tir::TracedScheduleNode::GetBlock(tvm::runtime::String const&, tvm::runtime::Optionaltvm::runtime::String const&)
BlockRV result = ConcreteScheduleNode::GetBlock(name, func_name);
File "/home/dev/tvm_upstream/src/tir/schedule/concrete_schedule.cc", line 321, in tvm::tir::ConcreteScheduleNode::GetBlock(tvm::runtime::String const&, tvm::runtime::Optionaltvm::runtime::String const&)
Array blocks = tir::GetBlocks(this->state, name, gv);
File "/home/dev/tvm_upstream/src/tir/schedule/primitive/get_block_loop.cc", line 46, in tvm::tir::GetBlocks(tvm::tir::ScheduleState const&, tvm::runtime::String const&, tvm::GlobalVar const&)
finder(prim_func->body);
File "/home/dev/tvm_upstream/src/tir/ir/stmt_functor.cc", line 142, in tvm::tir::StmtVisitor::VisitStmt(tvm::tir::BlockNode const)
this->VisitStmt(op->init.value());
File "/home/dev/tvm_upstream/src/tir/schedule/primitive/get_block_loop.cc", line 29, in VisitStmt
void VisitStmt_(const BlockNode* block) override {
File "/home/dev/tvm_upstream/src/tir/schedule/primitive/get_block_loop.cc", line 32, in VisitStmt_
ICHECK(it != self_->stmt2ref.end());
tvm.error.InternalError: Traceback (most recent call last):
5: tvm::tir::TracedScheduleNode::GetBlock(tvm::runtime::String const&, tvm::runtime::Optionaltvm::runtime::String const&)
at /home/dev/tvm_upstream/src/tir/schedule/traced_schedule.cc:128
4: tvm::tir::ConcreteScheduleNode::GetBlock(tvm::runtime::String const&, tvm::runtime::Optionaltvm::runtime::String const&)
at /home/dev/tvm_upstream/src/tir/schedule/concrete_schedule.cc:321
3: tvm::tir::GetBlocks(tvm::tir::ScheduleState const&, tvm::runtime::String const&, tvm::GlobalVar const&)
at /home/dev/tvm_upstream/src/tir/schedule/primitive/get_block_loop.cc:46
2: tvm::tir::StmtVisitor::VisitStmt_(tvm::tir::BlockNode const*)
at /home/dev/tvm_upstream/src/tir/ir/stmt_functor.cc:142
1: VisitStmt_
at /home/dev/tvm_upstream/src/tir/schedule/primitive/get_block_loop.cc:29
0: VisitStmt_
at /home/dev/tvm_upstream/src/tir/schedule/primitive/get_block_loop.cc:32
File "/home/dev/tvm_upstream/src/tir/schedule/primitive/get_block_loop.cc", line 32
Environment
Reproducible on main (d4056ca)
Steps to reproduce
Triage
The text was updated successfully, but these errors were encountered: