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) 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"); } 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 59f5ab923be..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 +// 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 = 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 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_, 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 $)