Skip to content

Commit

Permalink
Autotuner: Activate termination analysis in autotuner.
Browse files Browse the repository at this point in the history
  • Loading branch information
jerhard committed Nov 14, 2023
1 parent 2728c2a commit 8934a21
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
3 changes: 2 additions & 1 deletion conf/svcomp23.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@
"congruence",
"octagon",
"wideningThresholds",
"loopUnrollHeuristic"
"loopUnrollHeuristic",
"termination"
]
}
},
Expand Down
17 changes: 14 additions & 3 deletions src/autoTune.ml
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ let focusOnSpecification (spec: Svcomp.Specification.t) =
| NoDataRace -> (*enable all thread analyses*)
print_endline @@ "Specification: NoDataRace -> enabling thread analyses \"" ^ (String.concat ", " notNeccessaryThreadAnalyses) ^ "\"";
enableAnalyses notNeccessaryThreadAnalyses;
| Termination ->
| Termination ->
let terminationAnas = ["termination"; "threadflag"; "apron"] in
print_endline @@ "Specification: Termination -> enabling termination analyses \"" ^ (String.concat ", " terminationAnas) ^ "\"";
enableAnalyses terminationAnas;
Expand Down Expand Up @@ -466,6 +466,11 @@ let wideningOption factors file =
print_endline "Enabled widening thresholds";
}

let activateTerminationAnalysis () =
enableAnalyses ["termination"; "apron"];
set_string "sem.int.signed_overflow" "assume_none";
set_string "ana.apron.domain" "polyhedra";
set_bool "ana.int.interval_threshold_widening" true

let estimateComplexity factors file =
let pathsEstimate = factors.loops + factors.controlFlowStatements / 90 in
Expand Down Expand Up @@ -495,6 +500,8 @@ let chooseFromOptions costTarget options =

let isActivated a = get_bool "ana.autotune.enabled" && List.mem a @@ get_string_list "ana.autotune.activated"

let isTerminationTask () = List.mem Svcomp.Specification.Termination (Svcomp.Specification.of_option ())

let chooseConfig file =
let factors = collectFactors visitCilFileSameGlobals file in
let fileCompplexity = estimateComplexity factors file in
Expand Down Expand Up @@ -528,10 +535,14 @@ let chooseConfig file =

let options = [] in
let options = if isActivated "congruence" then (congruenceOption factors file)::options else options in
let options = if isActivated "octagon" then (apronOctagonOption factors file)::options else options in

(* Termination analysis uses apron in a different configuration. *)
let options = if isActivated "octagon" && not (isTerminationTask ()) then (apronOctagonOption factors file)::options else options in
let options = if isActivated "wideningThresholds" then (wideningOption factors file)::options else options in

List.iter (fun o -> o.activate ()) @@ chooseFromOptions (totalTarget - fileCompplexity) options
List.iter (fun o -> o.activate ()) @@ chooseFromOptions (totalTarget - fileCompplexity) options;

if isActivated "termination" && isTerminationTask () then
activateTerminationAnalysis ()

let reset_lazy () = ResettableLazy.reset functionCallMaps

0 comments on commit 8934a21

Please sign in to comment.