Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
SWIFT
SWIFTsim
Commits
63abecd0
Commit
63abecd0
authored
11 years ago
by
Pedro Gonnet
Browse files
Options
Downloads
Patches
Plain Diff
rank tasks according to weight of sub-tree.
Former-commit-id: cc8b8ee0bf4d45a0bb60a0aa259454d3b8a25e18
parent
ed94ec26
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/queue.c
+3
-3
3 additions, 3 deletions
src/queue.c
src/scheduler.c
+33
-2
33 additions, 2 deletions
src/scheduler.c
src/task.h
+1
-1
1 addition, 1 deletion
src/task.h
with
37 additions
and
6 deletions
src/queue.c
+
3
−
3
View file @
63abecd0
...
...
@@ -104,7 +104,7 @@ void queue_insert ( struct queue *q , struct task *t ) {
/* Shuffle up. */
for
(
int
k
=
q
->
count
-
1
;
k
>
0
;
k
/=
2
)
if
(
q
->
tasks
[
q
->
tid
[
k
]
].
maxdepth
>
q
->
tasks
[
q
->
tid
[
k
/
2
]
].
maxdepth
)
{
if
(
q
->
tasks
[
q
->
tid
[
k
]
].
weight
>
q
->
tasks
[
q
->
tid
[
k
/
2
]
].
weight
)
{
int
temp
=
q
->
tid
[
k
];
q
->
tid
[
k
]
=
q
->
tid
[
k
/
2
];
q
->
tid
[
k
/
2
]
=
temp
;
...
...
@@ -234,9 +234,9 @@ struct task *queue_gettask ( struct queue *q , int qid , int blocking ) {
int
i
=
2
*
k
;
if
(
i
>=
q
->
count
)
break
;
if
(
i
+
1
<
q
->
count
&&
qtasks
[
qtid
[
i
+
1
]
].
maxdepth
>
qtasks
[
qtid
[
i
]
].
maxdepth
)
if
(
i
+
1
<
q
->
count
&&
qtasks
[
qtid
[
i
+
1
]
].
weight
>
qtasks
[
qtid
[
i
]
].
weight
)
i
+=
1
;
if
(
qtasks
[
qtid
[
i
]
].
maxdepth
>
qtasks
[
qtid
[
k
]
].
maxdepth
)
{
if
(
qtasks
[
qtid
[
i
]
].
weight
>
qtasks
[
qtid
[
k
]
].
weight
)
{
int
temp
=
qtid
[
i
];
qtid
[
i
]
=
qtid
[
k
];
qtid
[
k
]
=
temp
;
...
...
This diff is collapsed.
Click to expand it.
src/scheduler.c
+
33
−
2
View file @
63abecd0
...
...
@@ -473,13 +473,44 @@ void scheduler_ranktasks ( struct scheduler *s ) {
}
/* Run throught the tasks backwards and set their maxdepth. */
/* Run throught the tasks backwards and set their
weight and
maxdepth. */
for
(
k
=
nr_tasks
-
1
;
k
>=
0
;
k
--
)
{
t
=
&
tasks
[
tid
[
k
]
];
t
->
maxdepth
=
0
;
for
(
j
=
0
;
j
<
t
->
nr_unlock_tasks
;
j
++
)
switch
(
t
->
type
)
{
case
task_type_none
:
t
->
weight
=
0
;
break
;
case
task_type_sort
:
t
->
weight
=
t
->
ci
->
count
*
(
sizeof
(
int
)
*
8
-
__builtin_clz
(
t
->
ci
->
count
)
);
break
;
case
task_type_self
:
t
->
weight
=
t
->
ci
->
count
*
t
->
ci
->
count
;
break
;
case
task_type_pair
:
t
->
weight
=
t
->
ci
->
count
*
t
->
cj
->
count
;
break
;
case
task_type_sub
:
if
(
t
->
cj
!=
NULL
)
t
->
weight
=
t
->
ci
->
count
*
t
->
cj
->
count
;
else
t
->
weight
=
t
->
ci
->
count
*
t
->
ci
->
count
;
break
;
case
task_type_ghost
:
if
(
t
->
ci
==
t
->
ci
->
super
)
t
->
weight
=
t
->
ci
->
count
;
else
t
->
weight
=
0
;
break
;
case
task_type_kick2
:
t
->
weight
=
t
->
ci
->
count
;
break
;
}
for
(
j
=
0
;
j
<
t
->
nr_unlock_tasks
;
j
++
)
{
t
->
weight
+=
t
->
unlock_tasks
[
j
]
->
weight
;
if
(
t
->
unlock_tasks
[
j
]
->
maxdepth
>
t
->
maxdepth
)
t
->
maxdepth
=
t
->
unlock_tasks
[
j
]
->
maxdepth
;
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/task.h
+
1
−
1
View file @
63abecd0
...
...
@@ -51,7 +51,7 @@ extern const char *taskID_names[];
struct
task
{
char
type
,
subtype
,
skip
,
tight
;
int
flags
,
wait
,
rank
,
maxdepth
;
int
flags
,
wait
,
rank
,
weight
,
maxdepth
;
lock_type
lock
;
...
...
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