Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
2ab986ae
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
2ab986ae
编写于
4月 14, 2022
作者:
C
Chen Weihang
提交者:
GitHub
4月 14, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[Phi] Unify dispatch macros to visit (#41653)
* chnage dispatch to visit * resolve conflict
上级
8e2d4d30
变更
32
展开全部
隐藏空白更改
内联
并排
Showing
32 changed file
with
421 addition
and
364 deletion
+421
-364
paddle/phi/api/ext/dispatch.h
paddle/phi/api/ext/dispatch.h
+24
-294
paddle/phi/api/lib/data_transform.cc
paddle/phi/api/lib/data_transform.cc
+0
-1
paddle/phi/core/visit_type.h
paddle/phi/core/visit_type.h
+338
-0
paddle/phi/kernels/cpu/cast_grad_kernel.cc
paddle/phi/kernels/cpu/cast_grad_kernel.cc
+2
-0
paddle/phi/kernels/cpu/cast_impl.h
paddle/phi/kernels/cpu/cast_impl.h
+1
-1
paddle/phi/kernels/cpu/cast_kernel.cc
paddle/phi/kernels/cpu/cast_kernel.cc
+1
-0
paddle/phi/kernels/cpu/cross_entropy_grad_kernel.cc
paddle/phi/kernels/cpu/cross_entropy_grad_kernel.cc
+2
-4
paddle/phi/kernels/cpu/elementwise_kernel.cc
paddle/phi/kernels/cpu/elementwise_kernel.cc
+0
-1
paddle/phi/kernels/cpu/reduce.h
paddle/phi/kernels/cpu/reduce.h
+1
-1
paddle/phi/kernels/cpu/transpose_kernel.cc
paddle/phi/kernels/cpu/transpose_kernel.cc
+2
-1
paddle/phi/kernels/funcs/reduce_function.h
paddle/phi/kernels/funcs/reduce_function.h
+0
-1
paddle/phi/kernels/gpu/cast_grad_kernel.cu
paddle/phi/kernels/gpu/cast_grad_kernel.cu
+3
-1
paddle/phi/kernels/gpu/cast_impl.h
paddle/phi/kernels/gpu/cast_impl.h
+1
-1
paddle/phi/kernels/gpu/cast_kernel.cu
paddle/phi/kernels/gpu/cast_kernel.cu
+3
-1
paddle/phi/kernels/gpu/cross_entropy_grad_kernel.cu
paddle/phi/kernels/gpu/cross_entropy_grad_kernel.cu
+2
-4
paddle/phi/kernels/gpu/cross_entropy_kernel.cu
paddle/phi/kernels/gpu/cross_entropy_kernel.cu
+14
-16
paddle/phi/kernels/gpu/reduce.h
paddle/phi/kernels/gpu/reduce.h
+1
-0
paddle/phi/kernels/gpu/reduce_grad.h
paddle/phi/kernels/gpu/reduce_grad.h
+1
-1
paddle/phi/kernels/gpu/transpose_kernel.cu
paddle/phi/kernels/gpu/transpose_kernel.cu
+0
-1
paddle/phi/kernels/sparse/cpu/convolution_grad_kernel.cc
paddle/phi/kernels/sparse/cpu/convolution_grad_kernel.cc
+2
-3
paddle/phi/kernels/sparse/cpu/convolution_kernel.cc
paddle/phi/kernels/sparse/cpu/convolution_kernel.cc
+2
-3
paddle/phi/kernels/sparse/cpu/sparse_mask_kernel.cc
paddle/phi/kernels/sparse/cpu/sparse_mask_kernel.cc
+3
-4
paddle/phi/kernels/sparse/cpu/sparse_pool_grad_kernel.cc
paddle/phi/kernels/sparse/cpu/sparse_pool_grad_kernel.cc
+2
-3
paddle/phi/kernels/sparse/cpu/sparse_pool_kernel.cc
paddle/phi/kernels/sparse/cpu/sparse_pool_kernel.cc
+2
-3
paddle/phi/kernels/sparse/gpu/convolution.cu.h
paddle/phi/kernels/sparse/gpu/convolution.cu.h
+1
-1
paddle/phi/kernels/sparse/gpu/convolution_grad_kernel.cu
paddle/phi/kernels/sparse/gpu/convolution_grad_kernel.cu
+2
-3
paddle/phi/kernels/sparse/gpu/convolution_kernel.cu
paddle/phi/kernels/sparse/gpu/convolution_kernel.cu
+2
-3
paddle/phi/kernels/sparse/gpu/sparse_mask_kernel.cu
paddle/phi/kernels/sparse/gpu/sparse_mask_kernel.cu
+3
-4
paddle/phi/kernels/sparse/gpu/sparse_pool_grad_kernel.cu
paddle/phi/kernels/sparse/gpu/sparse_pool_grad_kernel.cu
+2
-3
paddle/phi/kernels/sparse/gpu/sparse_pool_kernel.cu
paddle/phi/kernels/sparse/gpu/sparse_pool_kernel.cu
+2
-3
paddle/phi/kernels/transfer_layout_kernel.cc
paddle/phi/kernels/transfer_layout_kernel.cc
+1
-1
paddle/phi/kernels/xpu/full_kernel.cc
paddle/phi/kernels/xpu/full_kernel.cc
+1
-1
未找到文件。
paddle/phi/api/ext/dispatch.h
浏览文件 @
2ab986ae
此差异已折叠。
点击以展开。
paddle/phi/api/lib/data_transform.cc
浏览文件 @
2ab986ae
...
...
@@ -14,7 +14,6 @@ limitations under the License. */
#include "paddle/phi/api/lib/data_transform.h"
#include "paddle/phi/api/ext/dispatch.h"
#include "paddle/phi/api/lib/kernel_dispatch.h"
#include "paddle/phi/api/lib/utils/storage.h"
#include "paddle/phi/backends/all_context.h"
...
...
paddle/phi/core/visit_type.h
0 → 100644
浏览文件 @
2ab986ae
此差异已折叠。
点击以展开。
paddle/phi/kernels/cpu/cast_grad_kernel.cc
浏览文件 @
2ab986ae
...
...
@@ -13,7 +13,9 @@
// limitations under the License.
#include "paddle/phi/kernels/cast_grad_kernel.h"
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/core/visit_type.h"
#include "paddle/phi/kernels/cpu/cast_impl.h"
namespace
phi
{
...
...
paddle/phi/kernels/cpu/cast_impl.h
浏览文件 @
2ab986ae
...
...
@@ -13,7 +13,7 @@
// limitations under the License.
#pragma once
#include "paddle/phi/api/ext/dispatch.h"
#include "paddle/phi/backends/cpu/cpu_context.h"
// See Note [ Why still include the fluid headers? ]
...
...
paddle/phi/kernels/cpu/cast_kernel.cc
浏览文件 @
2ab986ae
...
...
@@ -16,6 +16,7 @@
#include "paddle/phi/kernels/cpu/cast_impl.h"
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/core/visit_type.h"
namespace
phi
{
...
...
paddle/phi/kernels/cpu/cross_entropy_grad_kernel.cc
浏览文件 @
2ab986ae
...
...
@@ -16,13 +16,11 @@ limitations under the License. */
#include "paddle/phi/backends/cpu/cpu_context.h"
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/core/visit_type.h"
#include "paddle/phi/kernels/copy_kernel.h"
#include "paddle/phi/kernels/funcs/axis_utils.h"
#include "paddle/phi/kernels/funcs/eigen/common.h"
// TODO(chenweihang): move dispatch.h into phi/core
#include "paddle/phi/api/ext/dispatch.h"
namespace
phi
{
template
<
typename
T
,
typename
LabelT
>
...
...
@@ -200,7 +198,7 @@ void CrossEntropyWithSoftmaxGradKernel(const Context& dev_ctx,
axis
,
logits_grad
);
}
else
{
PD_
DISPATCH
_INTEGRAL_TYPES
(
PD_
VISIT
_INTEGRAL_TYPES
(
dtype
,
"CrossEntropyWithSoftmaxGradCPUKernel"
,
([
&
]
{
CrossEntropyWithSoftmaxGradCPUKernel
<
T
,
data_t
>
(
dev_ctx
,
label
,
...
...
paddle/phi/kernels/cpu/elementwise_kernel.cc
浏览文件 @
2ab986ae
...
...
@@ -13,7 +13,6 @@
// limitations under the License.
#include "paddle/phi/kernels/cpu/elementwise.h"
#include "paddle/phi/api/ext/dispatch.h"
#include "paddle/phi/backends/cpu/cpu_context.h"
#include "paddle/phi/common/bfloat16.h"
#include "paddle/phi/common/complex.h"
...
...
paddle/phi/kernels/cpu/reduce.h
浏览文件 @
2ab986ae
...
...
@@ -16,8 +16,8 @@
#include <set>
#include "paddle/phi/api/ext/dispatch.h"
#include "paddle/phi/backends/cpu/cpu_context.h"
#include "paddle/phi/core/visit_type.h"
#include "paddle/phi/kernels/cast_kernel.h"
#include "paddle/phi/api/lib/utils/storage.h"
...
...
paddle/phi/kernels/cpu/transpose_kernel.cc
浏览文件 @
2ab986ae
...
...
@@ -13,8 +13,9 @@
// limitations under the License.
#include "paddle/phi/kernels/transpose_kernel.h"
#include <vector>
#include "paddle/phi/api/ext/dispatch.h"
#include "paddle/phi/backends/cpu/cpu_context.h"
#include "paddle/phi/common/bfloat16.h"
#include "paddle/phi/core/kernel_registry.h"
...
...
paddle/phi/kernels/funcs/reduce_function.h
浏览文件 @
2ab986ae
...
...
@@ -35,7 +35,6 @@ namespace cub = hipcub;
#include "paddle/fluid/platform/device/gpu/gpu_device_function.h"
#include "paddle/fluid/platform/device/gpu/gpu_launch_config.h"
#include "paddle/phi/api/ext/dispatch.h"
#include "paddle/phi/backends/gpu/gpu_context.h"
#include "paddle/phi/backends/gpu/gpu_info.h"
#include "paddle/phi/core/dense_tensor.h"
...
...
paddle/phi/kernels/gpu/cast_grad_kernel.cu
浏览文件 @
2ab986ae
...
...
@@ -12,8 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/kernels/cast_grad_kernel.h"
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/core/visit_type.h"
#include "paddle/phi/kernels/gpu/cast_impl.h"
namespace
phi
{
...
...
paddle/phi/kernels/gpu/cast_impl.h
浏览文件 @
2ab986ae
...
...
@@ -13,7 +13,7 @@
// limitations under the License.
#pragma once
#include "paddle/phi/api/ext/dispatch.h"
#include "paddle/phi/backends/gpu/gpu_context.h"
#include "paddle/phi/kernels/funcs/elementwise_base.h"
...
...
paddle/phi/kernels/gpu/cast_kernel.cu
浏览文件 @
2ab986ae
...
...
@@ -12,8 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/kernels/cast_kernel.h"
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/core/visit_type.h"
#include "paddle/phi/kernels/gpu/cast_impl.h"
namespace
phi
{
...
...
paddle/phi/kernels/gpu/cross_entropy_grad_kernel.cu
浏览文件 @
2ab986ae
...
...
@@ -24,15 +24,13 @@ namespace cub = hipcub;
#include "paddle/phi/common/amp_type_traits.h"
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/core/visit_type.h"
#include "paddle/phi/kernels/copy_kernel.h"
#include "paddle/phi/kernels/funcs/axis_utils.h"
#include "paddle/phi/kernels/funcs/for_range.h"
#include "paddle/phi/kernels/funcs/math_function.h"
#include "paddle/phi/kernels/gpudnn/softmax_gpudnn.h"
// TODO(chenweihang): move dispatch.h into phi/core
#include "paddle/phi/api/ext/dispatch.h"
#include "paddle/fluid/operators/math/cross_entropy.h"
#include "paddle/fluid/operators/math/softmax.h"
#include "paddle/fluid/platform/device/gpu/gpu_device_function.h"
...
...
@@ -267,7 +265,7 @@ void CrossEntropyWithSoftmaxGradKernel(const Context& dev_ctx,
axis
,
logits_grad
);
}
else
{
PD_
DISPATCH
_INTEGRAL_TYPES
(
PD_
VISIT
_INTEGRAL_TYPES
(
dtype
,
"CrossEntropyWithSoftmaxGradGPUKernel"
,
([
&
]
{
CrossEntropyWithSoftmaxGradGPUKernel
<
T
,
data_t
>
(
dev_ctx
,
label
,
...
...
paddle/phi/kernels/gpu/cross_entropy_kernel.cu
浏览文件 @
2ab986ae
...
...
@@ -24,15 +24,13 @@ namespace cub = hipcub;
#include "paddle/phi/common/amp_type_traits.h"
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/core/visit_type.h"
#include "paddle/phi/kernels/copy_kernel.h"
#include "paddle/phi/kernels/funcs/axis_utils.h"
#include "paddle/phi/kernels/funcs/for_range.h"
#include "paddle/phi/kernels/funcs/math_function.h"
#include "paddle/phi/kernels/gpudnn/softmax_gpudnn.h"
// TODO(chenweihang): move dispatch.h into phi/core
#include "paddle/phi/api/ext/dispatch.h"
#include "paddle/fluid/operators/math/cross_entropy.h"
#include "paddle/fluid/operators/math/softmax.h"
#include "paddle/fluid/platform/device/gpu/gpu_device_function.h"
...
...
@@ -1529,19 +1527,19 @@ void CrossEntropyWithSoftmaxKernel(const Context& dev_ctx,
softmax
,
loss
);
}
else
{
PD_
DISPATCH_INTEGRAL_TYPES
(
dtype
,
"CrossEntropyWithSoftmaxCUDAKernel"
,
([
&
]
{
CrossEntropyWithSoftmaxCUDAKernel
<
T
,
data_t
>
(
dev_ctx
,
logits
,
label
,
soft_label
,
use_softmax
,
numeric_stable_mode
,
ignore_index
,
axis
,
softmax
,
loss
);
}));
PD_
VISIT_INTEGRAL_TYPES
(
dtype
,
"CrossEntropyWithSoftmaxCUDAKernel"
,
([
&
]
{
CrossEntropyWithSoftmaxCUDAKernel
<
T
,
data_t
>
(
dev_ctx
,
logits
,
label
,
soft_label
,
use_softmax
,
numeric_stable_mode
,
ignore_index
,
axis
,
softmax
,
loss
);
}));
}
}
...
...
paddle/phi/kernels/gpu/reduce.h
浏览文件 @
2ab986ae
...
...
@@ -18,6 +18,7 @@
#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP) || \
defined(PADDLE_WITH_XPU_KP)
#include "paddle/phi/core/visit_type.h"
#include "paddle/phi/kernels/funcs/reduce_function.h"
namespace
phi
{
...
...
paddle/phi/kernels/gpu/reduce_grad.h
浏览文件 @
2ab986ae
...
...
@@ -23,7 +23,7 @@
#include <set>
#include <vector>
#include "paddle/phi/
api/ext/dispatch
.h"
#include "paddle/phi/
core/visit_type
.h"
#include "paddle/phi/kernels/funcs/broadcast_function.h"
namespace
phi
{
...
...
paddle/phi/kernels/gpu/transpose_kernel.cu
浏览文件 @
2ab986ae
...
...
@@ -14,7 +14,6 @@
#include <vector>
#include "paddle/phi/api/ext/dispatch.h"
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/kernels/transpose_kernel.h"
...
...
paddle/phi/kernels/sparse/cpu/convolution_grad_kernel.cc
浏览文件 @
2ab986ae
...
...
@@ -13,13 +13,12 @@ See the License for the specific language governing permissions and
limitations under the License. */
#include "paddle/phi/kernels/sparse/convolution_grad_kernel.h"
#include "paddle/phi/core/visit_type.h"
#include "paddle/phi/kernels/copy_kernel.h"
#include "paddle/phi/kernels/funcs/blas/blas.h"
#include "paddle/phi/kernels/funcs/math_function.h"
#include "paddle/phi/kernels/sparse/cpu/convolution.h"
#include "paddle/phi/api/ext/dispatch.h"
namespace
phi
{
namespace
sparse
{
...
...
@@ -191,7 +190,7 @@ void Conv3dGradKernel(const Context& dev_ctx,
const
bool
subm
,
SparseCooTensor
*
x_grad
,
DenseTensor
*
kernel_grad
)
{
PD_
DISPATCH
_INTEGRAL_TYPES
(
PD_
VISIT
_INTEGRAL_TYPES
(
x
.
non_zero_indices
().
dtype
(),
"Conv3dGradCPUKernel"
,
([
&
]
{
Conv3dGradCPUKernel
<
T
,
data_t
>
(
dev_ctx
,
x
,
...
...
paddle/phi/kernels/sparse/cpu/convolution_kernel.cc
浏览文件 @
2ab986ae
...
...
@@ -15,10 +15,9 @@ limitations under the License. */
#include "paddle/phi/kernels/sparse/cpu/convolution.h"
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/core/tensor_meta.h"
#include "paddle/phi/core/visit_type.h"
#include "paddle/phi/kernels/funcs/blas/blas.h"
#include "paddle/phi/api/ext/dispatch.h"
namespace
phi
{
namespace
sparse
{
...
...
@@ -159,7 +158,7 @@ void Conv3dKernel(const Context& dev_ctx,
const
bool
subm
,
SparseCooTensor
*
out
,
DenseTensor
*
rulebook
)
{
PD_
DISPATCH
_INTEGRAL_TYPES
(
PD_
VISIT
_INTEGRAL_TYPES
(
x
.
non_zero_indices
().
dtype
(),
"Conv3dCPUKernel"
,
([
&
]
{
Conv3dCPUKernel
<
T
,
data_t
>
(
dev_ctx
,
x
,
...
...
paddle/phi/kernels/sparse/cpu/sparse_mask_kernel.cc
浏览文件 @
2ab986ae
...
...
@@ -16,13 +16,12 @@ limitations under the License. */
#include "paddle/phi/core/ddim.h"
#include "paddle/phi/core/enforce.h"
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/core/visit_type.h"
#include "paddle/phi/kernels/copy_kernel.h"
#include "paddle/phi/kernels/empty_kernel.h"
#include "paddle/phi/kernels/funcs/math_function.h"
#include "paddle/phi/kernels/funcs/sparse/common_shape.h"
#include "paddle/phi/api/ext/dispatch.h"
namespace
phi
{
namespace
sparse
{
...
...
@@ -78,7 +77,7 @@ void SparseMaskKernel(const Context& dev_ctx,
const
DenseTensor
&
x
,
const
SparseCooTensor
&
mask
,
SparseCooTensor
*
out
)
{
PD_
DISPATCH
_INTEGRAL_TYPES
(
PD_
VISIT
_INTEGRAL_TYPES
(
mask
.
non_zero_indices
().
dtype
(),
"SparseMaskCPUKernel"
,
([
&
]
{
SparseMaskCPUKernel
<
T
,
data_t
>
(
dev_ctx
,
x
,
mask
,
out
);
}));
...
...
@@ -145,7 +144,7 @@ void SparseMaskHelperKernel(const Context& dev_ctx,
const
SparseCooTensor
&
x
,
const
DenseTensor
&
mask_indices
,
DenseTensor
*
out
)
{
PD_
DISPATCH
_INTEGRAL_TYPES
(
PD_
VISIT
_INTEGRAL_TYPES
(
x
.
non_zero_indices
().
dtype
(),
"SparseMaskHelperCPUKernel"
,
([
&
]
{
SparseMaskHelperCPUKernel
<
T
,
data_t
>
(
dev_ctx
,
x
,
mask_indices
,
out
);
}));
...
...
paddle/phi/kernels/sparse/cpu/sparse_pool_grad_kernel.cc
浏览文件 @
2ab986ae
...
...
@@ -14,13 +14,12 @@ limitations under the License. */
#include "paddle/phi/kernels/sparse/sparse_pool_grad_kernel.h"
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/core/visit_type.h"
#include "paddle/phi/kernels/copy_kernel.h"
#include "paddle/phi/kernels/empty_kernel.h"
#include "paddle/phi/kernels/funcs/pooling.h"
#include "paddle/phi/kernels/funcs/sparse/convolution.h"
#include "paddle/phi/api/ext/dispatch.h"
namespace
phi
{
namespace
sparse
{
...
...
@@ -82,7 +81,7 @@ void MaxPoolGradKernel(const Context& dev_ctx,
const
SparseCooTensor
&
out_grad
,
const
std
::
vector
<
int
>&
kernel_sizes
,
SparseCooTensor
*
x_grad
)
{
PD_
DISPATCH
_INTEGRAL_TYPES
(
PD_
VISIT
_INTEGRAL_TYPES
(
x
.
non_zero_indices
().
dtype
(),
"MaxPoolGradCPUKernel"
,
([
&
]
{
MaxPoolGradCPUKernel
<
T
,
data_t
>
(
dev_ctx
,
x
,
rulebook
,
out
,
out_grad
,
kernel_sizes
,
x_grad
);
...
...
paddle/phi/kernels/sparse/cpu/sparse_pool_kernel.cc
浏览文件 @
2ab986ae
...
...
@@ -15,12 +15,11 @@ limitations under the License. */
#include "paddle/phi/kernels/sparse/sparse_pool_kernel.h"
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/core/tensor_meta.h"
#include "paddle/phi/core/visit_type.h"
#include "paddle/phi/kernels/funcs/pooling.h"
#include "paddle/phi/kernels/funcs/sparse/convolution.h"
#include "paddle/phi/kernels/sparse/cpu/convolution.h"
#include "paddle/phi/api/ext/dispatch.h"
namespace
phi
{
namespace
sparse
{
...
...
@@ -106,7 +105,7 @@ void MaxPoolKernel(const Context& dev_ctx,
const
std
::
vector
<
int
>&
strides
,
SparseCooTensor
*
out
,
DenseTensor
*
rulebook
)
{
PD_
DISPATCH
_INTEGRAL_TYPES
(
PD_
VISIT
_INTEGRAL_TYPES
(
x
.
non_zero_indices
().
dtype
(),
"MaxPoolCPUKernel"
,
([
&
]
{
MaxPoolCPUKernel
<
T
,
data_t
>
(
dev_ctx
,
x
,
...
...
paddle/phi/kernels/sparse/gpu/convolution.cu.h
浏览文件 @
2ab986ae
...
...
@@ -338,7 +338,7 @@ int ProductRuleBook(const Context& dev_ctx,
SparseCooTensor
*
out
,
std
::
vector
<
int
>*
h_counter
,
std
::
vector
<
int
>*
h_offsets
)
{
// TODO(zhangkaihuo): use PD_
DISPATCH
_INTEGRAL_TYPES for secondary dispatch
// TODO(zhangkaihuo): use PD_
VISIT
_INTEGRAL_TYPES for secondary dispatch
auto
indices_dtype
=
paddle
::
experimental
::
CppTypeToDataType
<
IntT
>::
Type
();
const
int64_t
non_zero_num
=
x
.
nnz
();
const
auto
&
non_zero_indices
=
x
.
non_zero_indices
();
...
...
paddle/phi/kernels/sparse/gpu/convolution_grad_kernel.cu
浏览文件 @
2ab986ae
...
...
@@ -18,14 +18,13 @@ limitations under the License. */
#include "paddle/phi/backends/gpu/gpu_launch_config.h"
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/core/tensor_meta.h"
#include "paddle/phi/core/visit_type.h"
#include "paddle/phi/kernels/copy_kernel.h"
#include "paddle/phi/kernels/funcs/blas/blas.h"
#include "paddle/phi/kernels/funcs/math_function.h"
#include "paddle/phi/kernels/sparse/convolution_grad_kernel.h"
#include "paddle/phi/kernels/sparse/gpu/convolution.cu.h"
#include "paddle/phi/api/ext/dispatch.h"
namespace
phi
{
namespace
sparse
{
...
...
@@ -249,7 +248,7 @@ void Conv3dGradKernel(const Context& dev_ctx,
const
bool
subm
,
SparseCooTensor
*
x_grad
,
DenseTensor
*
kernel_grad
)
{
PD_
DISPATCH
_INTEGRAL_TYPES
(
PD_
VISIT
_INTEGRAL_TYPES
(
x
.
non_zero_indices
().
dtype
(),
"Conv3dGradGPUKernel"
,
([
&
]
{
Conv3dGradGPUKernel
<
T
,
data_t
>
(
dev_ctx
,
x
,
...
...
paddle/phi/kernels/sparse/gpu/convolution_kernel.cu
浏览文件 @
2ab986ae
...
...
@@ -15,12 +15,11 @@ limitations under the License. */
#include "paddle/phi/backends/gpu/gpu_context.h"
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/core/tensor_meta.h"
#include "paddle/phi/core/visit_type.h"
#include "paddle/phi/kernels/funcs/blas/blas.h"
#include "paddle/phi/kernels/sparse/convolution_kernel.h"
#include "paddle/phi/kernels/sparse/gpu/convolution.cu.h"
#include "paddle/phi/api/ext/dispatch.h"
namespace
phi
{
namespace
sparse
{
...
...
@@ -177,7 +176,7 @@ void Conv3dKernel(const Context& dev_ctx,
const
bool
subm
,
SparseCooTensor
*
out
,
DenseTensor
*
rulebook
)
{
PD_
DISPATCH
_INTEGRAL_TYPES
(
PD_
VISIT
_INTEGRAL_TYPES
(
x
.
non_zero_indices
().
dtype
(),
"Conv3dGPUKernel"
,
([
&
]
{
Conv3dGPUKernel
<
T
,
data_t
>
(
dev_ctx
,
x
,
...
...
paddle/phi/kernels/sparse/gpu/sparse_mask_kernel.cu
浏览文件 @
2ab986ae
...
...
@@ -19,14 +19,13 @@ limitations under the License. */
#include "paddle/phi/core/ddim.h"
#include "paddle/phi/core/enforce.h"
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/core/visit_type.h"
#include "paddle/phi/kernels/copy_kernel.h"
#include "paddle/phi/kernels/empty_kernel.h"
#include "paddle/phi/kernels/funcs/math_function.h"
#include "paddle/phi/kernels/funcs/sparse/common_shape.h"
#include "paddle/phi/kernels/sparse/sparse_mask_kernel.h"
#include "paddle/phi/api/ext/dispatch.h"
namespace
phi
{
namespace
sparse
{
...
...
@@ -118,7 +117,7 @@ void SparseMaskKernel(const Context& dev_ctx,
const
DenseTensor
&
x
,
const
SparseCooTensor
&
mask
,
SparseCooTensor
*
out
)
{
PD_
DISPATCH
_INTEGRAL_TYPES
(
PD_
VISIT
_INTEGRAL_TYPES
(
mask
.
non_zero_indices
().
dtype
(),
"SparseMaskGPUKernel"
,
([
&
]
{
SparseMaskGPUKernel
<
T
,
data_t
>
(
dev_ctx
,
x
,
mask
,
out
);
}));
...
...
@@ -265,7 +264,7 @@ void SparseMaskHelperKernel(const Context& dev_ctx,
const
SparseCooTensor
&
x
,
const
DenseTensor
&
mask_indices
,
DenseTensor
*
out
)
{
PD_
DISPATCH
_INTEGRAL_TYPES
(
PD_
VISIT
_INTEGRAL_TYPES
(
x
.
non_zero_indices
().
dtype
(),
"SparseMaskHelperGPUKernel"
,
([
&
]
{
SparseMaskHelperGPUKernel
<
T
,
data_t
>
(
dev_ctx
,
x
,
mask_indices
,
out
);
}));
...
...
paddle/phi/kernels/sparse/gpu/sparse_pool_grad_kernel.cu
浏览文件 @
2ab986ae
...
...
@@ -18,14 +18,13 @@ limitations under the License. */
#include "paddle/phi/backends/gpu/gpu_info.h"
#include "paddle/phi/backends/gpu/gpu_launch_config.h"
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/core/visit_type.h"
#include "paddle/phi/kernels/copy_kernel.h"
#include "paddle/phi/kernels/empty_kernel.h"
#include "paddle/phi/kernels/funcs/math_function.h"
#include "paddle/phi/kernels/funcs/pooling.h"
#include "paddle/phi/kernels/funcs/sparse/convolution.h"
#include "paddle/phi/api/ext/dispatch.h"
namespace
phi
{
namespace
sparse
{
...
...
@@ -129,7 +128,7 @@ void MaxPoolGradKernel(const Context& dev_ctx,
const
SparseCooTensor
&
out_grad
,
const
std
::
vector
<
int
>&
kernel_sizes
,
SparseCooTensor
*
x_grad
)
{
PD_
DISPATCH
_INTEGRAL_TYPES
(
PD_
VISIT
_INTEGRAL_TYPES
(
x
.
non_zero_indices
().
dtype
(),
"MaxPoolGradGPUKernel"
,
([
&
]
{
MaxPoolGradGPUKernel
<
T
,
data_t
>
(
dev_ctx
,
x
,
rulebook
,
out
,
out_grad
,
kernel_sizes
,
x_grad
);
...
...
paddle/phi/kernels/sparse/gpu/sparse_pool_kernel.cu
浏览文件 @
2ab986ae
...
...
@@ -16,12 +16,11 @@ limitations under the License. */
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/core/tensor_meta.h"
#include "paddle/phi/core/visit_type.h"
#include "paddle/phi/kernels/funcs/pooling.h"
#include "paddle/phi/kernels/funcs/sparse/convolution.h"
#include "paddle/phi/kernels/sparse/gpu/convolution.cu.h"
#include "paddle/phi/api/ext/dispatch.h"
namespace
phi
{
namespace
sparse
{
...
...
@@ -136,7 +135,7 @@ void MaxPoolKernel(const Context& dev_ctx,
const
std
::
vector
<
int
>&
strides
,
SparseCooTensor
*
out
,
DenseTensor
*
rulebook
)
{
PD_
DISPATCH
_INTEGRAL_TYPES
(
PD_
VISIT
_INTEGRAL_TYPES
(
x
.
non_zero_indices
().
dtype
(),
"MaxPoolGPUKernel"
,
([
&
]
{
MaxPoolGPUKernel
<
T
,
data_t
>
(
dev_ctx
,
x
,
...
...
paddle/phi/kernels/transfer_layout_kernel.cc
浏览文件 @
2ab986ae
...
...
@@ -14,9 +14,9 @@ limitations under the License. */
#include "paddle/phi/kernels/transfer_layout_kernel.h"
#include "paddle/phi/api/ext/dispatch.h"
#include "paddle/phi/backends/all_context.h"
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/core/visit_type.h"
#include "paddle/phi/kernels/funcs/math_function.h"
namespace
phi
{
...
...
paddle/phi/kernels/xpu/full_kernel.cc
浏览文件 @
2ab986ae
...
...
@@ -14,13 +14,13 @@
#include "paddle/phi/kernels/full_kernel.h"
#include "paddle/phi/api/ext/dispatch.h"
#include "paddle/phi/backends/xpu/xpu_context.h"
#include "paddle/phi/common/bfloat16.h"
#include "paddle/phi/common/complex.h"
#include "paddle/phi/common/float16.h"
#include "paddle/phi/common/scalar.h"
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/core/visit_type.h"
// See Note [ Why still include the fluid headers? ]
#include "paddle/fluid/memory/memcpy.h"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录