FrozenGene edited a comment on issue #4847: Return empty CSourceModule when no lowered_funcs exists in Relay mod URL: https://github.com/apache/incubator-tvm/pull/4847#issuecomment-585527191 > I did try just commenting out the assert and it seems to work. However, I then ran into a new problem... Because what you produce is ostensibly a 'c source' file (even if it's empty), all the external modules are also exported as c files. This results in having to do a proper compile when you try and merge all the modules together to produce a shared library. If one of your external modules happens to be a binary artifact that's 150MB (my case), this compile uses an incredible amount of RAM and takes a long time to complete. I didn't get this problem with your first solution as it used an LLVMModule (I think?) which results in the external modules becoming object files so all you need to do is link, not perform a full compilation. This is because our new `ModulePackImportsToLLVM` simplifies compilation and generate object file directly, it is designed for large artifact like your case. > The reason that LLVMModule simplifies compilation is because it remembers the correct target triple. We can try to enhance the code by introducing an Empty LLVM module(with the correct target) when it is available(so that Q2 can be resolved) and fallback to the CSourceModule. cc @FrozenGene who created the mechanism for the binary exporting I agree we could create empty llvm module if we have llvm target support, then we could fallback to CSourceModule. We could refer logic here: ```cpp runtime::Module build(const Map<Target, Array<LoweredFunc>>& inputs, const Target& target_host, const BuildConfig& config) Target target_host_val = target_host; if (!target_host.defined()) { for (const auto& it : inputs) { if (it.first->device_type == kDLCPU) { target_host_val = it.first; break; } } } if (!target_host_val.defined()) { target_host_val = DefaultTargetHost(target_host_val); } ``` Here, we have logic to detect and extract the correct target host. According to this, we could know whether we have LLVM (with correct target).
---------------------------------------------------------------- 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: [email protected] With regards, Apache Git Services
