6 #define LOG_TAG "ArmnnDriver"
8 #include <android-base/logging.h>
9 #include <android-base/scopeguard.h>
12 #include "NeuralNetworksShim.h"
13 #include "SupportLibrarySymbols.h"
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;