Skip to content

Commit 70c8ee9

Browse files
LukeBoyercopybara-github
authored andcommitted
Extra lib logging for compiler plugin. Also allow optional soc man if there is only one loaded plugin
LiteRT-PiperOrigin-RevId: 820433566
1 parent 2505792 commit 70c8ee9

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

litert/compiler/plugin/compiler_plugin.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,12 @@ Expected<std::vector<CompilerPlugin>> CompilerPlugin::LoadPlugins(
266266
loaded_plugins.reserve(lib_search_paths.size());
267267

268268
for (const auto& lib_path : plugin_lib_paths) {
269+
LITERT_LOG(LITERT_INFO, "Attempting to load plugin at: %s",
270+
lib_path.c_str());
269271
auto plugin = LoadPlugin(lib_path, env, options);
270272
if (!plugin.HasValue()) {
273+
LITERT_LOG(LITERT_WARNING, "Failed to load plugin at: %s",
274+
lib_path.c_str());
271275
continue;
272276
}
273277
loaded_plugins.push_back(std::move(plugin.Value()));
@@ -739,6 +743,11 @@ Expected<CompilerPlugin> CompilerPlugin::FindPlugin(
739743
LiteRtEnvironmentOptions env, LiteRtOptions options) {
740744
LITERT_ASSIGN_OR_RETURN(auto plugins, CompilerPlugin::LoadPlugins(
741745
lib_search_paths, env, options));
746+
if (plugins.size() == 1 && soc_manufacturer.empty()) {
747+
// Don't check soc string if there is only one plugin, for compatibility
748+
// with tooling and upstreams.
749+
return std::move(plugins.front());
750+
}
742751
for (auto& plugin : plugins) {
743752
if (plugin.SocManufacturer() == soc_manufacturer) {
744753
return std::move(plugin);

0 commit comments

Comments
 (0)