Remove hal::utils::countNumberOfConsumers
This CL removes hal::utils::countNumberOfConsumers and uses the existing nn::countNumberOfConsumers. This change is part of a larger chain of changes to remove HIDL and AIDL libraries from neuralnetworks_utils_hal_common. Bug: N/A Test: mma Change-Id: I7d06ea355eae7aa80b94b09a23d606bbb2322120
This commit is contained in:
parent
68e98f40dc
commit
301ef060e9
7 changed files with 10 additions and 18 deletions
|
@ -155,7 +155,7 @@ GeneralResult<Model> unvalidatedConvert(const hal::V1_0::Model& model) {
|
|||
|
||||
// Verify number of consumers.
|
||||
const auto numberOfConsumers =
|
||||
NN_TRY(hal::utils::countNumberOfConsumers(model.operands.size(), operations));
|
||||
NN_TRY(countNumberOfConsumers(model.operands.size(), operations));
|
||||
CHECK(model.operands.size() == numberOfConsumers.size());
|
||||
for (size_t i = 0; i < model.operands.size(); ++i) {
|
||||
if (model.operands[i].numberOfConsumers != numberOfConsumers[i]) {
|
||||
|
@ -346,7 +346,7 @@ nn::GeneralResult<Model> unvalidatedConvert(const nn::Model& model) {
|
|||
|
||||
// Update number of consumers.
|
||||
const auto numberOfConsumers =
|
||||
NN_TRY(hal::utils::countNumberOfConsumers(operands.size(), model.main.operations));
|
||||
NN_TRY(countNumberOfConsumers(operands.size(), model.main.operations));
|
||||
CHECK(operands.size() == numberOfConsumers.size());
|
||||
for (size_t i = 0; i < operands.size(); ++i) {
|
||||
operands[i].numberOfConsumers = numberOfConsumers[i];
|
||||
|
|
|
@ -100,7 +100,7 @@ GeneralResult<Model> unvalidatedConvert(const hal::V1_1::Model& model) {
|
|||
|
||||
// Verify number of consumers.
|
||||
const auto numberOfConsumers =
|
||||
NN_TRY(hal::utils::countNumberOfConsumers(model.operands.size(), operations));
|
||||
NN_TRY(countNumberOfConsumers(model.operands.size(), operations));
|
||||
CHECK(model.operands.size() == numberOfConsumers.size());
|
||||
for (size_t i = 0; i < model.operands.size(); ++i) {
|
||||
if (model.operands[i].numberOfConsumers != numberOfConsumers[i]) {
|
||||
|
@ -223,7 +223,7 @@ nn::GeneralResult<Model> unvalidatedConvert(const nn::Model& model) {
|
|||
|
||||
// Update number of consumers.
|
||||
const auto numberOfConsumers =
|
||||
NN_TRY(hal::utils::countNumberOfConsumers(operands.size(), model.main.operations));
|
||||
NN_TRY(countNumberOfConsumers(operands.size(), model.main.operations));
|
||||
CHECK(operands.size() == numberOfConsumers.size());
|
||||
for (size_t i = 0; i < operands.size(); ++i) {
|
||||
operands[i].numberOfConsumers = numberOfConsumers[i];
|
||||
|
|
|
@ -187,7 +187,7 @@ GeneralResult<Model> unvalidatedConvert(const hal::V1_2::Model& model) {
|
|||
|
||||
// Verify number of consumers.
|
||||
const auto numberOfConsumers =
|
||||
NN_TRY(hal::utils::countNumberOfConsumers(model.operands.size(), operations));
|
||||
NN_TRY(countNumberOfConsumers(model.operands.size(), operations));
|
||||
CHECK(model.operands.size() == numberOfConsumers.size());
|
||||
for (size_t i = 0; i < model.operands.size(); ++i) {
|
||||
if (model.operands[i].numberOfConsumers != numberOfConsumers[i]) {
|
||||
|
@ -481,7 +481,7 @@ nn::GeneralResult<Model> unvalidatedConvert(const nn::Model& model) {
|
|||
|
||||
// Update number of consumers.
|
||||
const auto numberOfConsumers =
|
||||
NN_TRY(hal::utils::countNumberOfConsumers(operands.size(), model.main.operations));
|
||||
NN_TRY(countNumberOfConsumers(operands.size(), model.main.operations));
|
||||
CHECK(operands.size() == numberOfConsumers.size());
|
||||
for (size_t i = 0; i < operands.size(); ++i) {
|
||||
operands[i].numberOfConsumers = numberOfConsumers[i];
|
||||
|
|
|
@ -194,7 +194,7 @@ GeneralResult<Model::Subgraph> unvalidatedConvert(const hal::V1_3::Subgraph& sub
|
|||
|
||||
// Verify number of consumers.
|
||||
const auto numberOfConsumers =
|
||||
NN_TRY(hal::utils::countNumberOfConsumers(subgraph.operands.size(), operations));
|
||||
NN_TRY(countNumberOfConsumers(subgraph.operands.size(), operations));
|
||||
CHECK(subgraph.operands.size() == numberOfConsumers.size());
|
||||
for (size_t i = 0; i < subgraph.operands.size(); ++i) {
|
||||
if (subgraph.operands[i].numberOfConsumers != numberOfConsumers[i]) {
|
||||
|
@ -543,7 +543,7 @@ nn::GeneralResult<Subgraph> unvalidatedConvert(const nn::Model::Subgraph& subgra
|
|||
|
||||
// Update number of consumers.
|
||||
const auto numberOfConsumers =
|
||||
NN_TRY(hal::utils::countNumberOfConsumers(operands.size(), subgraph.operations));
|
||||
NN_TRY(countNumberOfConsumers(operands.size(), subgraph.operations));
|
||||
CHECK(operands.size() == numberOfConsumers.size());
|
||||
for (size_t i = 0; i < operands.size(); ++i) {
|
||||
operands[i].numberOfConsumers = numberOfConsumers[i];
|
||||
|
|
|
@ -1315,8 +1315,8 @@ static void mutateExecutionPriorityTest(const std::shared_ptr<IDevice>& device,
|
|||
|
||||
void validateModel(const std::shared_ptr<IDevice>& device, const Model& model) {
|
||||
const auto numberOfConsumers =
|
||||
nn::countNumberOfConsumers(model.main.operands.size(),
|
||||
nn::unvalidatedConvert(model.main.operations).value())
|
||||
countNumberOfConsumers(model.main.operands.size(),
|
||||
nn::unvalidatedConvert(model.main.operations).value())
|
||||
.value();
|
||||
mutateExecutionOrderTest(device, model, numberOfConsumers);
|
||||
mutateOperandTypeTest(device, model);
|
||||
|
|
|
@ -125,9 +125,6 @@ nn::GeneralResult<std::reference_wrapper<const nn::Request>> convertRequestFromP
|
|||
const nn::Request* request, uint32_t alignment, uint32_t padding,
|
||||
std::optional<nn::Request>* maybeRequestInSharedOut, RequestRelocation* relocationOut);
|
||||
|
||||
nn::GeneralResult<std::vector<uint32_t>> countNumberOfConsumers(
|
||||
size_t numberOfOperands, const std::vector<nn::Operation>& operations);
|
||||
|
||||
nn::GeneralResult<hidl_memory> createHidlMemoryFromSharedMemory(const nn::SharedMemory& memory);
|
||||
nn::GeneralResult<nn::SharedMemory> createSharedMemoryFromHidlMemory(const hidl_memory& memory);
|
||||
|
||||
|
|
|
@ -331,11 +331,6 @@ nn::GeneralResult<std::reference_wrapper<const nn::Request>> convertRequestFromP
|
|||
return **maybeRequestInSharedOut;
|
||||
}
|
||||
|
||||
nn::GeneralResult<std::vector<uint32_t>> countNumberOfConsumers(
|
||||
size_t numberOfOperands, const std::vector<nn::Operation>& operations) {
|
||||
return nn::countNumberOfConsumers(numberOfOperands, operations);
|
||||
}
|
||||
|
||||
nn::GeneralResult<hidl_memory> createHidlMemoryFromSharedMemory(const nn::SharedMemory& memory) {
|
||||
if (memory == nullptr) {
|
||||
return NN_ERROR() << "Memory must be non-empty";
|
||||
|
|
Loading…
Reference in a new issue