| 87 | } |
| 88 | |
| 89 | virtual bool run(int precision) { |
| 90 | int numberThread = 0; |
| 91 | MNN::BackendConfig bnConfig; |
| 92 | auto exe = Executor::newExecutor(MNN_FORWARD_CPU, bnConfig, 1); |
| 93 | ExecutorScope scope(exe); |
| 94 | exe->setGlobalExecutorConfig(MNN_FORWARD_CPU, bnConfig, 4); |
| 95 | |
| 96 | auto x = _Input({1, 3, 224, 224}, NC4HW4); |
| 97 | auto y = _ReduceSum(_Multiply(x, x), {}); |
| 98 | ::memset(x->writeMap<float>(), 0, x->getInfo()->size * sizeof(float)); |
| 99 | y->readMap<float>(); |
| 100 | auto res = Executor::getComputeInfo(y->expr().first, MNN::Interpreter::THREAD_NUMBER, &numberThread); |
| 101 | if (numberThread != 4 || res == false) { |
| 102 | FUNC_PRINT(1); |
| 103 | return false; |
| 104 | } |
| 105 | |
| 106 | exe->setGlobalExecutorConfig(MNN_FORWARD_CPU, bnConfig, 4); |
| 107 | ::memset(x->writeMap<float>(), 0, x->getInfo()->size * sizeof(float)); |
| 108 | y->readMap<float>(); |
| 109 | res = Executor::getComputeInfo(y->expr().first, MNN::Interpreter::THREAD_NUMBER, &numberThread); |
| 110 | if (numberThread != 4 || res == false) { |
| 111 | FUNC_PRINT(1); |
| 112 | return false; |
| 113 | } |
| 114 | exe->setGlobalExecutorConfig(MNN_FORWARD_CPU, bnConfig, 1); |
| 115 | // Reset x, y |
| 116 | x = _Input({1, 3, 224, 224}, NC4HW4); |
| 117 | y = _ReduceSum(_Multiply(x, x), {}); |
| 118 | ::memset(x->writeMap<float>(), 0, x->getInfo()->size * sizeof(float)); |
| 119 | y->readMap<float>(); |
| 120 | res = Executor::getComputeInfo(y->expr().first, MNN::Interpreter::THREAD_NUMBER, &numberThread); |
| 121 | if (numberThread != 1 || res == false) { |
| 122 | FUNC_PRINT(1); |
| 123 | return false; |
| 124 | } |
| 125 | if (!_runmbv1()) { |
| 126 | return false; |
| 127 | } |
| 128 | return true; |
| 129 | } |
| 130 | }; |
| 131 | MNNTestSuiteRegister(ExecutorResetTest, "expr/ExecutorReset"); |
| 132 | class ExecutorConfigTest : public MNNTestCase { |
nothing calls this directly
no test coverage detected