kumasento opened a new pull request #5146: Handle empty LLVMModule in 
URL: https://github.com/apache/incubator-tvm/pull/5146
   #4847 introduces empty `LLVMModule`, which may appear when all the 
executable code are optimized #4748 . An empty `LLVMModule` is built from an IR 
file that only specifies target triplet and data layout.
   We just notice that existing logic in `LLVMModuleNode` may not consider this 
case properly. As shown by @trevor-m in this 
 `LLVMModuleNode::GetFunction` doesn't work properly.
   We dived into this problem and found out that `LLVMModuleNode` always 
assumes there exists an entry function (see this 
 If there is not, e.g., in an empty `LLVMModule`, we would have trouble, mostly 
in the form of segfault.
   This PR mainly deals with the empty `LLVMModule` issue in 
`LLVMModuleNode::GetFunction`. We assume that, without losing generality, a 
`LLVMModule` is empty if its `entry_func_` cannot be found, i.e.:
   GetGlobalAddr(runtime::symbol::tvm_module_main) == 0
   We use this assumption as follows:
   1. When `LazyInitJIT` is called by `GetFunction`, we will validate the 
address of `entry_func_` (by the condition above) first before we refer to it. 
   2. If `entry_func_` is empty, we can realize the current `LLVMModule` is 
empty and we should return `nullptr`.
   Please let me know whether this help address your problem @trevor-m 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:

With regards,
Apache Git Services

Reply via email to