Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
87d97246
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,发现更多精彩内容 >>
未验证
提交
87d97246
编写于
11月 09, 2022
作者:
Q
Qi Li
提交者:
GitHub
11月 09, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert "[NPU] add more attrs into npu storiages, test=develop (#47645)" (#47751)
This reverts commit
1568d64f
.
上级
2dce4320
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
11 addition
and
33 deletion
+11
-33
paddle/phi/core/dense_tensor.cc
paddle/phi/core/dense_tensor.cc
+0
-4
paddle/phi/core/dense_tensor.h
paddle/phi/core/dense_tensor.h
+0
-4
paddle/phi/core/storage_properties.h
paddle/phi/core/storage_properties.h
+5
-11
paddle/phi/tests/core/test_dense_tensor.cc
paddle/phi/tests/core/test_dense_tensor.cc
+6
-14
未找到文件。
paddle/phi/core/dense_tensor.cc
浏览文件 @
87d97246
...
@@ -266,10 +266,6 @@ template const NPUStorageProperties& DenseTensor::storage_properties() const;
...
@@ -266,10 +266,6 @@ template const NPUStorageProperties& DenseTensor::storage_properties() const;
template
const
OneDNNStorageProperties
&
DenseTensor
::
storage_properties
()
const
;
template
const
OneDNNStorageProperties
&
DenseTensor
::
storage_properties
()
const
;
#endif
#endif
bool
DenseTensor
::
storage_properties_initialized
()
const
{
return
storage_properties_
!=
nullptr
;
}
void
DenseTensor
::
set_storage_properties
(
void
DenseTensor
::
set_storage_properties
(
std
::
unique_ptr
<
StorageProperties
>&&
storage_properties
)
{
std
::
unique_ptr
<
StorageProperties
>&&
storage_properties
)
{
storage_properties_
=
std
::
move
(
storage_properties
);
storage_properties_
=
std
::
move
(
storage_properties
);
...
...
paddle/phi/core/dense_tensor.h
浏览文件 @
87d97246
...
@@ -164,10 +164,6 @@ class DenseTensor : public TensorBase,
...
@@ -164,10 +164,6 @@ class DenseTensor : public TensorBase,
void
*
data
();
void
*
data
();
/// \brief Get whether the storage_properties is inited.
/// \return The init status of storage_properties.
bool
storage_properties_initialized
()
const
;
/// \brief Returns the storage_properties of the tensor.
/// \brief Returns the storage_properties of the tensor.
/// \return The storage_properties of the tensor.
/// \return The storage_properties of the tensor.
template
<
typename
DeviceT
>
template
<
typename
DeviceT
>
...
...
paddle/phi/core/storage_properties.h
浏览文件 @
87d97246
...
@@ -15,7 +15,7 @@ limitations under the License. */
...
@@ -15,7 +15,7 @@ limitations under the License. */
#pragma once
#pragma once
#include <memory>
#include <memory>
#include "paddle/phi/core/ddim.h"
#include "paddle/phi/core/utils/type_registry.h"
#include "paddle/phi/core/utils/type_registry.h"
#ifdef PADDLE_WITH_MKLDNN
#ifdef PADDLE_WITH_MKLDNN
...
@@ -42,10 +42,8 @@ struct NPUStorageProperties
...
@@ -42,10 +42,8 @@ struct NPUStorageProperties
virtual
~
NPUStorageProperties
()
=
default
;
virtual
~
NPUStorageProperties
()
=
default
;
static
const
char
*
name
()
{
return
"NPUStorageProperties"
;
}
static
const
char
*
name
()
{
return
"NPUStorageProperties"
;
}
int64_t
origin_format
{
-
1
};
int64_t
storage_format
;
int64_t
storage_format
{
-
1
};
int64_t
storage_layout
;
DDim
origin_dims
;
DDim
storage_dims
;
};
};
// Add OneDNNStorageProperties firstly for unittest covergae
// Add OneDNNStorageProperties firstly for unittest covergae
...
@@ -76,14 +74,10 @@ static std::unique_ptr<StorageProperties> CopyStorageProperties(
...
@@ -76,14 +74,10 @@ static std::unique_ptr<StorageProperties> CopyStorageProperties(
if
(
sp
)
{
if
(
sp
)
{
if
(
NPUStorageProperties
::
classof
(
sp
.
get
()))
{
if
(
NPUStorageProperties
::
classof
(
sp
.
get
()))
{
auto
result
=
std
::
make_unique
<
NPUStorageProperties
>
();
auto
result
=
std
::
make_unique
<
NPUStorageProperties
>
();
result
->
origin_format
=
static_cast
<
NPUStorageProperties
*>
(
sp
.
get
())
->
origin_format
;
result
->
storage_format
=
result
->
storage_format
=
static_cast
<
NPUStorageProperties
*>
(
sp
.
get
())
->
storage_format
;
static_cast
<
NPUStorageProperties
*>
(
sp
.
get
())
->
storage_format
;
result
->
origin_dims
=
result
->
storage_layout
=
static_cast
<
NPUStorageProperties
*>
(
sp
.
get
())
->
origin_dims
;
static_cast
<
NPUStorageProperties
*>
(
sp
.
get
())
->
storage_layout
;
result
->
storage_dims
=
static_cast
<
NPUStorageProperties
*>
(
sp
.
get
())
->
storage_dims
;
return
result
;
return
result
;
#ifdef PADDLE_WITH_MKLDNN
#ifdef PADDLE_WITH_MKLDNN
}
else
if
(
OneDNNStorageProperties
::
classof
(
sp
.
get
()))
{
}
else
if
(
OneDNNStorageProperties
::
classof
(
sp
.
get
()))
{
...
...
paddle/phi/tests/core/test_dense_tensor.cc
浏览文件 @
87d97246
...
@@ -154,19 +154,13 @@ TEST(dense_tensor, storage_properties) {
...
@@ -154,19 +154,13 @@ TEST(dense_tensor, storage_properties) {
EXPECT_TRUE
(
caught_exception
);
EXPECT_TRUE
(
caught_exception
);
// test custom device storage properties
// test custom device storage properties
EXPECT_FALSE
(
tensor
.
storage_properties_initialized
());
auto
npu_properties
=
std
::
make_unique
<
NPUStorageProperties
>
();
auto
npu_properties
=
std
::
make_unique
<
NPUStorageProperties
>
();
npu_properties
->
origin_format
=
0
;
npu_properties
->
storage_format
=
1
;
npu_properties
->
storage_format
=
3
;
npu_properties
->
storage_layout
=
2
;
npu_properties
->
origin_dims
=
{
1
,
8
,
5
,
5
};
npu_properties
->
storage_dims
=
{
1
,
1
,
5
,
5
,
16
};
tensor
.
set_storage_properties
(
std
::
move
(
npu_properties
));
tensor
.
set_storage_properties
(
std
::
move
(
npu_properties
));
EXPECT_TRUE
(
tensor
.
storage_properties_initialized
());
auto
get_npu_properties
=
tensor
.
storage_properties
<
NPUStorageProperties
>
();
auto
get_npu_properties
=
tensor
.
storage_properties
<
NPUStorageProperties
>
();
CHECK_EQ
(
get_npu_properties
.
origin_format
,
0
);
CHECK_EQ
(
get_npu_properties
.
storage_format
,
1
);
CHECK_EQ
(
get_npu_properties
.
storage_format
,
3
);
CHECK_EQ
(
get_npu_properties
.
storage_layout
,
2
);
CHECK_EQ
(
get_npu_properties
.
origin_dims
.
size
(),
4
);
CHECK_EQ
(
get_npu_properties
.
storage_dims
.
size
(),
5
);
// test error type storage properties
// test error type storage properties
#ifdef PADDLE_WITH_MKLDNN
#ifdef PADDLE_WITH_MKLDNN
...
@@ -183,10 +177,8 @@ TEST(dense_tensor, storage_properties) {
...
@@ -183,10 +177,8 @@ TEST(dense_tensor, storage_properties) {
auto
cp_tensor
=
tensor
;
auto
cp_tensor
=
tensor
;
auto
get_cp_npu_properties
=
auto
get_cp_npu_properties
=
cp_tensor
.
storage_properties
<
NPUStorageProperties
>
();
cp_tensor
.
storage_properties
<
NPUStorageProperties
>
();
CHECK_EQ
(
get_cp_npu_properties
.
origin_format
,
0
);
CHECK_EQ
(
get_cp_npu_properties
.
storage_format
,
1
);
CHECK_EQ
(
get_cp_npu_properties
.
storage_format
,
3
);
CHECK_EQ
(
get_cp_npu_properties
.
storage_layout
,
2
);
CHECK_EQ
(
get_cp_npu_properties
.
origin_dims
.
size
(),
4
);
CHECK_EQ
(
get_cp_npu_properties
.
storage_dims
.
size
(),
5
);
}
}
}
// namespace tests
}
// namespace tests
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录