From 53a765267d831d6eb5ced676f80ffff41623d26f Mon Sep 17 00:00:00 2001 From: Megvii Engine Team Date: Wed, 12 Jul 2023 12:03:05 +0800 Subject: [PATCH] fix(opencl): fix MGE_WITH_OPENCL_ONLY crash on some model, eg, use type_cvt. at load stage, some(StaticInferOpr) naive op->exe will be called do not check elemwise_multi_type, as ocl do not run quantization model GitOrigin-RevId: 510df237428ca76b02f7c776cdec683e52c1a7bc --- dnn/src/naive/reduce/opr_impl.cpp | 6 ------ dnn/src/naive/type_cvt/opr_impl.cpp | 4 ---- 2 files changed, 10 deletions(-) diff --git a/dnn/src/naive/reduce/opr_impl.cpp b/dnn/src/naive/reduce/opr_impl.cpp index 4d613a3fc..4209f007c 100644 --- a/dnn/src/naive/reduce/opr_impl.cpp +++ b/dnn/src/naive/reduce/opr_impl.cpp @@ -112,7 +112,6 @@ void reduce_fwd( } } -#if !MGE_BUILD_WITHOUT_NAIVE_EXEC template <> void reduce_fwd( const dt_quint8* __restrict, dt_quint8* __restrict, size_t, size_t, size_t) { @@ -176,7 +175,6 @@ void reduce_fwd( "Reduce (PRODUCT) with DEFAULT DataType is not supported " "on QuantizedS8"); } -#endif template void dispatch_dtype( @@ -240,7 +238,6 @@ size_t ReduceForwardImpl::get_workspace_in_bytes( void ReduceForwardImpl::exec( _megdnn_tensor_in src, _megdnn_tensor_out dst, _megdnn_workspace workspace) { -#if !MGE_BUILD_WITHOUT_NAIVE_EXEC using namespace reduce; check_exec(src.layout, dst.layout, workspace.size); size_t A, B, C; @@ -307,9 +304,6 @@ void ReduceForwardImpl::exec( megdnn_assert_internal(false); } #undef CASE -#else - __builtin_trap(); -#endif } } // namespace naive diff --git a/dnn/src/naive/type_cvt/opr_impl.cpp b/dnn/src/naive/type_cvt/opr_impl.cpp index 85b5b4f07..3b2eb78d2 100644 --- a/dnn/src/naive/type_cvt/opr_impl.cpp +++ b/dnn/src/naive/type_cvt/opr_impl.cpp @@ -78,7 +78,6 @@ void on_dest_ctype(HandleImpl* handle, const TensorND& dest, const TensorND& src } // anonymous namespace void TypeCvtImpl::exec(_megdnn_tensor_in src, _megdnn_tensor_out dst) { -#if !MGE_BUILD_WITHOUT_NAIVE_EXEC check_exec(src.layout, dst.layout); // exec @@ -96,9 +95,6 @@ void TypeCvtImpl::exec(_megdnn_tensor_in src, _megdnn_tensor_out dst) { #undef cb default : megdnn_throw("bad dtype"); } -#else - __builtin_trap(); -#endif } // vim: syntax=cpp.doxygen -- GitLab