aosp-frameworks-ml-nn: fix vendor hal loading
With the implementation of multi-HAL loading (crrev.com/c/3007637), it
actually breaks the ability to load vendor HALs (ie, intel-nnhal).
This CL cleans up the dependencies and structure slightly to allow the
installed libvendor-nnhal.so from other packages to override the default
one.
BUG=b:196007189
TEST=USE=vendor-nnhal emerge-volteer aosp-frameworks-ml-nn
Change-Id: I7e0224ceca8b8904cea37996733e40b040004ad2
Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/frameworks/ml/+/3083669
Tested-by: Jim Pollock <jmpollock@chromium.org>
Auto-Submit: Jim Pollock <jmpollock@chromium.org>
Commit-Queue: Jim Pollock <jmpollock@chromium.org>
Reviewed-by: Michael Olney <mpolney@google.com>
diff --git a/nn/BUILD.gn b/nn/BUILD.gn
index e1c8a4a..b0c8f97 100644
--- a/nn/BUILD.gn
+++ b/nn/BUILD.gn
@@ -140,8 +140,6 @@
"runtime/include",
]
sources = [
- "chromeos/sampledriver.cpp",
- "chromeos/sampledriver_util.cpp",
"chromeos/compilation_caching.cpp",
"chromeos/daemon_store.cpp",
"chromeos/versioned_drivers.cpp",
@@ -271,7 +269,12 @@
shared_library("vendor-nn-hal") {
configs += [
+ ":common_defaults",
":target_defaults",
+ "//common-mk:visibility_default",
+ ]
+ cflags_cc = [
+ "-Wno-unused-parameter",
]
deps = [
":full-driver",
@@ -282,6 +285,10 @@
"tensorflowlite",
"textclassifier", # For Farmhash.
]
+ sources = [
+ "chromeos/sampledriver.cpp",
+ "chromeos/sampledriver_util.cpp",
+ ]
}
shared_library("minimal-driver") {
@@ -448,12 +455,12 @@
"//common-mk:test",
]
deps = [
- ":nn-common",
+ ":full-driver",
":generated_test_harness",
+ ":nn-common",
":nn_testrunner",
":runtime",
- ":full-driver",
- ":minimal-driver",
+ ":vendor-nn-hal",
"chromeos/tests/runtime/generated:all",
]
libs = [
@@ -544,7 +551,7 @@
":generated_test_harness",
":nn_testrunner",
":runtime",
- ":full-driver",
+ ":vendor-nn-hal",
"chromeos/tests/runtime/generated:all",
]
libs = [
@@ -605,7 +612,7 @@
":nn-common",
":nn_testrunner",
":runtime",
- ":full-driver"
+ ":vendor-nn-hal",
]
libs = [
"rt",
diff --git a/nn/chromeos/sampledriver.cpp b/nn/chromeos/sampledriver.cpp
index 6c18a6e..f0de740 100644
--- a/nn/chromeos/sampledriver.cpp
+++ b/nn/chromeos/sampledriver.cpp
@@ -2,18 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "SampleDriverMinimal.h"
-#include "SampleDriverFull.h"
-#include "SampleDriverPartial.h"
-#include "SampleDriverFloatXNNPACK.h"
+#include <android-base/logging.h>
+
#include <dlfcn.h>
#include <string>
-#include "sampledriver_util.h"
#include <unordered_map>
#include <utility>
#include <sstream>
#include <vector>
+#include "HalInterfaces.h"
+#include "sampledriver_util.h"
+
// type of function pointer
typedef void* (*get_driver_func)();