This is an automated email from the ASF dual-hosted git repository. tqchen pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push: new 53f05d8ded [Debug][Disco] Check if a PackedFunc exists before calling it (#16845) 53f05d8ded is described below commit 53f05d8dedb7ec32f4a820a3f42dd9747df1671f Author: Eric Lunderberg <lunderb...@users.noreply.github.com> AuthorDate: Thu Apr 4 06:35:48 2024 -0500 [Debug][Disco] Check if a PackedFunc exists before calling it (#16845) Prior to this commit, attempting to execute the result of `sess.get_global_func` for a non-existing function name would result in a segfault. While the equivalent `tvm.get_global_func` can throw an exception when looking up the function, Disco returns a `DFunction` immediately. This `DFunction` may resolve to a null pointer, and should be checked in the worker process before calling it. --- src/runtime/disco/disco_worker.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/runtime/disco/disco_worker.cc b/src/runtime/disco/disco_worker.cc index e8ba351e79..b281a3aca7 100644 --- a/src/runtime/disco/disco_worker.cc +++ b/src/runtime/disco/disco_worker.cc @@ -77,7 +77,9 @@ struct DiscoWorker::Impl { } case DiscoAction::kCallPacked: { int func_reg_id = args[2]; + CHECK_LT(func_reg_id, self->register_file.size()); PackedFunc func = GetReg(self, func_reg_id); + CHECK(func.defined()); CallPacked(self, reg_id, func, TVMArgs(args.values + 3, args.type_codes + 3, args.num_args - 3)); break;