Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MindSpore
akg
提交
19b8f18b
A
akg
项目概览
MindSpore
/
akg
通知
58
Star
7
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
akg
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
19b8f18b
编写于
6月 30, 2020
作者:
K
kasonchan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix bugs of multi-core processing
上级
5a35fac5
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
44 addition
and
8 deletion
+44
-8
src/pass/inject_thread_bind.cc
src/pass/inject_thread_bind.cc
+39
-4
src/poly/cce_isl_emitter.cc
src/poly/cce_isl_emitter.cc
+5
-4
未找到文件。
src/pass/inject_thread_bind.cc
浏览文件 @
19b8f18b
...
@@ -1371,18 +1371,53 @@ class MultiCoreScalarMerge : public IRMutator {
...
@@ -1371,18 +1371,53 @@ class MultiCoreScalarMerge : public IRMutator {
class
ScalarPeel
:
public
IRMutator
{
class
ScalarPeel
:
public
IRMutator
{
public:
public:
Stmt
Run
(
const
Stmt
&
s
)
{
return
Mutate
(
s
);
}
Stmt
Run
(
const
Stmt
&
s
)
{
Stmt
res
=
Mutate
(
s
);
if
(
!
before_scalar_store_
)
{
multi_core_body_
=
s
;
return
Stmt
();
}
return
res
;
}
Stmt
multi_core_body_
;
Stmt
multi_core_body_
;
bool
find_multi_core_
{
false
};
bool
before_scalar_store_
{
false
};
private:
private:
Stmt
Mutate_
(
const
Store
*
op
,
const
Stmt
&
s
)
final
{
if
(
!
find_multi_core_
)
before_scalar_store_
=
true
;
return
IRMutator
::
Mutate_
(
op
,
s
);
}
bool
MultiCoreAttr
(
const
AttrStmt
*
op
)
{
if
(
op
->
attr_key
==
"pragma_multi_core_depth"
&&
Compare
(
op
->
value
,
make_const
(
op
->
value
.
type
(),
1
))
==
0
)
{
return
true
;
}
return
false
;
}
Stmt
Mutate_
(
const
AttrStmt
*
op
,
const
Stmt
&
s
)
final
{
Stmt
Mutate_
(
const
AttrStmt
*
op
,
const
Stmt
&
s
)
final
{
if
(
op
->
attr_key
==
"pragma_multi_core_depth"
&&
Compare
(
op
->
value
,
make_const
(
op
->
value
.
type
(),
1
))
==
0
)
{
if
(
MultiCoreAttr
(
op
))
{
find_multi_core_
=
true
;
Stmt
body
=
Mutate
(
op
->
body
);
Stmt
body
=
Mutate
(
op
->
body
);
multi_core_body_
=
AttrStmt
::
make
(
op
->
node
,
op
->
attr_key
,
op
->
value
,
body
);
multi_core_body_
=
AttrStmt
::
make
(
op
->
node
,
op
->
attr_key
,
op
->
value
,
body
);
return
AttrStmt
::
make
(
op
->
node
,
op
->
attr_key
,
op
->
value
,
Evaluate
::
make
(
0
));
return
AttrStmt
::
make
(
op
->
node
,
op
->
attr_key
,
op
->
value
,
Evaluate
::
make
(
0
));
}
}
return
IRMutator
::
Mutate_
(
op
,
s
);
return
IRMutator
::
Mutate_
(
op
,
s
);
}
}
Stmt
Mutate_
(
const
Block
*
op
,
const
Stmt
&
s
)
final
{
if
(
op
->
first
.
defined
()
&&
op
->
rest
.
defined
()
&&
op
->
first
.
as
<
AttrStmt
>
()
!=
nullptr
&&
MultiCoreAttr
(
op
->
first
.
as
<
AttrStmt
>
()))
{
auto
first
=
Mutate
(
op
->
first
);
auto
rest
=
Mutate
(
op
->
rest
);
multi_core_body_
=
Block
::
make
(
multi_core_body_
,
rest
);
return
Block
::
make
(
first
,
Evaluate
::
make
(
0
));
}
return
IRMutator
::
Mutate_
(
op
,
s
);
}
};
};
Stmt
InjectMultiCore
(
Stmt
stmt
,
int
max_block_dim
,
int
merge_outer_loop
,
bool
is_dynamic
,
bool
scalar_rearrange
)
{
Stmt
InjectMultiCore
(
Stmt
stmt
,
int
max_block_dim
,
int
merge_outer_loop
,
bool
is_dynamic
,
bool
scalar_rearrange
)
{
...
@@ -1393,7 +1428,7 @@ Stmt InjectMultiCore(Stmt stmt, int max_block_dim, int merge_outer_loop, bool is
...
@@ -1393,7 +1428,7 @@ Stmt InjectMultiCore(Stmt stmt, int max_block_dim, int merge_outer_loop, bool is
Stmt
scalar_part
;
Stmt
scalar_part
;
if
(
scalar_rearrange
)
{
if
(
scalar_rearrange
)
{
ScalarPeel
peel
;
ScalarPeel
peel
;
scalar_part
=
peel
.
Mutate
(
stmt
);
scalar_part
=
peel
.
Run
(
stmt
);
stmt
=
peel
.
multi_core_body_
;
stmt
=
peel
.
multi_core_body_
;
}
}
...
@@ -1419,7 +1454,7 @@ Stmt InjectMultiCore(Stmt stmt, int max_block_dim, int merge_outer_loop, bool is
...
@@ -1419,7 +1454,7 @@ Stmt InjectMultiCore(Stmt stmt, int max_block_dim, int merge_outer_loop, bool is
stmt
=
MultiCoreInsert
(
plan
.
block_num_
,
plan
.
block_coef_
).
Insert
(
stmt
);
stmt
=
MultiCoreInsert
(
plan
.
block_num_
,
plan
.
block_coef_
).
Insert
(
stmt
);
}
}
stmt
=
LoopUnCompunder
().
Mutate
(
stmt
);
stmt
=
LoopUnCompunder
().
Mutate
(
stmt
);
if
(
scalar_rearrange
)
{
if
(
scalar_rearrange
&&
scalar_part
.
defined
()
)
{
stmt
=
MultiCoreScalarMerge
().
Run
(
stmt
,
scalar_part
);
stmt
=
MultiCoreScalarMerge
().
Run
(
stmt
,
scalar_part
);
}
}
return
stmt
;
return
stmt
;
...
...
src/poly/cce_isl_emitter.cc
浏览文件 @
19b8f18b
...
@@ -491,14 +491,15 @@ bool CCEIslEmitter::InjectMulticore(const std::string &iter) {
...
@@ -491,14 +491,15 @@ bool CCEIslEmitter::InjectMulticore(const std::string &iter) {
bool
is_loop_in_multicore_band
=
(
coincident_member
<
multicore_info
.
coincidence
.
size
());
bool
is_loop_in_multicore_band
=
(
coincident_member
<
multicore_info
.
coincidence
.
size
());
if
(
is_loop_in_multicore_band
)
{
if
(
is_loop_in_multicore_band
)
{
should_insert_multi_core
=
multicore_info
.
coincidence
[
coincident_member
];
should_insert_multi_core
=
multicore_info
.
coincidence
[
coincident_member
];
if
(
should_insert_multi_core
)
{
++
multicore_info
.
multicore_depth
;
--
multicore_info
.
coincidence
[
coincident_member
];
}
}
}
}
else
{
}
else
{
LOG
(
WARNING
)
<<
"multicore: unrecognized loop var "
<<
iter
;
LOG
(
WARNING
)
<<
"multicore: unrecognized loop var "
<<
iter
;
}
}
}
}
if
(
should_insert_multi_core
)
{
++
multicore_info
.
multicore_depth
;
}
return
should_insert_multi_core
;
return
should_insert_multi_core
;
}
}
...
@@ -549,8 +550,8 @@ Stmt CCEIslEmitter::EmitFor(const isl::ast_node_for &node) {
...
@@ -549,8 +550,8 @@ Stmt CCEIslEmitter::EmitFor(const isl::ast_node_for &node) {
if
(
should_insert_multi_core
)
{
if
(
should_insert_multi_core
)
{
CHECK_EQ
(
multicore_info
.
multicore_depth
,
original_multicore_info
.
multicore_depth
+
1
);
CHECK_EQ
(
multicore_info
.
multicore_depth
,
original_multicore_info
.
multicore_depth
+
1
);
stmt
=
AttrStmt
::
make
(
make_zero
(
Int
(
32
)),
"pragma_multi_core_depth"
,
Expr
(
multicore_info
.
multicore_depth
),
stmt
);
stmt
=
AttrStmt
::
make
(
make_zero
(
Int
(
32
)),
"pragma_multi_core_depth"
,
Expr
(
multicore_info
.
multicore_depth
),
stmt
);
--
multicore_info
.
multicore_depth
;
}
}
multicore_info
=
original_multicore_info
;
return
stmt
;
return
stmt
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录