Wire comparator CLI, marionette threading model, and final load order.
Initialize SmoThreadingModelDesc from marionette before body startup, load comparator libs before stimbuff via -c/--comparator-lib, and drop the hardcoded libcomparatorCore.so load path. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -10,7 +10,6 @@
|
||||
#include <componentThread.h>
|
||||
#include <opts.h>
|
||||
#include <user/smoHooks.h>
|
||||
#include <user/senseApiDesc.h>
|
||||
#include <mind.h>
|
||||
#include <deviceManager/deviceManager.h>
|
||||
#include <marionette/marionette.h>
|
||||
@@ -37,11 +36,13 @@ std::shared_ptr<sscl::ComponentThread> ComponentThread_getSelf()
|
||||
return sscl::ComponentThread::getSelf();
|
||||
}
|
||||
|
||||
/* Local static function to wrap OptionParser::getOptions for SmoCallbacks */
|
||||
OptionParser& OptionParser_getOptions()
|
||||
{
|
||||
return OptionParser::getOptions();
|
||||
}
|
||||
|
||||
/* Local static functions to wrap ComputeManager methods for SmoCallbacks */
|
||||
std::shared_ptr<smo::compute::ClBuffer>
|
||||
ComputeManager_createUseHostPtrBuffer(
|
||||
void* hostPtr, size_t size, cl_mem_flags flags)
|
||||
@@ -108,11 +109,6 @@ SmoCallbacks smoCallbacks =
|
||||
.Comparator_getNewInstance = Comparator_getNewInstanceHook
|
||||
};
|
||||
|
||||
/* Static file-scope threading model object for senseApi libraries */
|
||||
SmoThreadingModelDesc smoThreadingModelDesc = {
|
||||
.componentThread = nullptr
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
const SmoCallbacks& getSmoCallbacks()
|
||||
@@ -121,8 +117,7 @@ const SmoCallbacks& getSmoCallbacks()
|
||||
}
|
||||
|
||||
StimBuffApiLib& StimBuffApiManager::loadStimBuffApiLib(
|
||||
const std::string& libraryPath,
|
||||
const std::shared_ptr<sscl::ComponentThread>& componentThread)
|
||||
const std::string& libraryPath)
|
||||
{
|
||||
loadable_lib::LoadableLibraryManager& llm =
|
||||
loadable_lib::LoadableLibraryManager::getInstance();
|
||||
@@ -142,12 +137,17 @@ StimBuffApiLib& StimBuffApiManager::loadStimBuffApiLib(
|
||||
loadedLibrary->getDlopenHandle(),
|
||||
SMO_GET_STIM_BUFF_API_DESC_FN_NAME_STR);
|
||||
|
||||
if (!smoThreadingModelDesc.componentThread) {
|
||||
smoThreadingModelDesc.componentThread = componentThread;
|
||||
const stim_buff::SmoThreadingModelDesc& threadingModel =
|
||||
mrntt::getSmoThreadingModelDesc();
|
||||
if (!threadingModel.componentThread)
|
||||
{
|
||||
throw std::runtime_error(
|
||||
std::string(__func__)
|
||||
+ ": SmoThreadingModelDesc has not been initialized");
|
||||
}
|
||||
|
||||
const StimBuffApiDesc& libApiDesc = descFn(
|
||||
smoCallbacks, smoThreadingModelDesc);
|
||||
smoCallbacks, threadingModel);
|
||||
|
||||
auto lib = std::make_shared<StimBuffApiLib>(loadedLibrary, descFn);
|
||||
lib->setStimBuffApiDesc(libApiDesc);
|
||||
@@ -234,12 +234,11 @@ void StimBuffApiManager::unloadAllStimBuffApiLibs(void)
|
||||
}
|
||||
}
|
||||
|
||||
void StimBuffApiManager::loadAllStimBuffApiLibsFromOptions(
|
||||
const std::shared_ptr<sscl::ComponentThread>& componentThread)
|
||||
void StimBuffApiManager::loadAllStimBuffApiLibsFromOptions(void)
|
||||
{
|
||||
const auto& options = OptionParser::getOptions();
|
||||
for (const auto& libPath : options.senseApiLibs) {
|
||||
loadStimBuffApiLib(libPath, componentThread);
|
||||
loadStimBuffApiLib(libPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user