llov a fast static data race checker for openmp programs
play

LLOV : A Fast Static Data-Race Checker for OpenMP Programs Utpal - PowerPoint PPT Presentation

LLOV : A Fast Static Data-Race Checker for OpenMP Programs Utpal Bora PhD Student Computer Science and Engineering IIT Hyderabad, India February 23, 2020 Bora, Utpal (IITH) LLVM-Performance@CGO20 1 / 29 Table of Contents Motivation for


  1. LLOV : A Fast Static Data-Race Checker for OpenMP Programs Utpal Bora PhD Student Computer Science and Engineering IIT Hyderabad, India February 23, 2020 Bora, Utpal (IITH) LLVM-Performance@CGO20 1 / 29

  2. Table of Contents Motivation for LLOV 1 Architecture and Methodology 2 Results 3 Current Status 4 Extensions 5 Bora, Utpal (IITH) LLVM-Performance@CGO20 2 / 29

  3. Data race in Parallel programs Definition (Data Race) An execution of a concurrent program is said to have a data race when two different threads access the same memory location, these accesses are not protected by a mutual exclusion mechanism the order of the two accesses is non-deterministic one of these accesses is a write Bora, Utpal (IITH) LLVM-Performance@CGO20 3 / 29

  4. Common race conditions in OpenMP programs 1 #pragma omp parallel for private (temp ,i,j) Missing data sharing clauses for (i = 0; i < len; i++) 2 for (j = 0; j < len; j++) 3 { temp = u[i][j]; 4 sum = sum + temp * temp; 5 } 6 DRB021: OpenMP Worksharing construct with data race Bora, Utpal (IITH) LLVM-Performance@CGO20 4 / 29

  5. Common race conditions in OpenMP programs for (i=0;i<n;i++) { 1 Missing data sharing clauses #pragma omp parallel for 2 Loop carried dependences for (j=1;j<m;j++) { 3 b[i][j]=b[i][j -1]; 4 } 5 } 6 DRB038: Example with Loop Carried Dependence Bora, Utpal (IITH) LLVM-Performance@CGO20 4 / 29

  6. Common race conditions in OpenMP programs Missing data sharing clauses 1 #pragma omp simd Loop carried dependences 2 for (int i=0; i<len -1; i++){ a[i+1] = a[i] + b[i]; SIMD races 3 4 } DRB024: Example with SIMD data race Bora, Utpal (IITH) LLVM-Performance@CGO20 4 / 29

  7. Common race conditions in OpenMP programs 1 #pragma omp parallel shared(b, error) { Missing data sharing clauses 2 #pragma omp for nowait Loop carried dependences for(i = 0; i < len; i++) 3 a[i] = b + a[i]*5; 4 SIMD races 5 #pragma omp single Synchronization issues error = a[9] + 1; 6 } 7 DRB013: Example with data race due to improper synchronization Bora, Utpal (IITH) LLVM-Performance@CGO20 4 / 29

  8. Common race conditions in OpenMP programs Missing data sharing clauses 1 #pragma omp parallel Loop carried dependences if ( omp_get_thread_num () % 2 2 == 0) { SIMD races Flag = true; 3 } Synchronization issues 4 Control flow dependent on Control flow dependent on number of threads number of threads Bora, Utpal (IITH) LLVM-Performance@CGO20 4 / 29

  9. Race Detection Tools Table: OpenMP Race Detection Tools: A Short Survey Tools Infrastructure Analysis Type Helgrind [Vp07b] Valgrind Dynamic Valgrind DRD [Vp07a] Valgrind Dynamic TSan [SI09] LLVM/GCC Dynamic Archer [AGR + 16] LLVM Hybrid SWORD [AGR + 18] LLVM Dynamic ROMP [GMC18] Dyninst Dynamic PolyOMP [CSS15] ROSE Static DRACO [YSL + 18] ROSE Static ompVerify [BYR + 11] AlphaZ Static Bora, Utpal (IITH) LLVM-Performance@CGO20 5 / 29

  10. Race Detection Tools Table: OpenMP Race Detection Tools: A Short Survey Tools Infrastructure Analysis Type Helgrind [Vp07b] Valgrind Dynamic Valgrind DRD [Vp07a] Valgrind Dynamic TSan [SI09] LLVM/GCC Dynamic Archer [AGR + 16] LLVM Hybrid SWORD [AGR + 18] LLVM Dynamic ROMP [GMC18] Dyninst Dynamic PolyOMP [CSS15] ROSE Static DRACO [YSL + 18] ROSE Static ompVerify [BYR + 11] AlphaZ Static There is still need for a static OpenMP data race checker in LLVM. Bora, Utpal (IITH) LLVM-Performance@CGO20 5 / 29

  11. Advantage of Static tools over Dynamic tools Static tools have the following advantages over dynamic tools: Can detect races in SIMD constructs Bora, Utpal (IITH) LLVM-Performance@CGO20 6 / 29

  12. Advantage of Static tools over Dynamic tools Static tools have the following advantages over dynamic tools: Can detect races in SIMD constructs Are independent of the runtime thread schedule Bora, Utpal (IITH) LLVM-Performance@CGO20 6 / 29

  13. Advantage of Static tools over Dynamic tools Static tools have the following advantages over dynamic tools: Can detect races in SIMD constructs Are independent of the runtime thread schedule Are independent of the input size Bora, Utpal (IITH) LLVM-Performance@CGO20 6 / 29

  14. Advantage of Static tools over Dynamic tools Static tools have the following advantages over dynamic tools: Can detect races in SIMD constructs Are independent of the runtime thread schedule Are independent of the input size Are independent of the number of threads Bora, Utpal (IITH) LLVM-Performance@CGO20 6 / 29

  15. Advantage of Static tools over Dynamic tools Static tools have the following advantages over dynamic tools: Can detect races in SIMD constructs Are independent of the runtime thread schedule Are independent of the input size Are independent of the number of threads Bora, Utpal (IITH) LLVM-Performance@CGO20 6 / 29

  16. Advantage of Static tools over Dynamic tools Static tools have the following advantages over dynamic tools: Can detect races in SIMD constructs Are independent of the runtime thread schedule Are independent of the input size Are independent of the number of threads LLOV is an attempt to bridge this gap and move towards a fast, language agnostic, robust, static OpenMP data race checker in LLVM. Bora, Utpal (IITH) LLVM-Performance@CGO20 6 / 29

  17. Table of Contents Motivation for LLOV 1 Architecture and Methodology 2 Results 3 Current Status 4 Extensions 5 Bora, Utpal (IITH) LLVM-Performance@CGO20 7 / 29

  18. LLOV Overview LLOV is a language agnostic, static OpenMP data race checker in the LLVM compiler framework. Bora, Utpal (IITH) LLVM-Performance@CGO20 8 / 29

  19. LLOV Overview LLOV is a language agnostic, static OpenMP data race checker in the LLVM compiler framework. LLOV is based on Intermediate representation of LLVM (LLVM-IR) Bora, Utpal (IITH) LLVM-Performance@CGO20 8 / 29

  20. LLOV Overview LLOV is a language agnostic, static OpenMP data race checker in the LLVM compiler framework. LLOV is based on Intermediate representation of LLVM (LLVM-IR) uses Polyhedral framework, Polly, of LLVM Bora, Utpal (IITH) LLVM-Performance@CGO20 8 / 29

  21. LLOV Overview LLOV is a language agnostic, static OpenMP data race checker in the LLVM compiler framework. LLOV is based on Intermediate representation of LLVM (LLVM-IR) uses Polyhedral framework, Polly, of LLVM can handle FORTRAN as well as C/C++ Bora, Utpal (IITH) LLVM-Performance@CGO20 8 / 29

  22. LLOV Overview LLOV is a language agnostic, static OpenMP data race checker in the LLVM compiler framework. LLOV is based on Intermediate representation of LLVM (LLVM-IR) uses Polyhedral framework, Polly, of LLVM can handle FORTRAN as well as C/C++ can detect that a program is race free Bora, Utpal (IITH) LLVM-Performance@CGO20 8 / 29

  23. LLOV Overview LLOV is a language agnostic, static OpenMP data race checker in the LLVM compiler framework. LLOV is based on Intermediate representation of LLVM (LLVM-IR) uses Polyhedral framework, Polly, of LLVM can handle FORTRAN as well as C/C++ can detect that a program is race free has all the advantages of a static data-race checker Bora, Utpal (IITH) LLVM-Performance@CGO20 8 / 29

  24. LLOV Overview LLOV is a language agnostic, static OpenMP data race checker in the LLVM compiler framework. LLOV is based on Intermediate representation of LLVM (LLVM-IR) uses Polyhedral framework, Polly, of LLVM can handle FORTRAN as well as C/C++ can detect that a program is race free has all the advantages of a static data-race checker can be extended for approximate dependences (like LAI of LLVM) Bora, Utpal (IITH) LLVM-Performance@CGO20 8 / 29

  25. LLOV Overview LLOV is a language agnostic, static OpenMP data race checker in the LLVM compiler framework. LLOV is based on Intermediate representation of LLVM (LLVM-IR) uses Polyhedral framework, Polly, of LLVM can handle FORTRAN as well as C/C++ can detect that a program is race free has all the advantages of a static data-race checker can be extended for approximate dependences (like LAI of LLVM) has provision for handling entire OpenMP pragmas Bora, Utpal (IITH) LLVM-Performance@CGO20 8 / 29

  26. LLOV Architecture Alias Collect OpenMP Analysis information OpenMP Source Verifier Data Race LLVM-IR C/C++/FORTRAN (loadable module) Warnings Polly LLOV : LLVM OpenMP Verifier Figure: Flow Diagram of LLVM OpenMP Verifier ( LLOV ) Bora, Utpal (IITH) LLVM-Performance@CGO20 9 / 29

  27. Methodology (with Example) j dimension 6 for (i=0;i <10;i++) { 1 5 #pragma omp parallel for 2 for (j=1;j <10;j++) { 4 3 b[i][j]=b[i][j -1]; 4 3 } 5 2 } 6 1 Example with Loop Carried 0 Dependence i dimension 0 1 2 3 4 5 6 Figure: Dependence Polyhedra Bora, Utpal (IITH) LLVM-Performance@CGO20 10 / 29

  28. Methodology (with Example) j dimension 6 for (i=0;i <10;i++) { 1 5 #pragma omp parallel for 2 4 for (j=1;j <10;j++) { 3 3 b[i][j]=b[i][j -1]; 4 } 5 2 } 6 1 Listing 1: Example with Loop Carried 0 0 1 2 3 4 5 6 i dimension Dependence Figure: Projection of the Dependence Polyhedra on i-dimension Zero magnitude of the projections on a dimension signifies that the dimension is parallel. Bora, Utpal (IITH) LLVM-Performance@CGO20 11 / 29

Recommend


More recommend