Lines Matching refs:model
282 uint32_t lookupOperation(const HidlModel& model, const Subgraph& subgraph, in lookupOperation() argument
287 [&model](uint32_t offset) { return &model.operandValues[offset]; }, operationIndex); in lookupOperation()
292 void dump(const char* name, const ModelBuilder* model) { in dump() argument
293 const HidlModel hidlModel = model->makeHidlModel(); in dump()
387 const Model& model, ExecutionPreference, Priority, const OptionalTimePoint&, in prepareModel_1_3() argument
392 for (const auto& operation : model.main.operations) { in prepareModel_1_3()
410 Return<void> getSupportedOperations_1_3(const Model& model, in getSupportedOperations_1_3() argument
412 if (!android::nn::validateModel(model)) { in getSupportedOperations_1_3()
416 cb(V1_3::ErrorStatus::NONE, getSupportedOperationsForSubgraph(model, model.main)); in getSupportedOperations_1_3()
433 std::vector<bool> getSupportedOperationsForSubgraph(const Model& model, in getSupportedOperationsForSubgraph() argument
435 CHECK(&subgraph == &model.main || in getSupportedOperationsForSubgraph()
436 std::find_if(model.referenced.begin(), model.referenced.end(), in getSupportedOperationsForSubgraph()
439 }) != model.referenced.end()); in getSupportedOperationsForSubgraph()
440 auto supportsEntireSubgraph = [this, &model, &subgraph](uint32_t refSubgraphOperandIndex) { in getSupportedOperationsForSubgraph()
444 CHECK_LT(refSubgraphOperand.location.offset, model.referenced.size()); in getSupportedOperationsForSubgraph()
445 const Subgraph& refSubgraph = model.referenced[refSubgraphOperand.location.offset]; in getSupportedOperationsForSubgraph()
446 std::vector<bool> supported = getSupportedOperationsForSubgraph(model, refSubgraph); in getSupportedOperationsForSubgraph()
476 uint32_t operationEncoding = lookupOperation(model, subgraph, i); in getSupportedOperationsForSubgraph()
504 Return<void> getSupportedOperations_1_2(const V1_2::Model& model, in getSupportedOperations_1_2() argument
506 return mLatestDriver->getSupportedOperations_1_2(model, _hidl_cb); in getSupportedOperations_1_2()
509 const V1_2::Model& model, ExecutionPreference preference, in prepareModel_1_2() argument
513 return mLatestDriver->prepareModel_1_2(model, preference, modelCache, dataCache, token, in prepareModel_1_2()
534 Return<void> getSupportedOperations_1_1(const V1_1::Model& model, in getSupportedOperations_1_1() argument
536 return mLatestDriver->getSupportedOperations_1_1(model, _hidl_cb); in getSupportedOperations_1_1()
539 const V1_1::Model& model, ExecutionPreference preference, in prepareModel_1_1() argument
541 return mLatestDriver->prepareModel_1_1(model, preference, actualCallback); in prepareModel_1_1()
547 Return<void> getSupportedOperations(const V1_0::Model& model, in getSupportedOperations() argument
549 return mLatestDriver->getSupportedOperations(model, _hidl_cb); in getSupportedOperations()
552 const V1_0::Model& model, in prepareModel() argument
554 return mLatestDriver->prepareModel(model, actualCallback); in prepareModel()
573 Return<void> getSupportedOperations_1_1(const V1_1::Model& model, in getSupportedOperations_1_1() argument
575 return mLatestDriver->getSupportedOperations_1_1(model, _hidl_cb); in getSupportedOperations_1_1()
578 const V1_1::Model& model, ExecutionPreference preference, in prepareModel_1_1() argument
580 return mLatestDriver->prepareModel_1_1(model, preference, actualCallback); in prepareModel_1_1()
586 Return<void> getSupportedOperations(const V1_0::Model& model, in getSupportedOperations() argument
588 return mLatestDriver->getSupportedOperations(model, _hidl_cb); in getSupportedOperations()
591 const V1_0::Model& model, in prepareModel() argument
593 return mLatestDriver->prepareModel(model, actualCallback); in prepareModel()
612 Return<void> getSupportedOperations(const V1_0::Model& model, in getSupportedOperations() argument
614 return mLatestDriver->getSupportedOperations(model, _hidl_cb); in getSupportedOperations()
617 const V1_0::Model& model, in prepareModel() argument
619 return mLatestDriver->prepareModel(model, actualCallback); in prepareModel()
857 uint32_t addRefModelOperand(const PartitioningModel& model) { in addRefModelOperand() argument
859 WrapperModel::setOperandValueFromModel(index, &model); in addRefModelOperand()
881 PartitioningCompilation(const PartitioningModel* model, in PartitioningCompilation() argument
883 ModelBuilder* m = reinterpret_cast<ModelBuilder*>(model->getHandle()); in PartitioningCompilation()
1121 void buildDefinitionMap(const ModelBuilder* model, std::map<uint32_t, uint32_t>* defMap) { in buildDefinitionMap() argument
1123 ASSERT_LT(model->operationCount(), kPseudoDefiningOperationBase); in buildDefinitionMap()
1124 for (uint32_t i = 0, e = model->operationCount(); i < e; i++) { in buildDefinitionMap()
1125 const Operation& operation = model->getOperation(i); in buildDefinitionMap()
1131 ASSERT_LT(model->inputCount(), kPseudoDefiningOperationRange); in buildDefinitionMap()
1132 for (uint32_t i = 0, e = model->inputCount(); i < e; i++) { in buildDefinitionMap()
1133 (*defMap)[model->getInputOperandIndex(i)] = kPseudoDefiningOperationModelInput0 + i; in buildDefinitionMap()
1136 for (uint32_t i = 0, e = model->operandCount(); i < e; i++) { in buildDefinitionMap()
1137 const Operand& operand = model->getOperand(i); in buildDefinitionMap()
1145 memcpy(&value, model->getPointerToOperandValue(operand.location.offset), in buildDefinitionMap()
1162 ASSERT_EQ(model->operandCount(), defMap->size()); in buildDefinitionMap()
1382 bool compare(const ExecutionStep* step, const PartitioningModel* model, in compare() argument
1387 reinterpret_cast<const ModelBuilder*>(model->getHandle()), in compare()
1391 void compare(const std::shared_ptr<LogicalStep> logicalStep, const PartitioningModel* model, in compare() argument
1400 ASSERT_TRUE(compare(step, model, device, &inputsAndOutputsModelToStep))); in compare()
1417 const RemapVectorType& step, RemapVectorType model) { in compareRemapVectors() argument
1418 std::transform(model.begin(), model.end(), model.begin(), in compareRemapVectors()
1423 return step == model; in compareRemapVectors()
1428 const StepModelOutputSetType& step, const StepModelOutputSetType& model) { in compareStepModelOutputSets() argument
1431 model.begin(), model.end(), std::inserter(modelTransformed, modelTransformed.end()), in compareStepModelOutputSets()
1440 PartitioningModel model; in TEST_F() local
1441 uint32_t opnd0 = model.addFloatOperand(); in TEST_F()
1442 uint32_t opnd1 = model.addFloatOperand(); in TEST_F()
1443 uint32_t opnd2 = model.addOperation2To1V1_0(0, opnd0, opnd1); in TEST_F()
1444 uint32_t opnd3 = model.addFloatOperand(); in TEST_F()
1445 uint32_t opnd4 = model.addOperation2To1V1_0(1, opnd2, opnd3); in TEST_F()
1446 model.identifyInputsAndOutputs({opnd0, opnd1, opnd3}, {opnd4}); in TEST_F()
1447 model.finish(); in TEST_F()
1448 ASSERT_TRUE(model.isValid()); in TEST_F()
1455 ASSERT_EQ(model.partitionTheWork(devicesA, ExecutePreference::PREFER_LOW_POWER, in TEST_F()
1467 ASSERT_EQ(model.partitionTheWork(devicesC, ExecutePreference::PREFER_LOW_POWER, in TEST_F()
1479 ASSERT_EQ(model.partitionTheWork(devicesB, ExecutePreference::PREFER_LOW_POWER, in TEST_F()
1528 PartitioningModel model; in TEST_F() local
1529 uint32_t opnd0 = model.addFloatOperand(); in TEST_F()
1530 uint32_t opnd1 = model.addFloatOperand(); in TEST_F()
1531 uint32_t opnd2 = model.addOperation2To1V1_0(0, opnd0, opnd1); in TEST_F()
1532 uint32_t opnd3 = model.addOperation2To1V1_0(1, opnd0, opnd1); in TEST_F()
1533 uint32_t opnd4 = model.addOperation2To1V1_1(0, opnd0, opnd1); in TEST_F()
1534 uint32_t opnd5 = model.addOperation2To1V1_2(0, opnd2, opnd3); in TEST_F()
1535 uint32_t opnd6 = model.addOperation1To1V1_3(0, opnd2); in TEST_F()
1536 model.identifyInputsAndOutputs({opnd0, opnd1}, {opnd2, opnd4, opnd5, opnd6}); in TEST_F()
1537 model.finish(); in TEST_F()
1538 ASSERT_TRUE(model.isValid()); in TEST_F()
1548 ASSERT_EQ(model.partitionTheWork(devicesA, ExecutePreference::PREFER_LOW_POWER, in TEST_F()
1562 ASSERT_EQ(model.partitionTheWork(devicesB, ExecutePreference::PREFER_LOW_POWER, in TEST_F()
1655 PartitioningModel model; in TEST_F() local
1656 uint32_t opnd0 = model.addFloatOperand(); in TEST_F()
1657 uint32_t opnd1 = model.addOperation1To1V1_3(0, opnd0); in TEST_F()
1658 model.identifyInputsAndOutputs({opnd0}, {opnd1}); in TEST_F()
1659 model.finish(); in TEST_F()
1660 ASSERT_TRUE(model.isValid()); in TEST_F()
1670 ASSERT_EQ(model.partitionTheWork(devices, ExecutePreference::PREFER_LOW_POWER, in TEST_F()
1688 PartitioningModel model; in TEST_F() local
1690 uint32_t opnd0 = model.addFloatOperand(); in TEST_F()
1691 uint32_t opnd1 = model.addFloatOperand(); in TEST_F()
1693 uint32_t opnd2 = model.addOperation2To1V1_0(kDevOp, opnd0, opnd1); in TEST_F()
1694 uint32_t opnd3 = model.addOperation2To1V1_0(kDevOp, opnd0, opnd2); in TEST_F()
1696 uint32_t opnd4 = model.addOperation2To1V1_0(kCpuOp, opnd0, opnd3); in TEST_F()
1697 uint32_t opnd5 = model.addOperation2To1V1_0(kCpuOp, opnd2, opnd4); in TEST_F()
1699 uint32_t opnd6 = model.addFloatOperand(); in TEST_F()
1701 uint32_t opnd7 = model.addOperation2To1V1_0(kDevOp, opnd3, opnd5); in TEST_F()
1702 uint32_t opnd8 = model.addOperation2To1V1_0(kDevOp, opnd6, opnd7); in TEST_F()
1704 model.identifyInputsAndOutputs({opnd0, opnd1, opnd6}, {opnd4, opnd8}); in TEST_F()
1705 model.finish(); in TEST_F()
1706 ASSERT_TRUE(model.isValid()); in TEST_F()
1709 ASSERT_EQ(model.partitionTheWork(devices, ExecutePreference::PREFER_LOW_POWER, in TEST_F()
1783 PartitioningModel model; in TEST_F() local
1784 uint32_t opnd0 = model.addFloatOperand(); in TEST_F()
1785 uint32_t opnd1 = model.addFloatOperand(); in TEST_F()
1786 uint32_t opnd2 = model.addOperation2To1V1_0(0, opnd0, opnd1, Dimensioned::NO); in TEST_F()
1787 uint32_t opnd3 = model.addFloatOperand(); in TEST_F()
1788 uint32_t opnd4 = model.addOperation2To1V1_0(1, opnd2, opnd3); in TEST_F()
1789 model.identifyInputsAndOutputs({opnd0, opnd1, opnd3}, {opnd4}); in TEST_F()
1790 model.finish(); in TEST_F()
1791 ASSERT_TRUE(model.isValid()); in TEST_F()
1804 PartitioningCompilation cPNo(&model, devices); in TEST_F()
1817 PartitioningCompilation cPWithFallback(&model, devices); in TEST_F()
1827 PartitioningCompilation cPWithoutFallback(&model, devices); in TEST_F()
1839 PartitioningModel model; in TEST_F() local
1840 uint32_t opnd0 = model.addFloatOperand(); in TEST_F()
1841 uint32_t opnd1 = model.addFloatOperand(); in TEST_F()
1842 uint32_t opnd2 = model.addOperation2To1V1_0(0, opnd0, opnd1); in TEST_F()
1843 uint32_t opnd3 = model.addOperation2To1V1_0(1, opnd2, opnd2); in TEST_F()
1844 model.identifyInputsAndOutputs({opnd0, opnd1}, {opnd2, opnd3}); in TEST_F()
1845 model.finish(); in TEST_F()
1846 ASSERT_TRUE(model.isValid()); in TEST_F()
1854 ASSERT_EQ(model.partitionTheWork(devices, ExecutePreference::PREFER_LOW_POWER, in TEST_F()
1897 PartitioningModel model; in TEST_F() local
1898 uint32_t opndIn = model.addFloatOperand(); in TEST_F()
1899 uint32_t opndOut = model.addOperationOEM1To1(opndIn); in TEST_F()
1900 model.identifyInputsAndOutputs({opndIn}, {opndOut}); in TEST_F()
1901 model.finish(); in TEST_F()
1902 ASSERT_TRUE(model.isValid()); in TEST_F()
1911 PartitioningCompilation compilationBestOEM(&model, devicesBestOEM); in TEST_F()
1920 PartitioningCompilation compilationNoOEM(&model, devicesNoOEM); in TEST_F()
1926 PartitioningCompilation compilationIndecisiveOEM(&model, devicesIndecisiveOEM); in TEST_F()
1930 PartitioningCompilation compilationNoDrivers(&model, makeDevices({}) /* no drivers */); in TEST_F()
1943 PartitioningModel model; in TEST_F() local
1944 uint32_t opnd0 = model.addFloatOperand(); in TEST_F()
1945 uint32_t opnd1 = model.addFloatOperand(); in TEST_F()
1946 uint32_t opnd2 = model.addOperation2To1V1_0(0, opnd0, opnd1); in TEST_F()
1947 model.identifyInputsAndOutputs({opnd0, opnd1}, {opnd2}); in TEST_F()
1948 model.relaxComputationFloat32toFloat16(doRelax); in TEST_F()
1949 model.finish(); in TEST_F()
1950 ASSERT_TRUE(model.isValid()); in TEST_F()
1955 ASSERT_EQ(model.partitionTheWork(devices, ExecutePreference::PREFER_LOW_POWER, in TEST_F()
1986 PartitioningModel model; in TEST_F() local
1987 uint32_t opndIn = model.addOperand(static_cast<WrapperType>(operandType)); in TEST_F()
1988 uint32_t opndOut = model.addOperationOEM1To1(opndIn); in TEST_F()
1989 model.identifyInputsAndOutputs({opndIn}, {opndOut}); in TEST_F()
1990 model.finish(); in TEST_F()
1991 ASSERT_TRUE(model.isValid()); in TEST_F()
2008 ASSERT_EQ(model.partitionTheWork(devices, ExecutePreference::PREFER_LOW_POWER, in TEST_F()
2027 ASSERT_EQ(model.partitionTheWork(devices, ExecutePreference::PREFER_LOW_POWER, in TEST_F()
2079 void getTransformedCacheTokenSingle(const PartitioningModel& model, in getTransformedCacheTokenSingle() argument
2086 PartitioningCompilation compilation(&model, devices); in getTransformedCacheTokenSingle()
2132 void getTransformedCacheToken(const PartitioningModel& model, in getTransformedCacheToken() argument
2138 getTransformedCacheTokenSingle(model, devices, deviceName, tokenIn, preference, priority, in getTransformedCacheToken()
2146 getTransformedCacheTokenSingle(model, devices, deviceName, tokenIn, preference, in getTransformedCacheToken()
2152 void createModelForCachingTests(PartitioningModel* model) { in createModelForCachingTests() argument
2153 uint32_t opnd0 = model->addFloatOperand(); in createModelForCachingTests()
2154 uint32_t opnd1 = model->addFloatOperand(); in createModelForCachingTests()
2155 uint32_t opnd2 = model->addOperation2To1V1_0(0, opnd0, opnd1); in createModelForCachingTests()
2156 uint32_t opnd3 = model->addFloatOperand(); in createModelForCachingTests()
2157 uint32_t opnd4 = model->addOperation2To1V1_0(1, opnd2, opnd3); in createModelForCachingTests()
2158 model->identifyInputsAndOutputs({opnd0, opnd1, opnd3}, {opnd4}); in createModelForCachingTests()
2159 model->finish(); in createModelForCachingTests()
2160 ASSERT_TRUE(model->isValid()); in createModelForCachingTests()
2212 PartitioningModel model; in TEST_F() local
2213 createModelForCachingTests(&model); in TEST_F()
2221 getTransformedCacheToken(model, deviceA, "deviceA", tokenIn, in TEST_F()
2230 PartitioningModel model; in TEST_F() local
2231 createModelForCachingTests(&model); in TEST_F()
2239 getTransformedCacheToken(model, deviceA, "deviceA", tokenIn, in TEST_F()
2242 getTransformedCacheToken(model, deviceB, "deviceB", tokenIn, in TEST_F()
2251 PartitioningModel model; in TEST_F() local
2252 createModelForCachingTests(&model); in TEST_F()
2260 getTransformedCacheToken(model, deviceA_1_0, "deviceA", tokenIn, in TEST_F()
2263 getTransformedCacheToken(model, deviceA_1_1, "deviceA", tokenIn, in TEST_F()
2272 PartitioningModel model; in TEST_F() local
2273 createModelForCachingTests(&model); in TEST_F()
2280 getTransformedCacheToken(model, deviceA, "deviceA", tokenIn, in TEST_F()
2283 getTransformedCacheToken(model, deviceA, "deviceA", tokenIn, in TEST_F()
2286 getTransformedCacheToken(model, deviceA, "deviceA", tokenIn, in TEST_F()
2295 PartitioningModel model; in TEST_F() local
2296 createModelForCachingTests(&model); in TEST_F()
2303 getTransformedCacheToken(model, deviceA, "deviceA", tokenIn, in TEST_F()
2306 getTransformedCacheToken(model, deviceA, "deviceA", tokenIn, in TEST_F()
2309 getTransformedCacheToken(model, deviceA, "deviceA", tokenIn, in TEST_F()
2318 PartitioningModel model; in TEST_F() local
2319 createModelForCachingTests(&model); in TEST_F()
2327 getTransformedCacheToken(model, deviceA, "deviceA", tokenIn1, in TEST_F()
2330 getTransformedCacheToken(model, deviceA, "deviceA", tokenIn2, in TEST_F()
2339 PartitioningModel model; in TEST_F() local
2340 createModelForCachingTests(&model); in TEST_F()
2346 getTransformedCacheToken(model, devices, "deviceA", tokenIn, in TEST_F()
2350 getTransformedCacheToken(model, devices, "deviceB", tokenIn, in TEST_F()
2359 PartitioningModel model; in TEST_F() local
2360 createModelForCachingTests(&model); in TEST_F()
2369 getTransformedCacheToken(model, devices1, "deviceA", tokenIn, in TEST_F()
2372 getTransformedCacheToken(model, devices2, "deviceB", tokenIn, in TEST_F()
2381 PartitioningModel model; in TEST_F() local
2382 createModelForCachingTests(&model); in TEST_F()
2391 getTransformedCacheToken(model, devices1, "deviceA", tokenIn, in TEST_F()
2394 getTransformedCacheToken(model, devices2, "deviceA", tokenIn, in TEST_F()
2403 PartitioningModel model; in TEST_F() local
2404 createModelForCachingTests(&model); in TEST_F()
2411 getTransformedCacheToken(model, devices, "deviceA", tokenIn, in TEST_F()
2414 getTransformedCacheToken(model, devices, "deviceA", tokenIn, in TEST_F()
2417 getTransformedCacheToken(model, devices, "deviceA", tokenIn, in TEST_F()
2426 PartitioningModel model; in TEST_F() local
2427 createModelForCachingTests(&model); in TEST_F()
2434 getTransformedCacheToken(model, devices, "deviceA", tokenIn, in TEST_F()
2437 getTransformedCacheToken(model, devices, "deviceA", tokenIn, in TEST_F()
2440 getTransformedCacheToken(model, devices, "deviceA", tokenIn, in TEST_F()
2449 PartitioningModel model; in TEST_F() local
2450 createModelForCachingTests(&model); in TEST_F()
2458 getTransformedCacheToken(model, devices, "deviceA", tokenIn1, in TEST_F()
2461 getTransformedCacheToken(model, devices, "deviceA", tokenIn2, in TEST_F()
2470 PartitioningModel model; in TEST_F() local
2471 createModelForCachingTests(&model); in TEST_F()
2482 getTransformedCacheToken(model, devices1, "deviceA", tokenIn, in TEST_F()
2485 getTransformedCacheToken(model, devices2, "deviceA", tokenIn, in TEST_F()
2488 getTransformedCacheToken(model, devices3, "deviceA", tokenIn, in TEST_F()
2569 auto model = std::make_unique<PartitioningModel>(); in createBranchOrBodyModel() local
2570 const uint32_t opnd0 = model->addFloatOperand(dimensioned); in createBranchOrBodyModel()
2571 const uint32_t opnd1 = model->addFloatOperand(dimensioned); in createBranchOrBodyModel()
2572 const uint32_t opnd2 = model->addOperation2To1V1_0(0, opnd0, opnd1, dimensioned); in createBranchOrBodyModel()
2573 model->identifyInputsAndOutputs({opnd0, opnd1}, {opnd2}); in createBranchOrBodyModel()
2574 model->finish(); in createBranchOrBodyModel()
2575 EXPECT_TRUE(model->isValid()); in createBranchOrBodyModel()
2576 return model; in createBranchOrBodyModel()
2583 auto model = std::make_unique<PartitioningModel>(); in createCondModel() local
2584 const uint32_t opnd0 = model->addFloatOperand(dimensioned); in createCondModel()
2585 const uint32_t opnd1 = model->addFloatOperand(dimensioned); in createCondModel()
2586 const uint32_t opnd2 = model->addExplicitOperationXTo1( in createCondModel()
2588 model->identifyInputsAndOutputs({opnd0, opnd1}, {opnd2}); in createCondModel()
2589 model->finish(); in createCondModel()
2590 EXPECT_TRUE(model->isValid()); in createCondModel()
2591 return model; in createCondModel()