Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
24f00cc6
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看板
提交
24f00cc6
编写于
9月 01, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
9月 01, 2020
浏览文件
操作
浏览文件
下载
差异文件
!5617 clear graph output address in graph destructor
Merge pull request !5617 from limingqi107/master
上级
437ae441
7ec2f6a5
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
42 addition
and
3 deletion
+42
-3
mindspore/ccsrc/backend/optimizer/gpu/remove_format_transform_pair.cc
...src/backend/optimizer/gpu/remove_format_transform_pair.cc
+1
-1
mindspore/ccsrc/runtime/device/gpu/gpu_kernel_runtime.cc
mindspore/ccsrc/runtime/device/gpu/gpu_kernel_runtime.cc
+4
-2
mindspore/ccsrc/runtime/device/kernel_runtime.cc
mindspore/ccsrc/runtime/device/kernel_runtime.cc
+34
-0
mindspore/ccsrc/runtime/device/kernel_runtime.h
mindspore/ccsrc/runtime/device/kernel_runtime.h
+3
-0
未找到文件。
mindspore/ccsrc/backend/optimizer/gpu/remove_format_transform_pair.cc
浏览文件 @
24f00cc6
...
@@ -46,7 +46,7 @@ const AnfNodePtr RemoveFormatTransformPair::Process(const FuncGraphPtr &graph, c
...
@@ -46,7 +46,7 @@ const AnfNodePtr RemoveFormatTransformPair::Process(const FuncGraphPtr &graph, c
MS_LOG
(
EXCEPTION
)
<<
"The pattern is not transpose pair, "
MS_LOG
(
EXCEPTION
)
<<
"The pattern is not transpose pair, "
<<
"node:"
<<
AnfAlgo
::
GetCNodeName
(
node
)
<<
" node input:"
<<
AnfAlgo
::
GetCNodeName
(
input_node
);
<<
"node:"
<<
AnfAlgo
::
GetCNodeName
(
node
)
<<
" node input:"
<<
AnfAlgo
::
GetCNodeName
(
input_node
);
}
}
// If transpose operator used by more than one other operators, it cant not be deleted
directly.
// If transpose operator used by more than one other operators, it cant not be deleted directly.
if
(
IsUsedByOthers
(
graph
,
input_node
))
{
if
(
IsUsedByOthers
(
graph
,
input_node
))
{
MS_LOG
(
DEBUG
)
<<
"The transpose node ["
<<
input_node
->
fullname_with_scope
()
MS_LOG
(
DEBUG
)
<<
"The transpose node ["
<<
input_node
->
fullname_with_scope
()
<<
"] is used by more than one other operators."
;
<<
"] is used by more than one other operators."
;
...
...
mindspore/ccsrc/runtime/device/gpu/gpu_kernel_runtime.cc
浏览文件 @
24f00cc6
...
@@ -397,8 +397,8 @@ void GPUKernelRuntime::ReleaseDeviceRes() {
...
@@ -397,8 +397,8 @@ void GPUKernelRuntime::ReleaseDeviceRes() {
bin_map
->
RemoveKernelCache
();
bin_map
->
RemoveKernelCache
();
}
}
void
GPUKernelRuntime
::
ClearGraphRuntimeResource
(
uint32_t
graph_id
,
const
std
::
vector
<
AnfNodePtr
>
&
,
void
GPUKernelRuntime
::
ClearGraphRuntimeResource
(
uint32_t
graph_id
,
const
std
::
vector
<
AnfNodePtr
>
&
inputs
,
const
std
::
unordered_set
<
ValueNodePtr
>
&
,
const
std
::
unordered_set
<
ValueNodePtr
>
&
value_nodes
,
const
std
::
vector
<
CNodePtr
>
&
execution_order
)
{
const
std
::
vector
<
CNodePtr
>
&
execution_order
)
{
MS_LOG
(
INFO
)
<<
"Clear graph:"
<<
graph_id
<<
" GPU runtime resource"
;
MS_LOG
(
INFO
)
<<
"Clear graph:"
<<
graph_id
<<
" GPU runtime resource"
;
// Release the kernel resource.
// Release the kernel resource.
...
@@ -409,6 +409,8 @@ void GPUKernelRuntime::ClearGraphRuntimeResource(uint32_t graph_id, const std::v
...
@@ -409,6 +409,8 @@ void GPUKernelRuntime::ClearGraphRuntimeResource(uint32_t graph_id, const std::v
}
}
kernel_mod
->
ReleaseResource
();
kernel_mod
->
ReleaseResource
();
}
}
// Clear the output address of graph.
ClearOutputAddress
(
inputs
,
value_nodes
,
execution_order
);
}
}
void
GPUKernelRuntime
::
AssignMemory
(
session
::
KernelGraph
*
graph
)
{
void
GPUKernelRuntime
::
AssignMemory
(
session
::
KernelGraph
*
graph
)
{
...
...
mindspore/ccsrc/runtime/device/kernel_runtime.cc
浏览文件 @
24f00cc6
...
@@ -854,6 +854,40 @@ void KernelRuntime::ClearGraphRuntimeResource(uint32_t graph_id, const std::vect
...
@@ -854,6 +854,40 @@ void KernelRuntime::ClearGraphRuntimeResource(uint32_t graph_id, const std::vect
MS_LOG
(
INFO
)
<<
"Clear graph:"
<<
graph_id
<<
" runtime resource"
;
MS_LOG
(
INFO
)
<<
"Clear graph:"
<<
graph_id
<<
" runtime resource"
;
}
}
void
KernelRuntime
::
ClearOutputAddress
(
const
std
::
vector
<
AnfNodePtr
>
&
inputs
,
const
std
::
unordered_set
<
ValueNodePtr
>
&
value_nodes
,
const
std
::
vector
<
CNodePtr
>
&
execution_order
)
{
// clear input parameter output address.
for
(
const
auto
&
input_node
:
inputs
)
{
MS_EXCEPTION_IF_NULL
(
input_node
);
if
(
!
input_node
->
isa
<
Parameter
>
())
{
continue
;
}
for
(
size_t
index
=
0
;
index
<
AnfAlgo
::
GetOutputTensorNum
(
input_node
);
++
index
)
{
if
(
!
AnfAlgo
::
OutputAddrExist
(
input_node
,
index
))
{
continue
;
}
AnfAlgo
::
SetOutputAddr
(
nullptr
,
0
,
input_node
.
get
());
}
}
// clear input value node output address.
for
(
const
auto
&
value_node
:
value_nodes
)
{
if
(
!
AnfAlgo
::
OutputAddrExist
(
value_node
,
0
))
{
continue
;
}
AnfAlgo
::
SetOutputAddr
(
nullptr
,
0
,
value_node
.
get
());
}
// clear cnode output address.
for
(
const
auto
&
cnode
:
execution_order
)
{
for
(
size_t
index
=
0
;
index
<
AnfAlgo
::
GetOutputTensorNum
(
cnode
);
++
index
)
{
if
(
!
AnfAlgo
::
OutputAddrExist
(
cnode
,
index
))
{
continue
;
}
AnfAlgo
::
SetOutputAddr
(
nullptr
,
index
,
cnode
.
get
());
}
}
}
bool
KernelRuntime
::
LaunchTaskBasedOnSingleKernel
(
kernel
::
KernelModPtr
kernel_mod_ptr
,
bool
KernelRuntime
::
LaunchTaskBasedOnSingleKernel
(
kernel
::
KernelModPtr
kernel_mod_ptr
,
const
AddressPtrList
&
kernel_inputs
,
const
AddressPtrList
&
kernel_inputs
,
const
AddressPtrList
&
kernel_outputs
,
const
AddressPtrList
&
kernel_outputs
,
...
...
mindspore/ccsrc/runtime/device/kernel_runtime.h
浏览文件 @
24f00cc6
...
@@ -72,6 +72,9 @@ class KernelRuntime {
...
@@ -72,6 +72,9 @@ class KernelRuntime {
virtual
void
ClearGraphRuntimeResource
(
uint32_t
graph_id
,
const
std
::
vector
<
AnfNodePtr
>
&
inputs
,
virtual
void
ClearGraphRuntimeResource
(
uint32_t
graph_id
,
const
std
::
vector
<
AnfNodePtr
>
&
inputs
,
const
std
::
unordered_set
<
ValueNodePtr
>
&
value_nodes
,
const
std
::
unordered_set
<
ValueNodePtr
>
&
value_nodes
,
const
std
::
vector
<
CNodePtr
>
&
execution_order
);
const
std
::
vector
<
CNodePtr
>
&
execution_order
);
virtual
void
ClearOutputAddress
(
const
std
::
vector
<
AnfNodePtr
>
&
inputs
,
const
std
::
unordered_set
<
ValueNodePtr
>
&
value_nodes
,
const
std
::
vector
<
CNodePtr
>
&
execution_order
);
virtual
bool
SyncStream
()
=
0
;
virtual
bool
SyncStream
()
=
0
;
#ifdef ENABLE_DUMP_E2E
#ifdef ENABLE_DUMP_E2E
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录