aboutsummaryrefslogtreecommitdiffstats
path: root/scheduling
diff options
context:
space:
mode:
authorDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2020-09-24 15:23:09 +0200
committerDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2020-09-24 15:23:09 +0200
commit9c7724e98003699072d3af77a545401cd4249f2d (patch)
treef5a731a14efe77964370621038ac32693c5057f7 /scheduling
parenta9828b2acd57c99baae16310bc5a261404ab6198 (diff)
downloadcompcert-kvx-9c7724e98003699072d3af77a545401cd4249f2d.tar.gz
compcert-kvx-9c7724e98003699072d3af77a545401cd4249f2d.zip
attempt at "zigzag" scheduler; not quite testable due to issues in the duplicate/linearize passes
Diffstat (limited to 'scheduling')
-rw-r--r--scheduling/InstructionScheduler.mli6
-rw-r--r--scheduling/PrepassSchedulingOracle.ml31
2 files changed, 36 insertions, 1 deletions
diff --git a/scheduling/InstructionScheduler.mli b/scheduling/InstructionScheduler.mli
index 85e2a5c6..fb7af3f6 100644
--- a/scheduling/InstructionScheduler.mli
+++ b/scheduling/InstructionScheduler.mli
@@ -33,6 +33,12 @@ type problem = {
(** Print problem for human readability. *)
val print_problem : out_channel -> problem -> unit;;
+(** Get the number of instructions in a problem *)
+val get_nr_instructions : problem -> int;;
+
+(** Get the number of resources in a problem *)
+val get_nr_resources : problem -> int;;
+
(** Scheduling solution. For {i n} instructions to schedule, and 0≤{i i}<{i n}, position {i i} contains the time to which instruction {i i} should be scheduled. Position {i n} contains the final output latency. *)
type solution = int array
diff --git a/scheduling/PrepassSchedulingOracle.ml b/scheduling/PrepassSchedulingOracle.ml
index 78961310..7b7b7233 100644
--- a/scheduling/PrepassSchedulingOracle.ml
+++ b/scheduling/PrepassSchedulingOracle.ml
@@ -403,6 +403,29 @@ let define_problem seqa =
then (get_alias_dependencies seqa) @ simple_deps
else *) simple_deps };;
+let zigzag_scheduler problem early_ones =
+ let nr_instructions = get_nr_instructions problem in
+ assert(nr_instructions = (Array.length early_ones));
+ match list_scheduler problem with
+ | Some fwd_schedule ->
+ let fwd_makespan = fwd_schedule.((Array.length fwd_schedule) - 1) in
+ let constraints' = ref problem.latency_constraints in
+ Array.iteri (fun i is_early ->
+ if is_early then
+ constraints' := {
+ instr_from = i;
+ instr_to = nr_instructions ;
+ latency = fwd_makespan - fwd_schedule.(i) } ::!constraints' )
+ early_ones;
+ validated_scheduler reverse_list_scheduler
+ { problem with latency_constraints = !constraints' }
+ | None -> None;;
+
+let prepass_scheduler_by_name name problem early_ones =
+ match name with
+ | "zigzag" -> zigzag_scheduler problem early_ones
+ | _ -> scheduler_by_name name problem
+
let schedule_sequence (seqa : (instruction*Regset.t) array) =
try
if (Array.length seqa) <= 1
@@ -414,7 +437,13 @@ let schedule_sequence (seqa : (instruction*Regset.t) array) =
let problem = define_problem seqa in
print_sequence stdout (Array.map fst seqa);
print_problem stdout problem;
- match scheduler_by_name (!Clflags.option_fprepass_sched) problem with
+ match prepass_scheduler_by_name
+ (!Clflags.option_fprepass_sched)
+ problem
+ (Array.map (fun (ins, _) ->
+ match ins with
+ | Icond _ -> true
+ | _ -> false) seqa) with
| None -> Printf.printf "no solution in prepass scheduling\n";
None
| Some solution ->