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
8f22a8e2
Commit
8f22a8e2
authored
3 months ago
by
Xavier Routh
Browse files
Options
Downloads
Patches
Plain Diff
forkify fixes
parent
931ec954
No related branches found
No related tags found
1 merge request
!103
Forkify + Loop Canonicalization + Initial Fork Fission
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hercules_opt/src/forkify.rs
+13
-6
13 additions, 6 deletions
hercules_opt/src/forkify.rs
with
13 additions
and
6 deletions
hercules_opt/src/forkify.rs
+
13
−
6
View file @
8f22a8e2
...
@@ -439,6 +439,10 @@ pub fn analyze_phis<'a>(
...
@@ -439,6 +439,10 @@ pub fn analyze_phis<'a>(
phis
:
&
'a
[
NodeID
],
phis
:
&
'a
[
NodeID
],
loop_nodes
:
&
'a
HashSet
<
NodeID
>
,
loop_nodes
:
&
'a
HashSet
<
NodeID
>
,
)
->
impl
Iterator
<
Item
=
LoopPHI
>
+
'a
{
)
->
impl
Iterator
<
Item
=
LoopPHI
>
+
'a
{
// Find data cycles within the loop of this phi,
// Start from the phis loop_continue_latch, and walk its uses until we find the original phi.
phis
.into_iter
()
.map
(
move
|
phi
|
{
phis
.into_iter
()
.map
(
move
|
phi
|
{
let
stop_on
:
HashSet
<
NodeID
>
=
editor
let
stop_on
:
HashSet
<
NodeID
>
=
editor
.node_ids
()
.node_ids
()
...
@@ -451,6 +455,12 @@ pub fn analyze_phis<'a>(
...
@@ -451,6 +455,12 @@ pub fn analyze_phis<'a>(
return
true
;
return
true
;
}
}
}
}
// This phi
if
node
==
phi
{
return
true
;
}
// External Reduce
// External Reduce
if
let
Node
::
Reduce
{
if
let
Node
::
Reduce
{
control
,
control
,
...
@@ -480,10 +490,9 @@ pub fn analyze_phis<'a>(
...
@@ -480,10 +490,9 @@ pub fn analyze_phis<'a>(
.unwrap
();
.unwrap
();
let
loop_continue_latch
=
editor
.node
(
phi
)
.try_phi
()
.unwrap
()
.1
[
continue_idx
];
let
loop_continue_latch
=
editor
.node
(
phi
)
.try_phi
()
.unwrap
()
.1
[
continue_idx
];
// TODO: We may need to stop on exiting the loop for looking for data cycles.
let
uses
=
walk_all_uses_stop_on
(
loop_continue_latch
,
editor
,
stop_on
.clone
());
let
uses
=
walk_all_uses_stop_on
(
loop_continue_latch
,
editor
,
stop_on
.clone
());
let
users
=
walk_all_users_stop_on
(
loop_continue_latch
,
editor
,
stop_on
.clone
());
let
users
=
walk_all_users_stop_on
(
*
phi
,
editor
,
stop_on
.clone
());
let
other_stop_on
:
HashSet
<
NodeID
>
=
editor
let
other_stop_on
:
HashSet
<
NodeID
>
=
editor
.node_ids
()
.node_ids
()
...
@@ -514,8 +523,7 @@ pub fn analyze_phis<'a>(
...
@@ -514,8 +523,7 @@ pub fn analyze_phis<'a>(
.collect
();
.collect
();
let
mut
uses_for_dependance
=
walk_all_uses_stop_on
(
loop_continue_latch
,
editor
,
other_stop_on
);
let
mut
uses_for_dependance
=
walk_all_users_stop_on
(
loop_continue_latch
,
editor
,
other_stop_on
);
let
set1
:
HashSet
<
_
>
=
HashSet
::
from_iter
(
uses
);
let
set1
:
HashSet
<
_
>
=
HashSet
::
from_iter
(
uses
);
let
set2
:
HashSet
<
_
>
=
HashSet
::
from_iter
(
users
);
let
set2
:
HashSet
<
_
>
=
HashSet
::
from_iter
(
users
);
...
@@ -539,7 +547,6 @@ pub fn analyze_phis<'a>(
...
@@ -539,7 +547,6 @@ pub fn analyze_phis<'a>(
if
intersection
if
intersection
.iter
()
.iter
()
.filter
(|
node
|
**
node
!=
loop_continue_latch
)
.filter
(|
node
|
**
node
!=
loop_continue_latch
)
.filter
(|
node
|
!
(
editor
.node
(
*
node
)
.is_reduce
()
||
editor
.node
(
*
node
)
.is_phi
()))
.any
(|
data_node
|
{
.any
(|
data_node
|
{
editor
editor
.get_users
(
*
data_node
)
.get_users
(
*
data_node
)
...
...
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