Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FORK][FIX] Fixed build to work for GPU plugin #237

Open
wants to merge 6 commits into
base: v3.3_for_ie_master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions include/oneapi/dnnl/dnnl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3902,7 +3902,7 @@ struct primitive_attr : public handle<dnnl_primitive_attr_t> {
"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<int>(dims.size())),
"could not set scales primitive attribute");
}

Expand All @@ -3926,7 +3926,7 @@ struct primitive_attr : public handle<dnnl_primitive_attr_t> {
}
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<int>(dims.size()), memory::convert_to_c(dt)),
"could not set zero points primitive attribute");
}

Expand Down
2 changes: 2 additions & 0 deletions src/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
14 changes: 8 additions & 6 deletions src/common/cpp_compat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <class F, class... ArgTypes>
using invoke_result = std::result_of<F(ArgTypes...)>;
using invoke_result = std::invoke_result<F, ArgTypes...>;

#else

inline int uncaught_exceptions() {
return std::uncaught_exceptions();
return (int)std::uncaught_exception();
}

template <class F, class... ArgTypes>
using invoke_result = std::invoke_result<F, ArgTypes...>;
using invoke_result = typename std::result_of<F(ArgTypes...)>;

#endif
} // namespace cpp_compat
Expand Down
33 changes: 11 additions & 22 deletions src/common/impl_list_item.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,35 +90,24 @@ struct impl_list_item_t {
: public type_deduction_helper_t<pd_t> {};

template <typename pd_t>
impl_list_item_t(type_deduction_helper_t<pd_t>) {
using deduced_pd_t = typename type_deduction_helper_t<pd_t>::type;
create_pd_func_ = &primitive_desc_t::create<deduced_pd_t>;
DNNL_PRIMITIVE_NAME_INIT(pd_t);
}
constexpr impl_list_item_t(type_deduction_helper_t<pd_t>)
: create_pd_func_(&primitive_desc_t::create<
typename type_deduction_helper_t<pd_t>::type>) {}

template <typename pd_t>
impl_list_item_t(concat_type_deduction_helper_t<pd_t>) {
using deduced_pd_t =
typename concat_type_deduction_helper_t<pd_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<pd_t>)
: create_concat_pd_func_(
concat_type_deduction_helper_t<pd_t>::type::create) {}

template <typename pd_t>
impl_list_item_t(sum_type_deduction_helper_t<pd_t>) {
using deduced_pd_t = typename sum_type_deduction_helper_t<pd_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<pd_t>)
: create_sum_pd_func_(sum_type_deduction_helper_t<pd_t>::type::create) {
}

template <typename pd_t>
impl_list_item_t(reorder_type_deduction_helper_t<pd_t>) {
using deduced_pd_t =
typename reorder_type_deduction_helper_t<pd_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<pd_t>)
: create_reorder_pd_func_(
reorder_type_deduction_helper_t<pd_t>::type::create) {}

explicit operator bool() const {
return !utils::everyone_is(nullptr, create_pd_func_,
Expand Down
2 changes: 2 additions & 0 deletions src/gpu/ocl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
$<TARGET_OBJECTS:${OBJ_LIB}>)