Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
b7841a2b
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2299
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
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(
...
@@ -176,7 +176,7 @@ __device__ void VectorizedBroadcastKernelImpl(
#endif
#endif
constexpr
bool
kCallElementwiseAny
=
constexpr
bool
kCallElementwiseAny
=
p
addle
::
platform
::
FunctionTraits
<
Functor
>::
has_pointer_args
;
p
hi
::
funcs
::
FunctionTraits
<
Functor
>::
has_pointer_args
;
phi
::
funcs
::
ElementwisePrimitiveCaller
<
InT
,
phi
::
funcs
::
ElementwisePrimitiveCaller
<
InT
,
ConditionalT
<
OutT
,
NumOuts
>
,
ConditionalT
<
OutT
,
NumOuts
>
,
VecSize
,
VecSize
,
...
@@ -787,7 +787,7 @@ void BroadcastKernelForDifferentVecSize(
...
@@ -787,7 +787,7 @@ void BroadcastKernelForDifferentVecSize(
std
::
vector
<
DenseTensor
*>
*
outs
,
std
::
vector
<
DenseTensor
*>
*
outs
,
int
axis
,
int
axis
,
Functor
func
)
{
Functor
func
)
{
using
Traits
=
p
addle
::
platform
::
FunctionTraits
<
Functor
>
;
using
Traits
=
p
hi
::
funcs
::
FunctionTraits
<
Functor
>
;
const
int
kArity
=
const
int
kArity
=
Traits
::
has_pointer_args
?
static_cast
<
int
>
(
ET
)
:
Traits
::
arity
;
Traits
::
has_pointer_args
?
static_cast
<
int
>
(
ET
)
:
Traits
::
arity
;
PADDLE_ENFORCE_EQ
(
PADDLE_ENFORCE_EQ
(
...
...
paddle/phi/kernels/funcs/elementwise_base.h
浏览文件 @
b7841a2b
...
@@ -23,9 +23,9 @@ limitations under the License. */
...
@@ -23,9 +23,9 @@ limitations under the License. */
#include "paddle/phi/kernels/funcs/math_function.h"
#include "paddle/phi/kernels/funcs/math_function.h"
#if defined(__NVCC__) || defined(__HIPCC__) || defined(__xpu__)
#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/backends/gpu/gpu_launch_config.h"
#include "paddle/phi/kernels/funcs/aligned_vector.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"
#include "paddle/phi/kernels/primitive/kernel_primitives.h"
#define HOSTDEVICE __host__ __device__
#define HOSTDEVICE __host__ __device__
...
@@ -563,7 +563,7 @@ int GetVectorizedSizeForTensors(const std::vector<const DenseTensor *> &ins,
...
@@ -563,7 +563,7 @@ int GetVectorizedSizeForTensors(const std::vector<const DenseTensor *> &ins,
#ifdef PADDLE_WITH_XPU_KP
#ifdef PADDLE_WITH_XPU_KP
int
vec_size
=
256
;
int
vec_size
=
256
;
#else
#else
using
Traits
=
p
addle
::
platform
::
FunctionTraits
<
Functor
>
;
using
Traits
=
p
hi
::
funcs
::
FunctionTraits
<
Functor
>
;
using
ArgsT
=
typename
Traits
::
ArgsTuple
;
using
ArgsT
=
typename
Traits
::
ArgsTuple
;
const
int
Arity
=
Traits
::
arity
;
const
int
Arity
=
Traits
::
arity
;
int
vec_size
=
4
;
int
vec_size
=
4
;
...
@@ -736,7 +736,7 @@ __device__ void VectorizedElementwiseKernelImpl(
...
@@ -736,7 +736,7 @@ __device__ void VectorizedElementwiseKernelImpl(
int
num
,
int
num
,
int
read_lens
,
int
read_lens
,
Functor
func
)
{
Functor
func
)
{
using
Traits
=
p
addle
::
platform
::
FunctionTraits
<
Functor
>
;
using
Traits
=
p
hi
::
funcs
::
FunctionTraits
<
Functor
>
;
using
ArgsT
=
typename
Traits
::
ArgsTuple
;
using
ArgsT
=
typename
Traits
::
ArgsTuple
;
ArgsT
args
[
VecSize
];
ArgsT
args
[
VecSize
];
ConditionalT
<
OutT
,
NumOuts
>
result
[
VecSize
];
ConditionalT
<
OutT
,
NumOuts
>
result
[
VecSize
];
...
@@ -831,7 +831,7 @@ void ElementwiseKernel(const KPDevice &ctx,
...
@@ -831,7 +831,7 @@ void ElementwiseKernel(const KPDevice &ctx,
const
std
::
vector
<
const
DenseTensor
*>
&
ins
,
const
std
::
vector
<
const
DenseTensor
*>
&
ins
,
std
::
vector
<
DenseTensor
*>
*
outs
,
std
::
vector
<
DenseTensor
*>
*
outs
,
Functor
func
)
{
Functor
func
)
{
using
Traits
=
p
addle
::
platform
::
FunctionTraits
<
Functor
>
;
using
Traits
=
p
hi
::
funcs
::
FunctionTraits
<
Functor
>
;
const
int
kArity
=
Traits
::
arity
;
const
int
kArity
=
Traits
::
arity
;
PADDLE_ENFORCE_EQ
(
ins
.
size
(),
PADDLE_ENFORCE_EQ
(
ins
.
size
(),
kArity
,
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");
Licensed under the Apache License, Version 2.1 (the "License");
you may not use this file except in compliance with the License.
you may not use this file except in compliance with the License.
...
@@ -16,8 +16,8 @@ limitations under the License. */
...
@@ -16,8 +16,8 @@ limitations under the License. */
#include <tuple>
#include <tuple>
namespace
p
addle
{
namespace
p
hi
{
namespace
platform
{
namespace
funcs
{
template
<
int
Arity
,
typename
...
Args
>
template
<
int
Arity
,
typename
...
Args
>
struct
IsPointerArgs
{
struct
IsPointerArgs
{
static_assert
(
Arity
==
sizeof
...(
Args
),
"Arity and Args not match!"
);
static_assert
(
Arity
==
sizeof
...(
Args
),
"Arity and Args not match!"
);
...
@@ -57,5 +57,5 @@ struct FunctionTraits<ReturnType(Args...)> {
...
@@ -57,5 +57,5 @@ struct FunctionTraits<ReturnType(Args...)> {
using
ArgsTuple
=
std
::
tuple
<
Args
...
>
;
using
ArgsTuple
=
std
::
tuple
<
Args
...
>
;
};
};
}
// namespace
platform
}
// namespace
funcs
}
// namespace p
addle
}
// namespace p
hi
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录