1 / 140

Janus : exploiting parallelism via hindsight

Janus : exploiting parallelism via hindsight. Roman Manevich. Omer Tripp. John Field. Mooly Sagiv. the PMD code analyzer. the PMD code analyzer. popular open-source code analyzer (~2,000 weekly downloads). the PMD code analyzer. popular open-source code analyzer (~2,000 weekly downloads).

jayme
Download Presentation

Janus : exploiting parallelism via hindsight

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. Janus: exploiting parallelism via hindsight Roman Manevich Omer Tripp John Field MoolySagiv

  2. the PMD code analyzer

  3. the PMD code analyzer popular open-source code analyzer (~2,000 weekly downloads)

  4. the PMD code analyzer popular open-source code analyzer (~2,000 weekly downloads) scans source files modularly => parallelization opportunity

  5. the main loop of PMD (simplified)

  6. the main loop of PMD analyze files in parallel

  7. the main loop of PMD but.. (shared as local)

  8. the main loop of PMD hmm.. can’t we “localize” ctx?

  9. the main loop of PMD not so fast.. (happens sometimes, deep down the stack)

  10. the main loop of PMD no cloning =>

  11. the main loop of PMD reuse => @atomic ≈ @sequential

  12. the main loop of PMD to summarize..

  13. the main loop of PMD to summarize.. available parallelism

  14. the main loop of PMD to summarize.. available parallelism missed by write-set approach

  15. Janus: sequence-based detection /* offline */

  16. Janus: sequence-based detection /* offline */ T1 ctx.sourceCodeFilename = …; … String fname=ctx.sourceCodeFilename; … T2 ctx.sourceCodeFilename = …; … String fname=ctx.sourceCodeFilename; …

  17. Janus: sequence-based detection /* offline */ T1 ctx.sourceCodeFilename = …; … String fname=ctx.sourceCodeFilename; … T2 ctx.sourceCodeFilename = …; … String fname=ctx.sourceCodeFilename; …

  18. Janus: sequence-based detection /* offline */ T1 ctx.sourceCodeFilename = …; … ctx.setAttribute(s, …); … T2 ctx.sourceCodeFilename = …; … … = ctx.getAttribute(s); …

  19. Janus: sequence-based detection /* offline */ T1 ctx.sourceCodeFilename = …; … ctx.setAttribute(s, …); … T2 ctx.sourceCodeFilename = …; … … = ctx.getAttribute(s); …

  20. Janus: sequence-based detection /* offline */ T1 ctx.sourceCodeFilename = …; … ctx.setAttribute(s, …); … T2 ctx.sourceCodeFilename = …; … … = ctx.getAttribute(s); …

  21. the main loop of PMD • in paper: • more real-world examples • more coding patterns encouraging refined • conflict detection

  22. running example • Reverse-Delete MST • G’ = G • (e1 … en) = SortEdgesByDecreasingWeight() • for i=1 … n • G’.RemoveEdge(ei) • if (!G’.HasPath(ei.u, ei.v)) • G’.AddEdge(ei) • return G’

  23. running example ordered • Reverse-Delete MST • G’ = G • (e1 … en) = SortEdgesByDecreasingWeight() • for i=1 … n • G’.RemoveEdge(ei) • if (!G’.HasPath(ei.u, ei.v)) • G’.AddEdge(ei) • return G’

  24. running example heavy • Reverse-Delete MST • G’ = G • (e1 … en) = SortEdgesByDecreasingWeight() • for i=1 … n • G’.RemoveEdge(ei) • if (!G’.HasPath(ei.u, ei.v)) • G’.AddEdge(ei) • return G’

  25. running example identity if edge restored (available parallelism) • Reverse-Delete MST • G’ = G • (e1 … en) = SortEdgesByDecreasingWeight() • for i=1 … n • G’.RemoveEdge(ei) • if (!G’.HasPath(ei.u, ei.v)) • G’.AddEdge(ei) • return G’

  26. take I: blind parallelism • Reverse-Delete MST • G’ = G • (e1 … en) = SortEdgesByDecreasingWeight() • for i=1 … n • G’.RemoveEdge(ei) • if (!G’.HasPath(ei.u, ei.v)) • G’.AddEdge(ei) • return G’ // broken  but fast  parallel for

  27. take II: write-set speculation /* with boosting */ • Reverse-Delete MST • G’ = G • (e1 … en)= SortEdgesByDecreasingWeight() • for i=1 … n • G’.RemoveEdge(ei) • if (!G’.HasPath(ei.u, ei.v)) • G’.AddEdge(ei) • return G’ @atomic // exploit graph semantics: node ≈ location

  28. take II: write-set speculation /* with boosting */ can we exploit the available parallelism with this approach?

  29. the write-set approach in action G: v1 u v2 T1 T2

  30. the write-set approach in action G: v1 u v2 T1 T2 RemoveEdge(u,v1) RemoveEdge(u,v2)

  31. the write-set approach in action G: v1 u v2 T1 T2 RemoveEdge(u,v1) RemoveEdge(u,v2)

  32. the write-set approach in action G: v1 u v2 T1 T2 RemoveEdge(u,v1) b = HasPath(u,v1) RemoveEdge(u,v2) b = HasPath(u,v2)

  33. the write-set approach in action G: v1 u v2 T1 T2 RemoveEdge(u,v1) b = HasPath(u,v1) RemoveEdge(u,v2) b = HasPath(u,v2)

  34. the write-set approach in action G: v1 u v2 T1 T2 RemoveEdge(u,v1) b = HasPath(u,v1) test b RemoveEdge(u,v2) b = HasPath(u,v2) test b

  35. the write-set approach in action G: v1 u v2 T1 T2 RemoveEdge(u,v1) b = HasPath(u,v1) test b AddEdge(u,v1) RemoveEdge(u,v2) b = HasPath(u,v2) test b AddEdge(u,v2)

  36. the write-set approach in action G: v1 u v2 T1 T2 RemoveEdge(u,v1) b = HasPath(u,v1) test b AddEdge(u,v1) RemoveEdge(u,v2) b = HasPath(u,v2) test b AddEdge(u,v2)

  37. take III: online commutativity checking /* with boosting */ • Reverse-Delete MST • G’ = G • (e1 … en)= SortEdgesByDecreasingWeight() • for i=1 … n • G’.RemoveEdge(ei) • if (!G’.HasPath(ei.u, ei.v)) • G’.AddEdge(ei) • return G’ @atomic // full commutativity checking

  38. precise checking in action G: v1 u v2 T1 T2 RemoveEdge(u,v1) b = HasPath(u,v1) test b AddEdge(u,v1) RemoveEdge(u,v2) b = HasPath(u,v2) test b AddEdge(u,v2)

  39. precise checking in action G: v1 u v2 T1 T2 RemoveEdge(u,v1) b = HasPath(u,v1) test b AddEdge(u,v1) RemoveEdge(u,v2) b = HasPath(u,v2) test b AddEdge(u,v2)

  40. precise checking in action G: v1 u v2 T1 T2 RemoveEdge(u,v1) b = HasPath(u,v1) test b AddEdge(u,v1) RemoveEdge(u,v2) b = HasPath(u,v2) test b AddEdge(u,v2) ∙ RemoveEdge(u,v1); HasPath(u,v1); AddEdge(u,v1) RemoveEdge(u,v2); HasPath(u,v2); AddEdge(u,v2) ≡ ∙ RemoveEdge(u,v2); HasPath(u,v2); AddEdge(u,v2) RemoveEdge(u,v1); HasPath(u,v1); AddEdge(u,v1)

  41. precise checking in action G: v1 u v2 T1 T2 RemoveEdge(u,v1) b = HasPath(u,v1) test b AddEdge(u,v1) RemoveEdge(u,v2) b = HasPath(u,v2) test b AddEdge(u,v2) ∙ RemoveEdge(u,v1); HasPath(u,v1); AddEdge(u,v1) RemoveEdge(u,v2); HasPath(u,v2); AddEdge(u,v2) ≡ ∙ RemoveEdge(u,v2); HasPath(u,v2); AddEdge(u,v2) RemoveEdge(u,v1); HasPath(u,v1); AddEdge(u,v1)

  42. but.. can we really afford this? G: v1 u v2 T1 T2 RemoveEdge(u,v1) b = HasPath(u,v1) test b AddEdge(u,v1) RemoveEdge(u,v2) b = HasPath(u,v2) test b AddEdge(u,v2)

  43. but.. can we really afford this? G: v1 u v2 T1 T2 RemoveEdge(u,v1) b = HasPath(u,v1) test b AddEdge(u,v1) RemoveEdge(u,v2) b = HasPath(u,v2) test b AddEdge(u,v2) expensive instrumentation

  44. but.. can we really afford this? G: v1 u v2 T1 T2 RemoveEdge(u,v1) b = HasPath(u,v1) test b AddEdge(u,v1) RemoveEdge(u,v2) b = HasPath(u,v2) test b AddEdge(u,v2) + expensive instrumentation

  45. but.. can we really afford this? G: v1 u v2 T1 T2 RemoveEdge(u,v1) b = HasPath(u,v1) test b AddEdge(u,v1) RemoveEdge(u,v2) b = HasPath(u,v2) test b AddEdge(u,v2) + expensive instrumentation expensive conflict detection

  46. but.. can we really afford this? G: v1 u v2 T1 T2 RemoveEdge(u,v1) b = HasPath(u,v1) test b AddEdge(u,v1) RemoveEdge(u,v2) b = HasPath(u,v2) test b AddEdge(u,v2) + expensive instrumentation expensive conflict detection

  47. but.. can we really afford this? G: v1 u v2 T1 T2 RemoveEdge(u,v1) b = HasPath(u,v1) test b AddEdge(u,v1) RemoveEdge(u,v2) b = HasPath(u,v2) test b AddEdge(u,v2) + expensive instrumentation expensive conflict detection poor performance 

  48. take III: Janus /* with boosting */ • Reverse-Delete MST • G’ = G • (e1 … en)= SortEdgesByDecreasingWeight() • for i=1 … n • G’.RemoveEdge(ei) • if (!G’.HasPath(ei.u, ei.v)) • G’.AddEdge(ei) • return G’ @atomic // accurate checking utilizing offline data!

  49. the Janus approach G: v1 u v2 T1 T2 RemoveEdge(u,v1) b = HasPath(u,v1) test b AddEdge(u,v1) RemoveEdge(u,v2) b = HasPath(u,v2) test b AddEdge(u,v2)

More Related