Lines Matching refs:model
289 uint32_t lookupOperation(const HidlModel& model, const V1_3::Subgraph& subgraph, in lookupOperation() argument
298 [&model](uint32_t offset) { return &model.operandValues[offset]; }, operationIndex); in lookupOperation()
303 void dump(const char* name, const ModelBuilder* model) { in dump() argument
304 const HidlModel hidlModel = model->makeHidlModel(); in dump()
354 const V1_3::Model& model, V1_1::ExecutionPreference preference, V1_3::Priority priority, in prepareModel_1_3() argument
360 for (const auto& operation : model.main.operations) { in prepareModel_1_3()
371 model, [&outStatus](V1_3::ErrorStatus inStatus, in prepareModel_1_3()
381 return SampleDriver::prepareModel_1_3(model, preference, priority, deadline, modelCache, in prepareModel_1_3()
398 hardware::Return<void> getSupportedOperations_1_3(const V1_3::Model& model, in getSupportedOperations_1_3() argument
400 if (!android::nn::validateModel(model)) { in getSupportedOperations_1_3()
404 cb(V1_3::ErrorStatus::NONE, getSupportedOperationsForSubgraph(model, model.main)); in getSupportedOperations_1_3()
414 std::vector<bool> getSupportedOperationsForSubgraph(const V1_3::Model& model, in getSupportedOperationsForSubgraph() argument
416 CHECK(&subgraph == &model.main || in getSupportedOperationsForSubgraph()
417 std::find_if(model.referenced.begin(), model.referenced.end(), in getSupportedOperationsForSubgraph()
420 }) != model.referenced.end()); in getSupportedOperationsForSubgraph()
421 auto supportsEntireSubgraph = [this, &model, &subgraph](uint32_t refSubgraphOperandIndex) { in getSupportedOperationsForSubgraph()
425 CHECK_LT(refSubgraphOperand.location.offset, model.referenced.size()); in getSupportedOperationsForSubgraph()
427 model.referenced[refSubgraphOperand.location.offset]; in getSupportedOperationsForSubgraph()
428 std::vector<bool> supported = getSupportedOperationsForSubgraph(model, refSubgraph); in getSupportedOperationsForSubgraph()
458 uint32_t operationEncoding = lookupOperation(model, subgraph, i); in getSupportedOperationsForSubgraph()
487 const V1_2::Model& model, getSupportedOperations_1_2_cb _hidl_cb) override { in getSupportedOperations_1_2() argument
488 return mLatestDriver->getSupportedOperations_1_2(model, _hidl_cb); in getSupportedOperations_1_2()
491 const V1_2::Model& model, V1_1::ExecutionPreference preference, in prepareModel_1_2() argument
495 return mLatestDriver->prepareModel_1_2(model, preference, modelCache, dataCache, token, in prepareModel_1_2()
520 const V1_1::Model& model, getSupportedOperations_1_1_cb _hidl_cb) override { in getSupportedOperations_1_1() argument
521 return mLatestDriver->getSupportedOperations_1_1(model, _hidl_cb); in getSupportedOperations_1_1()
524 const V1_1::Model& model, V1_1::ExecutionPreference preference, in prepareModel_1_1() argument
526 return mLatestDriver->prepareModel_1_1(model, preference, actualCallback); in prepareModel_1_1()
532 hardware::Return<void> getSupportedOperations(const V1_0::Model& model, in getSupportedOperations() argument
534 return mLatestDriver->getSupportedOperations(model, _hidl_cb); in getSupportedOperations()
537 const V1_0::Model& model, in prepareModel() argument
539 return mLatestDriver->prepareModel(model, actualCallback); in prepareModel()
559 const V1_1::Model& model, getSupportedOperations_1_1_cb _hidl_cb) override { in getSupportedOperations_1_1() argument
560 return mLatestDriver->getSupportedOperations_1_1(model, _hidl_cb); in getSupportedOperations_1_1()
563 const V1_1::Model& model, V1_1::ExecutionPreference preference, in prepareModel_1_1() argument
565 return mLatestDriver->prepareModel_1_1(model, preference, actualCallback); in prepareModel_1_1()
571 hardware::Return<void> getSupportedOperations(const V1_0::Model& model, in getSupportedOperations() argument
573 return mLatestDriver->getSupportedOperations(model, _hidl_cb); in getSupportedOperations()
576 const V1_0::Model& model, in prepareModel() argument
578 return mLatestDriver->prepareModel(model, actualCallback); in prepareModel()
597 hardware::Return<void> getSupportedOperations(const V1_0::Model& model, in getSupportedOperations() argument
599 return mLatestDriver->getSupportedOperations(model, _hidl_cb); in getSupportedOperations()
602 const V1_0::Model& model, in prepareModel() argument
604 return mLatestDriver->prepareModel(model, actualCallback); in prepareModel()
908 uint32_t addRefModelOperand(const PartitioningModel& model) { in addRefModelOperand() argument
910 WrapperModel::setOperandValueFromModel(index, &model); in addRefModelOperand()
942 PartitioningCompilation(const PartitioningModel* model, in PartitioningCompilation() argument
944 ModelBuilder* m = reinterpret_cast<ModelBuilder*>(model->getHandle()); in PartitioningCompilation()
1256 void buildDefinitionMap(const ModelBuilder* model, std::map<uint32_t, uint32_t>* defMap) { in buildDefinitionMap() argument
1258 ASSERT_LT(model->operationCount(), kPseudoDefiningOperationBase); in buildDefinitionMap()
1259 for (uint32_t i = 0, e = model->operationCount(); i < e; i++) { in buildDefinitionMap()
1260 const V1_3::Operation& operation = android::nn::convertToV1_3(model->getOperation(i)); in buildDefinitionMap()
1266 ASSERT_LT(model->inputCount(), kPseudoDefiningOperationRange); in buildDefinitionMap()
1267 for (uint32_t i = 0, e = model->inputCount(); i < e; i++) { in buildDefinitionMap()
1268 (*defMap)[model->getInputOperandIndex(i)] = kPseudoDefiningOperationModelInput0 + i; in buildDefinitionMap()
1271 for (uint32_t i = 0, e = model->operandCount(); i < e; i++) { in buildDefinitionMap()
1272 const V1_3::Operand& operand = android::nn::convertToV1_3(model->getOperand(i)); in buildDefinitionMap()
1280 memcpy(&value, model->getPointerToOperandValue(operand.location.offset), in buildDefinitionMap()
1297 ASSERT_EQ(model->operandCount(), defMap->size()); in buildDefinitionMap()
1528 bool compare(const ExecutionStep* step, const PartitioningModel* model, in compare() argument
1533 reinterpret_cast<const ModelBuilder*>(model->getHandle()), in compare()
1537 void compare(const std::shared_ptr<LogicalStep> logicalStep, const PartitioningModel* model, in compare() argument
1547 ASSERT_TRUE(compare(step, model, device, &inputsAndOutputsModelToStep))); in compare()
1566 const RemapVectorType& step, RemapVectorType model) { in compareRemapVectors() argument
1567 std::transform(model.begin(), model.end(), model.begin(), in compareRemapVectors()
1572 return step == model; in compareRemapVectors()
1577 const StepModelOutputSetType& step, const StepModelOutputSetType& model) { in compareStepModelOutputSets() argument
1580 model.begin(), model.end(), std::inserter(modelTransformed, modelTransformed.end()), in compareStepModelOutputSets()
1589 PartitioningModel model; in TEST_F() local
1590 uint32_t opnd0 = model.addFloatOperand(); in TEST_F()
1591 uint32_t opnd1 = model.addFloatOperand(); in TEST_F()
1592 uint32_t opnd2 = model.addOperation2To1V1_0(0, opnd0, opnd1); in TEST_F()
1593 uint32_t opnd3 = model.addFloatOperand(); in TEST_F()
1594 uint32_t opnd4 = model.addOperation2To1V1_0(1, opnd2, opnd3); in TEST_F()
1595 model.identifyInputsAndOutputs({opnd0, opnd1, opnd3}, {opnd4}); in TEST_F()
1596 model.finish(); in TEST_F()
1597 ASSERT_TRUE(model.isValid()); in TEST_F()
1604 ASSERT_EQ(model.partitionTheWork(devicesA, ExecutePreference::PREFER_LOW_POWER, in TEST_F()
1617 ASSERT_EQ(model.partitionTheWork(devicesC, ExecutePreference::PREFER_LOW_POWER, in TEST_F()
1630 ASSERT_EQ(model.partitionTheWork(devicesB, ExecutePreference::PREFER_LOW_POWER, in TEST_F()
1682 PartitioningModel model; in TEST_F() local
1683 uint32_t opnd0 = model.addFloatOperand(); in TEST_F()
1684 uint32_t opnd1 = model.addFloatOperand(); in TEST_F()
1685 uint32_t opnd2 = model.addOperation2To1V1_0(0, opnd0, opnd1); in TEST_F()
1686 uint32_t opnd3 = model.addOperation2To1V1_0(1, opnd0, opnd1); in TEST_F()
1687 uint32_t opnd4 = model.addOperation2To1V1_1(0, opnd0, opnd1); in TEST_F()
1688 uint32_t opnd5 = model.addOperation2To1V1_2(0, opnd2, opnd3); in TEST_F()
1689 uint32_t opnd6 = model.addOperation1To1V1_3(0, opnd2); in TEST_F()
1690 model.identifyInputsAndOutputs({opnd0, opnd1}, {opnd2, opnd4, opnd5, opnd6}); in TEST_F()
1691 model.finish(); in TEST_F()
1692 ASSERT_TRUE(model.isValid()); in TEST_F()
1702 ASSERT_EQ(model.partitionTheWork(devicesA, ExecutePreference::PREFER_LOW_POWER, in TEST_F()
1717 ASSERT_EQ(model.partitionTheWork(devicesB, ExecutePreference::PREFER_LOW_POWER, in TEST_F()
1817 PartitioningModel model; in TEST_F() local
1818 uint32_t opnd0 = model.addFloatOperand(); in TEST_F()
1819 uint32_t opnd1 = model.addOperation1To1V1_3(0, opnd0); in TEST_F()
1820 model.identifyInputsAndOutputs({opnd0}, {opnd1}); in TEST_F()
1821 model.finish(); in TEST_F()
1822 ASSERT_TRUE(model.isValid()); in TEST_F()
1832 ASSERT_EQ(model.partitionTheWork(devices, ExecutePreference::PREFER_LOW_POWER, in TEST_F()
1851 PartitioningModel model; in TEST_F() local
1853 uint32_t opnd0 = model.addFloatOperand(); in TEST_F()
1854 uint32_t opnd1 = model.addFloatOperand(); in TEST_F()
1856 uint32_t opnd2 = model.addOperation2To1V1_0(kDevOp, opnd0, opnd1); in TEST_F()
1857 uint32_t opnd3 = model.addOperation2To1V1_0(kDevOp, opnd0, opnd2); in TEST_F()
1859 uint32_t opnd4 = model.addOperation2To1V1_0(kCpuOp, opnd0, opnd3); in TEST_F()
1860 uint32_t opnd5 = model.addOperation2To1V1_0(kCpuOp, opnd2, opnd4); in TEST_F()
1862 uint32_t opnd6 = model.addFloatOperand(); in TEST_F()
1864 uint32_t opnd7 = model.addOperation2To1V1_0(kDevOp, opnd3, opnd5); in TEST_F()
1865 uint32_t opnd8 = model.addOperation2To1V1_0(kDevOp, opnd6, opnd7); in TEST_F()
1867 model.identifyInputsAndOutputs({opnd0, opnd1, opnd6}, {opnd4, opnd8}); in TEST_F()
1868 model.finish(); in TEST_F()
1869 ASSERT_TRUE(model.isValid()); in TEST_F()
1872 ASSERT_EQ(model.partitionTheWork(devices, ExecutePreference::PREFER_LOW_POWER, in TEST_F()
1950 PartitioningModel model; in TEST_F() local
1951 uint32_t opnd0 = model.addFloatOperand(); in TEST_F()
1952 uint32_t opnd1 = model.addFloatOperand(); in TEST_F()
1953 uint32_t opnd2 = model.addOperation2To1V1_0(0, opnd0, opnd1, Dimensioned::NO); in TEST_F()
1954 uint32_t opnd3 = model.addFloatOperand(); in TEST_F()
1955 uint32_t opnd4 = model.addOperation2To1V1_0(1, opnd2, opnd3); in TEST_F()
1956 model.identifyInputsAndOutputs({opnd0, opnd1, opnd3}, {opnd4}); in TEST_F()
1957 model.finish(); in TEST_F()
1958 ASSERT_TRUE(model.isValid()); in TEST_F()
1967 PartitioningCompilation cPNo(&model, devices); in TEST_F()
1978 PartitioningCompilation cPWithFallback(&model, devices); in TEST_F()
1989 PartitioningCompilation cPWithoutFallback(&model, devices); in TEST_F()
2001 PartitioningModel model; in TEST_F() local
2002 uint32_t opnd0 = model.addFloatOperand(); in TEST_F()
2003 uint32_t opnd1 = model.addFloatOperand(); in TEST_F()
2004 uint32_t opnd2 = model.addOperation2To1V1_0(0, opnd0, opnd1); in TEST_F()
2005 uint32_t opnd3 = model.addOperation2To1V1_0(1, opnd2, opnd2); in TEST_F()
2006 model.identifyInputsAndOutputs({opnd0, opnd1}, {opnd2, opnd3}); in TEST_F()
2007 model.finish(); in TEST_F()
2008 ASSERT_TRUE(model.isValid()); in TEST_F()
2016 ASSERT_EQ(model.partitionTheWork(devices, ExecutePreference::PREFER_LOW_POWER, in TEST_F()
2062 PartitioningModel model; in TEST_F() local
2063 uint32_t opndIn = model.addFloatOperand(); in TEST_F()
2064 uint32_t opndOut = model.addOperationOEM1To1(opndIn); in TEST_F()
2065 model.identifyInputsAndOutputs({opndIn}, {opndOut}); in TEST_F()
2066 model.finish(); in TEST_F()
2067 ASSERT_TRUE(model.isValid()); in TEST_F()
2076 PartitioningCompilation compilationBestOEM(&model, devicesBestOEM); in TEST_F()
2085 PartitioningCompilation compilationNoOEM(&model, devicesNoOEM); in TEST_F()
2091 PartitioningCompilation compilationIndecisiveOEM(&model, devicesIndecisiveOEM); in TEST_F()
2095 PartitioningCompilation compilationNoDrivers(&model, makeDevices({}) /* no drivers */); in TEST_F()
2108 PartitioningModel model; in TEST_F() local
2109 uint32_t opnd0 = model.addFloatOperand(); in TEST_F()
2110 uint32_t opnd1 = model.addFloatOperand(); in TEST_F()
2111 uint32_t opnd2 = model.addOperation2To1V1_0(0, opnd0, opnd1); in TEST_F()
2112 model.identifyInputsAndOutputs({opnd0, opnd1}, {opnd2}); in TEST_F()
2113 model.relaxComputationFloat32toFloat16(doRelax); in TEST_F()
2114 model.finish(); in TEST_F()
2115 ASSERT_TRUE(model.isValid()); in TEST_F()
2120 ASSERT_EQ(model.partitionTheWork(devices, ExecutePreference::PREFER_LOW_POWER, in TEST_F()
2152 PartitioningModel model; in TEST_F() local
2153 uint32_t opndIn = model.addOperand(static_cast<WrapperType>(operandType)); in TEST_F()
2154 uint32_t opndOut = model.addOperationOEM1To1(opndIn); in TEST_F()
2155 model.identifyInputsAndOutputs({opndIn}, {opndOut}); in TEST_F()
2156 model.finish(); in TEST_F()
2157 ASSERT_TRUE(model.isValid()); in TEST_F()
2174 ASSERT_EQ(model.partitionTheWork(devices, ExecutePreference::PREFER_LOW_POWER, in TEST_F()
2194 ASSERT_EQ(model.partitionTheWork(devices, ExecutePreference::PREFER_LOW_POWER, in TEST_F()
2214 PartitioningModel model; in TEST_F() local
2215 const uint32_t opnd0 = model.addFloatZeroOperand(); in TEST_F()
2216 const uint32_t opnd1 = model.addOperation1To1V1_3(0, opnd0); in TEST_F()
2217 const uint32_t opnd2 = model.addFloatOperand(); in TEST_F()
2218 const uint32_t opnd3 = model.addOperation2To1V1_0(1, opnd1, opnd2); in TEST_F()
2219 model.identifyInputsAndOutputs({opnd2}, {opnd3}); in TEST_F()
2220 ASSERT_EQ(model.finish(), Result::NO_ERROR); in TEST_F()
2226 PartitioningCompilation compilation(&model, devices); in TEST_F()
2233 PartitioningModel model; in TEST_F() local
2234 const uint32_t opnd0 = model.addFloatOperand(); in TEST_F()
2235 const uint32_t opnd1 = model.addOperation1To1V1_3(0, opnd0); in TEST_F()
2236 const uint32_t opnd2 = model.addFloatOperand(); in TEST_F()
2237 model.addOperation2To1V1_0(1, opnd1, opnd2); in TEST_F()
2238 model.identifyInputsAndOutputs({opnd0, opnd2}, {opnd1}); in TEST_F()
2239 ASSERT_EQ(model.finish(), Result::NO_ERROR); in TEST_F()
2245 PartitioningCompilation compilation(&model, devices); in TEST_F()
2642 void getTransformedCacheTokenSingle(const PartitioningModel& model, in getTransformedCacheTokenSingle() argument
2649 PartitioningCompilation compilation(&model, devices); in getTransformedCacheTokenSingle()
2695 void getTransformedCacheToken(const PartitioningModel& model, in getTransformedCacheToken() argument
2701 getTransformedCacheTokenSingle(model, devices, deviceName, tokenIn, preference, priority, in getTransformedCacheToken()
2709 getTransformedCacheTokenSingle(model, devices, deviceName, tokenIn, preference, in getTransformedCacheToken()
2715 void createModelForCachingTests(PartitioningModel* model) { in createModelForCachingTests() argument
2716 uint32_t opnd0 = model->addFloatOperand(); in createModelForCachingTests()
2717 uint32_t opnd1 = model->addFloatOperand(); in createModelForCachingTests()
2718 uint32_t opnd2 = model->addOperation2To1V1_0(0, opnd0, opnd1); in createModelForCachingTests()
2719 uint32_t opnd3 = model->addFloatOperand(); in createModelForCachingTests()
2720 uint32_t opnd4 = model->addOperation2To1V1_0(1, opnd2, opnd3); in createModelForCachingTests()
2721 model->identifyInputsAndOutputs({opnd0, opnd1, opnd3}, {opnd4}); in createModelForCachingTests()
2722 model->finish(); in createModelForCachingTests()
2723 ASSERT_TRUE(model->isValid()); in createModelForCachingTests()
2775 PartitioningModel model; in TEST_F() local
2776 createModelForCachingTests(&model); in TEST_F()
2784 getTransformedCacheToken(model, deviceA, "deviceA", tokenIn, in TEST_F()
2793 PartitioningModel model; in TEST_F() local
2794 createModelForCachingTests(&model); in TEST_F()
2802 getTransformedCacheToken(model, deviceA, "deviceA", tokenIn, in TEST_F()
2805 getTransformedCacheToken(model, deviceB, "deviceB", tokenIn, in TEST_F()
2814 PartitioningModel model; in TEST_F() local
2815 createModelForCachingTests(&model); in TEST_F()
2823 getTransformedCacheToken(model, deviceA_1_0, "deviceA", tokenIn, in TEST_F()
2826 getTransformedCacheToken(model, deviceA_1_1, "deviceA", tokenIn, in TEST_F()
2835 PartitioningModel model; in TEST_F() local
2836 createModelForCachingTests(&model); in TEST_F()
2843 getTransformedCacheToken(model, deviceA, "deviceA", tokenIn, in TEST_F()
2846 getTransformedCacheToken(model, deviceA, "deviceA", tokenIn, in TEST_F()
2849 getTransformedCacheToken(model, deviceA, "deviceA", tokenIn, in TEST_F()
2859 PartitioningModel model; in TEST_F() local
2860 createModelForCachingTests(&model); in TEST_F()
2867 getTransformedCacheToken(model, deviceA, "deviceA", tokenIn, in TEST_F()
2870 getTransformedCacheToken(model, deviceA, "deviceA", tokenIn, in TEST_F()
2873 getTransformedCacheToken(model, deviceA, "deviceA", tokenIn, in TEST_F()
2882 PartitioningModel model; in TEST_F() local
2883 createModelForCachingTests(&model); in TEST_F()
2891 getTransformedCacheToken(model, deviceA, "deviceA", tokenIn1, in TEST_F()
2894 getTransformedCacheToken(model, deviceA, "deviceA", tokenIn2, in TEST_F()
2903 PartitioningModel model; in TEST_F() local
2904 createModelForCachingTests(&model); in TEST_F()
2910 getTransformedCacheToken(model, devices, "deviceA", tokenIn, in TEST_F()
2914 getTransformedCacheToken(model, devices, "deviceB", tokenIn, in TEST_F()
2923 PartitioningModel model; in TEST_F() local
2924 createModelForCachingTests(&model); in TEST_F()
2933 getTransformedCacheToken(model, devices1, "deviceA", tokenIn, in TEST_F()
2936 getTransformedCacheToken(model, devices2, "deviceB", tokenIn, in TEST_F()
2945 PartitioningModel model; in TEST_F() local
2946 createModelForCachingTests(&model); in TEST_F()
2955 getTransformedCacheToken(model, devices1, "deviceA", tokenIn, in TEST_F()
2958 getTransformedCacheToken(model, devices2, "deviceA", tokenIn, in TEST_F()
2967 PartitioningModel model; in TEST_F() local
2968 createModelForCachingTests(&model); in TEST_F()
2975 getTransformedCacheToken(model, devices, "deviceA", tokenIn, in TEST_F()
2978 getTransformedCacheToken(model, devices, "deviceA", tokenIn, in TEST_F()
2981 getTransformedCacheToken(model, devices, "deviceA", tokenIn, in TEST_F()
2990 PartitioningModel model; in TEST_F() local
2991 createModelForCachingTests(&model); in TEST_F()
2998 getTransformedCacheToken(model, devices, "deviceA", tokenIn, in TEST_F()
3001 getTransformedCacheToken(model, devices, "deviceA", tokenIn, in TEST_F()
3004 getTransformedCacheToken(model, devices, "deviceA", tokenIn, in TEST_F()
3013 PartitioningModel model; in TEST_F() local
3014 createModelForCachingTests(&model); in TEST_F()
3022 getTransformedCacheToken(model, devices, "deviceA", tokenIn1, in TEST_F()
3025 getTransformedCacheToken(model, devices, "deviceA", tokenIn2, in TEST_F()
3034 PartitioningModel model; in TEST_F() local
3035 createModelForCachingTests(&model); in TEST_F()
3046 getTransformedCacheToken(model, devices1, "deviceA", tokenIn, in TEST_F()
3049 getTransformedCacheToken(model, devices2, "deviceA", tokenIn, in TEST_F()
3052 getTransformedCacheToken(model, devices3, "deviceA", tokenIn, in TEST_F()
3133 auto model = std::make_unique<PartitioningModel>(); in createBranchOrBodyModel() local
3134 const uint32_t opnd0 = model->addFloatOperand(dimensioned); in createBranchOrBodyModel()
3135 const uint32_t opnd1 = model->addFloatOperand(dimensioned); in createBranchOrBodyModel()
3136 const uint32_t opnd2 = model->addOperation2To1V1_0(0, opnd0, opnd1, dimensioned); in createBranchOrBodyModel()
3137 model->identifyInputsAndOutputs({opnd0, opnd1}, {opnd2}); in createBranchOrBodyModel()
3138 model->finish(); in createBranchOrBodyModel()
3139 EXPECT_TRUE(model->isValid()); in createBranchOrBodyModel()
3140 return model; in createBranchOrBodyModel()
3147 auto model = std::make_unique<PartitioningModel>(); in createCondModel() local
3148 const uint32_t opnd0 = model->addFloatOperand(dimensioned); in createCondModel()
3149 const uint32_t opnd1 = model->addFloatOperand(dimensioned); in createCondModel()
3150 const uint32_t opnd2 = model->addExplicitOperationXTo1( in createCondModel()
3152 model->identifyInputsAndOutputs({opnd0, opnd1}, {opnd2}); in createCondModel()
3153 model->finish(); in createCondModel()
3154 EXPECT_TRUE(model->isValid()); in createCondModel()
3155 return model; in createCondModel()