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
32f2fcc1
Commit
32f2fcc1
authored
1 year ago
by
Russel Arbore
Browse files
Options
Downloads
Patches
Plain Diff
Code to convert representatives into partitions
parent
c7bf3621
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
+17
-2
17 additions, 2 deletions
hercules_ir/src/schedule.rs
with
17 additions
and
2 deletions
hercules_ir/src/schedule.rs
+
17
−
2
View file @
32f2fcc1
...
...
@@ -171,7 +171,7 @@ pub fn partition_out_forks(
// its user as a representative node ID for a partition. A region node taking
// multiple node IDs as input belongs to the partition with the smaller
// representative node ID.
let
representatives
=
forward_dataflow
(
let
control_
representatives
=
forward_dataflow
(
function
,
reverse_postorder
,
|
inputs
:
&
[
&
NodeID
],
node_id
:
NodeID
|
match
function
.nodes
[
node_id
.idx
()]
{
...
...
@@ -212,5 +212,20 @@ pub fn partition_out_forks(
},
);
println!
(
"{:?}"
,
representatives
);
// Step 2:
// Step 3: deduplicate representative node IDs.
let
mut
representative_to_partition_ids
=
HashMap
::
new
();
for
rep
in
&
representatives
{
if
!
representative_to_partition_ids
.contains_key
(
rep
)
{
representative_to_partition_ids
.insert
(
rep
,
PartitionID
::
new
(
representative_to_partition_ids
.len
()));
}
}
// Step 4: update plan.
plan
.num_partitions
=
representative_to_partition_ids
.len
();
for
id
in
(
0
..
function
.nodes
.len
())
.map
(
NodeID
::
new
)
{
plan
.partitions
[
id
.idx
()]
=
representative_to_partition_ids
[
&
representatives
[
id
.idx
()]];
}
}
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