Skip to content

Commit

Permalink
Windows Build Fixes (openvinotoolkit#645)
Browse files Browse the repository at this point in the history
* [NVIDIA] Fix CudaUnitTests target for Windows

* [NVIDIA] Fix CUDA::math::pow function

* [NVIDIA] Fix Windows build error in convert_benchmark.cpp

---------

Co-authored-by: Nadezhda Ageeva <[email protected]>
  • Loading branch information
apavliuk55 and nkogteva authored May 4, 2023
1 parent e5b0fe6 commit b2147a3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 26 deletions.
12 changes: 1 addition & 11 deletions modules/nvidia_plugin/src/cuda/math.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ inline __device__ T exp(T x) {

template <typename T>
inline __device__ T pow(T x, T y) {
return ::pow(x, y);
return static_cast<T>(powf(static_cast<float>(x), static_cast<float>(y)));
}

template <typename T>
Expand All @@ -103,11 +103,6 @@ inline __device__ __half round(__half x) {
return ::round(static_cast<float>(x));
}

template <>
inline __device__ __half pow<__half>(__half x, __half y) {
return powf(static_cast<float>(x), static_cast<float>(y));
}

#if defined(CUDA_HAS_HALF_MATH)
inline __device__ __half floor(__half x) { return ::hfloor(x); }

Expand Down Expand Up @@ -171,11 +166,6 @@ inline __device__ __nv_bfloat16 round(__nv_bfloat16 x) {
return ::round(static_cast<float>(x));
}

template <>
inline __device__ __nv_bfloat16 pow<__nv_bfloat16>(__nv_bfloat16 x, __nv_bfloat16 y) {
return powf(static_cast<float>(x), static_cast<float>(y));
}

#if defined(CUDA_HAS_BF16_MATH)
inline __device__ __nv_bfloat16 floor(__nv_bfloat16 x) { return ::hfloor(x); }

Expand Down
2 changes: 1 addition & 1 deletion modules/nvidia_plugin/tests/unit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ addIeTargetTest(
gtest_main
gmock
ngraphFunctions
commonTestUtils_s
commonTestUtils
ADD_CPPLINT
LABELS
CUDA
Expand Down
28 changes: 14 additions & 14 deletions modules/nvidia_plugin/tests/unit/convert_benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,20 @@ TEST_F(ConvertTest, DISABLED_benchmark) {
emptyTensor, emptyMapping, emptyTensor, emptyMapping, threadContext, token, profiler};

using Type_t = ov::element::Type_t;
static constexpr auto supported_types = {Type_t::boolean,
Type_t::bf16,
Type_t::f16,
Type_t::f32,
Type_t::f64,
Type_t::i8,
Type_t::i16,
Type_t::i32,
Type_t::i64,
/*Type_t::u1, convert doesn't support it*/
Type_t::u8,
Type_t::u16,
Type_t::u32,
Type_t::u64};
constexpr Type_t supported_types[] = {Type_t::boolean,
Type_t::bf16,
Type_t::f16,
Type_t::f32,
Type_t::f64,
Type_t::i8,
Type_t::i16,
Type_t::i32,
Type_t::i64,
/*Type_t::u1, convert doesn't support it*/
Type_t::u8,
Type_t::u16,
Type_t::u32,
Type_t::u64};
for (auto inputIdx : supported_types) {
for (auto outputIdx : supported_types) {
const auto inputType = Type_t(static_cast<std::underlying_type<Type_t>::type>(inputIdx));
Expand Down

0 comments on commit b2147a3

Please sign in to comment.