Skip to content

Commit 61c97ed

Browse files
authored
[GPU] Reduce unused macros to reduce loading time (openvinotoolkit#7435)
* Reduce unused macros, where two strategies are used: (1) Extract batch_headers and let them be included only once in each batch. (2) Static reduction in primitive_db_gen.py, which scans each macro's users and exclude the macro if there is no user. * Removed dependency from runtime to kernel_selector * Resolve too large string error * Fix duplicated definition (GET_FILTER_XXXX is defined in both fetch_weight.cl and by runtime. Removed from runtime because the definition is incorrect * Resolve GRN & deconv & gpu_select issues * Fix cldnn unittest issues * Minor fix * Applied review comments * Fix rebase error
1 parent e0cea20 commit 61c97ed

File tree

212 files changed

+741
-594
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

212 files changed

+741
-594
lines changed

inference-engine/thirdparty/clDNN/kernel_selector/CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,14 @@ file(GLOB_RECURSE __CLDNN_Sources__cl_kernels
7474
set(__CLDNN_Directory__cg_cache "${CLDNN__CODEGEN_INCDIR}")
7575
set(__CLDNN_CGDirectory__cg_cache "${CLDNN__CODEGEN_DIR}/cache")
7676
set(__CLDNN_Label__cg_cache "${__CLDNN_Label__core}\\codegen")
77+
set(__CLDNN_Label__cg_cache_batch_headers "${__CLDNN_Label__core}\\codegen")
7778
set(__CLDNN_File__cg_cache__prim_db "ks_primitive_db.inc")
79+
set(__CLDNN_File__cg_cache__prim_db_batch_headers "ks_primitive_db_batch_headers.inc")
7880
set(__CLDNN_Sources__cg_cache
7981
"${__CLDNN_Directory__cg_cache}/${__CLDNN_File__cg_cache__prim_db}"
82+
"${__CLDNN_Directory__cg_cache}/${__CLDNN_File__cg_cache__prim_db_batch_headers}"
8083
)
8184

82-
8385
set(__CLDNN_AllSources
8486
${__CLDNN_Sources__main}
8587
${__CLDNN_Sources__core}
@@ -144,12 +146,13 @@ endif()
144146
# =================================== Custom pre- and post-steps =======================================
145147
add_custom_command(OUTPUT "${__CLDNN_CGDirectory__cg_cache}/${__CLDNN_File__cg_cache__prim_db}"
146148
COMMAND "${CMAKE_COMMAND}" -E make_directory "${__CLDNN_CGDirectory__cg_cache}"
147-
COMMAND "${PYTHON_EXECUTABLE}" "${__CLDNN_Directory__core_common}/primitive_db_gen.py" -out_path "${__CLDNN_CGDirectory__cg_cache}" -out_file_name "${__CLDNN_File__cg_cache__prim_db}" -kernels "${__CLDNN_Directory__cl_kernels}"
149+
COMMAND "${PYTHON_EXECUTABLE}" "${__CLDNN_Directory__core_common}/primitive_db_gen.py" -out_path "${__CLDNN_CGDirectory__cg_cache}" -out_file_name_prim_db "${__CLDNN_File__cg_cache__prim_db}" -out_file_name_batch_headers "${__CLDNN_File__cg_cache__prim_db_batch_headers}" -kernels "${__CLDNN_Directory__cl_kernels}"
148150
DEPENDS ${__CLDNN_Sources__cl_kernels} "${__CLDNN_Directory__core_common}/primitive_db_gen.py"
149151
COMMENT "Generating ${__CLDNN_File__cg_cache__prim_db} ..."
150152
)
151153
add_custom_command(OUTPUT "${__CLDNN_Directory__cg_cache}/${__CLDNN_File__cg_cache__prim_db}"
152154
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${__CLDNN_CGDirectory__cg_cache}/${__CLDNN_File__cg_cache__prim_db}" "${__CLDNN_Directory__cg_cache}/${__CLDNN_File__cg_cache__prim_db}"
155+
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${__CLDNN_CGDirectory__cg_cache}/${__CLDNN_File__cg_cache__prim_db_batch_headers}" "${__CLDNN_Directory__cg_cache}/${__CLDNN_File__cg_cache__prim_db_batch_headers}"
153156
DEPENDS "${__CLDNN_CGDirectory__cg_cache}/${__CLDNN_File__cg_cache__prim_db}" ${__CLDNN_Sources__cl_kernels} "${__CLDNN_Directory__core_common}/primitive_db_gen.py"
154157
COMMENT "Updating file if the file changed (${__CLDNN_File__cg_cache__prim_db}) ..."
155158
)

inference-engine/thirdparty/clDNN/kernel_selector/core/cl_kernels/activation_opt.cl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// SPDX-License-Identifier: Apache-2.0
33
//
44

5-
#include "include/common.cl"
6-
#include "include/data_types.cl"
5+
#include "include/batch_headers/common.cl"
6+
#include "include/batch_headers/data_types.cl"
77

88
KERNEL(activation)(
99
__global INPUT0_TYPE* input,

inference-engine/thirdparty/clDNN/kernel_selector/core/cl_kernels/activation_ref.cl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// SPDX-License-Identifier: Apache-2.0
33
//
44

5-
#include "include/data_types.cl"
6-
#include "include/fetch_data.cl"
5+
#include "include/batch_headers/data_types.cl"
6+
#include "include/batch_headers/fetch_data.cl"
77

88
#ifdef PARAMETERIZED
99
#define GET_INDEX(prefix, num, idx_order) CAT(CAT(prefix, num), _GET_INDEX_SAFE)(idx_order)

inference-engine/thirdparty/clDNN/kernel_selector/core/cl_kernels/arg_max_min_axis.cl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// SPDX-License-Identifier: Apache-2.0
33
//
44

5-
#include "include/data_types.cl"
6-
#include "include/fetch_data.cl"
5+
#include "include/batch_headers/data_types.cl"
6+
#include "include/batch_headers/fetch_data.cl"
77

88
#ifdef BATCH_AXIS
99
#define VALUES_NUM INPUT0_BATCH_NUM

inference-engine/thirdparty/clDNN/kernel_selector/core/cl_kernels/arg_max_min_gpu_ref.cl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// SPDX-License-Identifier: Apache-2.0
33
//
44

5-
#include "include/common.cl"
6-
#include "include/data_types.cl"
5+
#include "include/batch_headers/common.cl"
6+
#include "include/batch_headers/data_types.cl"
77

88
#define GLOBAL_SIZE 128
99
#define LOCAL_SIZE GLOBAL_SIZE

inference-engine/thirdparty/clDNN/kernel_selector/core/cl_kernels/arg_max_min_opt.cl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// SPDX-License-Identifier: Apache-2.0
33
//
44

5-
#include "include/common.cl"
6-
#include "include/data_types.cl"
5+
#include "include/batch_headers/common.cl"
6+
#include "include/batch_headers/data_types.cl"
77

88
#ifndef SG_SIZE
99
#define SG_SIZE 16

inference-engine/thirdparty/clDNN/kernel_selector/core/cl_kernels/average_unpooling_gpu_ref.cl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// SPDX-License-Identifier: Apache-2.0
33
//
44

5-
#include "include/data_types.cl"
6-
#include "include/fetch_data.cl"
5+
#include "include/batch_headers/data_types.cl"
6+
#include "include/batch_headers/fetch_data.cl"
77

88
KERNEL(average_unpooling_gpu)(const __global UNIT_TYPE* input, __global UNIT_TYPE* output)
99
{

inference-engine/thirdparty/clDNN/kernel_selector/core/cl_kernels/batch_to_space_ref.cl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// SPDX-License-Identifier: Apache-2.0
33
//
44

5-
#include "include/data_types.cl"
6-
#include "include/fetch_data.cl"
5+
#include "include/batch_headers/data_types.cl"
6+
#include "include/batch_headers/fetch_data.cl"
77

88
KERNEL(batch_to_space_ref)(const __global INPUT0_TYPE* input,
99
__global OUTPUT_TYPE* output

inference-engine/thirdparty/clDNN/kernel_selector/core/cl_kernels/binary_convolution_gpu_1x1.cl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// SPDX-License-Identifier: Apache-2.0
33
//
44

5-
#include "include/data_types.cl"
6-
#include "include/fetch_data.cl"
5+
#include "include/batch_headers/data_types.cl"
6+
#include "include/batch_headers/fetch_data.cl"
77

88
#define OC_BLOCK_SIZE 32
99

inference-engine/thirdparty/clDNN/kernel_selector/core/cl_kernels/binary_convolution_gpu_1x1_b_fs_yx_fsv16.cl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// SPDX-License-Identifier: Apache-2.0
33
//
44

5-
#include "include/data_types.cl"
6-
#include "include/fetch_data.cl"
5+
#include "include/batch_headers/data_types.cl"
6+
#include "include/batch_headers/fetch_data.cl"
77
#include "include/unit_type.cl"
88

99
#define OC_BLOCK_SIZE 16

0 commit comments

Comments
 (0)