From b36cb1a57e8a6db4c8ce191b966218c654b96c3c Mon Sep 17 00:00:00 2001 From: yunji Date: Tue, 27 Jul 2021 02:14:23 +0900 Subject: [PATCH] Fix reviewed code and remove i8 and u8 data type. --- .../src/cldnn_engine/ops/gather_elements.cpp | 4 ++-- .../single_layer_tests/gather_elements.cpp | 4 +--- .../single_layer_tests/gather_elements.cpp | 4 +++- .../api/cldnn/primitives/gather_elements.hpp | 2 +- .../kernel_selector/common/common_types.h | 12 ------------ .../gather/gather_elements_kernel_ref.cpp | 19 +++++++++---------- .../gather/gather_elements_kernel_ref.h | 5 +++-- .../gather_elements_kernel_selector.cpp | 2 +- .../gather/gather_elements_kernel_selector.h | 2 +- .../core/cl_kernels/gather_elements_ref.cl | 1 + .../core/kernel_selector_common.cpp | 14 ++------------ .../core/kernel_selector_common.h | 1 - .../clDNN/src/impls/ocl/gather_elements.cpp | 8 +------- .../src/include/kernel_selector_helper.h | 2 +- 14 files changed, 26 insertions(+), 54 deletions(-) diff --git a/inference-engine/src/cldnn_engine/ops/gather_elements.cpp b/inference-engine/src/cldnn_engine/ops/gather_elements.cpp index 07f20356c76ff0..d61382807506c1 100644 --- a/inference-engine/src/cldnn_engine/ops/gather_elements.cpp +++ b/inference-engine/src/cldnn_engine/ops/gather_elements.cpp @@ -12,7 +12,7 @@ namespace CLDNNPlugin { -static cldnn::gather_elements::gather_elements_axis GetGatherElementsAxis(int axis, unsigned rank) { +static cldnn::gather_elements::gather_elements_axis GetGatherAxis(int axis, unsigned rank) { if (axis < 0) axis += rank; if (axis < 0 || axis >= rank) @@ -55,7 +55,7 @@ void CreateGatherElementsOp(Program& p, const std::shared_ptrget_output_shape(0)), - GetGatherElementsAxis(axis, rank)); + GetGatherAxis(axis, rank)); p.AddPrimitive(primitive); p.AddPrimitiveToProfiler(op); diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/gather_elements.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/gather_elements.cpp index 63a6fd88c3e241..0220364af315f8 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/gather_elements.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/gather_elements.cpp @@ -17,8 +17,6 @@ const std::vector dPrecisions = { InferenceEngine::Precision::I32, InferenceEngine::Precision::I64, InferenceEngine::Precision::I16, - InferenceEngine::Precision::U8, - InferenceEngine::Precision::I8 }; const std::vector iPrecisions = { InferenceEngine::Precision::I32, @@ -74,4 +72,4 @@ INSTANTIATE_TEST_SUITE_P(smoke_set5, GatherElementsLayerTest, ::testing::ValuesIn(iPrecisions), ::testing::Values(CommonTestUtils::DEVICE_CPU)), GatherElementsLayerTest::getTestCaseName); -} // namespace \ No newline at end of file +} // namespace diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/single_layer_tests/gather_elements.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/single_layer_tests/gather_elements.cpp index 452586fac12346..bbd06703caf71b 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/single_layer_tests/gather_elements.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/single_layer_tests/gather_elements.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2021 Intel Corporation // SPDX-License-Identifier: Apache-2.0 -// // +// #include #include @@ -17,6 +17,8 @@ const std::vector inputPrecisions = { InferenceEngine::Precision::FP32, InferenceEngine::Precision::FP16, InferenceEngine::Precision::I32, + InferenceEngine::Precision::I8, + InferenceEngine::Precision::U8, }; const std::vector idxPrecisions = { diff --git a/inference-engine/thirdparty/clDNN/api/cldnn/primitives/gather_elements.hpp b/inference-engine/thirdparty/clDNN/api/cldnn/primitives/gather_elements.hpp index fdcbc1df3babd9..d6d0ca9fdb24f9 100644 --- a/inference-engine/thirdparty/clDNN/api/cldnn/primitives/gather_elements.hpp +++ b/inference-engine/thirdparty/clDNN/api/cldnn/primitives/gather_elements.hpp @@ -55,4 +55,4 @@ struct gather_elements : public primitive_base { /// @} /// @} /// @} -} // namespace cldnn \ No newline at end of file +} // namespace cldnn diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/common/common_types.h b/inference-engine/thirdparty/clDNN/kernel_selector/common/common_types.h index fbb108a8124baa..dbe6bd7004c672 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/common/common_types.h +++ b/inference-engine/thirdparty/clDNN/kernel_selector/common/common_types.h @@ -514,18 +514,6 @@ enum class GatherAxis { BATCH, }; -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// GatherElementsAxis -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -enum class GatherElementsAxis { - X, - Y, - Z, - W, - FEATURE, - BATCH, -}; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // ScatterUpdateAxis //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gather/gather_elements_kernel_ref.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gather/gather_elements_kernel_ref.cpp index 2d126530ecadf9..eb01e12a12f0ee 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gather/gather_elements_kernel_ref.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gather/gather_elements_kernel_ref.cpp @@ -14,17 +14,17 @@ static size_t GetGatherElementsChannelIndex(const gather_elements_params& params size_t inputSize = params.inputs[0].GetDims().size(); switch (params.axis) { - case GatherElementsAxis::X: + case GatherAxis::X: return inputSize - 1; - case GatherElementsAxis::Y: + case GatherAxis::Y: return inputSize - 2; - case GatherElementsAxis::Z: + case GatherAxis::Z: return inputSize - 3; - case GatherElementsAxis::W: + case GatherAxis::W: return 2; - case GatherElementsAxis::FEATURE: + case GatherAxis::FEATURE: return 1; - case GatherElementsAxis::BATCH: + case GatherAxis::BATCH: return 0; default: break; @@ -38,13 +38,9 @@ ParamsKey GatherElementsKernelRef::GetSupportedKey() const { k.EnableInputDataType(Datatype::F16); k.EnableInputDataType(Datatype::F32); k.EnableInputDataType(Datatype::INT32); - k.EnableInputDataType(Datatype::INT8); - k.EnableInputDataType(Datatype::UINT8); k.EnableOutputDataType(Datatype::F16); k.EnableOutputDataType(Datatype::F32); k.EnableOutputDataType(Datatype::INT32); - k.EnableOutputDataType(Datatype::INT8); - k.EnableOutputDataType(Datatype::UINT8); k.EnableInputLayout(DataLayout::bfyx); k.EnableOutputLayout(DataLayout::bfyx); k.EnableInputLayout(DataLayout::bfzyx); @@ -152,4 +148,7 @@ KernelsData GatherElementsKernelRef::GetKernelsData(const Params& params, const return { kd }; } +KernelsPriority GatherElementsKernelRef::GetKernelsPriority(const Params& /*params*/, const optional_params& /*options*/) const { + return DONT_USE_IF_HAVE_SOMETHING_ELSE; +} } // namespace kernel_selector diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gather/gather_elements_kernel_ref.h b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gather/gather_elements_kernel_ref.h index 3216875f59a3cd..8eec4ae96326fa 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gather/gather_elements_kernel_ref.h +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gather/gather_elements_kernel_ref.h @@ -11,9 +11,9 @@ namespace kernel_selector { // gather_elements_params //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// struct gather_elements_params : public base_params { - gather_elements_params() : base_params(KernelType::GATHER_ELEMENTS), axis(GatherElementsAxis::BATCH) {} + gather_elements_params() : base_params(KernelType::GATHER_ELEMENTS), axis(GatherAxis::BATCH) {} - GatherElementsAxis axis; + GatherAxis axis; }; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -30,6 +30,7 @@ class GatherElementsKernelRef : public KernelBaseOpenCL { virtual JitConstants GetJitConstants(const gather_elements_params& params) const; virtual CommonDispatchData SetDefault(const gather_elements_params& params, const optional_params&) const; KernelsData GetKernelsData(const Params& params, const optional_params& options) const override; + KernelsPriority GetKernelsPriority(const Params& params, const optional_params& options) const override; ParamsKey GetSupportedKey() const override; std::vector GetSupportedFusedOps() const override { return { FusedOpType::QUANTIZE, diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gather/gather_elements_kernel_selector.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gather/gather_elements_kernel_selector.cpp index 361e89e6ad5c2b..3a451cf574add9 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gather/gather_elements_kernel_selector.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gather/gather_elements_kernel_selector.cpp @@ -24,4 +24,4 @@ gather_elements_kernel_selector::gather_elements_kernel_selector() { Attach