Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
8da9eff4
P
Paddle
项目概览
Crayon鑫
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
8da9eff4
编写于
12月 23, 2021
作者:
C
Chen Weihang
提交者:
GitHub
12月 23, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
move conj kernel impl (#38365)
上级
a3e6f18c
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
36 addition
and
86 deletion
+36
-86
paddle/fluid/operators/conj_op.h
paddle/fluid/operators/conj_op.h
+1
-2
paddle/pten/CMakeLists.txt
paddle/pten/CMakeLists.txt
+2
-2
paddle/pten/api/lib/kernel_declare.h
paddle/pten/api/lib/kernel_declare.h
+0
-2
paddle/pten/include/math.h
paddle/pten/include/math.h
+1
-2
paddle/pten/kernels/complex_kernel.h
paddle/pten/kernels/complex_kernel.h
+2
-3
paddle/pten/kernels/cpu/CMakeLists.txt
paddle/pten/kernels/cpu/CMakeLists.txt
+0
-1
paddle/pten/kernels/cpu/complex_kernel.cc
paddle/pten/kernels/cpu/complex_kernel.cc
+14
-20
paddle/pten/kernels/gpu/CMakeLists.txt
paddle/pten/kernels/gpu/CMakeLists.txt
+0
-2
paddle/pten/kernels/gpu/complex_kernel.cu
paddle/pten/kernels/gpu/complex_kernel.cu
+14
-20
paddle/pten/kernels/gpu/conj_kernel.h
paddle/pten/kernels/gpu/conj_kernel.h
+0
-30
paddle/pten/kernels/impl/complex_kernel_impl.h
paddle/pten/kernels/impl/complex_kernel_impl.h
+2
-2
未找到文件。
paddle/fluid/operators/conj_op.h
浏览文件 @
8da9eff4
...
...
@@ -20,8 +20,7 @@
// only can include the headers in paddle/pten/api dirs
#include "paddle/pten/api/lib/utils/tensor_utils.h"
#include "paddle/pten/include/core.h"
#include "paddle/pten/kernels/cpu/conj_kernel.h"
#include "paddle/pten/kernels/gpu/conj_kernel.h"
#include "paddle/pten/kernels/complex_kernel.h"
namespace
paddle
{
namespace
operators
{
...
...
paddle/pten/CMakeLists.txt
浏览文件 @
8da9eff4
...
...
@@ -26,10 +26,10 @@ add_subdirectory(tests)
set
(
PTEN_DEPS convert_utils dense_tensor pten_context kernel_factory kernel_context
)
get_property
(
pten_kernels GLOBAL PROPERTY PTEN_KERNELS
)
set
(
PTEN_DEPS
${
PTEN_DEPS
}
${
pten_kernels
}
)
set
(
PTEN_DEPS
${
PTEN_DEPS
}
math_cpu linalg_cpu manipulation_cpu
conj_kernel_cpu
)
set
(
PTEN_DEPS
${
PTEN_DEPS
}
math_cpu linalg_cpu manipulation_cpu
)
set
(
PTEN_DEPS
${
PTEN_DEPS
}
nary unary binary
)
if
(
WITH_GPU OR WITH_ROCM
)
set
(
PTEN_DEPS
${
PTEN_DEPS
}
math_gpu linalg_gpu manipulation_gpu
conj_kernel_gpu
)
set
(
PTEN_DEPS
${
PTEN_DEPS
}
math_gpu linalg_gpu manipulation_gpu
)
endif
()
if
(
WITH_XPU
)
set
(
PTEN_DEPS
${
PTEN_DEPS
}
manipulation_xpu
)
...
...
paddle/pten/api/lib/kernel_declare.h
浏览文件 @
8da9eff4
...
...
@@ -23,13 +23,11 @@ limitations under the License. */
PT_DECLARE_KERNEL
(
matmul
,
CPU
,
ALL_LAYOUT
);
PT_DECLARE_KERNEL
(
cast
,
CPU
,
ALL_LAYOUT
);
PT_DECLARE_KERNEL
(
mean
,
CPU
,
ALL_LAYOUT
);
PT_DECLARE_KERNEL
(
conj
,
CPU
,
ALL_LAYOUT
);
#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP)
PT_DECLARE_KERNEL
(
matmul
,
GPU
,
ALL_LAYOUT
);
PT_DECLARE_KERNEL
(
cast
,
GPU
,
ALL_LAYOUT
);
PT_DECLARE_KERNEL
(
mean
,
GPU
,
ALL_LAYOUT
);
PT_DECLARE_KERNEL
(
conj
,
GPU
,
ALL_LAYOUT
);
#endif
#ifdef PADDLE_WITH_XPU
...
...
paddle/pten/include/math.h
浏览文件 @
8da9eff4
...
...
@@ -17,9 +17,8 @@ limitations under the License. */
// See Note: [ How do we organize the kernel directory ]
#include "paddle/pten/api/lib/utils/storage.h"
#include "paddle/pten/include/infermeta.h"
#include "paddle/pten/kernels/c
pu/conj
_kernel.h"
#include "paddle/pten/kernels/c
omplex
_kernel.h"
#include "paddle/pten/kernels/cpu/math.h"
#include "paddle/pten/kernels/gpu/conj_kernel.h"
#include "paddle/pten/kernels/gpu/math.h"
#include "paddle/pten/kernels/scale_kernel.h"
...
...
paddle/pten/kernels/c
pu/conj
_kernel.h
→
paddle/pten/kernels/c
omplex
_kernel.h
浏览文件 @
8da9eff4
...
...
@@ -14,12 +14,11 @@ limitations under the License. */
#pragma once
#include "paddle/pten/backends/cpu/cpu_context.h"
#include "paddle/pten/core/dense_tensor.h"
namespace
pten
{
template
<
typename
T
>
void
Conj
(
const
C
PUContext
&
dev_ctx
,
const
DenseTensor
&
x
,
DenseTensor
*
out
);
template
<
typename
T
,
typename
ContextT
>
void
Conj
(
const
C
ontextT
&
dev_ctx
,
const
DenseTensor
&
x
,
DenseTensor
*
out
);
}
// namespace pten
paddle/pten/kernels/cpu/CMakeLists.txt
浏览文件 @
8da9eff4
...
...
@@ -2,4 +2,3 @@ cc_library(math_cpu SRCS math.cc DEPS dense_tensor kernel_context kernel_factory
cc_library
(
linalg_cpu SRCS linalg.cc DEPS dense_tensor kernel_context kernel_factory
)
cc_library
(
utils_cpu SRCS utils.cc DEPS dense_tensor kernel_context kernel_factory memory convert_utils
)
cc_library
(
manipulation_cpu SRCS manipulation.cc DEPS dense_tensor kernel_context kernel_factory utils_cpu unary
)
cc_library
(
conj_kernel_cpu SRCS conj_kernel.cc DEPS dense_tensor kernel_context kernel_factory
)
paddle/pten/kernels/cpu/co
nj
_kernel.cc
→
paddle/pten/kernels/cpu/co
mplex
_kernel.cc
浏览文件 @
8da9eff4
...
...
@@ -12,28 +12,22 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "paddle/pten/kernels/cpu/conj_kernel.h"
#include "paddle/pten/kernels/complex_kernel.h"
#include "paddle/pten/kernels/impl/complex_kernel_impl.h"
#include "paddle/pten/backends/cpu/cpu_context.h"
#include "paddle/pten/core/kernel_registry.h"
#include "paddle/pten/kernels/hybird/math/conj_impl.h"
namespace
pten
{
// See Note [ Why still include the fluid headers? ]
#include "paddle/fluid/platform/complex.h"
template
<
typename
T
>
void
Conj
(
const
CPUContext
&
dev_ctx
,
const
DenseTensor
&
x
,
DenseTensor
*
out
)
{
ConjImpl
<
T
,
CPUContext
>
(
dev_ctx
,
x
,
out
);
}
}
// namespace pten
PT_REGISTER_KERNEL
(
conj
,
CPU
,
ALL_LAYOUT
,
pten
::
Conj
,
paddle
::
platform
::
complex
<
float
>
,
paddle
::
platform
::
complex
<
double
>
,
float
,
double
,
int
,
int64_t
)
{}
PT_REGISTER_CTX_KERNEL
(
conj
,
CPU
,
ALL_LAYOUT
,
pten
::
Conj
,
paddle
::
platform
::
complex
<
float
>
,
paddle
::
platform
::
complex
<
double
>
,
float
,
double
,
int
,
int64_t
)
{}
paddle/pten/kernels/gpu/CMakeLists.txt
浏览文件 @
8da9eff4
...
...
@@ -3,11 +3,9 @@ if(WITH_GPU)
nv_library
(
linalg_gpu SRCS linalg.cu DEPS eigen_function dense_tensor kernel_context kernel_factory
)
nv_library
(
utils_gpu SRCS utils.cu DEPS dense_tensor kernel_context kernel_factory memory convert_utils
)
nv_library
(
manipulation_gpu SRCS manipulation.cu DEPS dense_tensor kernel_context kernel_factory utils_gpu unary
)
nv_library
(
conj_kernel_gpu SRCS conj_kernel.cu DEPS dense_tensor kernel_context kernel_factory
)
elseif
(
WITH_ROCM
)
hip_library
(
math_gpu SRCS math.cu DEPS eigen_function dense_tensor convert_utils kernel_context kernel_factory pten_transpose_gpu
)
hip_library
(
linalg_gpu SRCS linalg.cu DEPS eigen_function dense_tensor kernel_context kernel_factory
)
hip_library
(
utils_gpu SRCS utils.cu DEPS dense_tensor kernel_context kernel_factory memory convert_utils
)
hip_library
(
manipulation_gpu SRCS manipulation.cu DEPS dense_tensor kernel_context kernel_factory utils_gpu unary
)
hip_library
(
conj_kernel_gpu SRCS conj_kernel.cu DEPS dense_tensor kernel_context kernel_factory
)
endif
()
paddle/pten/kernels/gpu/co
nj
_kernel.cu
→
paddle/pten/kernels/gpu/co
mplex
_kernel.cu
浏览文件 @
8da9eff4
...
...
@@ -12,28 +12,22 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "paddle/pten/kernels/gpu/conj_kernel.h"
#include "paddle/pten/kernels/complex_kernel.h"
#include "paddle/pten/kernels/impl/complex_kernel_impl.h"
#include "paddle/pten/backends/gpu/gpu_context.h"
#include "paddle/pten/core/kernel_registry.h"
#include "paddle/pten/kernels/hybird/math/conj_impl.h"
namespace
pten
{
// See Note [ Why still include the fluid headers? ]
#include "paddle/fluid/platform/complex.h"
template
<
typename
T
>
void
Conj
(
const
GPUContext
&
dev_ctx
,
const
DenseTensor
&
x
,
DenseTensor
*
out
)
{
ConjImpl
<
T
,
GPUContext
>
(
dev_ctx
,
x
,
out
);
}
}
// namespace pten
PT_REGISTER_KERNEL
(
conj
,
GPU
,
ALL_LAYOUT
,
pten
::
Conj
,
paddle
::
platform
::
complex
<
float
>
,
paddle
::
platform
::
complex
<
double
>
,
float
,
double
,
int
,
int64_t
)
{}
PT_REGISTER_CTX_KERNEL
(
conj
,
GPU
,
ALL_LAYOUT
,
pten
::
Conj
,
paddle
::
platform
::
complex
<
float
>
,
paddle
::
platform
::
complex
<
double
>
,
float
,
double
,
int
,
int64_t
)
{}
paddle/pten/kernels/gpu/conj_kernel.h
已删除
100644 → 0
浏览文件 @
a3e6f18c
/* Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
#pragma once
// CUDA and HIP use same api
#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP)
#include "paddle/pten/backends/gpu/gpu_context.h"
#include "paddle/pten/core/dense_tensor.h"
namespace
pten
{
template
<
typename
T
>
void
Conj
(
const
GPUContext
&
dev_ctx
,
const
DenseTensor
&
x
,
DenseTensor
*
out
);
}
// namespace pten
#endif
paddle/pten/kernels/
hybird/math/conj
_impl.h
→
paddle/pten/kernels/
impl/complex_kernel
_impl.h
浏览文件 @
8da9eff4
...
...
@@ -14,14 +14,14 @@
#pragma once
// See Note [ Why still include the fluid headers? ]
#include "paddle/fluid/operators/math/complex_functors.h"
#include "paddle/fluid/platform/complex.h"
#include "paddle/fluid/platform/for_range.h"
namespace
pten
{
template
<
typename
T
,
typename
ContextT
>
void
Conj
Impl
(
const
ContextT
&
dev_ctx
,
const
DenseTensor
&
x
,
DenseTensor
*
out
)
{
void
Conj
(
const
ContextT
&
dev_ctx
,
const
DenseTensor
&
x
,
DenseTensor
*
out
)
{
auto
numel
=
x
.
numel
();
auto
*
x_data
=
x
.
data
<
T
>
();
auto
*
out_data
=
out
->
mutable_data
<
T
>
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录