You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by tq...@apache.org on 2025/04/13 21:40:03 UTC
(tvm) 02/12: [FFI] minor update
This is an automated email from the ASF dual-hosted git repository.
tqchen pushed a commit to branch refactor-s1
in repository https://gitbox.apache.org/repos/asf/tvm.git
commit 1eabb1503b90da997daaa6d81643657700112f49
Author: tqchen <ti...@gmail.com>
AuthorDate: Sun Apr 13 11:54:23 2025 -0400
[FFI] minor update
---
ffi/include/tvm/ffi/dtype.h | 2 +-
ffi/src/ffi/function.cc | 9 ++++-----
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/ffi/include/tvm/ffi/dtype.h b/ffi/include/tvm/ffi/dtype.h
index 2dea46ad99..650a86c897 100644
--- a/ffi/include/tvm/ffi/dtype.h
+++ b/ffi/include/tvm/ffi/dtype.h
@@ -132,7 +132,7 @@ inline void PrintDLDataTypeCodeAsStr(std::ostream& os, DLDataTypeCode type_code)
break;
}
default: {
- if (type_code >= static_cast<int>(DLExtDataTypeCode::kDLExtCustomBegin)) {
+ if (static_cast<int>(type_code) >= static_cast<int>(DLExtDataTypeCode::kDLExtCustomBegin)) {
os << "custom[" << details::DLDataTypeCodeGetCustomTypeName(type_code) << "]";
} else {
TVM_FFI_THROW(ValueError) << "DLDataType contains unknown type_code="
diff --git a/ffi/src/ffi/function.cc b/ffi/src/ffi/function.cc
index dca2420092..065720e204 100644
--- a/ffi/src/ffi/function.cc
+++ b/ffi/src/ffi/function.cc
@@ -121,10 +121,9 @@ class GlobalFunctionTable {
int TVMFFIFuncCreate(void* self, TVMFFISafeCallType safe_call, void (*deleter)(void* self),
TVMFFIObjectHandle* out) {
- using namespace tvm::ffi;
TVM_FFI_SAFE_CALL_BEGIN();
- Function func = Function::FromExternC(self, safe_call, deleter);
- *out = details::ObjectUnsafe::MoveObjectRefToTVMFFIObjectPtr(std::move(func));
+ tvm::ffi::Function func = tvm::ffi::Function::FromExternC(self, safe_call, deleter);
+ *out = tvm::ffi::details::ObjectUnsafe::MoveObjectRefToTVMFFIObjectPtr(std::move(func));
TVM_FFI_SAFE_CALL_END();
}
@@ -141,8 +140,8 @@ int TVMFFIFuncGetGlobal(const char* name, TVMFFIObjectHandle* out) {
TVM_FFI_SAFE_CALL_BEGIN();
const Function* fp = GlobalFunctionTable::Global()->Get(name);
if (fp != nullptr) {
- Function func(*fp);
- *out = details::ObjectUnsafe::MoveObjectRefToTVMFFIObjectPtr(std::move(func));
+ tvm::ffi::Function func(*fp);
+ *out = tvm::ffi::details::ObjectUnsafe::MoveObjectRefToTVMFFIObjectPtr(std::move(func));
} else {
*out = nullptr;
}