From 6961af530138d2076103fd4ff06eac93c95e59a4 Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Fri, 8 Mar 2024 16:47:02 +0400 Subject: [PATCH 1/6] [FORK][FIX] Fixed build to work for GPU plugin --- src/common/impl_list_item.hpp | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/src/common/impl_list_item.hpp b/src/common/impl_list_item.hpp index 9efa0732567..c5e5809a4c1 100644 --- a/src/common/impl_list_item.hpp +++ b/src/common/impl_list_item.hpp @@ -90,35 +90,24 @@ struct impl_list_item_t { : public type_deduction_helper_t {}; template - impl_list_item_t(type_deduction_helper_t) { - using deduced_pd_t = typename type_deduction_helper_t::type; - create_pd_func_ = &primitive_desc_t::create; - DNNL_PRIMITIVE_NAME_INIT(pd_t); - } + constexpr impl_list_item_t(type_deduction_helper_t) + : create_pd_func_(&primitive_desc_t::create< + typename type_deduction_helper_t::type>) {} template - impl_list_item_t(concat_type_deduction_helper_t) { - using deduced_pd_t = - typename concat_type_deduction_helper_t::type; - create_concat_pd_func_ = deduced_pd_t::create; - DNNL_PRIMITIVE_NAME_INIT(pd_t); - } + constexpr impl_list_item_t(concat_type_deduction_helper_t) + : create_concat_pd_func_( + concat_type_deduction_helper_t::type::create) {} template - impl_list_item_t(sum_type_deduction_helper_t) { - using deduced_pd_t = typename sum_type_deduction_helper_t::type; - create_sum_pd_func_ = deduced_pd_t::create; - DNNL_PRIMITIVE_NAME_INIT(pd_t); + constexpr impl_list_item_t(sum_type_deduction_helper_t) + : create_sum_pd_func_(sum_type_deduction_helper_t::type::create) { } template - impl_list_item_t(reorder_type_deduction_helper_t) { - using deduced_pd_t = - typename reorder_type_deduction_helper_t::type; - create_reorder_pd_func_ = deduced_pd_t::create; - DNNL_PRIMITIVE_NAME_INIT(pd_t); - } - + constexpr impl_list_item_t(reorder_type_deduction_helper_t) + : create_reorder_pd_func_( + reorder_type_deduction_helper_t::type::create) {} explicit operator bool() const { return !utils::everyone_is(nullptr, create_pd_func_, From 52e696784662ef2a6f9982ea6fae2ec3e442b7b3 Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Sat, 9 Mar 2024 00:32:46 +0400 Subject: [PATCH 2/6] [FORK][FIX] OCL impl uses dlopen --- src/gpu/ocl/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gpu/ocl/CMakeLists.txt b/src/gpu/ocl/CMakeLists.txt index 711645b87fa..9298d402baf 100644 --- a/src/gpu/ocl/CMakeLists.txt +++ b/src/gpu/ocl/CMakeLists.txt @@ -39,5 +39,7 @@ list(APPEND SOURCES ${kernel_list_src}) set(OBJ_LIB ${LIB_PACKAGE_NAME}_gpu_ocl) add_library(${OBJ_LIB} OBJECT ${SOURCES}) +set_property(GLOBAL APPEND PROPERTY DNNL_SUBDIR_EXTRA_SHARED_LIBS + ${CMAKE_DL_LIBS}) set_property(GLOBAL APPEND PROPERTY DNNL_LIB_DEPS $) From 1af8bc81257417874e50870ea5804e32b8059e40 Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Sat, 9 Mar 2024 09:36:49 +0400 Subject: [PATCH 3/6] [FORK][FIX] Compilation with new C++ standards --- src/common/cpp_compat.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/cpp_compat.hpp b/src/common/cpp_compat.hpp index 59f5ab923be..3e4cb880b9f 100644 --- a/src/common/cpp_compat.hpp +++ b/src/common/cpp_compat.hpp @@ -30,13 +30,13 @@ namespace cpp_compat { // contains a compatibility layer for such C++ features. // Older than C++17. -#if defined(__cplusplus) && __cplusplus < 201703L +#if defined(__cplusplus) && __cplusplus < 201703L || defined(_MSVC_LANG) && _MSVC_LANG < 201703L inline int uncaught_exceptions() { return (int)std::uncaught_exception(); } template -using invoke_result = std::result_of; +using invoke_result = typename std::result_of; #else inline int uncaught_exceptions() { From 3ab1dd895b5c842b10bd53b5fe6a73fe2dcc3319 Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Sat, 9 Mar 2024 09:43:20 +0400 Subject: [PATCH 4/6] [FORK][FIX] Fix compilation with MASM on Windows --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cee2cbf2260..efd1f79c7b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,7 +82,7 @@ if (CMAKE_VERSION VERSION_LESS 3.0) project(${PROJECT_NAME} C CXX) else() cmake_policy(SET CMP0048 NEW) - project(${PROJECT_NAME} VERSION "${PROJECT_VERSION}" LANGUAGES C CXX) + project(${PROJECT_NAME} VERSION "${PROJECT_VERSION}" LANGUAGES C CXX ASM) endif() if (NOT CMAKE_SIZEOF_VOID_P EQUAL 8) From 59cab32ad668c10a21c00c1087ece6b0aa8e33a8 Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Sat, 9 Mar 2024 13:11:46 +0400 Subject: [PATCH 5/6] [FORK][FIX] Add dl library when ITT is used --- src/common/CMakeLists.txt | 2 ++ src/common/cpp_compat.hpp | 14 ++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index be81c3e20c1..d7020ffefe3 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -40,6 +40,8 @@ if(DNNL_ENABLE_JIT_PROFILING OR DNNL_ENABLE_ITT_TASKS) endif() list(APPEND SOURCES ${ITT_PT}) endif() + + set_property(GLOBAL APPEND PROPERTY DNNL_SUBDIR_EXTRA_SHARED_LIBS ${CMAKE_DL_LIBS}) endif() endif() diff --git a/src/common/cpp_compat.hpp b/src/common/cpp_compat.hpp index 3e4cb880b9f..7ad3e262132 100644 --- a/src/common/cpp_compat.hpp +++ b/src/common/cpp_compat.hpp @@ -29,22 +29,24 @@ namespace cpp_compat { // been deprecated in C++17, which triggers deprecations warnings. This file // contains a compatibility layer for such C++ features. -// Older than C++17. -#if defined(__cplusplus) && __cplusplus < 201703L || defined(_MSVC_LANG) && _MSVC_LANG < 201703L +// Newer than C++17. +#if defined(__cplusplus) && __cplusplus >= 201703L || defined(_MSVC_LANG) && _MSVC_LANG >= 201703L + inline int uncaught_exceptions() { - return (int)std::uncaught_exception(); + return std::uncaught_exceptions(); } template -using invoke_result = typename std::result_of; +using invoke_result = std::invoke_result; + #else inline int uncaught_exceptions() { - return std::uncaught_exceptions(); + return (int)std::uncaught_exception(); } template -using invoke_result = std::invoke_result; +using invoke_result = typename std::result_of; #endif } // namespace cpp_compat From 740795e2ec21b1149e878ecd4424ae03a3544bf3 Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Sat, 9 Mar 2024 20:44:22 +0400 Subject: [PATCH 6/6] [FORK][FIX] Compilation warnings (as errorswq) --- include/oneapi/dnnl/dnnl.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/oneapi/dnnl/dnnl.hpp b/include/oneapi/dnnl/dnnl.hpp index 5684d3a4052..413b57482bf 100644 --- a/include/oneapi/dnnl/dnnl.hpp +++ b/include/oneapi/dnnl/dnnl.hpp @@ -3902,7 +3902,7 @@ struct primitive_attr : public handle { "could not set scales primitive attribute"); } void set_scales_dims(int arg, const memory::dims& dims) { - error::wrap_c_api(dnnl_primitive_attr_set_scales_dims(get(), arg, dims.data(), dims.size()), + error::wrap_c_api(dnnl_primitive_attr_set_scales_dims(get(), arg, dims.data(), static_cast(dims.size())), "could not set scales primitive attribute"); } @@ -3926,7 +3926,7 @@ struct primitive_attr : public handle { } void set_zero_points_dims(int arg, const memory::dims& dims, memory::data_type dt) { error::wrap_c_api( - dnnl_primitive_attr_set_zero_points_dims(get(), arg, dims.data(), dims.size(), memory::convert_to_c(dt)), + dnnl_primitive_attr_set_zero_points_dims(get(), arg, dims.data(), static_cast(dims.size()), memory::convert_to_c(dt)), "could not set zero points primitive attribute"); }