Skip to content

Commit

Permalink
Changing the support for DIC/IDC
Browse files Browse the repository at this point in the history
It is now based on variants, but parsed from the cachetype field in tests.
  • Loading branch information
artkhyzha committed Jun 27, 2023
1 parent 395c5e9 commit 7508162
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 22 deletions.
20 changes: 0 additions & 20 deletions herd/machModelChecker.ml
Original file line number Diff line number Diff line change
Expand Up @@ -451,26 +451,6 @@ module Make
end)
E.Act.arch_dirty)
else m in
let m = (* ifetch DIC/IDC *)
if self then
let dic_pred, idc_pred =
let open CacheType in
match O.cache_type with
| None ->
(fun _ -> false), (fun _ -> false)
| Some cache_type ->
cache_type.dic, cache_type.idc in
let mk_from_pred pred = lazy begin
E.EventSet.filter
(fun e -> E.is_mem_store e &&
match E.proc_of e with
| Some proc -> pred proc
| None -> true)
(Lazy.force mem_evts)
end in
let dic_set, idc_set = (mk_from_pred dic_pred),(mk_from_pred idc_pred) in
I.add_sets m [("DIC", dic_set);("IDC", idc_set)]
else m in
(* Override arch specific fences *)
let m =
I.add_rels m
Expand Down
15 changes: 13 additions & 2 deletions herd/parseTest.ml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ module Top (TopConf:RunTest.Config) = struct
(* First split the input file in sections *)
let (splitted:Splitter.result) = SP.split name chan in
let tname = splitted.Splitter.name.Name.name in
let cache_type = CacheType.get splitted.Splitter.info in
let module Conf = struct (* override the precision and variant fields *)
(* Modify variant with the 'Variant' field of test *)
module TestConf =
Expand All @@ -49,7 +50,18 @@ module Top (TopConf:RunTest.Config) = struct
(* Override *)
include TopConf
let precision = TestConf.precision
let variant = TestConf.variant
let variant =
let dic_pred, idc_pred =
let open CacheType in
match cache_type with
| None ->
(fun _ -> false), (fun _ -> false)
| Some cache_type ->
cache_type.dic, cache_type.idc in
Misc.(|||) TestConf.variant (function
| Variant.DIC -> dic_pred 0
| Variant.IDC -> idc_pred 0
| _ -> false)
end in
if Conf.check_name tname then begin
(* Get arch *)
Expand All @@ -60,7 +72,6 @@ module Top (TopConf:RunTest.Config) = struct
GetModel.parse
Conf.archcheck arch Conf.libfind Conf.variant Conf.model in

let cache_type = CacheType.get splitted.Splitter.info in
let dirty = DirtyBit.get splitted.Splitter.info in

let module ModelConfig = struct
Expand Down
16 changes: 16 additions & 0 deletions herd/runTest.ml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,22 @@ module Make
| Some hash ->
TestHash.check_env env name.Name.name filename hash in
let test = T.build name parsed in
let dic_pred, idc_pred =
let open CacheType in
match cache_type with
| None ->
(fun _ -> false), (fun _ -> false)
| Some cache_type ->
cache_type.dic, cache_type.idc in
let procs =
List.map (fun (p,_,_) -> p) (test.Test_herd.start_points) in
let all_dic = List.fold_left (fun acc p -> acc && (dic_pred p)) true procs in
let all_idc = List.fold_left (fun acc p -> acc && (idc_pred p)) true procs in
let () =
let any_dic = List.fold_left (fun acc p -> acc || (dic_pred p)) false procs in
let any_idc = List.fold_left (fun acc p -> acc || (idc_pred p)) false procs in
if (not all_idc && any_idc) || (not all_dic && any_dic) then
Warn.user_error "Each PE must have the same DIC and IDC cache type features\n"; in
(* Compute basic machine size *)
let sz =
if S.A.is_mixed then begin match C.byte with
Expand Down
7 changes: 7 additions & 0 deletions herd/variant.ml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ type t =
| Exp
(* Instruction-fetch support (AKA "self-modifying code" mode) *)
| Self
(* CacheType features *)
| DIC
| IDC
(* Have cat interpreter to optimise generation of co's *)
| CosOpt
(* Test something *)
Expand Down Expand Up @@ -132,6 +135,8 @@ let parse s = match Misc.lowercase s with
| "constrainedunpredictable"|"cu" -> Some ConstrainedUnpredictable
| "exp" -> Some Exp
| "self" -> Some Self
| "dic" -> Some DIC
| "idc" -> Some IDC
| "cos-opt" -> Some CosOpt
| "test" -> Some Test
| "asl" -> Some ASL
Expand Down Expand Up @@ -194,6 +199,8 @@ let pp = function
| ConstrainedUnpredictable -> "ConstrainedUnpredictable"
| Exp -> "exp"
| Self -> "self"
| DIC -> "dic"
| IDC -> "idc"
| CosOpt -> "cos-opt"
| Test -> "test"
| T n -> Printf.sprintf "T%02i" n
Expand Down
3 changes: 3 additions & 0 deletions herd/variant.mli
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ type t =
| Exp
(* Instruction-fetch support (AKA "self-modifying code" mode) *)
| Self
(* CacheType features *)
| DIC
| IDC
(* Have cat interpreter to optimise generation of co's *)
| CosOpt
(* Test something *)
Expand Down

0 comments on commit 7508162

Please sign in to comment.