hierarchical pointer analysis for distributed programs
play

Hierarchical Pointer Analysis for Distributed Programs Distributed - PowerPoint PPT Presentation

Hierarchical Pointer Analysis for Distributed Programs Distributed Programs Amir Kamil and Katherine Yelick U.C. Berkeley A August 23, 2007 t 23 2007 1 Hierarchical Pointer Analysis Amir Kamil Background 2 Hierarchical Pointer Analysis


  1. Hierarchical Pointer Analysis for Distributed Programs Distributed Programs Amir Kamil and Katherine Yelick U.C. Berkeley A August 23, 2007 t 23 2007 1 Hierarchical Pointer Analysis Amir Kamil

  2. Background 2 Hierarchical Pointer Analysis Amir Kamil

  3. Hierarchical Machines • Parallel machines often have hierarchical structure level 1 level 1 (thread local) 1 level 2 A (node local) ( ) level 3 2 B 4 3 C (cluster local) D level 4 level 4 (grid world) 3 Hierarchical Pointer Analysis Amir Kamil

  4. Partitioned Global Address Space • Partitioned global address space (PGAS) languages provide the illusion of shared memory across the machine • Wide pointers used to represent global addresses • Contain identifying information plus the physical address Process ID: 1 Address: 0xf9a0cb48 • Narrow pointers can still be used for addresses Narrow pointers can still be used for addresses in the local physical address space Address: 0xf9a0cb48 4 Hierarchical Pointer Analysis Amir Kamil

  5. The Problems 5 Hierarchical Pointer Analysis Amir Kamil

  6. Three Problems • What data is private to a thread? • What data is local to the physical address p y space? • What possible race conditions can occur? What possible race conditions can occur? 6 Hierarchical Pointer Analysis Amir Kamil

  7. Data Privacy • Data is private if it cannot leak beyond its source thread • Useful to know which data is private for global garbage collection, monitor optimization, and other applications 7 Hierarchical Pointer Analysis Amir Kamil

  8. Data Locality • Recall: global pointers composed identifying • Recall: global pointers composed identifying information and an address P Process ID: 1 ID 1 Add Address: 0xf9a0cb48 0 f9 0 b48 • When dereferenced, runtime system must perform a check to determine if the data is perform a check to determine if the data is actually in the local physical address space • If local, then access directly If l l th di tl • If not local, then perform communication • Thus, global pointers are more costly in both Th l b l i t tl i b th space and time, even if the actual data is local 8 Hierarchical Pointer Analysis Amir Kamil

  9. Race Detection • Shared memory introduces the possibility of race conditions • Two threads access the same memory location • The accesses can be simultaneous (no intermediate synchronization) • At least one access is a write 9 Hierarchical Pointer Analysis Amir Kamil

  10. The Solution 10 Hierarchical Pointer Analysis Amir Kamil

  11. Hierarchical Pointer Analysis • A pointer analysis that takes into account the machine hierarchy can answer the preceding questions • For each variable, we want to know not only from which allocation sites the data could have originated, but also from which threads 11 Hierarchical Pointer Analysis Amir Kamil

  12. Related Work • Thread-aware pointer analysis has been done by others • Rugina and Rinard , Zhu and Hendren, Hicks, and others • None of them did it for hierarchical, distributed machines • Data privacy and locality detection previously done by Liblit, Aiken, and Yelick • Uses constraint propagation • Does not distinguish allocation sites 12 Hierarchical Pointer Analysis Amir Kamil

  13. The Implementation 13 Hierarchical Pointer Analysis Amir Kamil

  14. Titanium • Titanium is a single program multiple data • Titanium is a single program, multiple data (SPMD) dialect of Java • All threads execute the same program text • All threads execute the same program text • Designed for distributed machines • Global address space – all threads can access Gl b l dd ll th d all memory • At runtime, threads are grouped into processes At ti th d d i t • A thread shares a physical address space with some other b t not all threads other, but not all threads 14 Hierarchical Pointer Analysis Amir Kamil

  15. Titanium Memory Hierarchy • Global memory is composed of a hierarchy • Global memory is composed of a hierarchy Program Processes Threads 0 1 2 3 global global tlocal plocal • Locations can be thread-local (tlocal) process- • Locations can be thread-local (tlocal), process- local (plocal), or potentially in another process (global) (global) 15 Hierarchical Pointer Analysis Amir Kamil

  16. The Analysis 16 Hierarchical Pointer Analysis Amir Kamil

  17. Approach • We define a small SPMD language based on • We define a small SPMD language based on Titanium • We produce a type system that accounts for the • We produce a type system that accounts for the memory hierarchy • The analysis can handle an arbitrary number of levels but • The analysis can handle an arbitrary number of levels, but we use three levels in this talk • We give an overview of the pointer analysis • We give an overview of the pointer analysis inference rules 17 Hierarchical Pointer Analysis Amir Kamil

  18. Language Syntax • Types Types τ ::= int | ref q τ • Qualifiers • Qualifiers q ::= tlocal | plocal | global (tl (tlocal � plocal � global) l l l l b l) • Expressions e ::= new l τ (allocation) | transmit e 1 from e 2 | transmit e 1 from e 2 (communication) (communication) | e 1 � e 2 (dereferencing assignment) | convert(e n) | convert(e, n) (type conversion) (type conversion) 18 Hierarchical Pointer Analysis Amir Kamil

  19. Type Rules – Allocation • The expression new l τ allocates space of type τ The expression new l τ allocates space of type τ in local memory and returns a reference to the location • The label l is unique for each allocation site and will be used by the pointer analysis • The resulting reference is qualified with tlocal , since it references thread-local memory Thread 0 new l int tl tlocal l Γ � new l τ : ref tlocal τ 19 Hierarchical Pointer Analysis Amir Kamil

  20. Type Rules – Communication • The expression transmit e 1 from e 2 The expression transmit e 1 from e 2 evaluates e 1 on the thread given by e 2 and retrieves the result • If e 1 has reference type, the result type must be widened to global widened to global • Statically do not know source thread, so must assume it can be any thread y Γ � e 1 : τ Γ � e 1 : τ Γ � e 2 : int Γ � e 2 : int Thread 0 Thread 1 Γ � transmit e 1 from e 2 : y tlocal expand( τ global) expand( τ , global) transmit global expand(ref q τ , q’) � ref � (q, q’) τ y from 1 expand( τ q’) � τ otherwise expand( τ , q ) � τ otherwise 20 Hierarchical Pointer Analysis Amir Kamil

  21. Type Rules – Dereferencing Assignment • The expression e 1 � e 2 puts the value of e 2 into The expression e 1 e 2 puts the value of e 2 into the location referenced by e 1 (like *e 1 = e 2 in C) • Some assignments are unsound Some assignments are unsound Γ � e 1 : ref q τ Γ � e 2 : τ robust( τ , q) f b t( ) Γ � e 1 Γ � e 1 � e 2 : ref q τ e 2 : ref q τ Thread 0 Thread 1 plocal y robust(ref q τ , q ) robust(ref τ q’) � false if q � q’ false if q � q tlocal tlocal tlocal tl l plocal l l z robust( τ , q’) � true otherwise 21 Hierarchical Pointer Analysis Amir Kamil

  22. Type Rules – Type Conversion • The expression convert(e, q) is an assertion The expression convert(e, q) is an assertion that e refers to data that is no further than q • Titanium code often checks if data is plocal and then p casts to it before operating on it for efficiency Thread 0 x Γ � e : ref q’ τ global Γ � convert(e, q) : ref q τ Γ t( ) f 22 Hierarchical Pointer Analysis Amir Kamil

  23. Pointer Analysis • Since language is SPMD, analysis is only done for a single thread • We use thread 0 in our examples W th d 0 i l • Each expression has a points-to set of abstract locations that it can reference locations that it can reference • Abstract locations also have points-to sets 23 Hierarchical Pointer Analysis Amir Kamil

  24. Abstract Locations • Abstract locations consist of label and qualifier • A-loc (l, q) can refer to any concrete location allocated at label l that is at most distance q from thread 0 at label l that is at most distance q from thread 0 Thread 0 Thread 0 Thread 1 Thread 1 (l, tlocal) new l int new l int tlocal tlocal (l (l, plocal) l l) 24 Hierarchical Pointer Analysis Amir Kamil

  25. Pointer Analysis – Allocation and Pointer Analysis – Allocation and Communication • The inference rules for allocation and The inference rules for allocation and communication are similar to the type rules • An allocation new l τ produces a new abstract An allocation new l τ produces a new abstract location (l, tlocal) • The result of the expression transmit e 1 from • The result of the expression transmit e from e 2 is the set of a-locs resulting from e 1 but with global qualifiers global qualifiers e 1 � {(l 1 , tlocal), (l 2 , plocal), (l 3 , global)} transmit e 1 from e 2 � {(l 1 , global), (l 2 , global), (l 3 , global)} 25 Hierarchical Pointer Analysis Amir Kamil

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