Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
Hercules
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
llvm
Hercules
Commits
6f161d1e
Commit
6f161d1e
authored
3 weeks ago
by
Xavier Routh
Browse files
Options
Downloads
Patches
Plain Diff
canon + forkify fix
parent
e8ee780c
No related branches found
No related tags found
1 merge request
!207
Loop bound lte
Pipeline
#201949
passed
3 weeks ago
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
hercules_opt/src/forkify.rs
+16
-5
16 additions, 5 deletions
hercules_opt/src/forkify.rs
hercules_opt/src/loop_bound_canon.rs
+4
-4
4 additions, 4 deletions
hercules_opt/src/loop_bound_canon.rs
juno_samples/rodinia/backprop/src/cpu.sch
+1
-0
1 addition, 0 deletions
juno_samples/rodinia/backprop/src/cpu.sch
with
21 additions
and
9 deletions
hercules_opt/src/forkify.rs
+
16
−
5
View file @
6f161d1e
...
...
@@ -95,6 +95,8 @@ pub fn forkify_loop(
)
->
bool
{
let
function
=
editor
.func
();
println!
(
"forkifying {:?}"
,
l
.header
);
let
Some
(
loop_condition
)
=
get_loop_exit_conditions
(
function
,
l
,
control_subgraph
)
else
{
return
false
;
};
...
...
@@ -106,12 +108,13 @@ pub fn forkify_loop(
else
{
return
false
;
};
// Compute loop variance
let
loop_variance
=
compute_loop_variance
(
editor
,
l
);
let
ivs
=
compute_induction_vars
(
editor
.func
(),
l
,
&
loop_variance
);
let
ivs
=
compute_iv_ranges
(
editor
,
l
,
ivs
,
&
loop_condition
);
let
Some
(
canonical_iv
)
=
has_canonical_iv
(
editor
,
l
,
&
ivs
)
else
{
println!
(
"no canonical iv"
);
return
false
;
};
...
...
@@ -130,6 +133,7 @@ pub fn forkify_loop(
};
let
Some
(
bound_dc_id
)
=
bound
else
{
println!
(
"no bound iv"
);
return
false
;
};
...
...
@@ -167,6 +171,8 @@ pub fn forkify_loop(
return
false
;
}
println!
(
"this one"
);
// Get all phis used outside of the loop, they need to be reductionable.
// For now just assume all phis will be phis used outside of the loop, except for the canonical iv.
// FIXME: We need a different definiton of `loop_nodes` to check for phis used outside hte loop than the one
...
...
@@ -196,6 +202,9 @@ pub fn forkify_loop(
let
loop_body_last
=
editor
.get_uses
(
loop_if
)
.next
()
.unwrap
();
println!
(
"phis {:?}"
,
reductionable_phis
);
if
reductionable_phis
.iter
()
.any
(|
phi
|
!
matches!
(
phi
,
LoopPHI
::
Reductionable
{
..
}))
...
...
@@ -403,6 +412,7 @@ pub fn forkify_loop(
Ok
(
edit
)
});
println!
(
"result: {:?}"
,
result
);
return
result
;
}
...
...
@@ -530,10 +540,11 @@ pub fn analyze_phis<'a>(
let
intersection
:
HashSet
<
_
>
=
set1
.intersection
(
&
set2
)
.cloned
()
.collect
();
// If this phi uses any other phis the node is loop dependant,
// we use `phis` because this phi can actually contain the loop iv and its fine.
if
uses_for_dependance
.any
(|
node
|
phis
.contains
(
&
node
)
&&
node
!=
*
phi
)
{
LoopPHI
::
LoopDependant
(
*
phi
)
}
else
if
intersection
.clone
()
.iter
()
.next
()
.is_some
()
{
// // we use `phis` because this phi can actually contain the loop iv and its fine.
// if uses_for_dependance.any(|node| phis.contains(&node) && node != *phi) {
// LoopPHI::LoopDependant(*phi)
// } else
if
intersection
.clone
()
.iter
()
.next
()
.is_some
()
{
// PHIs on the frontier of the uses by the candidate phi, i.e in uses_for_dependance need
// to have headers that postdominate the loop continue latch. The value of the PHI used needs to be defined
// by the time the reduce is triggered (at the end of the loop's internal control).
...
...
This diff is collapsed.
Click to expand it.
hercules_opt/src/loop_bound_canon.rs
+
4
−
4
View file @
6f161d1e
...
...
@@ -73,7 +73,7 @@ pub fn canonicalize_single_loop_bounds(
.into_iter
()
.partition
(|
f
|
loop_bound_iv_phis
.contains
(
&
f
.phi
()));
println!
(
"{:?}"
,
loop_bound_ivs
);
//
println!("{:?}", loop_bound_ivs);
// Assume there is only one loop bound iv.
...
...
@@ -248,9 +248,9 @@ pub fn canonicalize_single_loop_bounds(
}
else
{
None
};
println!
(
"condition node: {:?}"
,
condition_node
);
//
println!("condition node: {:?}", condition_node);
let
users
=
editor
.get_users
(
condition_node
)
.collect_vec
();
println!
(
"{:?}"
,
users
);
//
println!("{:?}", users);
let
mut
condition_node
=
condition_node
;
...
...
@@ -280,7 +280,7 @@ pub fn canonicalize_single_loop_bounds(
let
new_binop_node
=
edit
.add_node
(
Node
::
Binary
{
left
,
right
:
blah
,
op
:
BinaryOperator
::
LT
});
edit
=
edit
.replace_all_uses_where
(
binop_node
,
new_binop_node
,
|
usee
|
*
usee
==
if_node
)
?
;
Some
((
init_id
,
b
ound_id
,
new_binop_node
,
if_node
))
Some
((
init_id
,
b
lah
,
new_binop_node
,
if_node
))
}
else
{
guard_info
};
edit
=
edit
.replace_all_uses_where
(
dc_bound_node
,
new_dc_bound_node
,
|
usee
|
*
usee
==
new_bop
)
?
;
...
...
This diff is collapsed.
Click to expand it.
juno_samples/rodinia/backprop/src/cpu.sch
+
1
−
0
View file @
6f161d1e
...
...
@@ -17,6 +17,7 @@ lift-dc-math(*);
loop-bound-canon(*);
dce(*);
lift-dc-math(*);
fixpoint {
forkify(*);
fork-guard-elim(*);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment