未验证 提交 0f344838 编写于 作者: Y Yiqun Liu 提交者: GitHub

[Cherry-pick 2.2] Correct the return type of elementwise kernel to avoid many...

 [Cherry-pick 2.2] Correct the return type of elementwise kernel to avoid many compiling warnings. (#35839) (#35868)

Cherry-pick #35839
上级 6cc8b167
...@@ -75,13 +75,13 @@ int GetVectorizedSizeForTensors( ...@@ -75,13 +75,13 @@ int GetVectorizedSizeForTensors(
template <typename InT, typename OutT, int VecSize, typename Functor, int Arity, template <typename InT, typename OutT, int VecSize, typename Functor, int Arity,
bool CallElementwiseAny = false> bool CallElementwiseAny = false>
struct ElementwisePrimitiveCaller { struct ElementwisePrimitiveCaller {
__device__ inline OutT operator()(Functor func, InT (*args)[VecSize], __device__ inline void operator()(Functor func, InT (*args)[VecSize],
OutT *result); OutT *result);
}; };
template <typename InT, typename OutT, int VecSize, typename Functor, int Arity> template <typename InT, typename OutT, int VecSize, typename Functor, int Arity>
struct ElementwisePrimitiveCaller<InT, OutT, VecSize, Functor, Arity, true> { struct ElementwisePrimitiveCaller<InT, OutT, VecSize, Functor, Arity, true> {
__device__ inline OutT operator()(Functor func, InT (*args)[VecSize], __device__ inline void operator()(Functor func, InT (*args)[VecSize],
OutT *result) { OutT *result) {
kps::ElementwiseAny<InT, OutT, VecSize, 1, 1, Arity, Functor>(result, args, kps::ElementwiseAny<InT, OutT, VecSize, 1, 1, Arity, Functor>(result, args,
func); func);
...@@ -90,7 +90,7 @@ struct ElementwisePrimitiveCaller<InT, OutT, VecSize, Functor, Arity, true> { ...@@ -90,7 +90,7 @@ struct ElementwisePrimitiveCaller<InT, OutT, VecSize, Functor, Arity, true> {
template <typename InT, typename OutT, int VecSize, typename Functor> template <typename InT, typename OutT, int VecSize, typename Functor>
struct ElementwisePrimitiveCaller<InT, OutT, VecSize, Functor, 1, false> { struct ElementwisePrimitiveCaller<InT, OutT, VecSize, Functor, 1, false> {
__device__ inline OutT operator()(Functor func, InT (*args)[VecSize], __device__ inline void operator()(Functor func, InT (*args)[VecSize],
OutT *result) { OutT *result) {
kps::ElementwiseUnary<InT, OutT, VecSize, 1, 1, Functor>(result, args[0], kps::ElementwiseUnary<InT, OutT, VecSize, 1, 1, Functor>(result, args[0],
func); func);
...@@ -99,7 +99,7 @@ struct ElementwisePrimitiveCaller<InT, OutT, VecSize, Functor, 1, false> { ...@@ -99,7 +99,7 @@ struct ElementwisePrimitiveCaller<InT, OutT, VecSize, Functor, 1, false> {
template <typename InT, typename OutT, int VecSize, typename Functor> template <typename InT, typename OutT, int VecSize, typename Functor>
struct ElementwisePrimitiveCaller<InT, OutT, VecSize, Functor, 2, false> { struct ElementwisePrimitiveCaller<InT, OutT, VecSize, Functor, 2, false> {
__device__ inline OutT operator()(Functor func, InT (*args)[VecSize], __device__ inline void operator()(Functor func, InT (*args)[VecSize],
OutT *result) { OutT *result) {
kps::ElementwiseBinary<InT, OutT, VecSize, 1, 1, Functor>(result, args[0], kps::ElementwiseBinary<InT, OutT, VecSize, 1, 1, Functor>(result, args[0],
args[1], func); args[1], func);
...@@ -108,7 +108,7 @@ struct ElementwisePrimitiveCaller<InT, OutT, VecSize, Functor, 2, false> { ...@@ -108,7 +108,7 @@ struct ElementwisePrimitiveCaller<InT, OutT, VecSize, Functor, 2, false> {
template <typename InT, typename OutT, int VecSize, typename Functor> template <typename InT, typename OutT, int VecSize, typename Functor>
struct ElementwisePrimitiveCaller<InT, OutT, VecSize, Functor, 3, false> { struct ElementwisePrimitiveCaller<InT, OutT, VecSize, Functor, 3, false> {
__device__ inline OutT operator()(Functor func, InT **args, OutT *result) { __device__ inline void operator()(Functor func, InT **args, OutT *result) {
kps::ElementwiseTernary<InT, OutT, VecSize, 1, 1, Functor>( kps::ElementwiseTernary<InT, OutT, VecSize, 1, 1, Functor>(
result, args[0], args[1], args[2], func); result, args[0], args[1], args[2], func);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册