Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[GPU][CLANG-TIDY] Enable modernize-use-using (#37026)

Nesterov Alexandera89c7d0c9dd5
diff --git a/src/plugins/intel_gpu/.clang-tidy b/src/plugins/intel_gpu/.clang-tidy
index 5947d29e476..60fb4c335e5 100644
--- a/src/plugins/intel_gpu/.clang-tidy
+++ b/src/plugins/intel_gpu/.clang-tidy
@@ -8,6 +8,7 @@
Checks: >
-*,
modernize-use-override,
+ modernize-use-using
modernize-redundant-void-arg
readability-container-size-empty
readability-redundant-string-cstr
diff --git a/src/plugins/intel_gpu/include/intel_gpu/graph/program.hpp b/src/plugins/intel_gpu/include/intel_gpu/graph/program.hpp
index 688cdcc077f..ac09b4e6c70 100644
--- a/src/plugins/intel_gpu/include/intel_gpu/graph/program.hpp
+++ b/src/plugins/intel_gpu/include/intel_gpu/graph/program.hpp
@@ -54,11 +54,11 @@ struct program {
public:
struct nodes_ordering {
public:
- typedef std::list<program_node*> list_of_nodes;
- typedef list_of_nodes::const_iterator const_iterator;
- typedef list_of_nodes::const_reverse_iterator const_reverse_iterator;
- typedef list_of_nodes::iterator node_iterator;
- typedef list_of_nodes::reverse_iterator node_reverse_iterator;
+ using list_of_nodes = std::list<program_node *>;
+ using const_iterator = list_of_nodes::const_iterator;
+ using const_reverse_iterator = list_of_nodes::const_reverse_iterator;
+ using node_iterator = list_of_nodes::iterator;
+ using node_reverse_iterator = list_of_nodes::reverse_iterator;
const_iterator begin() const { return _processing_order.begin(); }
const_iterator end() const { return _processing_order.end(); }
const_reverse_iterator rbegin() const { return _processing_order.rbegin(); }
@@ -126,9 +126,9 @@ public:
T* elem;
};
- typedef std::vector<primitive_info> primitives_info;
- typedef std::vector<std::pair<std::string, primitives_info>> graph_optimizer_info;
- typedef std::pair<primitive_id, std::vector<primitive_id>> optimized_info;
+ using primitives_info = std::vector<primitive_info>;
+ using graph_optimizer_info = std::vector<std::pair<std::string, primitives_info>>;
+ using optimized_info = std::pair<primitive_id, std::vector<primitive_id>>;
program(engine& engine_ref,
topology const& topology,
diff --git a/src/plugins/intel_gpu/include/intel_gpu/graph/topology.hpp b/src/plugins/intel_gpu/include/intel_gpu/graph/topology.hpp
index 26942414ee7..9465df57c64 100644
--- a/src/plugins/intel_gpu/include/intel_gpu/graph/topology.hpp
+++ b/src/plugins/intel_gpu/include/intel_gpu/graph/topology.hpp
@@ -13,7 +13,7 @@
namespace cldnn {
-typedef std::map<primitive_id, std::shared_ptr<primitive>> topology_map;
+using topology_map = std::map<primitive_id, std::shared_ptr<primitive>>;
struct topology {
public:
diff --git a/src/plugins/intel_gpu/include/intel_gpu/plugin/custom_layer.hpp b/src/plugins/intel_gpu/include/intel_gpu/plugin/custom_layer.hpp
index c148e87e724..c1b3dc50b93 100644
--- a/src/plugins/intel_gpu/include/intel_gpu/plugin/custom_layer.hpp
+++ b/src/plugins/intel_gpu/include/intel_gpu/plugin/custom_layer.hpp
@@ -21,12 +21,12 @@ public:
CustomLayerMap& customLayers,
bool can_be_missed = false);
- typedef enum {
+ enum ParamType {
Input,
Output,
Data,
Internal,
- } ParamType;
+ };
struct KerenlParam {
KerenlParam() :type(Input), paramIndex(-1), portIndex(-1),
format(cldnn::format::any) {}
diff --git a/src/plugins/intel_gpu/include/intel_gpu/primitives/gemm.hpp b/src/plugins/intel_gpu/include/intel_gpu/primitives/gemm.hpp
index 2acdfc7125a..74422452b79 100644
--- a/src/plugins/intel_gpu/include/intel_gpu/primitives/gemm.hpp
+++ b/src/plugins/intel_gpu/include/intel_gpu/primitives/gemm.hpp
@@ -25,11 +25,11 @@ namespace cldnn {
struct gemm : public primitive_base<gemm> {
CLDNN_DECLARE_PRIMITIVE(gemm)
- typedef enum {
+ enum TransposeType {
X_LAST = 0,
Y_LAST,
OTHER,
- } TransposeType;
+ };
gemm() : primitive_base("", {}) {}
diff --git a/src/plugins/intel_gpu/include/intel_gpu/primitives/lrn.hpp b/src/plugins/intel_gpu/include/intel_gpu/primitives/lrn.hpp
index 5108bd0fd8c..ba255fe1725 100644
--- a/src/plugins/intel_gpu/include/intel_gpu/primitives/lrn.hpp
+++ b/src/plugins/intel_gpu/include/intel_gpu/primitives/lrn.hpp
@@ -6,10 +6,10 @@
#include "primitive.hpp"
namespace cldnn {
-typedef enum { /*:int32_t*/
+enum lrn_norm_region { /*:int32_t*/
lrn_norm_region_across_channel,
lrn_norm_region_within_channel
-} lrn_norm_region;
+};
/// @brief Local response normalization
/// @details LRN layer as described in chapter 3.3 of "ImageNet Classification with Deep Convolutional
diff --git a/src/plugins/intel_gpu/include/intel_gpu/runtime/compounds.hpp b/src/plugins/intel_gpu/include/intel_gpu/runtime/compounds.hpp
index d9037a5751e..cd91c5b1c0e 100644
--- a/src/plugins/intel_gpu/include/intel_gpu/runtime/compounds.hpp
+++ b/src/plugins/intel_gpu/include/intel_gpu/runtime/compounds.hpp
@@ -205,7 +205,7 @@ _NODISCARD constexpr checked_array_iterator<_Ptr> make_checked_array_iterator(
template <typename T>
class mutable_array_ref {
public:
- typedef size_t size_type;
+ using size_type = size_t;
mutable_array_ref() : _data(nullptr), _size(0) {}
explicit mutable_array_ref(T& val) : _data(&val), _size(1) {}
@@ -236,8 +236,8 @@ public:
const_iterator cbegin() const { return make_checked_array_iterator(_data, _size); }
const_iterator cend() const { return make_checked_array_iterator(_data, _size, _size); }
#else
- typedef T* iterator;
- typedef T* const_iterator;
+ using iterator = T *;
+ using const_iterator = T *;
iterator begin() const { return _data; }
iterator end() const { return _data + _size; }
const_iterator cbegin() const { return _data; }
diff --git a/src/plugins/intel_gpu/include/intel_gpu/runtime/profiling.hpp b/src/plugins/intel_gpu/include/intel_gpu/runtime/profiling.hpp
index b36f71ba14f..6c8be6a0769 100644
--- a/src/plugins/intel_gpu/include/intel_gpu/runtime/profiling.hpp
+++ b/src/plugins/intel_gpu/include/intel_gpu/runtime/profiling.hpp
@@ -56,7 +56,7 @@ class timer {
public:
/// @brief Timer value type.
- typedef typename ClockTy::duration val_type;
+ using val_type = typename ClockTy::duration;
/// @brief Starts timer.
timer() : start_point(ClockTy::now()) {}
diff --git a/src/plugins/intel_gpu/include/intel_gpu/runtime/tensor.hpp b/src/plugins/intel_gpu/include/intel_gpu/runtime/tensor.hpp
index 15b03cacc32..408cbe59287 100644
--- a/src/plugins/intel_gpu/include/intel_gpu/runtime/tensor.hpp
+++ b/src/plugins/intel_gpu/include/intel_gpu/runtime/tensor.hpp
@@ -123,7 +123,7 @@ struct tensor {
friend class details::dim_vec_kind_init<details::dim_vec_kind::spatial>;
friend class details::dim_vec_kind_init<details::dim_vec_kind::group>;
- typedef ov::Dimension::value_type value_type; ///< Values type stored in tensor.
+ using value_type = ov::Dimension::value_type; ///< Values type stored in tensor.
// TODO find the way to prevent direct change of following fields.
mutable_array_ref<value_type> raw; ///< Raw representation of all dimensions.
mutable_array_ref<value_type> batch; ///< Batch dimensions.
diff --git a/src/plugins/intel_gpu/include/va/va.h b/src/plugins/intel_gpu/include/va/va.h
index b7b5d029336..b42c31472c4 100644
--- a/src/plugins/intel_gpu/include/va/va.h
+++ b/src/plugins/intel_gpu/include/va/va.h
@@ -2,6 +2,6 @@
// SPDX-License-Identifier: Apache-2.0
//
-typedef cl_uint VASurfaceID;
-typedef void* VADisplay;
-typedef void* VAImageFormat;
+using VASurfaceID = cl_uint;
+using VADisplay = void *;
+using VAImageFormat = void *;
diff --git a/src/plugins/intel_gpu/src/graph/impls/onednn/grouped_matmul_helper.hpp b/src/plugins/intel_gpu/src/graph/impls/onednn/grouped_matmul_helper.hpp
index 9e4b6de881d..2cdf8f477d8 100644
--- a/src/plugins/intel_gpu/src/graph/impls/onednn/grouped_matmul_helper.hpp
+++ b/src/plugins/intel_gpu/src/graph/impls/onednn/grouped_matmul_helper.hpp
@@ -194,7 +194,7 @@ struct onednn_matmul {
template <typename... TTypes>
class tuple_hasher {
private:
- typedef std::tuple<TTypes...> Tuple;
+ using Tuple = std::tuple<TTypes...>;
template <int N>
size_t hash(Tuple& value) const {
return 0;
diff --git a/src/plugins/intel_gpu/src/kernel_selector/kernel_selector_params.h b/src/plugins/intel_gpu/src/kernel_selector/kernel_selector_params.h
index 2c972bc7366..09f5c5f5b56 100644
--- a/src/plugins/intel_gpu/src/kernel_selector/kernel_selector_params.h
+++ b/src/plugins/intel_gpu/src/kernel_selector/kernel_selector_params.h
@@ -242,7 +242,7 @@ public:
static_assert(sizeof(restrict_t) == sizeof(uint64_t), "problem with union");
- typedef union DataTypesKey_t {
+ union DataTypesKey {
struct val_t {
uint32_t int4 : 1;
uint32_t uint4 : 1;
@@ -261,7 +261,7 @@ public:
uint32_t F8E8M0 : 1;
} val;
uint32_t raw;
- } DataTypesKey;
+ };
DataTypesKey inputType;
DataTypesKey outputType;
diff --git a/src/plugins/intel_gpu/src/runtime/ocl/ocl_ext.hpp b/src/plugins/intel_gpu/src/runtime/ocl/ocl_ext.hpp
index 6602fe99ea8..ceba2746156 100644
--- a/src/plugins/intel_gpu/src/runtime/ocl/ocl_ext.hpp
+++ b/src/plugins/intel_gpu/src/runtime/ocl/ocl_ext.hpp
@@ -31,8 +31,8 @@ typedef cl_d3d11_device_source_khr cl_device_source_intel;
typedef cl_d3d11_device_set_khr cl_device_set_intel;
#else
# include <CL/cl_va_api_media_sharing_intel.h>
-typedef cl_va_api_device_source_intel cl_device_source_intel;
-typedef cl_va_api_device_set_intel cl_device_set_intel;
+using cl_device_source_intel = cl_va_api_device_source_intel;
+using cl_device_set_intel = cl_va_api_device_set_intel;
#endif
#include <sstream>
@@ -428,7 +428,7 @@ T load_entrypoint(const cl_command_queue queue, const std::string name) {
namespace cl {
-typedef CL_API_ENTRY cl_int(CL_API_CALL *PFN_clEnqueueAcquireMediaSurfacesINTEL)(
+using PFN_clEnqueueAcquireMediaSurfacesINTEL = CL_API_ENTRY cl_int(CL_API_CALL *)(
cl_command_queue /* command_queue */,
cl_uint /* num_objects */,
const cl_mem* /* mem_objects */,
@@ -436,7 +436,7 @@ typedef CL_API_ENTRY cl_int(CL_API_CALL *PFN_clEnqueueAcquireMediaSurfacesINTEL)
const cl_event* /* event_wait_list */,
cl_event* /* event */);
-typedef CL_API_ENTRY cl_int(CL_API_CALL *PFN_clEnqueueReleaseMediaSurfacesINTEL)(
+using PFN_clEnqueueReleaseMediaSurfacesINTEL = CL_API_ENTRY cl_int(CL_API_CALL *)(
cl_command_queue /* command_queue */,
cl_uint /* num_objects */,
const cl_mem* /* mem_objects */,
@@ -444,7 +444,7 @@ typedef CL_API_ENTRY cl_int(CL_API_CALL *PFN_clEnqueueReleaseMediaSurfacesINTEL)
const cl_event* /* event_wait_list */,
cl_event* /* event */);
-typedef CL_API_ENTRY cl_mem(CL_API_CALL * PFN_clCreateFromMediaSurfaceINTEL)(
+using PFN_clCreateFromMediaSurfaceINTEL = CL_API_ENTRY cl_mem(CL_API_CALL *)(
cl_context /* context */,
cl_mem_flags /* flags */,
void* /* surface */,
@@ -453,7 +453,7 @@ typedef CL_API_ENTRY cl_mem(CL_API_CALL * PFN_clCreateFromMediaSurfaceINTEL)(
#ifdef WIN32
- typedef CL_API_ENTRY cl_mem(CL_API_CALL * PFN_clCreateFromD3D11Buffer)(
+ using PFN_clCreateFromD3D11Buffer = CL_API_ENTRY cl_mem(CL_API_CALL *)(
cl_context context,
cl_mem_flags flags,
void* resource, cl_int* errcode_ret);
@@ -694,7 +694,7 @@ public:
#endif
class ExternalMemoryHelper {
- typedef CL_API_ENTRY cl_int(CL_API_CALL * PFN_clEnqueueAcquireExternalMemObjectsKHR)(
+ using PFN_clEnqueueAcquireExternalMemObjectsKHR = CL_API_ENTRY cl_int(CL_API_CALL *)(
cl_command_queue /* command_queue */,
cl_uint /* num_mem_objects */,
const cl_mem* /* mem_objects */,
@@ -702,7 +702,7 @@ class ExternalMemoryHelper {
const cl_event* /* event_wait_list */,
cl_event* /* event */);
- typedef CL_API_ENTRY cl_int(CL_API_CALL * PFN_clEnqueueReleaseExternalMemObjectsKHR)(
+ using PFN_clEnqueueReleaseExternalMemObjectsKHR = CL_API_ENTRY cl_int(CL_API_CALL *)(
cl_command_queue /* command_queue */,
cl_uint /* num_mem_objects */,
const cl_mem* /* mem_objects */,
@@ -756,7 +756,7 @@ public:
void * media_adapter,
cl_device_set_intel media_adapter_set,
vector<Device>* devices) const {
- typedef CL_API_ENTRY cl_int(CL_API_CALL * PFN_clGetDeviceIDsFromMediaAdapterINTEL)(
+ using PFN_clGetDeviceIDsFromMediaAdapterINTEL = CL_API_ENTRY cl_int(CL_API_CALL *)(
cl_platform_id /* platform */,
cl_device_source_intel /* media_adapter_type */,
void * /* media_adapter */,