Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand simulator to handle more DSL programs #58

Open
polybeandip opened this issue Aug 17, 2024 · 0 comments
Open

Expand simulator to handle more DSL programs #58

polybeandip opened this issue Aug 17, 2024 · 0 comments

Comments

@polybeandip
Copy link
Contributor

polybeandip commented Aug 17, 2024

PR #57 adds a simulator and T2T compiler to our DSL! Much of that work was to convert DSL programs into "controls" (see Definition 3.7 in Formal Abstractions or issue #53). This has been done for programs built with Strict, RoundRobin, WeightedFair, and Fifo; however, building controls is harder for other policies because the semantics of our DSL have yet to be ironed out (for example, see issue #51).

Instead of maintaining multiple catch-all branches in the simulator, we've temporarily removed certain policies from Policy.t and parked their associated code here

(* from Policy.t in both policy.ml and policy.mli *)
type t =
  | Class of Ast.clss
  | Fifo of t list
  | RoundRobin of t list
  | Strict of t list
  | WeightedFair of (t * float) list
  | EarliestDeadline of t list
  | ShortestJobNext of t list
  | ShortestRemaining of t list
  | RateControlled of t list
  | LeakyBucket of t list * int * int
  | TokenBucket of t list * int * int
  | StopAndGo of t list * int
(* from Policy.to_string *)
  match p with
  | Class c -> c
  | Fifo lst -> sprintf "fifo%s" (join lst)
  | RoundRobin lst -> sprintf "rr%s" (join lst)
  | Strict lst -> sprintf "strict%s" (join lst)
  | WeightedFair lst -> sprintf "wfq%s" (join_weighted lst)
  | EarliestDeadline lst -> sprintf "edf%s" (join lst)
  | ShortestJobNext lst -> sprintf "sjn%s" (join lst)
  | ShortestRemaining lst -> sprintf "srtf%s" (join lst)
  | RateControlled lst -> sprintf "rcsp%s" (join lst)
  | LeakyBucket (lst, width, buffer) ->
    sprintf "leaky[%s, width = %d, buffer = %d]" (join lst) width buffer
  | TokenBucket (lst, width, buffer) ->
    sprintf "token[%s, width = %d, time = %d]" (join lst) width buffer
  | StopAndGo (lst, width) -> sprintf "stopandgo[%s, width = %d]" (join lst) width
(* from Policy.sub *)
  match p with
  | Class c -> if List.mem c cl then Class c else raise (UndeclaredClass c)
  | Var x -> sub cl st (lookup st x)
  | Fifo plst -> Fifo (sub_plst cl st plst)
  | RoundRobin plst -> RoundRobin (sub_plst cl st plst)
  | Strict plst -> Strict (sub_plst cl st plst)
  | WeightedFair wplst -> WeightedFair (sub_weighted_plst cl st wplst)
  | EarliestDeadline plst -> EarliestDeadline (sub_plst cl st plst)
  | ShortestJobNext plst -> ShortestJobNext (sub_plst cl st plst)
  | ShortestRemaining plst -> ShortestRemaining (sub_plst cl st plst)
  | RateControlled plst -> RateControlled (sub_plst cl st plst)
  | LeakyBucket (plst, n1, n2) -> LeakyBucket (sub_plst cl st plst, n1, n2)
  | TokenBucket (plst, n1, n2) -> TokenBucket (sub_plst cl st plst, n1, n2)
  | StopAndGo (plst, n) -> StopAndGo (sub_plst cl st plst, n)

The plan is to add these back to Policy when the simulator can handle them.

NOTE: none of the lexing and parsing for these policies has been altered: that is, ast.ml is unchanged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant