#include <android-base/logging.h>
#include <android-base/scopeguard.h>
#include <dlfcn.h>
#include "NeuralNetworksShim.h"
#include "SupportLibrarySymbols.h"
#include <string>
Go to the source code of this file.
◆ LOG_TAG
#define LOG_TAG "ArmnnDriver" |
◆ main()
The platform shim allows use of the armnn support library driver (arm-armnn-sl) to create a binderized vendor service (arm-armnn-shim) that is started at device startup
Definition at line 19 of file shimservice.cpp.
24 NnApiSLDriverImpl* impl = ANeuralNetworks_getSLDriverImpl();
27 LOG(ERROR) <<
"ArmnnDriver: ANeuralNetworks_getSLDriverImpl returned nullptr!!!";
31 ANeuralNetworksShimDeviceInfo* deviceInfo;
32 ANeuralNetworksShimDeviceInfo_create(&deviceInfo,
35 const auto guardDeviceInfo = android::base::make_scope_guard(
36 [deviceInfo] { ANeuralNetworksShimDeviceInfo_free(deviceInfo); });
38 ANeuralNetworksShimRegistrationParams* params;
39 ANeuralNetworksShimRegistrationParams_create(impl, ¶ms);
40 const auto guardParams = android::base::make_scope_guard(
41 [params] { ANeuralNetworksShimRegistrationParams_free(params); });
42 ANeuralNetworksShimRegistrationParams_addDeviceInfo(params, deviceInfo);
43 ANeuralNetworksShimRegistrationParams_setNumberOfListenerThreads(params, 15);
44 ANeuralNetworksShimRegistrationParams_registerAsLazyService(params,
false);
45 ANeuralNetworksShimRegistrationParams_fallbackToMinimumSupportDevice(params,
false);
47 auto result = ANeuralNetworksShim_registerSupportLibraryService(params);
48 LOG(ERROR) <<
"ArmnnDriver: ANeuralNetworksShim_registerSupportLibraryService returned error status: " << result;