correctness issues in transforming task parallel programs
play

Correctness Issues in Transforming Task Parallel Programs V. - PowerPoint PPT Presentation

Correctness Issues in Transforming Task Parallel Programs V. Krishna Nandivada IIT Madras 10-Jan-2013 Collaborators: Vivek Sarkar, Jun Shirako and Jisheng Zhao . I dont like the idea of optimizations going wrong! Multi-core a new era


  1. Correctness Issues in Transforming Task Parallel Programs V. Krishna Nandivada IIT Madras 10-Jan-2013 Collaborators: Vivek Sarkar, Jun Shirako and Jisheng Zhao . “I don’t like the idea of optimizations going wrong!”

  2. Multi-core a new era “Be the change you want to see in the world.” – Mahatma Gandhi New H/W: Opteron, (AMD), Cell (IBM+), Core i7 (Intel), Roadrunner, . . . New Languages: CAF , Chappel, Fortress, UPC, X10, HJ V. Krishna Nandivada (IIT Madras) 10-Jan-2013 2 / 32

  3. Multi-core a new era “Be the change you want to see in the world.” – Mahatma Gandhi New H/W: Opteron, (AMD), Cell (IBM+), Core i7 (Intel), Roadrunner, . . . New Languages: CAF , Chappel, Fortress, UPC, X10, HJ New times ⇒ New challenges ⇒ New solutions. V. Krishna Nandivada (IIT Madras) 10-Jan-2013 2 / 32

  4. Multi-core a new era “Be the change you want to see in the world.” – Mahatma Gandhi New H/W: Opteron, (AMD), Cell (IBM+), Core i7 (Intel), Roadrunner, . . . New Languages: CAF , Chappel, Fortress, UPC, X10, HJ New challenge : applications/system software must be redesigned for multi-core parallelism. automatic (in the compiler) or semi-automatic (as a source-source refactoring) New challenge : Optimizing task parallel programs. Reducing communication - activities, synchronization, data. Reasoning about correctness of program transformations. Reasoning about control and data dependence. New times ⇒ New challenges ⇒ New solutions. V. Krishna Nandivada (IIT Madras) 10-Jan-2013 2 / 32

  5. Relevant HJ syntax async S : creates an asynchronous activity. V. Krishna Nandivada (IIT Madras) 10-Jan-2013 3 / 32

  6. Relevant HJ syntax async S : creates an asynchronous activity. finish S : ensures activity termination. // Parent Activity finish { S1; // Parent Activity async { S2; // Child Activity } S3; // Parent activity continues } S4; V. Krishna Nandivada (IIT Madras) 10-Jan-2013 3 / 32

  7. Relevant HJ syntax async S : creates an asynchronous activity. finish S : ensures activity termination. // Parent Activity finish { S1; // Parent Activity async { S2; // Child Activity } S3; // Parent activity continues } S4; foreach (i: [1..n]) ≡ for (i: [1..n]) S async S V. Krishna Nandivada (IIT Madras) 10-Jan-2013 3 / 32

  8. Relevant HJ syntax async S : creates an asynchronous activity. finish S : ensures activity termination. // Parent Activity finish { S1; // Parent Activity async { S2; // Child Activity } S3; // Parent activity continues } S4; foreach (i: [1..n]) ≡ for (i: [1..n]) S async S ≡ finish foreach (i: [1..n]) forall (i: [1..n]) S S V. Krishna Nandivada (IIT Madras) 10-Jan-2013 3 / 32

  9. IEF and isolated Each activity has a unique parent finish – called the Immediately enclosing finish(IEF). V. Krishna Nandivada (IIT Madras) 10-Jan-2013 4 / 32

  10. IEF and isolated Each activity has a unique parent finish – called the Immediately enclosing finish(IEF). Statically each async has one or more IEFs. V. Krishna Nandivada (IIT Madras) 10-Jan-2013 4 / 32

  11. IEF and isolated Each activity has a unique parent finish – called the Immediately enclosing finish(IEF). Statically each async has one or more IEFs. V. Krishna Nandivada (IIT Madras) 10-Jan-2013 4 / 32

  12. IEF and isolated Each activity has a unique parent finish – called the Immediately enclosing finish(IEF). Statically each async has one or more IEFs. void foo(){ async { S; } } V. Krishna Nandivada (IIT Madras) 10-Jan-2013 4 / 32

  13. IEF and isolated Each activity has a unique parent finish – called the Immediately enclosing finish(IEF). Statically each async has one or more IEFs. main(){ finish { void foo(){ ... foo(); ... async { } S; finish { } ... foo(); ... } } foo(); } V. Krishna Nandivada (IIT Madras) 10-Jan-2013 4 / 32

  14. IEF and isolated Each activity has a unique parent finish – called the Immediately enclosing finish(IEF). Statically each async has one or more IEFs. main(){ finish { void foo(){ ... foo(); ... async { } S; finish { } ... foo(); ... } } foo(); } isolated S : global critical section, provides weak isolation. V. Krishna Nandivada (IIT Madras) 10-Jan-2013 4 / 32

  15. Outline 1 Background 2 Data Dependence in task parallel programs Static Happens Before and Dependence relation 3 Optimization framework 4 5 Correctness 6 Example optimizations 7 Transformations in the presence of exceptions 8 Conclusion V. Krishna Nandivada (IIT Madras) 10-Jan-2013 5 / 32

  16. Correctness of programs Say a program P , is transformed to P ′ . V. Krishna Nandivada (IIT Madras) 10-Jan-2013 6 / 32

  17. Correctness of programs Say a program P , is transformed to P ′ . Sequential programs : If the behaviour of P and P ′ match. V. Krishna Nandivada (IIT Madras) 10-Jan-2013 6 / 32

  18. Correctness of programs Say a program P , is transformed to P ′ . Sequential programs : If the behaviour of P and P ′ match. Parallel programs : V. Krishna Nandivada (IIT Madras) 10-Jan-2013 6 / 32

  19. Correctness of programs Say a program P , is transformed to P ′ . Sequential programs : If the behaviour of P and P ′ match. Parallel programs : If the behaviours of P ′ is a subset of the behaviours of P . V. Krishna Nandivada (IIT Madras) 10-Jan-2013 6 / 32

  20. Correctness of programs Say a program P , is transformed to P ′ . Sequential programs : If the behaviour of P and P ′ match. Parallel programs : If the behaviours of P ′ is a subset of the behaviours of P . How to extend it to transformations of parallel programs? V. Krishna Nandivada (IIT Madras) 10-Jan-2013 6 / 32

  21. Data Dependence in Task parallel programs - challenges Legality of program transformation requires the preservation of the order of “interfering” memory accesses. Traditional analysis is not sufficient in the context of task parallel languages. Constructs like async makes it challenging. for (int i = ...) { /*S1*/ X[f(i)] = ... async { /*S2*/ ... = X[g(i)]; } } V. Krishna Nandivada (IIT Madras) 10-Jan-2013 7 / 32

  22. Dynamic Happens-before dependence Extending the classical definition of data dependence in sequential programs to happens-before dependence in parallel programs; V. Krishna Nandivada (IIT Madras) 10-Jan-2013 8 / 32

  23. Dynamic Happens-before dependence Extending the classical definition of data dependence in sequential programs to happens-before dependence in parallel programs; HB ( I A , I B ) = true , if V. Krishna Nandivada (IIT Madras) 10-Jan-2013 8 / 32

  24. Dynamic Happens-before dependence Extending the classical definition of data dependence in sequential programs to happens-before dependence in parallel programs; HB ( I A , I B ) = true , if ( Sequential order ) V. Krishna Nandivada (IIT Madras) 10-Jan-2013 8 / 32

  25. Dynamic Happens-before dependence Extending the classical definition of data dependence in sequential programs to happens-before dependence in parallel programs; HB ( I A , I B ) = true , if ( Sequential order ) S1; // I A S2; // I B // I B is control or //data dependent on I A . V. Krishna Nandivada (IIT Madras) 10-Jan-2013 8 / 32

  26. Dynamic Happens-before dependence Extending the classical definition of data dependence in sequential programs to happens-before dependence in parallel programs; HB ( I A , I B ) = true , if ( Sequential order ) S1; // I A S2; // I B // I B is control or //data dependent on I A . ( Async creation ) V. Krishna Nandivada (IIT Madras) 10-Jan-2013 8 / 32

  27. Dynamic Happens-before dependence Extending the classical definition of data dependence in sequential programs to happens-before dependence in parallel programs; HB ( I A , I B ) = true , if ( Sequential order ) S1; // I A S2; // I B // I B is control or //data dependent on I A . ( Async creation ) async // I A S // I B V. Krishna Nandivada (IIT Madras) 10-Jan-2013 8 / 32

  28. Dynamic Happens-before dependence Extending the classical definition of data dependence in sequential programs to happens-before dependence in parallel programs; HB ( I A , I B ) = true , if ( Sequential order ) S1; // I A S2; // I B // I B is control or //data dependent on I A . ( Async creation ) async // I A S // I B ( Finish termination ) V. Krishna Nandivada (IIT Madras) 10-Jan-2013 8 / 32

  29. Dynamic Happens-before dependence Extending the classical definition of data dependence in sequential programs to happens-before dependence in parallel programs; HB ( I A , I B ) = true , if ( Sequential order ) S1; // I A S2; // I B // I B is control or //data dependent on I A . ( Async creation ) async // I A S // I B ( Finish termination ) finish { // finish-start async { S1; S2; // I A } I B } // finish-end V. Krishna Nandivada (IIT Madras) 10-Jan-2013 8 / 32

  30. Dynamic Happens-before dependence Extending the classical definition of data dependence in sequential programs to happens-before dependence in parallel programs; HB ( I A , I B ) = true , if ( Sequential order ) S1; // I A S2; // I B // I B is control or //data dependent on I A . ( Async creation ) async // I A S // I B ( Finish termination ) finish { // finish-start async { S1; S2; // I A } I B } // finish-end V. Krishna Nandivada (IIT Madras) 10-Jan-2013 8 / 32

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend