Added simple scheduler with -simple-scheduler option

Scheduler_simple module: simplest possible scheduler, with
only topological sort and without any "smart" algo/heuristic.
master
Gwenaël Delaval 7 years ago
parent 7d6106d0aa
commit 35bce1d5e8

@ -164,6 +164,7 @@ let main () =
"-only-memalloc", Arg.Set do_mem_alloc, doc_memalloc_only;
"-only-linear", Arg.Set do_linear_typing, doc_linear_only;
"-old-scheduler", Arg.Set use_old_scheduler, doc_interf_scheduler;
"-simple-scheduler", Arg.Set use_simple_scheduler, doc_simple_scheduler;
"-unroll", Arg.Set unroll_loops, doc_unroll;
"-O", Arg.Unit do_optim, doc_optim;
"-mall", Arg.Set interf_all, doc_interf_all;

@ -104,10 +104,15 @@ let compile_program p log_c =
(* Scheduling *)
let p =
if not !Compiler_options.use_old_scheduler then
pass "Scheduling (with minimization of interferences)" true Schedule_interf.program p pp
else
pass "Scheduling" true Schedule.program p pp
match !Compiler_options.use_old_scheduler,
!Compiler_options.use_simple_scheduler with
| false, false ->
pass "Scheduling (with minimization of interferences)"
true Schedule_interf.program p pp
| true, false ->
pass "Scheduling" true Schedule.program p pp
| _, true ->
pass "Scheduling (simple)" true Schedule_simple.program p pp
in
let z3z = List.mem "z3z" !target_languages in

@ -0,0 +1,48 @@
(***********************************************************************)
(* *)
(* Heptagon *)
(* *)
(* Gwenael Delaval, LIG/INRIA, UJF *)
(* Leonard Gerard, Parkas, ENS *)
(* Adrien Guatto, Parkas, ENS *)
(* Cedric Pasteur, Parkas, ENS *)
(* Marc Pouzet, Parkas, ENS *)
(* *)
(* Copyright 2012 ENS, INRIA, UJF *)
(* *)
(* This file is part of the Heptagon compiler. *)
(* *)
(* Heptagon is free software: you can redistribute it and/or modify it *)
(* under the terms of the GNU General Public License as published by *)
(* the Free Software Foundation, either version 3 of the License, or *)
(* (at your option) any later version. *)
(* *)
(* Heptagon is distributed in the hope that it will be useful, *)
(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)
(* GNU General Public License for more details. *)
(* *)
(* You should have received a copy of the GNU General Public License *)
(* along with Heptagon. If not, see <http://www.gnu.org/licenses/> *)
(* *)
(***********************************************************************)
(* scheduling of equations *)
open Mls_utils
open Sgraph
(* clever scheduling *)
let schedule eq_list =
let node_list, _ = DataFlowDep.build eq_list in
let node_list = topological node_list in
List.rev (List.rev_map containt node_list)
let eqs funs () eq_list =
let eqs, () = Mls_mapfold.eqs funs () eq_list in
schedule eqs, ()
let program p =
let funs = { Mls_mapfold.defaults with Mls_mapfold.eqs = eqs } in
let p, () = Mls_mapfold.program_it funs () p in
p

@ -142,6 +142,7 @@ let do_mem_alloc_and_typing () =
do_linear_typing := true
let use_old_scheduler = ref false
let use_simple_scheduler = ref false
let strict_ssa = ref false
(* if this option is on, generate code that first copies the whole
@ -213,6 +214,7 @@ and doc_memalloc = "\t\tEnable memory allocation and linear annotations"
and doc_memalloc_only = "\tEnable memory allocation"
and doc_linear_only = "\t\tEnable linear annotations"
and doc_interf_scheduler = "\tUse the old scheduler"
and doc_simple_scheduler = "\tUse a very simple, time-efficient scheduler"
and doc_optim = "\t\t\tOptimize with deadcode, tomato, itfusion and memalloc"
and doc_interf_all = "\t\tPerform memory allocation on all types"
and doc_unroll = "\t\tUnroll all loops"

Loading…
Cancel
Save