From 94bcb1cd8c7da38e37a4146877403ea853bbd465 Mon Sep 17 00:00:00 2001 From: Andrew Reusch Date: Wed, 5 Jan 2022 12:06:30 -0800 Subject: [PATCH] fixup! Stack-allocate DLTensor instances when necessary. --- src/relay/backend/aot_executor_codegen.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/relay/backend/aot_executor_codegen.cc b/src/relay/backend/aot_executor_codegen.cc index 93d742ee238a..ac287529efe0 100644 --- a/src/relay/backend/aot_executor_codegen.cc +++ b/src/relay/backend/aot_executor_codegen.cc @@ -820,7 +820,11 @@ class AOTExecutorCodegen : public MixedModeVisitor { Integer workspace_byte_alignment = executor_config->GetAttr("workspace-byte-alignment").value_or(16); use_unpacked_api_ = executor_config->GetAttr("unpacked-api").value_or(Bool(false)); - use_call_cpacked_ = Bool(interface_api == "c"); + use_call_cpacked_ = + (Bool(interface_api == "c") || + // for now, C runtime does not support calling functions on other devices. therefore, + // opt to call PackedFunc directly by name rather than TVMBackendGetFuncFromEnv. + runtime_config->name == kTvmRuntimeCrt); // Validate choice of use_unpacked_api_ and use_call_cpacked_ if (runtime_config->name == kTvmRuntimeCrt) {