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
ab5b00cf
Commit
ab5b00cf
authored
1 month ago
by
Russel Arbore
Browse files
Options
Downloads
Patches
Plain Diff
Loop bound canon in cava + forkify
parent
f0018604
No related branches found
No related tags found
1 merge request
!189
Use loop bound canon to forkify demosaic
Pipeline
#201750
failed
1 month ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
hercules_opt/src/loop_bound_canon.rs
+1
-17
1 addition, 17 deletions
hercules_opt/src/loop_bound_canon.rs
juno_samples/cava/src/cpu.sch
+8
-0
8 additions, 0 deletions
juno_samples/cava/src/cpu.sch
with
9 additions
and
17 deletions
hercules_opt/src/loop_bound_canon.rs
+
1
−
17
View file @
ab5b00cf
...
...
@@ -47,8 +47,6 @@ pub fn canonicalize_single_loop_bounds(
)
->
bool
{
let
function
=
editor
.func
();
println!
(
"canonicalizing {:?}"
,
l
.header
);
let
Some
(
loop_condition
)
=
get_loop_exit_conditions
(
function
,
l
,
control_subgraph
)
else
{
return
false
;
};
...
...
@@ -66,7 +64,6 @@ pub fn canonicalize_single_loop_bounds(
let
ivs
=
compute_iv_ranges
(
editor
,
l
,
ivs
,
&
loop_condition
);
if
has_canonical_iv
(
editor
,
l
,
&
ivs
)
.is_some
()
{
// println!("has canon iv!");
return
false
;
}
...
...
@@ -78,7 +75,6 @@ pub fn canonicalize_single_loop_bounds(
// Assume there is only one loop bound iv.
if
loop_bound_ivs
.len
()
!=
1
{
// println!("has multiple iv!");
return
false
;
}
...
...
@@ -225,25 +221,15 @@ pub fn canonicalize_single_loop_bounds(
// If increment is negative (how in the world do we know that...)
// Increment can be DefinetlyPostiive, Unknown, DefinetlyNegative.
// // First, massage loop condition to be <, because that is normal!
// Also includes
// editor.edit(|mut edit| {
// }
// Collect immediate IV users
let
update_expr_users
:
Vec
<
_
>
=
editor
.get_users
(
*
update_expression
)
.filter
(|
node
|
*
node
!=
iv
.phi
()
&&
*
node
!=
condition_node
)
.collect
();
// println!("update_expr_users: {:?}", update_expr_users);
let
iv_phi_users
:
Vec
<
_
>
=
editor
.get_users
(
iv
.phi
())
.filter
(|
node
|
*
node
!=
iv
.phi
()
&&
*
node
!=
*
update_expression
)
.collect
();
// println!(" iv_phi_users: {:?}", iv_phi_users);
let
result
=
editor
.edit
(|
mut
edit
|
{
// 4) Second, change loop IV to go from 0..N.
// we subtract off init from init and dc_bound_node,
...
...
@@ -270,7 +256,6 @@ pub fn canonicalize_single_loop_bounds(
edit
.replace_all_uses_where
(
bound_id
,
new_condition
,
|
usee
|
*
usee
==
binop_node
)
?
;
}
// for user in update_expr_users {
// let new_user = Node::Binary {
// left: user,
...
...
@@ -281,7 +266,7 @@ pub fn canonicalize_single_loop_bounds(
// edit = edit.replace_all_uses(user, new_user)?;
// }
// for
// for
// Add the offset back to users of the IV update expression
let
new_user
=
Node
::
Binary
{
...
...
@@ -311,6 +296,5 @@ pub fn canonicalize_single_loop_bounds(
Ok
(
edit
)
});
println!
(
"result: {:?}"
,
result
);
return
result
;
}
This diff is collapsed.
Click to expand it.
juno_samples/cava/src/cpu.sch
+
8
−
0
View file @
ab5b00cf
...
...
@@ -39,6 +39,13 @@ fixpoint {
simpl!(fuse1);
array-slf(fuse1);
loop-bound-canon(fuse1);
fixpoint {
forkify(fuse1);
fork-guard-elim(fuse1);
fork-coalesce(fuse1);
}
predication(fuse1);
simpl!(fuse1);
inline(fuse2);
no-memset(fuse2@res);
...
...
@@ -116,6 +123,7 @@ simpl!(fuse5);
delete-uncalled(*);
simpl!(*);
xdot[true](fuse1);
simpl!(fuse1);
unforkify(fuse1);
...
...
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