tqchen commented on code in PR #254:
URL: https://github.com/apache/tvm-ffi/pull/254#discussion_r2541991838
##########
addons/tvm-ffi-orcjit/src/ffi/orcjit_dylib.cc:
##########
@@ -168,34 +141,24 @@ static void RegisterOrcJITFunctions() {
namespace refl = tvm::ffi::reflection;
refl::GlobalDef()
- .def("orcjit.CreateExecutionSession",
- []() -> ORCJITExecutionSession { return
ORCJITExecutionSession::Create(); })
- .def("orcjit.SessionCreateDynamicLibrary",
- [](ORCJITExecutionSession session, String name) -> ObjectRef {
- auto session_obj = GetObjectPtr<ORCJITExecutionSessionObj>(
-
const_cast<ORCJITExecutionSessionObj*>(session.as<ORCJITExecutionSessionObj>()));
- return ObjectRef(session_obj->CreateDynamicLibrary(name));
+ .def("orcjit.ExecutionSession", ORCJITExecutionSession::Create)
+ .def("orcjit.ExecutionSessionCreateDynamicLibrary",
+ [](const ORCJITExecutionSession& session, const String& name) ->
ObjectRef {
+ return session->CreateDynamicLibrary(name);
})
.def("orcjit.DynamicLibraryAdd",
Review Comment:
because dynamic library is only a Module and is not an explicit subclass,
let us avoid passing these function via def, instead we can overload
GetFunction in ORCJITDynamicLibrary to return set link order and AddFile etc
##########
addons/tvm-ffi-orcjit/src/ffi/orcjit_dylib.h:
##########
@@ -38,15 +40,7 @@ namespace orcjit {
class ORCJITExecutionSessionObj;
-/*!
- * \brief DynamicLibrary wrapper for LLVM ORC JIT v2 JITDylib
- *
- * This class wraps an LLVM JITDylib and provides functionality to:
- * - Load object files
- * - Link against other dynamic libraries
- * - Look up symbols
- */
-class ORCJITDynamicLibrary : public Object {
+class DynamicLibraryObj : public ModuleObj {
Review Comment:
Keep the name ORCJITDynamicLibraryObj
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]