| 193 | |
| 194 | template <typename Opr, typename Proxy> |
| 195 | void TaskRecordChecker<Opr, Proxy>::exec(TensorLayoutArray layouts) { |
| 196 | auto opr_cur = this->opr(); |
| 197 | opr_cur->param() = m_param; |
| 198 | |
| 199 | m_proxy.deduce_layout(opr_cur, layouts); |
| 200 | for (size_t i = 0; i < layouts.size(); ++i) { |
| 201 | if (layouts[i].dtype == dtype::Byte()) { |
| 202 | layouts[i] = TensorLayout(layouts[i], dtype::Int8()); |
| 203 | } |
| 204 | } |
| 205 | |
| 206 | // allocate input |
| 207 | m_tensors_truth = alloc_tensors(m_handle.get(), layouts, 0); |
| 208 | m_tensors_first = alloc_tensors(m_handle.get(), layouts, 0); |
| 209 | m_tensors_second = alloc_tensors(m_handle.get(), layouts, 0); |
| 210 | |
| 211 | init_host_values(); |
| 212 | |
| 213 | copy_tensors(*m_tensors_first, *m_tensors_truth); |
| 214 | copy_tensors(*m_tensors_second, *m_tensors_truth); |
| 215 | |
| 216 | m_dispatcher->enable_execute_inplace(); |
| 217 | m_proxy.exec(opr_cur, *m_tensors_truth); |
| 218 | |
| 219 | m_dispatcher->clear_task(); |
| 220 | m_dispatcher->disable_execute_inplace(); |
| 221 | //! record the task |
| 222 | m_proxy.exec(opr_cur, *m_tensors_first); |
| 223 | m_dispatcher->run_task(); |
| 224 | |
| 225 | //! if check record2, the opr should be free |
| 226 | // free_opr(); |
| 227 | check_tensors(*m_tensors_truth, *m_tensors_first); |
| 228 | |
| 229 | //! change the src and out ptr and run again |
| 230 | change_tensor_ptr(m_tensors_first, m_tensors_second, m_recovery_ptrs); |
| 231 | m_dispatcher->run_task(); |
| 232 | check_tensors(*m_tensors_truth, *m_tensors_second); |
| 233 | |
| 234 | m_dispatcher->clear_task(); |
| 235 | recovery_tensor_ptr(m_tensors_first, m_recovery_ptrs); |
| 236 | m_recovery_ptrs.clear(); |
| 237 | } |
| 238 | |
| 239 | template <typename Opr, typename Proxy> |
| 240 | void TaskRecordChecker<Opr, Proxy>::init_host_values() { |
nothing calls this directly
no test coverage detected