1 / 48

Partial Program Admission

Partial Program Admission. Mike Wilson, Ron Cytron, and Jon Turner Computer Science & Engineering. This work supported by the National Science Foundation. Presentation Roadmap. Context and Problem Partial Program Admission Concept Algorithm Complexity Evaluation Real Programs

alyn
Télécharger la présentation

Partial Program Admission

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Partial Program Admission Mike Wilson, Ron Cytron, and Jon Turner Computer Science & Engineering This work supported by the National Science Foundation

  2. Presentation Roadmap • Context and Problem • Partial Program Admission • Concept • Algorithm • Complexity • Evaluation • Real Programs • Future Directions • Conclusions

  3. Presentation Roadmap • Context and Problem • Partial Program Admission • Concept • Algorithm • Complexity • Evaluation • Real Programs • Future Directions • Conclusions

  4. Context: Virtual Networking Outside developer provides virtual router code Developer requests bandwidth amount, supplies WCET VR 1 WDRR VR N CPU At admission, bandwidth and WCET are used to compute WDRR parameters

  5. Context: Virtual Networking VR 1 WDRR VR N CPU If WCET is accurate, isolation is achieved

  6. Context: Virtual Networking VR 1 WDRR VR N CPU If WCET is accurate, isolation is achieved

  7. Context: Virtual Networking VR 1 WDRR VR N CPU What if the developer lies or is wrong?

  8. Context: Virtual Networking VR 1 WDRR VR N CPU If WCET is wrong, guarantees are missed

  9. Problem: Enforcing Execution Bounds Need a way to enforce assertions of WCET • Preemption? • Unavailable • Runtime instrumentation? • Adds too much overhead • WCET Analysis? • Can be too pessimistic

  10. Presentation Roadmap • Context and Problem • Partial Program Admission • Concept • Algorithm • Complexity • Evaluation • Real Programs • Future Directions • Conclusions

  11. Partial Program Admission • Partial Program Admission (PPA) • Inputs: • Program CFG • Cycle Budget B • Exception Handler • Outputs: • Program CFG which adheres to budget • Calls exception handler before overrun • No runtime overhead

  12. Partial Program Admission • Relies on an idealized (predictable) processor model • No cache (data or instruction) • No pipeline, one instruction/cycle • Single-threaded

  13. Control Flow Graph S 0 • Digraph representation of a program • Vertices represent pieces of code • Edges represent flow of control • Weights represent cycle counts to traverse vertex • Artificial source, sink: S, T A A;if (cond1) B;else C;D;if (cond2) E;else F;G; 2 B C 1 3 D 1 E F 4 1 G 1 T 0

  14. S 0 A 2 B C 1 3 D 1 E F 4 1 G 1 T 0 Partial Program Admission: Concept

  15. Infeasible! Partial Program Admission: Concept S 0 Consider the CFG as a collection of paths with lengths Suppose path SACDFGT is infeasible Then the exact WCET is 9 PPA can remove SACDFGT without affecting correctness! A 2 B C 1 3 D 1 E F 4 1 Paths Length SABDEGT 6 SABDFGT 9 SACDEGT 8 SACDFGT 11 G 1 T 0

  16. S S 0 0 A A 2 2 B B C C 1 1 3 3 D D2 D1 1 1 1 E1 E E2 F1 F2 F 4 4 4 1 1 1 G1 G2 G G3 G4 1 1 1 1 1 T1 T T2 T3 T4 0 0 0 0 0 Partial Program Admission: Concept S What does it mean to remove a path? Suppose we split up all paths. A B C D D E E F F G G G G T T T T

  17. S 0 A 2 B C 1 3 D2 D1 1 1 E1 E2 F1 F2 4 4 1 1 G1 G2 G3 G4 1 1 1 1 T1 T2 T3 T4 0 0 0 0 Partial Program Admission: Concept Now removing SACDFGT is easy We intercept at D2 and raise an exception This program is safe to run, but bloated. We can compact it by coalescing identical subtrees X

  18. S 0 A 2 B C 1 3 D2 D1 1 1 F1 4 Partial Program Admission: Concept The program size is now reasonable. Separating all paths and then coalescing is usually impractical. What we really want is just to generate what we need. These two subtrees are identical. We can combine them. These are also identical. E1 E2 1 1 G1 G2 G3 1 1 1 T1 T2 T3 X 0 0 0

  19. D D1 D1 D1 1 1 1 1 Paths Length DEGT 3 DFGT 6 E1 E1 E1 E F1 F1 F1 F 4 4 4 4 1 1 1 1 G1 G1 G1 G2 G2 G2 G 1 1 1 1 1 1 1 T1 T1 T1 T T2 T2 T2 0 0 0 0 0 0 0 Partial Program Admission: Foundations • Two subgraphs can be coalesced if they include identical paths • Included paths depend on cycles remaining • These are the equivalence classes of cycles R at vertex D R≤2 3≤R≤5 R≥6

  20. D[6,∞] D[3,5] D[∞,2] 1 1 1 E1 E1 E1 F1 F1 F1 4 4 4 1 1 1 G1 G1 G1 G2 G2 G2 1 1 1 1 1 1 T1 T1 T1 T2 T2 T2 0 0 0 0 0 0 Partial Program Admission: Foundations Notationally, we refer to: D[i,j]: equivalence class of paths from D of length R or less where i≤R≤j These can be determined if we have all path lengths rooted at D R≤2 3≤R≤5 R≥6

  21. S 0 A 2 B C 1 3 D 1 E F 4 1 G 1 T 0 Algorithm: Computing Path Lengths • Starting from sink, weight-shift and push to predecessor • We provide an O(mB) algorithm in the paper • Only need lengths up to B • Using path lengths, we define a Dynamic Programming Graph {6,8,9,11} {6,8,9,11} {6,9} {4,7} {6,9} {8,11} {6,9} {3,6} {4,7} {3,6} {3,6} {6} {5} {2} {3} {1} {2} {1} {5} {0} {1} {0}

  22. S 0 A 2 B C 1 3 D 1 E F 4 1 G 1 T 0 Dynamic Programming Graph [-∞,5] [6,7] {6,8,9,11} S[-∞,5] S[6,7] S[8,8] S[9,10] S[11,∞] [8,8] [9,10] [-∞,5] [11,∞] [6,7] A[6,7] A[8,8] A[9,10] A[11,∞] A [-∞,5] {6,8,9,11} [8,8] [9,10] [11,∞] [-∞,5] [-∞,3] {6,9} {4,7} [6,8] B[-∞,3] C[-∞,5] B[4,6] C[6,8] B[7,∞] C[9,∞] [4,6] [9,∞] [7,∞] [-∞,2] D[3,5] D[6,∞] D[-∞,2] {3,6} [3,5] [6,∞] [-∞,4] [-∞,1] {5} {2} E[-∞,1] E[2,∞] F[5,∞] F[-∞,4] [2,∞] [5,∞] [-∞,0] G[-∞,0] G[1,∞] {1} [1,∞] [-∞,-1] {0} T[0,∞] T[-∞,-1] [0,∞]

  23. S[-∞,5] A [-∞,5] B[-∞,3] C[-∞,5] D[-∞,2] E[-∞,1] F[-∞,4] G[-∞,0] T[-∞,-1] Dynamic Programming Graph S[6,7] S[8,8] S[9,10] S[11,∞] Each vertex has a distinct path set except for empty sets. We can combine these and replace with an exception handler. Finally, we return control from X to the caller. A[6,7] A[8,8] A[9,10] A[11,∞] B[4,6] C[6,8] B[7,∞] C[9,∞] D[3,5] D[6,∞] E[2,∞] F[5,∞] X G[1,∞] T[0,∞]

  24. Algorithm: Compute Transformed CFG S[6,7] S[8,8] S[9,10] S[11,∞] Now we can generate our transformed CFG. For B=9, we want all paths of length 9 or less. Algorithm in paper is O(mB) Equivalence class for budgets 9≤B≤10 A[6,7] A[8,8] A[9,10] A[11,∞] B[4,6] C[6,8] B[7,∞] C[9,∞] D[3,5] D[6,∞] E[2,∞] F[5,∞] X G[1,∞] T[0,∞]

  25. Complexity • Space Complexity • Duplication factor of each vertex u is upper-bounded by the smallest of three factors: • Number of paths from source to vertex u • Number of paths from vertex u to sink • Budget B

  26. Presentation Roadmap • Context and Problem • Partial Program Admission • Concept • Algorithm • Complexity • Evaluation • Real Programs • Future Directions • Conclusions

  27. Evaluation: Real Programs • 8 programs from the networking domain • Size is in instructions • Cyclic programs will be analyzed separately

  28. Evaluation: Acyclic Programs Size (Normalized to Inlined) Original Inlined PPA

  29. Evaluation: Cyclic Programs Size (Normalized to Inlined) PPA Inlined Original

  30. Evaluation: Cyclic, Unrolled Size (Normalized to Unrolled) PPA Unrolled Inlined

  31. Evaluation: Assessment • Bad news: • Some significant duplication • Good news: for the inlined, unrolled programs, all eight programs can fit into our instruction store with room leftover for the scheduler. • 7,018 instructions; istore is 8,192 instructions.

  32. Presentation Roadmap • Context and Problem • Partial Program Admission • Concept • Algorithm • Complexity • Evaluation • Real Programs • Future Directions • Conclusions

  33. Future Directions • Annotated infeasible paths • Reduces bloat of loops • Adds function-call handling • Hybrid approaches • PPA and ... • Runtime Instrumentation • Single-Path Approach

  34. Presentation Roadmap • Context and Problem • Partial Program Admission • Concept • Algorithm • Complexity • Evaluation • Real Programs • Future Directions • Conclusions

  35. Conclusions • Partial Program Admission works! • Best used when: • Programs are small • Budgets are small and tight • Hardware model is tractable

  36. Questions?

  37. Scratch Slides Scratch Slides

  38. S 0 A 2 B C 1 3 D2 D1 1 1 F1 4 Partial Program Admission: Foundations • New Concepts • Completion Set of u • cset(u,G) – all paths from u to the sink • csetR(u,G) – all paths in cset(u,G) of length R or less • Two vertices can be coalescedif they have identical csets • cset3(E,G) = cset5(E,G) = {EGT} E1 E2 1 1 G1 G3 1 1 T1 X T3 0 0

  39. S 0 A 2 B C 1 3 D 1 E F 4 1 G 1 T 0 Partial Program Admission: Foundations • New Concepts • Completion Set of u • cset(u,G) – all paths from u to the sink • csetR(u,G) – all paths in cset(u,G) of length R or less • Two vertices can be coalescedif they have identical csets • cset3(E,G) = cset5(E,G) = {EGT}

  40. S 0 A 2 B C 1 3 D 1 E F 4 1 G 1 T 0 Partial Program Admission: Foundations • New Concepts • clen(u,G) – set of lengths of all paths in cset(u,G) • clenR(u,G) – set of lengths of all paths in csetR(u,G) • cset(D,G)={DEGT, DFGT} • clen(D,G)={3,6} • Note that csetR(u,G) only changes when R crosses a value in clen(u,G) • We can use this to define equivalence classes of R over completion sets

  41. S 0 A 2 B C 1 3 D 1 E F 4 1 G 1 T 0 Partial Program Admission: Foundations • New Concepts • We call these equivalence classes Intervals. • clen(D,G)={3,6} • Intervals at D: [-∞,2] [3,5] [6,∞] • These intervals form the basis of a dynamic programming approach

  42. S 0 A 2 B C 1 3 D 1 E F 4 1 G 1 T 0 Generating clen Sets • Compute all clen sets • Starting from sink, weight-shift and push to predeccessor • We provide an O(mB) algorithm in the paper • We actually only need all clenB sets {6,8,9,11} {6,8,9,11} {6,9} {4,7} {6,9} {8,11} {6,9} {3,6} {4,7} {3,6} {3,6} {6} {5} {2} {3} {1} {2} {1} {5} {0} {1} {0}

  43. S 0 A 2 B C 1 3 D 1 E F 4 1 G 1 T 0 Dynamic Programming Graph {6,8,9,11} • From clen sets, we know all intervals • Intervals give our equivalence classes of csets • Each vertex u and interval [i,j] becomes a new vertex u[i,j] • Edges are connected to keep csets correct {6,8,9,11} {6,9} {4,7} {3,6} {5} {2} {1} {0}

  44. S 0 A 2 B C 1 3 D 1 E F 4 1 G 1 T 0 Dynamic Programming Graph {6,8,9,11} S S S S S A A A A A {6,8,9,11} B C B C B C {6,9} {4,7} D D D {3,6} E E F F {5} {2} G G {1} {0} T T

  45. S A B C D E F G T Dynamic Programming Graph S S S S Each vertex heads distinct path sets except those which have no admissible paths We can combine these and replace with an exception handler. A A A A B C B C D D X E F G T

  46. Dynamic Programming Graph S S S S Equivalence class for budgets 9≤B≤10 A A A A Finally, we return control from X to the caller. From this, we can generate our transformed CFG. Algorithm in paper is O(mB) B C B C D D X E F G T

  47. Evaluation: Synthetics • 1000 random acyclic CFGs • Generated by graph transformations mimicking grammar productions in a C-like language

  48. Performance: Range of Budgets

More Related