Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
b7841a2b
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
b7841a2b
编写于
11月 17, 2022
作者:
W
Wang Xin
提交者:
GitHub
11月 17, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
move "function_traits.h" from fluid to phi (#48065)
上级
ff44df18
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
11 addition
and
11 deletion
+11
-11
paddle/phi/kernels/funcs/broadcast_function.h
paddle/phi/kernels/funcs/broadcast_function.h
+2
-2
paddle/phi/kernels/funcs/elementwise_base.h
paddle/phi/kernels/funcs/elementwise_base.h
+4
-4
paddle/phi/kernels/funcs/function_traits.h
paddle/phi/kernels/funcs/function_traits.h
+5
-5
未找到文件。
paddle/phi/kernels/funcs/broadcast_function.h
浏览文件 @
b7841a2b
...
...
@@ -176,7 +176,7 @@ __device__ void VectorizedBroadcastKernelImpl(
#endif
constexpr
bool
kCallElementwiseAny
=
p
addle
::
platform
::
FunctionTraits
<
Functor
>::
has_pointer_args
;
p
hi
::
funcs
::
FunctionTraits
<
Functor
>::
has_pointer_args
;
phi
::
funcs
::
ElementwisePrimitiveCaller
<
InT
,
ConditionalT
<
OutT
,
NumOuts
>
,
VecSize
,
...
...
@@ -787,7 +787,7 @@ void BroadcastKernelForDifferentVecSize(
std
::
vector
<
DenseTensor
*>
*
outs
,
int
axis
,
Functor
func
)
{
using
Traits
=
p
addle
::
platform
::
FunctionTraits
<
Functor
>
;
using
Traits
=
p
hi
::
funcs
::
FunctionTraits
<
Functor
>
;
const
int
kArity
=
Traits
::
has_pointer_args
?
static_cast
<
int
>
(
ET
)
:
Traits
::
arity
;
PADDLE_ENFORCE_EQ
(
...
...
paddle/phi/kernels/funcs/elementwise_base.h
浏览文件 @
b7841a2b
...
...
@@ -23,9 +23,9 @@ limitations under the License. */
#include "paddle/phi/kernels/funcs/math_function.h"
#if defined(__NVCC__) || defined(__HIPCC__) || defined(__xpu__)
#include "paddle/fluid/platform/function_traits.h"
#include "paddle/phi/backends/gpu/gpu_launch_config.h"
#include "paddle/phi/kernels/funcs/aligned_vector.h"
#include "paddle/phi/kernels/funcs/function_traits.h"
#include "paddle/phi/kernels/primitive/kernel_primitives.h"
#define HOSTDEVICE __host__ __device__
...
...
@@ -563,7 +563,7 @@ int GetVectorizedSizeForTensors(const std::vector<const DenseTensor *> &ins,
#ifdef PADDLE_WITH_XPU_KP
int
vec_size
=
256
;
#else
using
Traits
=
p
addle
::
platform
::
FunctionTraits
<
Functor
>
;
using
Traits
=
p
hi
::
funcs
::
FunctionTraits
<
Functor
>
;
using
ArgsT
=
typename
Traits
::
ArgsTuple
;
const
int
Arity
=
Traits
::
arity
;
int
vec_size
=
4
;
...
...
@@ -736,7 +736,7 @@ __device__ void VectorizedElementwiseKernelImpl(
int
num
,
int
read_lens
,
Functor
func
)
{
using
Traits
=
p
addle
::
platform
::
FunctionTraits
<
Functor
>
;
using
Traits
=
p
hi
::
funcs
::
FunctionTraits
<
Functor
>
;
using
ArgsT
=
typename
Traits
::
ArgsTuple
;
ArgsT
args
[
VecSize
];
ConditionalT
<
OutT
,
NumOuts
>
result
[
VecSize
];
...
...
@@ -831,7 +831,7 @@ void ElementwiseKernel(const KPDevice &ctx,
const
std
::
vector
<
const
DenseTensor
*>
&
ins
,
std
::
vector
<
DenseTensor
*>
*
outs
,
Functor
func
)
{
using
Traits
=
p
addle
::
platform
::
FunctionTraits
<
Functor
>
;
using
Traits
=
p
hi
::
funcs
::
FunctionTraits
<
Functor
>
;
const
int
kArity
=
Traits
::
arity
;
PADDLE_ENFORCE_EQ
(
ins
.
size
(),
kArity
,
...
...
paddle/
fluid/platform
/function_traits.h
→
paddle/
phi/kernels/funcs
/function_traits.h
浏览文件 @
b7841a2b
/* Copyright (c) 202
1
PaddlePaddle Authors. All Rights Reserved.
/* Copyright (c) 202
2
PaddlePaddle Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.1 (the "License");
you may not use this file except in compliance with the License.
...
...
@@ -16,8 +16,8 @@ limitations under the License. */
#include <tuple>
namespace
p
addle
{
namespace
platform
{
namespace
p
hi
{
namespace
funcs
{
template
<
int
Arity
,
typename
...
Args
>
struct
IsPointerArgs
{
static_assert
(
Arity
==
sizeof
...(
Args
),
"Arity and Args not match!"
);
...
...
@@ -57,5 +57,5 @@ struct FunctionTraits<ReturnType(Args...)> {
using
ArgsTuple
=
std
::
tuple
<
Args
...
>
;
};
}
// namespace
platform
}
// namespace p
addle
}
// namespace
funcs
}
// namespace p
hi
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录