Skip to content

Commit a737c9d

Browse files
committed
Split octagon autotuner to separate octagonAnalysis and octagonVars autotuners
1 parent bb9722d commit a737c9d

4 files changed

Lines changed: 32 additions & 14 deletions

File tree

src/autoTune.ml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,14 @@ let congruenceOption factors file =
423423
activate;
424424
}
425425

426-
let apronOctagonOption factors file =
426+
let activateOctagonAnalysis () =
427+
set_string "ana.apron.domain" "octagon";
428+
set_auto "ana.activated[+]" "apron";
429+
set_bool "ana.apron.threshold_widening" true;
430+
set_string "ana.apron.threshold_widening_constants" "comparisons";
431+
Logs.info "Enabled octagon domain."
432+
433+
let octagonVarsOption factors file =
427434
let locals =
428435
if List.mem "specification" (get_string_list "ana.autotune.activated" ) && get_string "ana.specification" <> "" then
429436
if List.mem Svcomp.Specification.NoOverflow (Svcomp.Specification.of_option ()) then
@@ -447,13 +454,9 @@ let apronOctagonOption factors file =
447454
let allVars = (selectedGlobals @ selectedLocals) in
448455
let cost = (Batteries.Int.pow (locals + globals) 3) * (factors.instructions / 70) in
449456
let activateVars () =
450-
Logs.debug "Octagon: %d" cost;
457+
Logs.debug "Octagon vars: %d" cost;
451458
set_bool "annotation.goblint_relation_track" true;
452-
set_string "ana.apron.domain" "octagon";
453-
set_auto "ana.activated[+]" "apron";
454-
set_bool "ana.apron.threshold_widening" true;
455-
set_string "ana.apron.threshold_widening_constants" "comparisons";
456-
Logs.info "Enabled octagon domain ONLY for:";
459+
Logs.info "Restricted octagon analysis to following tracked variables:";
457460
Logs.info "%s" @@ String.concat ", " @@ List.map (fun info -> info.vname) allVars;
458461
List.iter (fun info -> info.vattr <- addAttribute (Attr("goblint_relation_track",[])) info.vattr) allVars
459462
in
@@ -556,10 +559,16 @@ let chooseConfig file =
556559
if isActivated "tmpSpecialAnalysis" then
557560
activateTmpSpecialAnalysis ();
558561

562+
let non_termination_task = not (isTerminationTask ()) in
563+
564+
(* octagonVars implies octagonAnalysis *)
565+
if non_termination_task && (isActivated "octagonAnalysis" || isActivated "octagonVars") then
566+
activateOctagonAnalysis ();
567+
559568
let options = [] in
560569
let options = if isActivated "congruence" then (congruenceOption factors file)::options else options in
561570
(* Termination analysis uses apron in a different configuration. *)
562-
let options = if isActivated "octagon" && not (isTerminationTask ()) then (apronOctagonOption factors file)::options else options in
571+
let options = if non_termination_task && isActivated "octagonVars" then (octagonVarsOption factors file)::options else options in
563572
let options = if isActivated "wideningThresholds" then (wideningOption factors file)::options else options in
564573

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

src/config/options.schema.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,8 @@
556556
"loopUnrollHeuristic",
557557
"forceLoopUnrollForFewLoops",
558558
"arrayDomain",
559-
"octagon",
559+
"octagonAnalysis",
560+
"octagonVars",
560561
"wideningThresholds",
561562
"memsafetySpecification",
562563
"concurrencySafetySpecification",
@@ -573,7 +574,8 @@
573574
"enums",
574575
"loopUnrollHeuristic",
575576
"arrayDomain",
576-
"octagon",
577+
"octagonAnalysis",
578+
"octagonVars",
577579
"wideningThresholds",
578580
"memsafetySpecification",
579581
"concurrencySafetySpecification",

tests/regression/29-svcomp/35-nla-sqrt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SKIP PARAM: --enable ana.sv-comp.functions --enable ana.autotune.enabled --set ana.autotune.activated[+] octagon
1+
// SKIP PARAM: --enable ana.sv-comp.functions --enable ana.autotune.enabled --set ana.autotune.activated[+] octagonVars
22
// Extracted from: nla-digbench-scaling/sqrt1-ll_unwindbound5.c
33
#include <goblint.h>
44
extern int __VERIFIER_nondet_int(void);
Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
Should not annotate functions for octagon.
22

3-
$ goblint --enable ana.autotune.enabled --set ana.autotune.activated[*] octagon 38-autotune-octagon-fun.c
4-
[Info] Enabled octagon domain ONLY for:
5-
[Info] i, count, tmp, count, i, j, i___0, j___0, k, size, r
3+
$ goblint --enable ana.autotune.enabled --set ana.autotune.activated[*] octagonAnalysis 38-autotune-octagon-fun.c
4+
[Info] Enabled octagon domain.
65
[Info][Deadcode] Logical lines of code (LLoC) summary:
76
live: 5
87
dead: 0
98
total lines: 5
109

10+
$ goblint --enable ana.autotune.enabled --set ana.autotune.activated[*] octagonVars 38-autotune-octagon-fun.c
11+
[Info] Enabled octagon domain.
12+
[Info] Restricted octagon analysis to following tracked variables:
13+
[Info] i, count, tmp, count, i, j, i___0, j___0, k, size, r
14+
[Info][Deadcode] Logical lines of code (LLoC) summary:
15+
live: 5
16+
dead: 0
17+
total lines: 5

0 commit comments

Comments
 (0)