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
2c9867b7
Commit
2c9867b7
authored
1 year ago
by
Russel Arbore
Browse files
Options
Downloads
Patches
Plain Diff
Refactor
parent
24886c52
No related branches found
No related tags found
1 merge request
!13
Basic IR schedules framework
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hercules_ir/src/schedule.rs
+22
-11
22 additions, 11 deletions
hercules_ir/src/schedule.rs
with
22 additions
and
11 deletions
hercules_ir/src/schedule.rs
+
22
−
11
View file @
2c9867b7
...
...
@@ -32,21 +32,34 @@ define_id_type!(PartitionID);
* by the compiler should be included.
*/
pub
fn
default_plan
(
function
:
&
Function
,
fork_join_map
:
&
HashMap
<
NodeID
,
NodeID
>
)
->
Plan
{
// St
ep 1:
creat
e
a completely bare-bones plan doing nothing interesting.
// St
art by
creat
ing
a completely bare-bones plan doing nothing interesting.
let
mut
plan
=
Plan
{
schedules
:
vec!
[
vec!
[];
function
.nodes
.len
()],
partitions
:
vec!
[
PartitionID
::
new
(
0
);
function
.nodes
.len
()],
num_partitions
:
0
,
};
// Step 2: infer parallel reductions consisting of a simple loop between a
// Reduce node and a Write node, where an index of the Write is a position
// index using the ThreadID node attached to the corresponding Fork. This
// procedure also adds the ParallelReduce schedule to Reduce nodes reducing
// over a parallelized Reduce, as long as the base Write node also has a
// position index that is the ThreadID of the outer fork. In other words,
// the complete Reduce chain is annotated with ParallelReduce, as long as
// each ThreadID appears in the positional indexing of the Write.
// Infer schedules.
infer_parallel_reduce
(
function
,
fork_join_map
,
&
mut
plan
);
plan
}
/*
* Infer parallel reductions consisting of a simple cycle between a Reduce node
* and a Write node, where an index of the Write is a position index using the
* ThreadID node attached to the corresponding Fork. This procedure also adds
* the ParallelReduce schedule to Reduce nodes reducing over a parallelized
* Reduce, as long as the base Write node also has a position index that is the
* ThreadID of the outer fork. In other words, the complete Reduce chain is
* annotated with ParallelReduce, as long as each ThreadID appears in the
* positional indexing of the Write.
*/
pub
fn
infer_parallel_reduce
(
function
:
&
Function
,
fork_join_map
:
&
HashMap
<
NodeID
,
NodeID
>
,
plan
:
&
mut
Plan
,
)
{
for
id
in
(
0
..
function
.nodes
.len
())
.map
(
NodeID
::
new
)
.filter
(|
id
|
function
.nodes
[
id
.idx
()]
.is_reduce
())
...
...
@@ -110,6 +123,4 @@ pub fn default_plan(function: &Function, fork_join_map: &HashMap<NodeID, NodeID>
}
}
}
plan
}
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