forked from openvinotoolkit/openvino_contrib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NVIDIA] Add new activation, comparison and reduce operations (openvi…
…notoolkit#705) * [NVIDIA] Adds abs,cos,cosh,exp,gelu,sin,sinh,sqrt,log activations * [NVIDIA] Adds greater_equal,less_equal,equal,not_equal operations * Missing licenses * Adds hswish * Small update * Adds ReduceMax,ReduceMean,ReduceMin,ReduceProd operations * Support reduction opeations with keed_dims == false * Update StridedSlice to support i32 input * Adds Mish activation * Update cuda_opset.md * Adds Elu activation * Disable ShuffleChannelsFusion * Update cuda_opset.md * Fix ReduceTransformation for case when Reduce doesn't reduce dims * ELU: double alpha => float * Update ReduceTransformation
- Loading branch information
Showing
93 changed files
with
3,184 additions
and
436 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright (C) 2021-2023 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#include "abs.hpp" | ||
|
||
namespace ov { | ||
namespace nvidia_gpu { | ||
namespace kernel { | ||
|
||
namespace cumath = CUDA::math; | ||
|
||
template <typename T> | ||
struct AbsOpImpl { | ||
__device__ static inline T op(T x) { | ||
return cumath::abs(x); | ||
} | ||
}; | ||
|
||
Abs::Abs(Type_t element_type, size_t max_threads_per_block, size_t num_elements) | ||
: impl_{element_type, max_threads_per_block, num_elements} {} | ||
|
||
void Abs::operator()(cudaStream_t stream, const void* in0, void* out) const { | ||
impl_(stream, in0, out); | ||
} | ||
|
||
} // namespace kernel | ||
} // namespace nvidia_gpu | ||
} // namespace ov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright (C) 2021-2023 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#pragma once | ||
|
||
#include "details/cuda_type_traits.hpp" | ||
#include "details/elementwise_unary.cuh" | ||
|
||
namespace ov { | ||
namespace nvidia_gpu { | ||
namespace kernel { | ||
|
||
template <typename T> | ||
struct AbsOpImpl; | ||
/** | ||
* Elementwise Abs operation | ||
*/ | ||
class Abs { | ||
public: | ||
Abs(Type_t element_type, size_t max_threads_per_block, size_t num_elements); | ||
|
||
void operator()(cudaStream_t stream, const void* in0, void* out) const; | ||
|
||
private: | ||
ElementwiseUnary<AllElementTypesSwitch, AbsOpImpl> impl_; | ||
}; | ||
|
||
} // namespace kernel | ||
} // namespace nvidia_gpu | ||
} // namespace ov | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright (C) 2021-2023 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#include "cos.hpp" | ||
|
||
namespace ov { | ||
namespace nvidia_gpu { | ||
namespace kernel { | ||
|
||
namespace cumath = CUDA::math; | ||
|
||
template <typename T> | ||
struct CosOpImpl { | ||
__device__ static inline T op(T x) { | ||
return cumath::cos(x); | ||
} | ||
}; | ||
|
||
Cos::Cos(Type_t element_type, size_t max_threads_per_block, size_t num_elements) | ||
: impl_{element_type, max_threads_per_block, num_elements} {} | ||
|
||
void Cos::operator()(cudaStream_t stream, const void* in0, void* out) const { | ||
impl_(stream, in0, out); | ||
} | ||
|
||
} // namespace kernel | ||
} // namespace nvidia_gpu | ||
} // namespace ov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright (C) 2021-2023 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#pragma once | ||
|
||
#include "details/cuda_type_traits.hpp" | ||
#include "details/elementwise_unary.cuh" | ||
|
||
namespace ov { | ||
namespace nvidia_gpu { | ||
namespace kernel { | ||
|
||
template <typename T> | ||
struct CosOpImpl; | ||
/** | ||
* Elementwise Cos operation | ||
*/ | ||
class Cos { | ||
public: | ||
Cos(Type_t element_type, size_t max_threads_per_block, size_t num_elements); | ||
|
||
void operator()(cudaStream_t stream, const void* in0, void* out) const; | ||
|
||
private: | ||
ElementwiseUnary<AllElementTypesSwitch, CosOpImpl> impl_; | ||
}; | ||
|
||
} // namespace kernel | ||
} // namespace nvidia_gpu | ||
} // namespace ov | ||
|
||
|
Oops, something went wrong.