Skip to content

Commit 58405c2

Browse files
committed
[Metal] Fix GetFunction of metal runtime
This PR fixes a bug in `MetalModuleNode::GetFunction`. The lambda passed to autoreleasepool is supposed to return nothing. Prior to this PR, it returns a function at an early exit branch, which may cause the error of `EXC_BREAKPOINT` in Metal.
1 parent 3873ce4 commit 58405c2

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,7 @@ if(BUILD_STATIC_RUNTIME)
520520
add_library(tvm_runtime STATIC
521521
$<TARGET_OBJECTS:tvm_runtime_objs>
522522
$<TARGET_OBJECTS:tvm_libinfo_objs>
523+
$<TARGET_OBJECTS:tvm_ffi_objs>
523524
${TVM_RUNTIME_EXT_OBJS}
524525
)
525526
set(NOTICE_MULTILINE

ffi/cmake/Utils/Library.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# under the License.
1717
function(add_dsymutil target_name)
1818
# running dsymutil on macos to generate debugging symbols for backtraces
19-
if(APPLE)
19+
if(APPLE AND TVM_FFI_USE_LIBBACKTRACE)
2020
find_program(DSYMUTIL dsymutil)
2121
mark_as_advanced(DSYMUTIL)
2222
add_custom_command(TARGET ${target_name}

src/runtime/metal/metal_module.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ void operator()(ffi::PackedArgs args, ffi::Any* rv, const ArgUnion64* pack_args)
267267
auto it = fmap_.find(name);
268268
if (it == fmap_.end()) {
269269
ret = ffi::Function();
270-
return ret;
270+
return;
271271
}
272272
const FunctionInfo& info = it->second;
273273
MetalWrappedFunc f;

0 commit comments

Comments
 (0)