Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
ae2d8ba1
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看板
未验证
提交
ae2d8ba1
编写于
7月 24, 2023
作者:
C
Chen Weihang
提交者:
GitHub
7月 24, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[AutoParallel] Simplify DistTensor namespace path (#55593)
* simplify dist tensor namespace path * fix tensor dist attr decl error
上级
a3cf25e3
变更
11
显示空白变更内容
内联
并排
Showing
11 changed file
with
14 addition
and
20 deletion
+14
-20
paddle/fluid/pybind/eager.cc
paddle/fluid/pybind/eager.cc
+1
-1
paddle/fluid/pybind/eager_method.cc
paddle/fluid/pybind/eager_method.cc
+2
-2
paddle/fluid/pybind/eager_properties.cc
paddle/fluid/pybind/eager_properties.cc
+2
-3
paddle/fluid/pybind/eager_utils.cc
paddle/fluid/pybind/eager_utils.cc
+1
-1
paddle/fluid/pybind/eager_utils.h
paddle/fluid/pybind/eager_utils.h
+1
-1
paddle/fluid/pybind/tensor.cc
paddle/fluid/pybind/tensor.cc
+1
-1
paddle/phi/api/lib/tensor.cc
paddle/phi/api/lib/tensor.cc
+1
-1
paddle/phi/core/dense_tensor.h
paddle/phi/core/dense_tensor.h
+1
-3
paddle/phi/core/distributed/auto_parallel/dist_tensor.cc
paddle/phi/core/distributed/auto_parallel/dist_tensor.cc
+0
-2
paddle/phi/core/distributed/auto_parallel/dist_tensor.h
paddle/phi/core/distributed/auto_parallel/dist_tensor.h
+3
-3
paddle/phi/core/utils/type_info.cc
paddle/phi/core/utils/type_info.cc
+1
-2
未找到文件。
paddle/fluid/pybind/eager.cc
浏览文件 @
ae2d8ba1
...
...
@@ -45,7 +45,7 @@ limitations under the License. */
#ifdef PADDLE_WITH_DISTRIBUTE
#include "paddle/phi/core/distributed/auto_parallel/dist_attr.h"
#include "paddle/phi/core/distributed/auto_parallel/dist_tensor.h"
using
phi
::
distributed
::
auto_parallel
::
DistTensor
;
using
phi
::
distributed
::
DistTensor
;
using
phi
::
distributed
::
auto_parallel
::
TensorDistAttr
;
#endif
...
...
paddle/fluid/pybind/eager_method.cc
浏览文件 @
ae2d8ba1
...
...
@@ -801,8 +801,8 @@ static PyObject* tensor_method_get_underline_tensor(TensorObject* self,
return
ToPyObject
(
tensor
);
}
else
if
(
self
->
tensor
.
is_dist_tensor
())
{
#ifdef PADDLE_WITH_DISTRIBUTE
auto
*
tensor
=
static_cast
<
phi
::
distributed
::
auto_parallel
::
DistTensor
*>
(
self
->
tensor
.
impl
().
get
());
auto
*
tensor
=
s
tatic_cast
<
phi
::
distributed
::
DistTensor
*>
(
s
elf
->
tensor
.
impl
().
get
());
VLOG
(
6
)
<<
"dist tensor: "
<<
tensor
->
defined
();
return
ToPyObject
(
tensor
);
#else
...
...
paddle/fluid/pybind/eager_properties.cc
浏览文件 @
ae2d8ba1
...
...
@@ -164,9 +164,8 @@ PyObject* tensor_properties_get_dist_attr(TensorObject* self, void* closure) {
EAGER_TRY
if
(
self
->
tensor
.
is_dist_tensor
())
{
#ifdef PADDLE_WITH_DISTRIBUTE
phi
::
distributed
::
auto_parallel
::
DistTensor
*
dist_tensor
=
static_cast
<
phi
::
distributed
::
auto_parallel
::
DistTensor
*>
(
self
->
tensor
.
impl
().
get
());
phi
::
distributed
::
DistTensor
*
dist_tensor
=
static_cast
<
phi
::
distributed
::
DistTensor
*>
(
self
->
tensor
.
impl
().
get
());
return
ToPyObject
(
dist_tensor
->
dist_attr
().
get
());
#else
RETURN_PY_NONE
...
...
paddle/fluid/pybind/eager_utils.cc
浏览文件 @
ae2d8ba1
...
...
@@ -859,7 +859,7 @@ PyObject* ToPyObject(const phi::DenseTensor* value) {
}
#ifdef PADDLE_WITH_DISTRIBUTE
PyObject
*
ToPyObject
(
const
phi
::
distributed
::
auto_parallel
::
DistTensor
*
value
)
{
PyObject
*
ToPyObject
(
const
phi
::
distributed
::
DistTensor
*
value
)
{
auto
obj
=
::
pybind11
::
cast
(
value
,
py
::
return_value_policy
::
reference
);
obj
.
inc_ref
();
return
obj
.
ptr
();
...
...
paddle/fluid/pybind/eager_utils.h
浏览文件 @
ae2d8ba1
...
...
@@ -113,7 +113,7 @@ PyObject* ToPyObject(const std::vector<std::vector<paddle::Tensor>>& value,
PyObject
*
ToPyObject
(
const
platform
::
Place
&
value
);
PyObject
*
ToPyObject
(
const
phi
::
DenseTensor
*
value
);
#ifdef PADDLE_WITH_DISTRIBUTE
PyObject
*
ToPyObject
(
const
phi
::
distributed
::
auto_parallel
::
DistTensor
*
value
);
PyObject
*
ToPyObject
(
const
phi
::
distributed
::
DistTensor
*
value
);
PyObject
*
ToPyObject
(
const
phi
::
distributed
::
auto_parallel
::
TensorDistAttr
*
value
);
#endif
...
...
paddle/fluid/pybind/tensor.cc
浏览文件 @
ae2d8ba1
...
...
@@ -1025,7 +1025,7 @@ void BindTensor(pybind11::module &m) { // NOLINT
#endif
#ifdef PADDLE_WITH_DISTRIBUTE
using
phi
::
distributed
::
auto_parallel
::
DistTensor
;
using
phi
::
distributed
::
DistTensor
;
py
::
class_
<
DistTensor
>
(
m
,
"DistTensor"
)
.
def
(
"get_tensor"
,
...
...
paddle/phi/api/lib/tensor.cc
浏览文件 @
ae2d8ba1
...
...
@@ -133,7 +133,7 @@ bool Tensor::is_dense_tensor() const {
}
bool
Tensor
::
is_dist_tensor
()
const
{
#ifdef PADDLE_WITH_DISTRIBUTE
return
phi
::
distributed
::
auto_parallel
::
DistTensor
::
classof
(
impl_
.
get
());
return
phi
::
distributed
::
DistTensor
::
classof
(
impl_
.
get
());
#else
return
false
;
#endif
...
...
paddle/phi/core/dense_tensor.h
浏览文件 @
ae2d8ba1
...
...
@@ -30,9 +30,7 @@ namespace phi {
class
DenseTensorUtils
;
namespace
distributed
{
namespace
auto_parallel
{
class
DistTensor
;
}
// namespace auto_parallel
}
// namespace distributed
/// \brief The Dense tensor stores values in a contiguous sequential block
...
...
@@ -186,7 +184,7 @@ class DenseTensor : public TensorBase,
private:
friend
class
DenseTensorUtils
;
friend
class
phi
::
distributed
::
auto_parallel
::
DistTensor
;
friend
class
phi
::
distributed
::
DistTensor
;
protected:
DenseTensorMeta
meta_
;
...
...
paddle/phi/core/distributed/auto_parallel/dist_tensor.cc
浏览文件 @
ae2d8ba1
...
...
@@ -16,7 +16,6 @@
namespace
phi
{
namespace
distributed
{
namespace
auto_parallel
{
void
*
DistTensor
::
AllocateFrom
(
Allocator
*
allocator
,
DataType
dtype
,
...
...
@@ -59,6 +58,5 @@ void DistTensor::set_meta(const DenseTensorMeta& meta) {
meta_
=
meta
;
}
}
// namespace auto_parallel
}
// namespace distributed
}
// namespace phi
paddle/phi/core/distributed/auto_parallel/dist_tensor.h
浏览文件 @
ae2d8ba1
...
...
@@ -18,11 +18,12 @@
#include "paddle/phi/core/dense_tensor.h"
namespace
phi
{
namespace
distributed
{
namespace
auto_parallel
{
namespace
auto_parallel
{
class
TensorDistAttr
;
}
using
auto_parallel
::
TensorDistAttr
;
class
DistTensor
final
:
public
phi
::
TensorBase
,
...
...
@@ -125,6 +126,5 @@ class DistTensor final
std
::
unique_ptr
<
DenseTensor
>
value_
{
nullptr
};
};
}
// namespace auto_parallel
}
// namespace distributed
}
// namespace phi
paddle/phi/core/utils/type_info.cc
浏览文件 @
ae2d8ba1
...
...
@@ -56,8 +56,7 @@ template class TypeInfoTraits<phi::DeviceContext, CPUContext>;
template
class
TypeInfoTraits
<
phi
::
DeviceContext
,
CustomContext
>;
#ifdef PADDLE_WITH_DISTRIBUTE
template
class
TypeInfoTraits
<
phi
::
TensorBase
,
phi
::
distributed
::
auto_parallel
::
DistTensor
>;
template
class
TypeInfoTraits
<
phi
::
TensorBase
,
phi
::
distributed
::
DistTensor
>;
#endif
#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP) || \
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录