Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
bb421b70
M
mindspore
项目概览
magicwindyyd
/
mindspore
与 Fork 源项目一致
Fork自
MindSpore / mindspore
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindspore
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
bb421b70
编写于
4月 01, 2020
作者:
L
laiyongqiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix bug when dump op with trans_flag true
上级
22a9c00b
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
35 addition
and
30 deletion
+35
-30
config/e2e_dump_config.json
config/e2e_dump_config.json
+6
-6
config/e2e_dump_config_0.json
config/e2e_dump_config_0.json
+7
-7
config/e2e_dump_config_1.json
config/e2e_dump_config_1.json
+7
-7
mindspore/ccsrc/common/trans.cc
mindspore/ccsrc/common/trans.cc
+6
-1
mindspore/ccsrc/device/ascend/ascend_device_address.cc
mindspore/ccsrc/device/ascend/ascend_device_address.cc
+3
-3
mindspore/ccsrc/device/ascend/ascend_kernel_runtime.cc
mindspore/ccsrc/device/ascend/ascend_kernel_runtime.cc
+6
-6
未找到文件。
config/e2e_dump_config.json
浏览文件 @
bb421b70
...
...
@@ -6,17 +6,17 @@
"net_name"
:
"ResNet50"
,
"mode"
:
0
,
"iteration"
:
0
,
"kernels"
:
[
"
TensorAdd
"
]
"kernels"
:
[
"
Default/Conv2D-op2"
,
"Default/TensorAdd-op10
"
]
},
"DumpSettingsSpec"
:
{
"enable"
:
"true: dump enable false: dump disable"
,
"trans_flag"
:
"true: trans to host format,false: not trans format"
,
"enable"
:
"true: dump enable
,
false: dump disable"
,
"trans_flag"
:
"true: trans to host format,
false: not trans format"
,
"path"
:
"the dump file folder"
,
"net_name"
:
"net name eg:ResNet50"
,
"mode"
:
"0: dump all kernels 1: dump kernels in kernels list"
,
"iteration"
:
"0: all iteration
others: specified iteration "
,
"kernels"
:
"
kernel name list
need to be dump"
"mode"
:
"0: dump all kernels
,
1: dump kernels in kernels list"
,
"iteration"
:
"0: all iteration
,
others: specified iteration "
,
"kernels"
:
"
op's full scope name which
need to be dump"
},
"other"
:
{}
}
\ No newline at end of file
config/e2e_dump_config_0.json
浏览文件 @
bb421b70
...
...
@@ -6,17 +6,17 @@
"net_name"
:
"ResNet50"
,
"mode"
:
0
,
"iteration"
:
0
,
"kernels"
:
[
"
AllReduce"
,
"BiasAddGrad"
,
"Conv2DBackpropFilter"
,
"SparseSoftmaxCrossEntropyWithLogits
"
]
"kernels"
:
[
"
Default/Conv2D-op2"
,
"Default/TensorAdd-op10
"
]
},
"DumpSettingsSpec"
:
{
"enable"
:
"true: dump enable false: dump disable"
,
"trans_flag"
:
"true: trans to host format,false: not trans format"
,
"enable"
:
"true: dump enable
,
false: dump disable"
,
"trans_flag"
:
"true: trans to host format,
false: not trans format"
,
"path"
:
"the dump file folder"
,
"net_name"
:
"net name eg:ResNet50"
,
"mode"
:
"0: dump all kernels 1: dump kernels in kernels list"
,
"iteration"
:
"0: all iteration
others: specified iteration "
,
"kernels"
:
"
kernel name list
need to be dump"
"mode"
:
"0: dump all kernels
,
1: dump kernels in kernels list"
,
"iteration"
:
"0: all iteration
,
others: specified iteration "
,
"kernels"
:
"
op's full scope name which
need to be dump"
},
"other"
:
{}
}
}
\ No newline at end of file
config/e2e_dump_config_1.json
浏览文件 @
bb421b70
...
...
@@ -6,17 +6,17 @@
"net_name"
:
"ResNet50"
,
"mode"
:
0
,
"iteration"
:
0
,
"kernels"
:
[
"
AllReduce"
,
"BiasAddGrad"
,
"Conv2DBackpropFilter"
,
"SparseSoftmaxCrossEntropyWithLogits
"
]
"kernels"
:
[
"
Default/Conv2D-op2"
,
"Default/TensorAdd-op10
"
]
},
"DumpSettingsSpec"
:
{
"enable"
:
"true: dump enable false: dump disable"
,
"trans_flag"
:
"true: trans to host format,false: not trans format"
,
"enable"
:
"true: dump enable
,
false: dump disable"
,
"trans_flag"
:
"true: trans to host format,
false: not trans format"
,
"path"
:
"the dump file folder"
,
"net_name"
:
"net name eg:ResNet50"
,
"mode"
:
"0: dump all kernels 1: dump kernels in kernels list"
,
"iteration"
:
"0: all iteration
others: specified iteration "
,
"kernels"
:
"
kernel name list
need to be dump"
"mode"
:
"0: dump all kernels
,
1: dump kernels in kernels list"
,
"iteration"
:
"0: all iteration
,
others: specified iteration "
,
"kernels"
:
"
op's full scope name which
need to be dump"
},
"other"
:
{}
}
}
\ No newline at end of file
mindspore/ccsrc/common/trans.cc
浏览文件 @
bb421b70
...
...
@@ -53,6 +53,7 @@ enum DataTypeTransMode {
FROM_INT8_TO_FLOAT
,
FROM_INT8_TO_INT32
,
FROM_INT64_TO_INT32
,
FROM_UINT16_TO_INT32
,
};
const
std
::
map
<
std
::
pair
<
TypeId
,
TypeId
>
,
DataTypeTransMode
>
mode_map
{
...
...
@@ -68,7 +69,8 @@ const std::map<std::pair<TypeId, TypeId>, DataTypeTransMode> mode_map{
{
std
::
pair
<
TypeId
,
TypeId
>
(
kNumberTypeUInt8
,
kNumberTypeInt32
),
FROM_UINT8_TO_INT32
},
{
std
::
pair
<
TypeId
,
TypeId
>
(
kNumberTypeInt8
,
kNumberTypeFloat32
),
FROM_INT8_TO_FLOAT
},
{
std
::
pair
<
TypeId
,
TypeId
>
(
kNumberTypeInt8
,
kNumberTypeInt32
),
FROM_INT8_TO_INT32
},
{
std
::
pair
<
TypeId
,
TypeId
>
(
kNumberTypeInt64
,
kNumberTypeInt32
),
FROM_INT64_TO_INT32
}};
{
std
::
pair
<
TypeId
,
TypeId
>
(
kNumberTypeInt64
,
kNumberTypeInt32
),
FROM_INT64_TO_INT32
},
{
std
::
pair
<
TypeId
,
TypeId
>
(
kNumberTypeUInt16
,
kNumberTypeInt32
),
FROM_UINT16_TO_INT32
}};
template
<
typename
SrcT
,
typename
DstT
>
void
TransDataSrc2Dst
(
const
TypeIdArgs
&
args
,
void
*
dst
,
const
size_t
data_size
)
{
...
...
@@ -116,6 +118,9 @@ bool CastKernel(const TypeIdArgs &args, void *dst, const size_t data_size, const
case
FROM_INT64_TO_INT32
:
TransDataSrc2Dst
<
int64_t
,
int32_t
>
(
args
,
dst
,
data_size
);
break
;
case
FROM_UINT16_TO_INT32
:
TransDataSrc2Dst
<
uint16_t
,
int32_t
>
(
args
,
dst
,
data_size
);
break
;
default:
MS_LOG
(
ERROR
)
<<
"unsupported datatype trans"
;
return
false
;
...
...
mindspore/ccsrc/device/ascend/ascend_device_address.cc
浏览文件 @
bb421b70
...
...
@@ -106,13 +106,13 @@ bool AscendDeviceAddress::SyncDeviceToHost(const std::vector<int> &shape, size_t
}
else
{
auto
shape_size
=
trans
::
ShapeSize
(
host_shape
);
auto
host
=
std
::
vector
<
uint8_t
>
(
size_
);
const
trans
::
TypeIdArgs
type_args
{
ptr_
,
shape_size
,
type_id_
,
type
};
sync_ok
=
trans
::
TransDataType
(
type_args
,
host
.
data
());
SyncMemory
(
host
.
data
(),
ptr_
,
size_
,
RT_MEMCPY_DEVICE_TO_HOST
);
const
trans
::
TypeIdArgs
type_args
{
host
.
data
(),
shape_size
,
type_id_
,
type
};
sync_ok
=
trans
::
TransDataType
(
type_args
,
host_ptr
);
if
(
!
sync_ok
)
{
MS_LOG
(
ERROR
)
<<
"trans data type failed."
;
return
false
;
}
SyncMemory
(
host_ptr
,
host
.
data
(),
size
,
RT_MEMCPY_DEVICE_TO_HOST
);
}
}
else
if
(
format_
==
kOpFormat_NC1HWC0
||
format_
==
kOpFormat_FRAC_Z
||
format_
==
kOpFormat_FRAC_NZ
)
{
sync_ok
=
SyncDeviceToHostAndConvertFormat
(
shape
,
size
,
type
,
host_ptr
);
...
...
mindspore/ccsrc/device/ascend/ascend_kernel_runtime.cc
浏览文件 @
bb421b70
...
...
@@ -150,9 +150,9 @@ void DumpOutput(mindspore::session::KernelGraph *graph, const string &dump_path,
auto
output_size
=
AnfAlgo
::
GetOutputTensorNum
(
node
);
for
(
size_t
j
=
0
;
j
<
output_size
;
++
j
)
{
auto
addr
=
AnfAlgo
::
GetOutputAddr
(
node
,
j
);
auto
shape
=
AnfAlgo
::
GetOutput
Device
Shape
(
node
,
j
);
auto
type
=
AnfAlgo
::
GetOutput
Device
DataType
(
node
,
j
);
auto
format
=
AnfAlgo
::
GetOutputFormat
(
node
,
j
)
;
auto
shape
=
AnfAlgo
::
GetOutput
Infer
Shape
(
node
,
j
);
auto
type
=
AnfAlgo
::
GetOutput
Infer
DataType
(
node
,
j
);
auto
format
=
kOpFormat_DEFAULT
;
string
filepath
=
dump_path
+
'/'
+
kernel_name
+
'_'
+
"output_"
+
std
::
to_string
(
j
);
auto
ascend_addr
=
dynamic_cast
<
const
mindspore
::
device
::
ascend
::
AscendDeviceAddress
*>
(
addr
);
std
::
vector
<
int
>
int_shapes
;
...
...
@@ -181,9 +181,9 @@ void DumpParameters(mindspore::session::KernelGraph *graph, const string &dump_p
continue
;
}
auto
addr
=
AnfAlgo
::
GetOutputAddr
(
item
,
PRAMATER_OUTPUT_INDEX
);
auto
shape
=
AnfAlgo
::
GetOutput
Device
Shape
(
item
,
PRAMATER_OUTPUT_INDEX
);
auto
type
=
AnfAlgo
::
GetOutput
Device
DataType
(
item
,
PRAMATER_OUTPUT_INDEX
);
auto
format
=
AnfAlgo
::
GetOutputFormat
(
item
,
PRAMATER_OUTPUT_INDEX
)
;
auto
shape
=
AnfAlgo
::
GetOutput
Infer
Shape
(
item
,
PRAMATER_OUTPUT_INDEX
);
auto
type
=
AnfAlgo
::
GetOutput
Infer
DataType
(
item
,
PRAMATER_OUTPUT_INDEX
);
auto
format
=
kOpFormat_DEFAULT
;
string
filepath
=
dump_path
+
'/'
+
parameter_name
+
'_'
+
"output_0"
;
auto
ascend_addr
=
dynamic_cast
<
const
mindspore
::
device
::
ascend
::
AscendDeviceAddress
*>
(
addr
);
std
::
vector
<
int
>
int_shapes
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录