Files
vanity/bin/main.ml
T
2026-02-11 17:24:09 +00:00

46 lines
1.8 KiB
OCaml

open Vanity
type profile = {
name : string;
flags : Pipeline.optimisation_flags;
relation : Relation.relation;
}
let safe_flags =
{ Pipeline.default_flags with unsafe_repr_eq = false; unsafe_strict_unroll = false }
let profiles =
[
{ name = "safe"; flags = safe_flags; relation = Relation.Boxed_unboxed };
{ name = "specialise-only"; flags = { safe_flags with inline = false; repr_lower = false }; relation = Relation.Baseline };
{ name = "inline-no-repr-leak"; flags = { safe_flags with inline = true }; relation = Relation.Boxed_unboxed };
{ name = "unsafe-inline"; flags = { safe_flags with unsafe_repr_eq = true }; relation = Relation.Boxed_unboxed };
{ name = "unsafe-unbox"; flags = Pipeline.default_flags; relation = Relation.Boxed_unboxed };
{ name = "unsafe-strictness"; flags = { safe_flags with inline = false; unsafe_strict_unroll = true }; relation = Relation.Boxed_unboxed };
]
let run_case (case : Corpus.case) =
let audit = Audit.audit_case case in
Printf.printf
"case %s\nclassification %s\nverdict %s\nsource %s\ntarget %s\n\n"
case.Corpus.name
(Audit.failure_mode_to_string audit.Audit.failure_mode)
(Reporting.verdict_to_string audit.Audit.comparison.Relation.verdict)
(Reporting.string_of_source_outcome audit.Audit.source_trace.Source.outcome)
(Reporting.string_of_target_outcome audit.Audit.target_trace.Target.outcome)
let run_profile profile =
let result = Gen.run_campaign profile.flags profile.relation ~count:160 ~max_depth:4 () in
Printf.printf
"profile %s\nrelated %d/%d\nviolations %d\n\n"
profile.name
result.Gen.related
result.Gen.total
(result.Gen.total - result.Gen.related)
let () =
Printf.printf "corpus\n\n";
List.iter run_case Corpus.all;
Printf.printf "profiles\n\n";
List.iter run_profile profiles