Skip to content
Snippets Groups Projects
Commit 938258cf authored by Erwan Jahier's avatar Erwan Jahier
Browse files

Rationnalize the use of time-profiling printing.

by
- remove duplication (add a profile_info function ine Lv6Verbose
- be more efficient (computing Sys.time only when necessary
- control the time-profiling printing via the -dbg flag "profile", and
  not the verbosity level
parent 196914a3
No related branches found
No related tags found
No related merge requests found
OASISFormat: 0.4 OASISFormat: 0.4
Name: lustre-v6 Name: lustre-v6
Version: 1.641 Version: 1.642
Synopsis: The Lustre V6 Verimag compiler Synopsis: The Lustre V6 Verimag compiler
Description: This package contains: Description: This package contains:
- lus2lic: the (current) name of the compiler (and interpreter via -exec). - lus2lic: the (current) name of the compiler (and interpreter via -exec).
......
...@@ -11,9 +11,7 @@ open Lxm ...@@ -11,9 +11,7 @@ open Lxm
open Lic open Lic
let dbg = (Lv6Verbose.get_flag "split") let dbg = (Lv6Verbose.get_flag "split")
let info msg = let profile_info = Lv6Verbose.profile_info
let t = Sys.time() in
Lv6Verbose.exe ~flag:dbg (fun () -> Printf.eprintf "%4.4f: %s%!" t msg)
(********************************************************************************) (********************************************************************************)
...@@ -352,7 +350,7 @@ and split_node (opt:Lv6MainArgs.t) (n: Lic.node_exp) : Lic.node_exp = ...@@ -352,7 +350,7 @@ and split_node (opt:Lv6MainArgs.t) (n: Lic.node_exp) : Lic.node_exp =
| BodyLic b -> | BodyLic b ->
let loc = match n.loclist_eff with None -> [] | Some l -> l in let loc = match n.loclist_eff with None -> [] | Some l -> l in
let (neqs, nv) = List.fold_left (split_eq_acc) ([], loc) b.eqs_eff in let (neqs, nv) = List.fold_left (split_eq_acc) ([], loc) b.eqs_eff in
info (Printf.sprintf "Split %i equations into %i ones\n" profile_info (Printf.sprintf "Split %i equations into %i ones\n"
(List.length b.eqs_eff)(List.length neqs)); (List.length b.eqs_eff)(List.length neqs));
let (nasserts,neqs, nv) = let (nasserts,neqs, nv) =
...@@ -396,7 +394,7 @@ let rec doit (opt:Lv6MainArgs.t) (inprg : LicPrg.t) : LicPrg.t = ...@@ -396,7 +394,7 @@ let rec doit (opt:Lv6MainArgs.t) (inprg : LicPrg.t) : LicPrg.t =
(** TRAITE LES NOEUDS : *) (** TRAITE LES NOEUDS : *)
let rec do_node k (ne:Lic.node_exp) = let rec do_node k (ne:Lic.node_exp) =
(* On passe en parametre un constructeur de nouvelle variable locale *) (* On passe en parametre un constructeur de nouvelle variable locale *)
info (Printf.sprintf "#DBG: split equations of '%s'\n" (Lic.string_of_node_key k)); profile_info (Printf.sprintf "#DBG: split equations of '%s'\n" (Lic.string_of_node_key k));
let ne' = split_node opt ne in let ne' = split_node opt ne in
res := LicPrg.add_node k ne' !res res := LicPrg.add_node k ne' !res
in in
......
(** Time-stamp: <modified the 02/02/2016 (at 15:40) by Erwan Jahier> *) (** Time-stamp: <modified the 03/02/2016 (at 15:10) by Erwan Jahier> *)
(* XXX ce module est mal crit. A reprendre. (R1) *) (* XXX ce module est mal crit. A reprendre. (R1) *)
...@@ -696,16 +696,13 @@ let (actions_of_equation: Lxm.t -> Soc.tbl -> ctx -> Lic.eq_info -> ...@@ -696,16 +696,13 @@ let (actions_of_equation: Lxm.t -> Soc.tbl -> ctx -> Lic.eq_info ->
(*********************************************************************************) (*********************************************************************************)
open Soc open Soc
let info msg = let profile_info = Lv6Verbose.profile_info
let t = Sys.time() in
Lv6Verbose.exe ~level:1 (fun () -> Printf.eprintf "%4.4f: %s%!" t msg; flush stderr)
let rec f: (LicPrg.t -> Lic.node_key -> Soc.key * Soc.tbl) = let rec f: (LicPrg.t -> Lic.node_key -> Soc.key * Soc.tbl) =
fun prog mnk -> fun prog mnk ->
let rec (process_node : Lic.node_key -> Soc.tbl -> Soc.key * Soc.tbl) = let rec (process_node : Lic.node_key -> Soc.tbl -> Soc.key * Soc.tbl) =
fun nk soc_tbl -> fun nk soc_tbl ->
info ("Lic2soc.process_node "^(Lic.string_of_node_key nk)^"\n"); profile_info ("Lic2soc.process_node "^(Lic.string_of_node_key nk)^"\n");
let node = let node =
match LicPrg.find_node prog nk with match LicPrg.find_node prog nk with
| None -> | None ->
...@@ -799,7 +796,7 @@ let rec f: (LicPrg.t -> Lic.node_key -> Soc.key * Soc.tbl) = ...@@ -799,7 +796,7 @@ let rec f: (LicPrg.t -> Lic.node_key -> Soc.key * Soc.tbl) =
(** Produit des soc de noeuds. *) (** Produit des soc de noeuds. *)
and (soc_of_node: LicPrg.t -> Lic.node_exp -> Soc.tbl -> (ctx * Soc.t * Soc.tbl) option) = and (soc_of_node: LicPrg.t -> Lic.node_exp -> Soc.tbl -> (ctx * Soc.t * Soc.tbl) option) =
fun licprg node soc_tbl -> fun licprg node soc_tbl ->
info ("Lic2soc.soc_of_node..."^(Lic.string_of_node_key node.node_key_eff)^"\n"); profile_info ("Lic2soc.soc_of_node..."^(Lic.string_of_node_key node.node_key_eff)^"\n");
let io_list = node.Lic.inlist_eff @ node.Lic.outlist_eff in let io_list = node.Lic.inlist_eff @ node.Lic.outlist_eff in
let io_type = List.map (fun vi -> lic_to_data_type vi.var_type_eff) io_list in let io_type = List.map (fun vi -> lic_to_data_type vi.var_type_eff) io_list in
let soc_key = make_soc_key_of_node_key node.Lic.node_key_eff None io_type in let soc_key = make_soc_key_of_node_key node.Lic.node_key_eff None io_type in
...@@ -807,7 +804,7 @@ let rec f: (LicPrg.t -> Lic.node_key -> Soc.key * Soc.tbl) = ...@@ -807,7 +804,7 @@ let rec f: (LicPrg.t -> Lic.node_key -> Soc.key * Soc.tbl) =
let ctx = create_context licprg in let ctx = create_context licprg in
let (soc_of_body: Lic.node_body -> Soc.tbl -> (ctx * Soc.t * Soc.tbl) option) = let (soc_of_body: Lic.node_body -> Soc.tbl -> (ctx * Soc.t * Soc.tbl) option) =
fun b soc_tbl -> fun b soc_tbl ->
info "Lic2soc.soc_of_node: computing actions...\n"; profile_info "Lic2soc.soc_of_node: computing actions...\n";
let ctx, actions, instances, deps = let ctx, actions, instances, deps =
(* on itere sur la liste des quations *) (* on itere sur la liste des quations *)
List.fold_left List.fold_left
...@@ -820,15 +817,15 @@ let rec f: (LicPrg.t -> Lic.node_key -> Soc.key * Soc.tbl) = ...@@ -820,15 +817,15 @@ let rec f: (LicPrg.t -> Lic.node_key -> Soc.key * Soc.tbl) =
b.eqs_eff b.eqs_eff
in in
(* Construction des dpendances entre les expressions *) (* Construction des dpendances entre les expressions *)
info "Lic2soc.soc_of_node: computing dependencies...\n"; profile_info "Lic2soc.soc_of_node: computing dependencies...\n";
let all_deps = let all_deps =
ActionsDeps.build_data_deps_from_actions lic_to_data_type deps actions ActionsDeps.build_data_deps_from_actions lic_to_data_type deps actions
in in
Lv6Verbose.exe ~flag:dbg Lv6Verbose.exe ~flag:dbg
(fun () -> print_string (ActionsDeps.to_string all_deps); flush stdout); (fun () -> print_string (ActionsDeps.to_string all_deps); flush stdout);
info "SortActions.f: sorting actions...\n"; profile_info "SortActions.f: sorting actions...\n";
let gaol = SortActions.f actions all_deps lxm in let gaol = SortActions.f actions all_deps lxm in
info "Lic2soc.soc_of_node: actions sorted. \n"; profile_info "Lic2soc.soc_of_node: actions sorted. \n";
let (locals: Soc.var list) = let (locals: Soc.var list) =
match node.Lic.loclist_eff with match node.Lic.loclist_eff with
| None -> [] | None -> []
...@@ -848,7 +845,7 @@ let rec f: (LicPrg.t -> Lic.node_key -> Soc.key * Soc.tbl) = ...@@ -848,7 +845,7 @@ let rec f: (LicPrg.t -> Lic.node_key -> Soc.key * Soc.tbl) =
in in
let (soc_of_metaop: Lic.node_key -> Soc.tbl -> (ctx * Soc.t * Soc.tbl) option) = let (soc_of_metaop: Lic.node_key -> Soc.tbl -> (ctx * Soc.t * Soc.tbl) option) =
fun nk soc_tbl -> fun nk soc_tbl ->
info "Lic2soc.soc_of_metaop...\n"; profile_info "Lic2soc.soc_of_metaop...\n";
match snd (fst nk), List.sort compare (snd nk) with match snd (fst nk), List.sort compare (snd nk) with
| ("map"|"red"|"fill"|"fillred"|"fold"),[ | ("map"|"red"|"fill"|"fillred"|"fold"),[
ConstStaticArgLic(_,Int_const_eff(c)); NodeStaticArgLic(_,iter_node)] ConstStaticArgLic(_,Int_const_eff(c)); NodeStaticArgLic(_,iter_node)]
......
(* Time-stamp: <modified the 03/02/2016 (at 14:18) by Erwan Jahier> *) (* Time-stamp: <modified the 03/02/2016 (at 15:10) by Erwan Jahier> *)
open Lxm open Lxm
...@@ -13,9 +13,7 @@ let dbg = (Lv6Verbose.get_flag "lazyc") ...@@ -13,9 +13,7 @@ let dbg = (Lv6Verbose.get_flag "lazyc")
let finish_me msg = print_string ("\n\tXXX licTab:"^msg^" -> finish me!\n") let finish_me msg = print_string ("\n\tXXX licTab:"^msg^" -> finish me!\n")
let info msg = let profile_info = Lv6Verbose.profile_info
let t = Sys.time() in
Lv6Verbose.exe ~level:1 (fun () -> Printf.eprintf "%4.4f: %s%!" t msg)
(******************************************************************************) (******************************************************************************)
(** Returns the ident on which the recursion was detected, plus an execution (** Returns the ident on which the recursion was detected, plus an execution
...@@ -387,7 +385,7 @@ module TopoSortVars = ...@@ -387,7 +385,7 @@ module TopoSortVars =
let (sort_vars : Lxm.t -> AstCore.node_vars-> Lv6Id.t list -> Lv6Id.t list) = let (sort_vars : Lxm.t -> AstCore.node_vars-> Lv6Id.t list -> Lv6Id.t list) =
fun lxm vars l -> (* we sort vars according to their clock deps *) fun lxm vars l -> (* we sort vars according to their clock deps *)
info "LicTab.sort_vars\n"; profile_info "LicTab.sort_vars\n";
let tbl = dep_star lxm l vars in let tbl = dep_star lxm l vars in
TopoSortVars.f tbl l TopoSortVars.f tbl l
...@@ -801,7 +799,7 @@ and (node_check_interface_do: t -> Lic.node_key -> Lxm.t -> ...@@ -801,7 +799,7 @@ and (node_check_interface_do: t -> Lic.node_key -> Lxm.t ->
(node_def: AstCore.node_info srcflagged) (node_def: AstCore.node_info srcflagged)
: Lic.node_exp = : Lic.node_exp =
(* START node_check_do *) (* START node_check_do *)
info "node_check_do\n"; profile_info "node_check_do\n";
( (
Lv6Verbose.exe ~flag:dbg (fun () -> Printf.printf Lv6Verbose.exe ~flag:dbg (fun () -> Printf.printf
"#DBG: ENTERING node_check_do '%s'\n (%s)\n" "#DBG: ENTERING node_check_do '%s'\n (%s)\n"
...@@ -1035,7 +1033,7 @@ and (node_check_interface_do: t -> Lic.node_key -> Lxm.t -> ...@@ -1035,7 +1033,7 @@ and (node_check_interface_do: t -> Lic.node_key -> Lxm.t ->
try List.map (fun id -> List.assoc id tab) l_id try List.map (fun id -> List.assoc id tab) l_id
with Not_found -> assert false with Not_found -> assert false
in in
info "LicTab.unsort\n"; profile_info "LicTab.unsort\n";
let inlist2 = unsort vars.inlist inlist let inlist2 = unsort vars.inlist inlist
and outlist2 = unsort vars.outlist outlist in and outlist2 = unsort vars.outlist outlist in
{ {
...@@ -1399,7 +1397,7 @@ let compile_all (this:t) : t = ...@@ -1399,7 +1397,7 @@ let compile_all (this:t) : t =
let compile_node (this:t) (main_node:Lv6Id.idref) : t = let compile_node (this:t) (main_node:Lv6Id.idref) : t =
(* la cle "absolue" du main node (pas d'args statiques) *) (* la cle "absolue" du main node (pas d'args statiques) *)
let main_node_key = node_key_of_idref main_node in let main_node_key = node_key_of_idref main_node in
info "LicTab.compile_node\n"; profile_info "LicTab.compile_node\n";
Lv6Verbose.printf Lv6Verbose.printf
"-- MAIN NODE: \"%s\"\n" "-- MAIN NODE: \"%s\"\n"
(LicDump.string_of_node_key_rec false main_node_key); (LicDump.string_of_node_key_rec false main_node_key);
......
(* Time-stamp: <modified the 02/02/2016 (at 15:44) by Erwan Jahier> *) (* Time-stamp: <modified the 03/02/2016 (at 15:09) by Erwan Jahier> *)
open Lxm open Lxm
open Lv6errors open Lv6errors
...@@ -8,14 +8,12 @@ open AstCore ...@@ -8,14 +8,12 @@ open AstCore
(* get the first package in the package/model list *) (* get the first package in the package/model list *)
let dbg = (Lv6Verbose.get_flag "ast") let dbg = (Lv6Verbose.get_flag "ast")
let info msg = let profile_info = Lv6Verbose.profile_info
let t = Sys.time() in
Lv6Verbose.exe ~level:1 (fun () -> Printf.eprintf "%4.4f: %s%!" t msg)
let (doit : Lv6MainArgs.t -> AstV6.pack_or_model list -> Lv6Id.idref option -> LicPrg.t) = let (doit : Lv6MainArgs.t -> AstV6.pack_or_model list -> Lv6Id.idref option -> LicPrg.t) =
fun opt srclist main_node -> fun opt srclist main_node ->
(* let t0 = Sys.time() in *) (* let t0 = Sys.time() in *)
info "Lv6Compile: Start!\n"; profile_info "Lv6Compile: Start!\n";
let syntax_tab = AstTab.create srclist in let syntax_tab = AstTab.create srclist in
(* Pour chaque package, on a un solveur de rfrences (* Pour chaque package, on a un solveur de rfrences
globales, pour les types, const et node : globales, pour les types, const et node :
...@@ -31,7 +29,7 @@ let (doit : Lv6MainArgs.t -> AstV6.pack_or_model list -> Lv6Id.idref option -> L ...@@ -31,7 +29,7 @@ let (doit : Lv6MainArgs.t -> AstV6.pack_or_model list -> Lv6Id.idref option -> L
let lic_tab = LicTab.create syntax_tab in let lic_tab = LicTab.create syntax_tab in
Lv6Verbose.exe ~flag:dbg (fun () -> AstTab.dump syntax_tab); Lv6Verbose.exe ~flag:dbg (fun () -> AstTab.dump syntax_tab);
info "Lv6Compile: Compiling into lic\n"; profile_info "Lv6Compile: Compiling into lic\n";
let lic_tab = match main_node with let lic_tab = match main_node with
| None -> LicTab.compile_all lic_tab | None -> LicTab.compile_all lic_tab
| Some main_node -> | Some main_node ->
...@@ -40,26 +38,26 @@ let (doit : Lv6MainArgs.t -> AstV6.pack_or_model list -> Lv6Id.idref option -> L ...@@ -40,26 +38,26 @@ let (doit : Lv6MainArgs.t -> AstV6.pack_or_model list -> Lv6Id.idref option -> L
else else
LicTab.compile_node lic_tab main_node LicTab.compile_node lic_tab main_node
in in
info "Converting to lic_prg...\n"; profile_info "Converting to lic_prg...\n";
let zelic = LicTab.to_lic_prg lic_tab in let zelic = LicTab.to_lic_prg lic_tab in
if opt.Lv6MainArgs.print_interface then zelic else ( if opt.Lv6MainArgs.print_interface then zelic else (
info "Check safety and memory declarations...\n"; profile_info "Check safety and memory declarations...\n";
if Lv6MainArgs.global_opt.Lv6MainArgs.kcg then if Lv6MainArgs.global_opt.Lv6MainArgs.kcg then
L2lCheckKcgKeyWord.doit zelic L2lCheckKcgKeyWord.doit zelic
else else
L2lCheckMemSafe.doit zelic; L2lCheckMemSafe.doit zelic;
let zelic = let zelic =
if not opt.Lv6MainArgs.optim_ite then zelic else ( if not opt.Lv6MainArgs.optim_ite then zelic else (
info "Optimizing if/then/else...\n"; profile_info "Optimizing if/then/else...\n";
L2lOptimIte.doit zelic) L2lOptimIte.doit zelic)
in in
let zelic = let zelic =
(* limination polymorphisme surcharge *) (* limination polymorphisme surcharge *)
info "Removing polymorphism...\n"; profile_info "Removing polymorphism...\n";
L2lRmPoly.doit zelic L2lRmPoly.doit zelic
in in
let zelic = if not opt.Lv6MainArgs.inline_iterator then zelic else ( let zelic = if not opt.Lv6MainArgs.inline_iterator then zelic else (
info "Inlining iterators...\n"; profile_info "Inlining iterators...\n";
(* to be done before array expansion otherwise they won't be expanded *) (* to be done before array expansion otherwise they won't be expanded *)
L2lExpandMetaOp.doit zelic L2lExpandMetaOp.doit zelic
) )
...@@ -77,7 +75,7 @@ let (doit : Lv6MainArgs.t -> AstV6.pack_or_model list -> Lv6Id.idref option -> L ...@@ -77,7 +75,7 @@ let (doit : Lv6MainArgs.t -> AstV6.pack_or_model list -> Lv6Id.idref option -> L
only if we have one op per equation...*) only if we have one op per equation...*)
then ( then (
(* Split des equations (1 eq = 1 op) *) (* Split des equations (1 eq = 1 op) *)
info "One op per equations...\n"; profile_info "One op per equations...\n";
L2lSplit.doit opt zelic) L2lSplit.doit opt zelic)
else else
zelic zelic
...@@ -115,7 +113,7 @@ let (doit : Lv6MainArgs.t -> AstV6.pack_or_model list -> Lv6Id.idref option -> L ...@@ -115,7 +113,7 @@ let (doit : Lv6MainArgs.t -> AstV6.pack_or_model list -> Lv6Id.idref option -> L
[] []
in in
assert (nodes_to_keep <> []); assert (nodes_to_keep <> []);
info ("Expanding the following node calls: " profile_info ("Expanding the following node calls: "
^(String.concat "," (List.map Lv6Id.string_of_idref ids_to_expand))^"\n"); ^(String.concat "," (List.map Lv6Id.string_of_idref ids_to_expand))^"\n");
L2lExpandNodes.doit nodes_to_keep zelic L2lExpandNodes.doit nodes_to_keep zelic
) )
...@@ -125,7 +123,7 @@ let (doit : Lv6MainArgs.t -> AstV6.pack_or_model list -> Lv6Id.idref option -> L ...@@ -125,7 +123,7 @@ let (doit : Lv6MainArgs.t -> AstV6.pack_or_model list -> Lv6Id.idref option -> L
(* Array and struct expansion: to do after polymorphism elimination (* Array and struct expansion: to do after polymorphism elimination
and after node expansion *) and after node expansion *)
let zelic = if not opt.Lv6MainArgs.expand_arrays then zelic else ( let zelic = if not opt.Lv6MainArgs.expand_arrays then zelic else (
info "Expanding arrays...\n"; profile_info "Expanding arrays...\n";
L2lExpandArrays.doit zelic) L2lExpandArrays.doit zelic)
in in
(* alias des types array XXX fait partir lic2soc en boucle (* alias des types array XXX fait partir lic2soc en boucle
...@@ -133,17 +131,17 @@ let (doit : Lv6MainArgs.t -> AstV6.pack_or_model list -> Lv6Id.idref option -> L ...@@ -133,17 +131,17 @@ let (doit : Lv6MainArgs.t -> AstV6.pack_or_model list -> Lv6Id.idref option -> L
(cf commentaire au dbut du module). Bon, j'enleve, car j'en ai (cf commentaire au dbut du module). Bon, j'enleve, car j'en ai
pas vraiment besoin en plus. pas vraiment besoin en plus.
info "Aliasing arrays...\n"; profile_info "Aliasing arrays...\n";
let zelic = L2lAliasType.doit zelic in let zelic = L2lAliasType.doit zelic in
*) *)
(* Currently only works in this mode *) (* Currently only works in this mode *)
if Lv6MainArgs.global_opt.Lv6MainArgs.ec then ( if Lv6MainArgs.global_opt.Lv6MainArgs.ec then (
info "Check loops...\n"; profile_info "Check loops...\n";
L2lCheckLoops.doit zelic L2lCheckLoops.doit zelic
); );
info "Check unique outputs...\n"; profile_info "Check unique outputs...\n";
L2lCheckOutputs.doit zelic; L2lCheckOutputs.doit zelic;
info "Lic Compilation done!\n"; profile_info "Lic Compilation done!\n";
zelic zelic
) )
......
...@@ -105,3 +105,9 @@ let put s = ( ...@@ -105,3 +105,9 @@ let put s = (
*) *)
(* put "%d %s %d\n" 42 "toto" 43; flush stderr;; *) (* put "%d %s %d\n" 42 "toto" 43; flush stderr;; *)
let prof = get_flag "profile"
let profile_info msg =
exe ~flag:prof (fun () -> Printf.eprintf "%4.4f: %s%!" (Sys.time()) msg)
...@@ -46,3 +46,5 @@ val printf : ?level:int -> ?flag:flag -> ('a, unit, string, unit) format4 -> 'a ...@@ -46,3 +46,5 @@ val printf : ?level:int -> ?flag:flag -> ('a, unit, string, unit) format4 -> 'a
val put : ?level:int -> ?flag:flag -> ('a, unit, string, unit) format4 -> 'a val put : ?level:int -> ?flag:flag -> ('a, unit, string, unit) format4 -> 'a
val print_string : ?level:int -> ?flag:flag -> string -> unit val print_string : ?level:int -> ?flag:flag -> string -> unit
val exe : ?level:int -> ?flag:flag -> (unit -> unit) -> unit val exe : ?level:int -> ?flag:flag -> (unit -> unit) -> unit
val profile_info : string -> unit
(** Automatically generated from Makefile *) (** Automatically generated from Makefile *)
let tool = "lus2lic" let tool = "lus2lic"
let branch = "master" let branch = "master"
let commit = "641" let commit = "642"
let sha_1 = "b57372e15caf72a8958ade4e74927fd97f890766" let sha_1 = "196914a31f29b1ebabae08ac5426824865f1d323"
let str = (branch ^ "." ^ commit ^ " (" ^ sha_1 ^ ")") let str = (branch ^ "." ^ commit ^ " (" ^ sha_1 ^ ")")
let maintainer = "jahier@imag.fr" let maintainer = "jahier@imag.fr"
(* Time-stamp: <modified the 14/01/2016 (at 10:42) by Erwan Jahier> *) (* Time-stamp: <modified the 03/02/2016 (at 15:09) by Erwan Jahier> *)
open Lv6Verbose open Lv6Verbose
open AstV6 open AstV6
...@@ -232,10 +232,7 @@ tel ...@@ -232,10 +232,7 @@ tel
output_string stdout (oracle_file_name ^" generated.\n"); output_string stdout (oracle_file_name ^" generated.\n");
flush stdout flush stdout
let info msg = let profile_info = Lv6Verbose.profile_info
let t = Sys.time() in
Lv6Verbose.exe ~level:1 (fun () -> Printf.eprintf "%4.4f: %s%!" t msg; flush stderr)
let main () = ( let main () = (
(* Lv6Compile.init_appli () ; *) (* Lv6Compile.init_appli () ; *)
...@@ -258,7 +255,7 @@ let main () = ( ...@@ -258,7 +255,7 @@ let main () = (
let lic_prg = Lv6Compile.doit opt nsl main_node in let lic_prg = Lv6Compile.doit opt nsl main_node in
if opt.print_interface then ( if opt.print_interface then (
gen_rif_interface lic_prg main_node opt; gen_rif_interface lic_prg main_node opt;
info "bye!"; profile_info "bye!";
my_exit opt 0 my_exit opt 0
); );
if opt.Lv6MainArgs.gen_autotest then if opt.Lv6MainArgs.gen_autotest then
...@@ -273,14 +270,14 @@ let main () = ( ...@@ -273,14 +270,14 @@ let main () = (
if LicPrg.node_exists lic_prg nk then ( if LicPrg.node_exists lic_prg nk then (
print_string ("WARNING: No main node is specified. I'll try with " ^ name ^"\n"); print_string ("WARNING: No main node is specified. I'll try with " ^ name ^"\n");
flush stdout; flush stdout;
info "Start compiling to soc...\n"; profile_info "Start compiling to soc...\n";
let msk,zesoc = Lic2soc.f lic_prg nk in let msk,zesoc = Lic2soc.f lic_prg nk in
info "Soc Compilation done.\n"; profile_info "Soc Compilation done.\n";
if opt.gen_c then ( if opt.gen_c then (
info "Start generating C code...\n"; profile_info "Start generating C code...\n";
Soc2c.f opt msk zesoc lic_prg); Soc2c.f opt msk zesoc lic_prg);
if opt.exec then ( if opt.exec then (
info "Start interpreting soc...\n"; profile_info "Start interpreting soc...\n";
SocExec.f opt zesoc msk) SocExec.f opt zesoc msk)
) else ( ) else (
print_string ("Error: no node is specified, cannot exec.\nbye\n"); print_string ("Error: no node is specified, cannot exec.\nbye\n");
...@@ -289,16 +286,16 @@ let main () = ( ...@@ -289,16 +286,16 @@ let main () = (
) )
) )
| Some main_node -> | Some main_node ->
info "Start compiling to soc...\n"; profile_info "Start compiling to soc...\n";
let msk, zesoc = Lic2soc.f lic_prg (Lic.node_key_of_idref main_node) in let msk, zesoc = Lic2soc.f lic_prg (Lic.node_key_of_idref main_node) in
info "Soc Compilation done. \n"; profile_info "Soc Compilation done. \n";
if opt.gen_c then ( if opt.gen_c then (
info "Start generating C code...\n"; profile_info "Start generating C code...\n";
Soc2c.f opt msk zesoc lic_prg); Soc2c.f opt msk zesoc lic_prg);
if opt.exec then ( if opt.exec then (
info "Start interpreting soc...\n"; profile_info "Start interpreting soc...\n";
SocExec.f opt zesoc msk) SocExec.f opt zesoc msk)
) else ( ) else (
LicPrg.to_file opt lic_prg main_node LicPrg.to_file opt lic_prg main_node
......
(* Time-stamp: <modified the 25/01/2016 (at 11:13) by Erwan Jahier> *) (* Time-stamp: <modified the 03/02/2016 (at 15:07) by Erwan Jahier> *)
open Soc open Soc
open Data open Data
open SocExecValue open SocExecValue
let dbg = (Lv6Verbose.get_flag "exec") let dbg = Lv6Verbose.get_flag "exec"
let profile_info = Lv6Verbose.profile_info
let (assign_expr : ctx -> var_expr -> var_expr -> ctx) = let (assign_expr : ctx -> var_expr -> var_expr -> ctx) =
fun ctx ve_in ve_out -> (* ve_out := ve_in (in ctx) *) fun ctx ve_in ve_out -> (* ve_out := ve_in (in ctx) *)
...@@ -29,6 +30,7 @@ let (array_index : int -> var -> var_expr) = ...@@ -29,6 +30,7 @@ let (array_index : int -> var -> var_expr) =
let rec (soc_step : Soc.step_method -> Soc.tbl -> Soc.t -> SocExecValue.ctx let rec (soc_step : Soc.step_method -> Soc.tbl -> Soc.t -> SocExecValue.ctx
-> SocExecValue.ctx) = -> SocExecValue.ctx) =
fun step soc_tbl soc ctx -> fun step soc_tbl soc ctx ->
profile_info ("SocExec.soc_step \n");
let soc_name,_,_ = soc.key in let soc_name,_,_ = soc.key in
let ctx = let ctx =
match step.impl with match step.impl with
...@@ -170,6 +172,7 @@ and (do_gao : Lxm.t -> Soc.tbl -> SocExecValue.ctx -> gao -> SocExecValue.ctx) ...@@ -170,6 +172,7 @@ and (do_gao : Lxm.t -> Soc.tbl -> SocExecValue.ctx -> gao -> SocExecValue.ctx)
and (do_step : Lv6Id.t -> step_method -> SocExecValue.ctx -> Soc.tbl -> Soc.t -> and (do_step : Lv6Id.t -> step_method -> SocExecValue.ctx -> Soc.tbl -> Soc.t ->
var_expr list -> var_expr list -> SocExecValue.ctx) = var_expr list -> var_expr list -> SocExecValue.ctx) =
fun name step ctx soc_tbl soc vel_in vel_out -> fun name step ctx soc_tbl soc vel_in vel_out ->
profile_info ("SocExec.do_step "^name^"\n");
let soc_in_vars, soc_out_vars = soc.profile in let soc_in_vars, soc_out_vars = soc.profile in
let step_in_vars = filter_params soc soc_in_vars step.idx_ins in let step_in_vars = filter_params soc soc_in_vars step.idx_ins in
let step_out_vars = filter_params soc soc_out_vars step.idx_outs in let step_out_vars = filter_params soc soc_out_vars step.idx_outs in
......
(** Time-stamp: <modified the 03/02/2016 (at 10:03) by Erwan Jahier> *) (** Time-stamp: <modified the 03/02/2016 (at 15:09) by Erwan Jahier> *)
(** topological sort of actions (that may optimize test openning) *) (** topological sort of actions (that may optimize test openning) *)
open ActionsDeps open ActionsDeps
let info msg = let profile_info = Lv6Verbose.profile_info
let t = Sys.time() in
Lv6Verbose.exe ~level:1 (fun () -> Printf.eprintf "%4.4f: %s%!" t msg; flush stderr)
(*********************************************************************************) (*********************************************************************************)
module TopoSortActions = module TopoSortActions =
...@@ -23,7 +20,7 @@ module TopoSortActions = ...@@ -23,7 +20,7 @@ module TopoSortActions =
let (topo_sort : Action.t list -> ActionsDeps.t -> Action.t list) = let (topo_sort : Action.t list -> ActionsDeps.t -> Action.t list) =
fun actions stbl -> fun actions stbl ->
info "topo_sort...\n"; profile_info "topo_sort...\n";
TopoSortActions.f stbl actions TopoSortActions.f stbl actions
...@@ -90,11 +87,11 @@ let (f : Action.t list -> ActionsDeps.t -> Lxm.t -> Soc.gao list) = ...@@ -90,11 +87,11 @@ let (f : Action.t list -> ActionsDeps.t -> Lxm.t -> Soc.gao list) =
(* => la liste d'actions en entrée contient des doublons ! *) (* => la liste d'actions en entrée contient des doublons ! *)
try match global_opt.schedul_mode with try match global_opt.schedul_mode with
| Simple -> ( | Simple -> (
info "SortActions.f: topo_sort...\n"; profile_info "SortActions.f: topo_sort...\n";
let actions = topo_sort actions deps in let actions = topo_sort actions deps in
info "SortActions.f: gao_of_action...\n"; profile_info "SortActions.f: gao_of_action...\n";
let gaol = List.map gao_of_action actions in let gaol = List.map gao_of_action actions in
info "SortActions.f: optimize_test_openning actions...\n"; profile_info "SortActions.f: optimize_test_openning actions...\n";
optimize_test_openning gaol deps optimize_test_openning gaol deps
) )
| Sort -> ( (* experimental scheduling *) | Sort -> ( (* experimental scheduling *)
......
==> lus2lic0.sum <== ==> lus2lic0.sum <==
Test Run By jahier on Wed Feb 3 14:35:34 Test Run By jahier on Wed Feb 3 15:16:07
Native configuration is x86_64-unknown-linux-gnu Native configuration is x86_64-unknown-linux-gnu
=== lus2lic0 tests === === lus2lic0 tests ===
...@@ -64,7 +64,7 @@ XFAIL: Test bad programs (assert): test_lus2lic_no_node should_fail/assert/lecte ...@@ -64,7 +64,7 @@ XFAIL: Test bad programs (assert): test_lus2lic_no_node should_fail/assert/lecte
XFAIL: Test bad programs (assert): test_lus2lic_no_node should_fail/assert/s.lus XFAIL: Test bad programs (assert): test_lus2lic_no_node should_fail/assert/s.lus
==> lus2lic1.sum <== ==> lus2lic1.sum <==
Test Run By jahier on Wed Feb 3 14:35:34 Test Run By jahier on Wed Feb 3 15:16:08
Native configuration is x86_64-unknown-linux-gnu Native configuration is x86_64-unknown-linux-gnu
=== lus2lic1 tests === === lus2lic1 tests ===
...@@ -396,7 +396,7 @@ PASS: gcc -o multipar.exec multipar_multipar.c multipar_multipar_loop.c ...@@ -396,7 +396,7 @@ PASS: gcc -o multipar.exec multipar_multipar.c multipar_multipar_loop.c
PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c multipar.lus {} PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c multipar.lus {}
==> lus2lic2.sum <== ==> lus2lic2.sum <==
Test Run By jahier on Wed Feb 3 14:35:36 Test Run By jahier on Wed Feb 3 15:16:23
Native configuration is x86_64-unknown-linux-gnu Native configuration is x86_64-unknown-linux-gnu
=== lus2lic2 tests === === lus2lic2 tests ===
...@@ -741,7 +741,7 @@ PASS: gcc -o zzz2.exec zzz2_zzz2.c zzz2_zzz2_loop.c ...@@ -741,7 +741,7 @@ PASS: gcc -o zzz2.exec zzz2_zzz2.c zzz2_zzz2_loop.c
PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c zzz2.lus {} PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c zzz2.lus {}
==> lus2lic3.sum <== ==> lus2lic3.sum <==
Test Run By jahier on Wed Feb 3 14:35:36 Test Run By jahier on Wed Feb 3 15:17:09
Native configuration is x86_64-unknown-linux-gnu Native configuration is x86_64-unknown-linux-gnu
=== lus2lic3 tests === === lus2lic3 tests ===
...@@ -1243,7 +1243,7 @@ PASS: ./myec2c {-o multipar.c multipar.ec} ...@@ -1243,7 +1243,7 @@ PASS: ./myec2c {-o multipar.c multipar.ec}
PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node multipar.lus {} PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node multipar.lus {}
==> lus2lic4.sum <== ==> lus2lic4.sum <==
Test Run By jahier on Wed Feb 3 14:35:38 Test Run By jahier on Wed Feb 3 15:17:23
Native configuration is x86_64-unknown-linux-gnu Native configuration is x86_64-unknown-linux-gnu
=== lus2lic4 tests === === lus2lic4 tests ===
...@@ -1764,12 +1764,14 @@ PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node zzz2.lus {} ...@@ -1764,12 +1764,14 @@ PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node zzz2.lus {}
# of unexpected failures 4 # of unexpected failures 4
=============================== ===============================
# Total number of failures: 23 # Total number of failures: 23
lus2lic0.log:testcase ./lus2lic.tests/test0.exp completed in 1 seconds lus2lic0.log:testcase ./lus2lic.tests/test0.exp completed in 0 seconds
lus2lic1.log:testcase ./lus2lic.tests/test1.exp completed in 21 seconds lus2lic1.log:testcase ./lus2lic.tests/test1.exp completed in 15 seconds
lus2lic2.log:testcase ./lus2lic.tests/test2.exp completed in 50 seconds lus2lic2.log:testcase ./lus2lic.tests/test2.exp completed in 46 seconds
lus2lic3.log:testcase ./lus2lic.tests/test3.exp completed in 18 seconds lus2lic3.log:testcase ./lus2lic.tests/test3.exp completed in 14 seconds
lus2lic4.log:testcase ./lus2lic.tests/test4.exp completed in 54 seconds lus2lic4.log:testcase ./lus2lic.tests/test4.exp completed in 48 seconds
* Ref time: * Ref time:
0.04user 0.03system 2:03.41elapsed 0%CPU (0avgtext+0avgdata 5200maxresident)k
0inputs+0outputs (0major+5562minor)pagefaults 0swaps
* Quick time (-j 4): * Quick time (-j 4):
0.03user 0.02system 0:57.63elapsed 0%CPU (0avgtext+0avgdata 5140maxresident)k 0.05user 0.01system 0:54.40elapsed 0%CPU (0avgtext+0avgdata 5168maxresident)k
0inputs+0outputs (0major+5592minor)pagefaults 0swaps 0inputs+0outputs (0major+5581minor)pagefaults 0swaps
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment