Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wux_labs
Tensorflow
提交
fcbb00ff
T
Tensorflow
项目概览
wux_labs
/
Tensorflow
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Tensorflow
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
fcbb00ff
编写于
8月 10, 2017
作者:
A
A. Unique TensorFlower
提交者:
TensorFlower Gardener
8月 10, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Clean up fused_instructions method in HloInstruction
PiperOrigin-RevId: 164879220
上级
471c506b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
15 addition
and
16 deletion
+15
-16
tensorflow/compiler/xla/service/hlo_instruction.cc
tensorflow/compiler/xla/service/hlo_instruction.cc
+14
-13
tensorflow/compiler/xla/service/hlo_instruction.h
tensorflow/compiler/xla/service/hlo_instruction.h
+1
-3
未找到文件。
tensorflow/compiler/xla/service/hlo_instruction.cc
浏览文件 @
fcbb00ff
...
...
@@ -521,13 +521,18 @@ void HloInstruction::MergeFusionInstruction(
// fusion.
// Add all non-parameter fused instructions to 'unfused_instructions' to be
// merged into 'this'.
// This is done in reverse post order.
std
::
vector
<
HloInstruction
*>
unfused_instructions
;
for
(
auto
&
fused_instruction
:
clone
->
fused_instructions
())
{
auto
fused_instructions
=
clone
->
fused_instructions_computation
()
->
MakeInstructionPostOrder
();
for
(
auto
fused_it
=
fused_instructions
.
rbegin
();
fused_it
!=
fused_instructions
.
rend
();
++
fused_it
)
{
auto
fused_instruction
=
*
fused_it
;
if
(
fused_instruction
->
opcode
()
==
HloOpcode
::
kParameter
)
{
TF_CHECK_OK
(
fused_instruction
->
ReplaceAllUsesWith
(
clone
->
mutable_operand
(
fused_instruction
->
parameter_number
())));
}
else
{
unfused_instructions
.
push_back
(
fused_instruction
.
get
()
);
unfused_instructions
.
push_back
(
fused_instruction
);
}
}
CHECK
(
unfused_instructions
.
front
()
==
clone
->
fused_expression_root
());
...
...
@@ -1007,8 +1012,6 @@ std::unique_ptr<HloInstruction> HloInstruction::CloneFusionWithNewOperands(
std
::
vector
<
HloInstruction
*>
new_fused_parameters
;
const
std
::
vector
<
HloInstruction
*>&
fused_parameters_
=
fused_instructions_computation
()
->
parameter_instructions
();
const
std
::
list
<
std
::
unique_ptr
<
HloInstruction
>>&
fused_instructions_
=
fused_instructions_computation
()
->
instructions
();
for
(
HloInstruction
*
old_fused_parameter
:
fused_parameters_
)
{
new_fused_instructions
.
push_back
(
old_fused_parameter
->
Clone
());
...
...
@@ -1017,10 +1020,8 @@ std::unique_ptr<HloInstruction> HloInstruction::CloneFusionWithNewOperands(
new_fused_parameters
.
push_back
(
new_fusion_parameter
);
InsertOrDie
(
&
old_to_new
,
old_fused_parameter
,
new_fusion_parameter
);
}
for
(
auto
old_fused_instruction_iter
=
fused_instructions_
.
rbegin
();
old_fused_instruction_iter
!=
fused_instructions_
.
rend
();
++
old_fused_instruction_iter
)
{
HloInstruction
*
old_fused_instruction
=
old_fused_instruction_iter
->
get
();
for
(
auto
old_fused_instruction
:
fused_instructions_computation
()
->
MakeInstructionPostOrder
())
{
if
(
old_fused_instruction
->
opcode
()
==
HloOpcode
::
kParameter
)
{
FindOrDie
(
old_to_new
,
old_fused_instruction
);
continue
;
...
...
@@ -1667,11 +1668,11 @@ HloInstructionProto HloInstruction::ToProto() const {
proto
.
mutable_fused_instructions_computation
();
proto_fused_computation
->
set_name
(
name
());
// Fill in fused instructions
. Note that fused_instructions() returns in
// reverse post-order (i.e. root first), so we reverse to get post-order.
for
(
auto
fused_it
=
fused_instructions
().
rbegin
();
fused_it
!=
fused_instructions
().
rend
();
++
fused_it
)
{
HloInstructionProto
fused_proto
=
(
*
fused_it
)
->
ToProto
();
// Fill in fused instructions
in post order.
auto
fused_instructions
=
fused_instructions_computation
()
->
MakeInstructionPostOrder
();
for
(
auto
fused_instruction
:
fused_instructions
)
{
HloInstructionProto
fused_proto
=
fused_instruction
->
ToProto
();
proto_fused_computation
->
add_instructions
()
->
Swap
(
&
fused_proto
);
}
break
;
...
...
tensorflow/compiler/xla/service/hlo_instruction.h
浏览文件 @
fcbb00ff
...
...
@@ -599,9 +599,7 @@ class HloInstruction {
// Precondition: opcode() == HloOpcode::kFusion
HloComputation
*
fused_instructions_computation
()
const
;
// Returns the vector of fused instructions inside this fusion
// instruction. The order is a reverse postorder of the fused expression (root
// is first in the order).
// Returns the list of fused instructions inside this fusioninstruction.
//
// Note: although the list itself is const, the instructions contained in the
// list returned here are mutable.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录