Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d7975bf8 authored by Slava Shklyaev's avatar Slava Shklyaev Committed by Gerrit Code Review
Browse files

Merge changes from topic "nnapi-control-flow"

* changes:
  Add NNAPI loop timeout API
  Add control flow support to NNAPI VTS tests
  Add control flow performance to NNAPI Capabilities
parents f89784a5 a96ab740
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -628,9 +628,9 @@ ddcf89cd8ee2df0d32aee55050826446fb64f7aafde0a7cd946c64f61b1a364c android.hardwar
9db064ee44268a876be0367ff771e618362d39ec603b6ecab17e1575725fcd87 android.hardware.neuralnetworks@1.3::IDevice
9db064ee44268a876be0367ff771e618362d39ec603b6ecab17e1575725fcd87 android.hardware.neuralnetworks@1.3::IDevice
4167dc3ad35e9cd0d2057d4868c7675ae2c3c9d05bbd614c1f5dccfa5fd68797 android.hardware.neuralnetworks@1.3::IExecutionCallback
4167dc3ad35e9cd0d2057d4868c7675ae2c3c9d05bbd614c1f5dccfa5fd68797 android.hardware.neuralnetworks@1.3::IExecutionCallback
2fa3679ad7c94b5e88724adcd560c561041068a4ca565c63830e68101988746a android.hardware.neuralnetworks@1.3::IFencedExecutionCallback
2fa3679ad7c94b5e88724adcd560c561041068a4ca565c63830e68101988746a android.hardware.neuralnetworks@1.3::IFencedExecutionCallback
237b23b126a66f3432658020fed78cdd06ba6297459436fe6bae0ba753370833 android.hardware.neuralnetworks@1.3::IPreparedModel
43088ffc71945b463a7279262cfe2e290f6ed2f15d3fd6032798a3be299fb08f android.hardware.neuralnetworks@1.3::IPreparedModel
0439a1fbbec7f16e5e4c653d85ac685d51bfafbae15b8f8cca530acdd7d6a8ce android.hardware.neuralnetworks@1.3::IPreparedModelCallback
0439a1fbbec7f16e5e4c653d85ac685d51bfafbae15b8f8cca530acdd7d6a8ce android.hardware.neuralnetworks@1.3::IPreparedModelCallback
2fabd246f985d94a0172dacefb0d6cf19e2aeb2d5f17752653988ef39570a52d android.hardware.neuralnetworks@1.3::types
306fda32ac969fd51d75d066352cadcb769944ec4823be4cdd3f86fdb9e97511 android.hardware.neuralnetworks@1.3::types
3e01d4446cd69fd1c48f8572efd97487bc179564b32bd795800b97bbe10be37b android.hardware.wifi@1.4::IWifi
3e01d4446cd69fd1c48f8572efd97487bc179564b32bd795800b97bbe10be37b android.hardware.wifi@1.4::IWifi
a64467bae843569f0d465c5be7f0c7a5b987985b55a3ef4794dd5afc68538650 android.hardware.wifi.supplicant@1.3::ISupplicant
a64467bae843569f0d465c5be7f0c7a5b987985b55a3ef4794dd5afc68538650 android.hardware.wifi.supplicant@1.3::ISupplicant
44445b8a03d7b9e68b2fbd954672c18a8fce9e32851b0692f4f4ab3407f86ecb android.hardware.wifi.supplicant@1.3::ISupplicantStaIface
44445b8a03d7b9e68b2fbd954672c18a8fce9e32851b0692f4f4ab3407f86ecb android.hardware.wifi.supplicant@1.3::ISupplicantStaIface
+13 −12
Original line number Original line Diff line number Diff line
@@ -42,10 +42,11 @@ using implementation::PreparedModelCallback;


Model createModel(const TestModel& testModel) {
Model createModel(const TestModel& testModel) {
    // Model operands.
    // Model operands.
    hidl_vec<Operand> operands(testModel.operands.size());
    CHECK_EQ(testModel.referenced.size(), 0u);  // Not supported in 1.0.
    hidl_vec<Operand> operands(testModel.main.operands.size());
    size_t constCopySize = 0, constRefSize = 0;
    size_t constCopySize = 0, constRefSize = 0;
    for (uint32_t i = 0; i < testModel.operands.size(); i++) {
    for (uint32_t i = 0; i < testModel.main.operands.size(); i++) {
        const auto& op = testModel.operands[i];
        const auto& op = testModel.main.operands[i];


        DataLocation loc = {};
        DataLocation loc = {};
        if (op.lifetime == TestOperandLifeTime::CONSTANT_COPY) {
        if (op.lifetime == TestOperandLifeTime::CONSTANT_COPY) {
@@ -70,9 +71,9 @@ Model createModel(const TestModel& testModel) {
    }
    }


    // Model operations.
    // Model operations.
    hidl_vec<Operation> operations(testModel.operations.size());
    hidl_vec<Operation> operations(testModel.main.operations.size());
    std::transform(testModel.operations.begin(), testModel.operations.end(), operations.begin(),
    std::transform(testModel.main.operations.begin(), testModel.main.operations.end(),
                   [](const TestOperation& op) -> Operation {
                   operations.begin(), [](const TestOperation& op) -> Operation {
                       return {.type = static_cast<OperationType>(op.type),
                       return {.type = static_cast<OperationType>(op.type),
                               .inputs = op.inputs,
                               .inputs = op.inputs,
                               .outputs = op.outputs};
                               .outputs = op.outputs};
@@ -80,8 +81,8 @@ Model createModel(const TestModel& testModel) {


    // Constant copies.
    // Constant copies.
    hidl_vec<uint8_t> operandValues(constCopySize);
    hidl_vec<uint8_t> operandValues(constCopySize);
    for (uint32_t i = 0; i < testModel.operands.size(); i++) {
    for (uint32_t i = 0; i < testModel.main.operands.size(); i++) {
        const auto& op = testModel.operands[i];
        const auto& op = testModel.main.operands[i];
        if (op.lifetime == TestOperandLifeTime::CONSTANT_COPY) {
        if (op.lifetime == TestOperandLifeTime::CONSTANT_COPY) {
            const uint8_t* begin = op.data.get<uint8_t>();
            const uint8_t* begin = op.data.get<uint8_t>();
            const uint8_t* end = begin + op.data.size();
            const uint8_t* end = begin + op.data.size();
@@ -102,8 +103,8 @@ Model createModel(const TestModel& testModel) {
                reinterpret_cast<uint8_t*>(static_cast<void*>(mappedMemory->getPointer()));
                reinterpret_cast<uint8_t*>(static_cast<void*>(mappedMemory->getPointer()));
        CHECK(mappedPtr != nullptr);
        CHECK(mappedPtr != nullptr);


        for (uint32_t i = 0; i < testModel.operands.size(); i++) {
        for (uint32_t i = 0; i < testModel.main.operands.size(); i++) {
            const auto& op = testModel.operands[i];
            const auto& op = testModel.main.operands[i];
            if (op.lifetime == TestOperandLifeTime::CONSTANT_REFERENCE) {
            if (op.lifetime == TestOperandLifeTime::CONSTANT_REFERENCE) {
                const uint8_t* begin = op.data.get<uint8_t>();
                const uint8_t* begin = op.data.get<uint8_t>();
                const uint8_t* end = begin + op.data.size();
                const uint8_t* end = begin + op.data.size();
@@ -114,8 +115,8 @@ Model createModel(const TestModel& testModel) {


    return {.operands = std::move(operands),
    return {.operands = std::move(operands),
            .operations = std::move(operations),
            .operations = std::move(operations),
            .inputIndexes = testModel.inputIndexes,
            .inputIndexes = testModel.main.inputIndexes,
            .outputIndexes = testModel.outputIndexes,
            .outputIndexes = testModel.main.outputIndexes,
            .operandValues = std::move(operandValues),
            .operandValues = std::move(operandValues),
            .pools = std::move(pools)};
            .pools = std::move(pools)};
}
}
+8 −8
Original line number Original line Diff line number Diff line
@@ -42,10 +42,10 @@ constexpr uint32_t kOutputPoolIndex = 1;


Request createRequest(const TestModel& testModel) {
Request createRequest(const TestModel& testModel) {
    // Model inputs.
    // Model inputs.
    hidl_vec<RequestArgument> inputs(testModel.inputIndexes.size());
    hidl_vec<RequestArgument> inputs(testModel.main.inputIndexes.size());
    size_t inputSize = 0;
    size_t inputSize = 0;
    for (uint32_t i = 0; i < testModel.inputIndexes.size(); i++) {
    for (uint32_t i = 0; i < testModel.main.inputIndexes.size(); i++) {
        const auto& op = testModel.operands[testModel.inputIndexes[i]];
        const auto& op = testModel.main.operands[testModel.main.inputIndexes[i]];
        if (op.data.size() == 0) {
        if (op.data.size() == 0) {
            // Omitted input.
            // Omitted input.
            inputs[i] = {.hasNoValue = true};
            inputs[i] = {.hasNoValue = true};
@@ -59,10 +59,10 @@ Request createRequest(const TestModel& testModel) {
    }
    }


    // Model outputs.
    // Model outputs.
    hidl_vec<RequestArgument> outputs(testModel.outputIndexes.size());
    hidl_vec<RequestArgument> outputs(testModel.main.outputIndexes.size());
    size_t outputSize = 0;
    size_t outputSize = 0;
    for (uint32_t i = 0; i < testModel.outputIndexes.size(); i++) {
    for (uint32_t i = 0; i < testModel.main.outputIndexes.size(); i++) {
        const auto& op = testModel.operands[testModel.outputIndexes[i]];
        const auto& op = testModel.main.operands[testModel.main.outputIndexes[i]];


        // In the case of zero-sized output, we should at least provide a one-byte buffer.
        // In the case of zero-sized output, we should at least provide a one-byte buffer.
        // This is because zero-sized tensors are only supported internally to the driver, or
        // This is because zero-sized tensors are only supported internally to the driver, or
@@ -90,8 +90,8 @@ Request createRequest(const TestModel& testModel) {
    CHECK(inputPtr != nullptr);
    CHECK(inputPtr != nullptr);


    // Copy input data to the memory pool.
    // Copy input data to the memory pool.
    for (uint32_t i = 0; i < testModel.inputIndexes.size(); i++) {
    for (uint32_t i = 0; i < testModel.main.inputIndexes.size(); i++) {
        const auto& op = testModel.operands[testModel.inputIndexes[i]];
        const auto& op = testModel.main.operands[testModel.main.inputIndexes[i]];
        if (op.data.size() > 0) {
        if (op.data.size() > 0) {
            const uint8_t* begin = op.data.get<uint8_t>();
            const uint8_t* begin = op.data.get<uint8_t>();
            const uint8_t* end = begin + op.data.size();
            const uint8_t* end = begin + op.data.size();
+13 −12
Original line number Original line Diff line number Diff line
@@ -49,10 +49,11 @@ using V1_0::implementation::PreparedModelCallback;


Model createModel(const TestModel& testModel) {
Model createModel(const TestModel& testModel) {
    // Model operands.
    // Model operands.
    hidl_vec<Operand> operands(testModel.operands.size());
    CHECK_EQ(testModel.referenced.size(), 0u);  // Not supported in 1.1.
    hidl_vec<Operand> operands(testModel.main.operands.size());
    size_t constCopySize = 0, constRefSize = 0;
    size_t constCopySize = 0, constRefSize = 0;
    for (uint32_t i = 0; i < testModel.operands.size(); i++) {
    for (uint32_t i = 0; i < testModel.main.operands.size(); i++) {
        const auto& op = testModel.operands[i];
        const auto& op = testModel.main.operands[i];


        DataLocation loc = {};
        DataLocation loc = {};
        if (op.lifetime == TestOperandLifeTime::CONSTANT_COPY) {
        if (op.lifetime == TestOperandLifeTime::CONSTANT_COPY) {
@@ -77,9 +78,9 @@ Model createModel(const TestModel& testModel) {
    }
    }


    // Model operations.
    // Model operations.
    hidl_vec<Operation> operations(testModel.operations.size());
    hidl_vec<Operation> operations(testModel.main.operations.size());
    std::transform(testModel.operations.begin(), testModel.operations.end(), operations.begin(),
    std::transform(testModel.main.operations.begin(), testModel.main.operations.end(),
                   [](const TestOperation& op) -> Operation {
                   operations.begin(), [](const TestOperation& op) -> Operation {
                       return {.type = static_cast<OperationType>(op.type),
                       return {.type = static_cast<OperationType>(op.type),
                               .inputs = op.inputs,
                               .inputs = op.inputs,
                               .outputs = op.outputs};
                               .outputs = op.outputs};
@@ -87,8 +88,8 @@ Model createModel(const TestModel& testModel) {


    // Constant copies.
    // Constant copies.
    hidl_vec<uint8_t> operandValues(constCopySize);
    hidl_vec<uint8_t> operandValues(constCopySize);
    for (uint32_t i = 0; i < testModel.operands.size(); i++) {
    for (uint32_t i = 0; i < testModel.main.operands.size(); i++) {
        const auto& op = testModel.operands[i];
        const auto& op = testModel.main.operands[i];
        if (op.lifetime == TestOperandLifeTime::CONSTANT_COPY) {
        if (op.lifetime == TestOperandLifeTime::CONSTANT_COPY) {
            const uint8_t* begin = op.data.get<uint8_t>();
            const uint8_t* begin = op.data.get<uint8_t>();
            const uint8_t* end = begin + op.data.size();
            const uint8_t* end = begin + op.data.size();
@@ -109,8 +110,8 @@ Model createModel(const TestModel& testModel) {
                reinterpret_cast<uint8_t*>(static_cast<void*>(mappedMemory->getPointer()));
                reinterpret_cast<uint8_t*>(static_cast<void*>(mappedMemory->getPointer()));
        CHECK(mappedPtr != nullptr);
        CHECK(mappedPtr != nullptr);


        for (uint32_t i = 0; i < testModel.operands.size(); i++) {
        for (uint32_t i = 0; i < testModel.main.operands.size(); i++) {
            const auto& op = testModel.operands[i];
            const auto& op = testModel.main.operands[i];
            if (op.lifetime == TestOperandLifeTime::CONSTANT_REFERENCE) {
            if (op.lifetime == TestOperandLifeTime::CONSTANT_REFERENCE) {
                const uint8_t* begin = op.data.get<uint8_t>();
                const uint8_t* begin = op.data.get<uint8_t>();
                const uint8_t* end = begin + op.data.size();
                const uint8_t* end = begin + op.data.size();
@@ -121,8 +122,8 @@ Model createModel(const TestModel& testModel) {


    return {.operands = std::move(operands),
    return {.operands = std::move(operands),
            .operations = std::move(operations),
            .operations = std::move(operations),
            .inputIndexes = testModel.inputIndexes,
            .inputIndexes = testModel.main.inputIndexes,
            .outputIndexes = testModel.outputIndexes,
            .outputIndexes = testModel.main.outputIndexes,
            .operandValues = std::move(operandValues),
            .operandValues = std::move(operandValues),
            .pools = std::move(pools),
            .pools = std::move(pools),
            .relaxComputationFloat32toFloat16 = testModel.isRelaxed};
            .relaxComputationFloat32toFloat16 = testModel.isRelaxed};
+4 −4
Original line number Original line Diff line number Diff line
@@ -207,10 +207,10 @@ TestModel createLargeTestModelImpl(TestOperationType op, uint32_t len) {
    };
    };


    return {
    return {
            .operands = std::move(operands),
            .main = {.operands = std::move(operands),
                     .operations = std::move(operations),
                     .operations = std::move(operations),
                     .inputIndexes = {1},
                     .inputIndexes = {1},
            .outputIndexes = {len * 2 + 1},
                     .outputIndexes = {len * 2 + 1}},
            .isRelaxed = false,
            .isRelaxed = false,
    };
    };
}
}
Loading