summaryrefslogtreecommitdiff
path: root/nn/runtime/Manager.cpp
diff options
context:
space:
mode:
authorSlava Shklyaev <slavash@google.com>2019-02-11 18:26:29 +0000
committerSlava Shklyaev <slavash@google.com>2019-03-06 11:49:51 +0000
commit1b7ef17ff89fcbaaa2b7f0fb7a6682165809d3a1 (patch)
tree4c2431d80656e34c25ac96f1c2f21917e2876afe /nn/runtime/Manager.cpp
parent4f88faf4e907f7a6516adf5b2826ea26abd885bd (diff)
downloadml-1b7ef17ff89fcbaaa2b7f0fb7a6682165809d3a1.tar.gz
Add a centralized runtime extension information store
Fix: 124107169 Fix: 123523457 Fix: 124285861 Fix: 124104123 Fix: 123178734 Test: NeuralNetworksTest_static Test: NeuralNetworksTest_utils Test: NeuralNetworksTest_FibonacciExtension (from change Ibe0fc5356baa909bce8424138bd5cfac9f74648f) Change-Id: Id3f105476f42bd747a098f081a07b161036e4922
Diffstat (limited to 'nn/runtime/Manager.cpp')
-rw-r--r--nn/runtime/Manager.cpp34
1 files changed, 0 insertions, 34 deletions
diff --git a/nn/runtime/Manager.cpp b/nn/runtime/Manager.cpp
index 6c15daf08..26df6a151 100644
--- a/nn/runtime/Manager.cpp
+++ b/nn/runtime/Manager.cpp
@@ -37,40 +37,6 @@ using HidlToken = hidl_array<uint8_t, ANEURALNETWORKS_BYTE_SIZE_OF_CACHE_TOKEN>;
namespace android {
namespace nn {
-uint32_t Device::getSizeOfData(const Operand& operand,
- const std::map<std::string, uint16_t>& extensionNameToPrefix) const {
- if (!isExtensionOperandType(operand.type)) {
- return sizeOfData(operand);
- }
-
- // A slow naive implementation.
- // TODO(b/123178734): Speed it up.
- uint32_t operandType = static_cast<uint32_t>(operand.type);
- uint8_t kLowBitsType = static_cast<uint8_t>(Model::ExtensionTypeEncoding::LOW_BITS_TYPE);
- uint16_t prefix = operandType >> kLowBitsType;
- uint16_t typeWithinExtension = operandType & ((1 << kLowBitsType) - 1);
- for (const Extension& extension : getSupportedExtensions()) {
- if (extensionNameToPrefix.at(extension.name) != prefix) {
- continue;
- }
- for (auto& extensionOperandType : extension.operandTypes) {
- if (extensionOperandType.type == typeWithinExtension) {
- uint32_t numElements = 1;
- if (extensionOperandType.isTensor) {
- for (auto dimension : operand.dimensions) {
- numElements *= dimension;
- }
- }
- return numElements * extensionOperandType.byteSize;
- }
- }
- }
-
- CHECK(false) << "Cannot determine the size of extension operand type "
- << toString(operand.type);
- return 0;
-}
-
// A Device with actual underlying driver
class DriverDevice : public Device {
DISALLOW_IMPLICIT_CONSTRUCTORS(DriverDevice);