Ferad Zyulkyarov 1,2, Tim Harris 3, Osman S. Unsal 1, Adrián Cristal 1, Mateo Valero 1,2 1 BSC-Microsoft Research Centre 2 Universitat Politècnica de Catalunya.

Slides:



Advertisements
Similar presentations
Inferring Locks for Atomic Sections Cornell University (summer intern at Microsoft Research) Microsoft Research Sigmund CheremTrishul ChilimbiSumit Gulwani.
Advertisements

Introduction to Eclipse. Start Eclipse Click and then click Eclipse from the menu: Or open a shell and type eclipse after the prompt.
Slide 1 Atomic Quake – Using Transactional Memory in an Interactive Multiplayer Game Server Ferad Zyulkyarov 1,2, Vladimir Gajinov 1,2, Osman S. Unsal.
QuakeTM: Parallelizing a Complex Serial Application Using Transactional Memory Vladimir Gajinov 1,2, Ferad Zyulkyarov 1,2,Osman S. Unsal 1, Adrián Cristal.
Enabling Speculative Parallelization via Merge Semantics in STMs Kaushik Ravichandran Santosh Pande College.
Hardware Transactional Memory for GPU Architectures Wilson W. L. Fung Inderpeet Singh Andrew Brownsword Tor M. Aamodt University of British Columbia In.
Transactional Memory Supporting Large Transactions Anvesh Komuravelli Abe Othman Kanat Tangwongsan Hardware-based.
Transactional Memory Guest Lecture Design of Parallel and High-Performance Computing Georg Ofenbeck TexPoint fonts used in EMF. Read the TexPoint manual.
Thread-Level Transactional Memory Decoupling Interface and Implementation UW Computer Architecture Affiliates Conference Kevin Moore October 21, 2004.
The Path to Multi-core Tools Paul Petersen. Multi-coreToolsThePathTo 2 Outline Motivation Where are we now What is easy to do next What is missing.
Transactional Memory (TM) Evan Jolley EE 6633 December 7, 2012.
Actions in the Twilight Ein Erweiterung für Software Transactional Memory Annette Bieniusa Peter Thiemann Universität Freiburg Arie Middelkoop Universiteit.
Supporting Nested Transactional Memory in LogTM Authors Michelle J Moravan Mark Hill Jayaram Bobba Ben Liblit Kevin Moore Michael Swift Luke Yen David.
Language Support for Lightweight transactions Tim Harris & Keir Fraser Presented by Narayanan Sundaram 04/28/2008.
Chapter 4 H1 Assembly Language: Part 2. Direct instruction Contains the absolute address of the memory location it accesses. ld instruction:
The Cost of Privatization Hagit Attiya Eshcar Hillel Technion & EPFLTechnion.
Unbounded Transactional Memory Paper by Ananian et al. of MIT CSAIL Presented by Daniel.
Department of Computer Science Presenters Dennis Gove Matthew Marzilli The ATOMO ∑ Transactional Programming Language.
DEBUGGERS For CS302 Data Structures Course Slides prepared by TALHA OZ (most of the text is from
Dynamic Runtime Testing for Cycle-Accurate Simulators Saša Tomić, Adrián Cristal, Osman Unsal, Mateo Valero Barcelona Supercomputing Center (BSC) Universitat.
CS252: Systems Programming Ninghui Li Final Exam Review.
CSE 486/586 CSE 486/586 Distributed Systems PA Best Practices Steve Ko Computer Sciences and Engineering University at Buffalo.
©2009 HP Confidential1 A Proposal to Incorporate Software Transactional Memory (STM) Support in the Open64 Compiler Dhruva R. Chakrabarti HP Labs, USA.
Discovering and Understanding Performance Bottlenecks in Transactional Applications Ferad Zyulkyarov 1,2, Srdjan Stipic 1,2, Tim Harris 3, Osman S. Unsal.
1 Scalable and transparent parallelization of multiplayer games Bogdan Simion MASc thesis Department of Electrical and Computer Engineering.
15-740/ Oct. 17, 2012 Stefan Muller.  Problem: Software is buggy!  More specific problem: Want to make sure software doesn’t have bad property.
Copyright 2007 Sun Microsystems, Inc SNZI: Scalable Non-Zero Indicator Yossi Lev (Brown University & Sun Microsystems Laboratories) Joint work with: Faith.
Accelerating Precise Race Detection Using Commercially-Available Hardware Transactional Memory Support Serdar Tasiran Koc University, Istanbul, Turkey.
EazyHTM: Eager-Lazy Hardware Transactional Memory Saša Tomić, Cristian Perfumo, Chinmay Kulkarni, Adrià Armejach, Adrián Cristal, Osman Unsal, Tim Harris,
WormBench A Configurable Application for Evaluating Transactional Memory Systems MEDEA Workshop Ferad Zyulkyarov 1, 2, Sanja Cvijic 3, Osman.
Debugging in Java. Common Bugs Compilation or syntactical errors are the first that you will encounter and the easiest to debug They are usually the result.
Debugging and Profiling With some help from Software Carpentry resources.
A Tutorial on Introduction to gdb By Sasanka Madiraju Graduate Assistant Center for Computation and Technology.
Debugging Xin Tong. GDB GNU Project debugger Allows you to see what is going on `inside' another program while it executes or crashed. (Faster than printing.
CS 460/660 Compiler Construction. Class 01 2 Why Study Compilers? Compilers are important – –Responsible for many aspects of system performance Compilers.
CS162 Week 5 Kyle Dewey. Overview Announcements Reactive Imperative Programming Parallelism Software transactional memory.
Software Transactional Memory Should Not Be Obstruction-Free Robert Ennals Presented by Abdulai Sei.
Dale Roberts Debugger Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer and Information Science, School.
How D can make concurrent programming a piece of cake Bartosz Milewski D Programming Language.
CoreDet: A Compiler and Runtime System for Deterministic Multithreaded Execution Tom Bergan Owen Anderson, Joe Devietti, Luis Ceze, Dan Grossman To appear.
Hardware and Software transactional memory and usages in MRE
Debugging tools in Flash CIS 126. Debugging Flash provides several tools for testing ActionScript in your SWF files. –The Debugger, lets you find errors.
Architectural Features of Transactional Memory Designs for an Operating System Chris Rossbach, Hany Ramadan, Don Porter Advanced Computer Architecture.
4 November 2005 CS 838 Presentation 1 Nested Transactional Memory: Model and Preliminary Sketches J. Eliot B. Moss and Antony L. Hosking Presented by:
Beyond Application Profiling to System Aware Analysis Elena Laskavaia, QNX Bill Graham, QNX.
Dale Roberts Debugger Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer and Information Science, School.
Lecture 20: Consistency Models, TM
Ferad Zyulkyarov1,2, Srdjan Stipic1,2, Tim Harris3, Osman S. Unsal1,
Minh, Trautmann, Chung, McDonald, Bronson, Casper, Kozyrakis, Olukotun
Transactional Memory : Hardware Proposals Overview
Testing and Debugging.
Effective Data-Race Detection for the Kernel
LESSON 20.
Introduction to Operating Systems
Predictive Performance
Chapter 15 Debugging.
Changing thread semantics
Lecture 6: Transactions
DEBUGGING JAVA PROGRAMS USING ECLIPSE DEBUGGER
CSc 352 Debugging Tools Saumya Debray Dept. of Computer Science
Lecture 22: Consistency Models, TM
Chapter 15 Debugging.
Debuggers and Debugging
Design and Implementation Issues for Atomicity
Transactions and Concurrency
Code Composer Essentials 3.0
Chapter 15 Debugging.
Tim Harris (MSR Cambridge)
Dynamic Binary Translators and Instrumenters
Chapter 15 Debugging.
Presentation transcript:

Ferad Zyulkyarov 1,2, Tim Harris 3, Osman S. Unsal 1, Adrián Cristal 1, Mateo Valero 1,2 1 BSC-Microsoft Research Centre 2 Universitat Politècnica de Catalunya 3 Microsoft Research Cambridge 15th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming January 2010 – Bangalore Debugging Programs that use Atomic Blocks and Transactional Memory

2 Our Motivation It is difficult to debug transactional applications with existing debuggers Existing debuggers are not aware of atomic blocks and transactional memory –Lessons learnt from developing complex TM applications such as Atomic Quake[1] and Quake TM [2]. [1] Zyulkyarov et al. “Atomic Quake: Using Transactional Memory in an Interactive Multiplayer Game Server“, PPoPP'09 [2] Gajinov et al. “QuakeTM: Parallelizing a Complex Serial Application Using Transactional Memory “, ICS'09

Overview Debugging atomic blocks atomically Examining the TM state Managing the TM state at debug-time Conflict point discovery Design and implementation 3

Debugging at the Level of Atomic Blocks Debugger is extended with the semantics of atomic blocks –Atomicity – atomic blocks are treated as single instruction –Isolation – the user does not observe intermediate results of concurrently running transactions Hides the low level implementation details of atomic blocks (TM or lock inference) 4

Atomicity in Debugging Step over atomic blocks as if single instruction. Good for debugging sync errors at granularity of atomic blocks vs. individual statements inside the atomic blocks. 5 atomic { } atomic { } Current DebuggerTM Aware Debugger

Using Existing Debuggers 6 SV_LinkEdict 1 atomic { 2 InitializeBoundingBox(ent); 3 SV_FindTouchedLeafs(ent, sv.worldmodel->nodes); 4 node = FindNewLocation(ent, sv_areanode); 5 InsertLinkBefore(&ent->area, &node->trigger_edicts); 6 } // end atomic sv_areanode Want to move from A to B and take the keys. Compute the bounding box. Find the leafs the bounding box maps to. Find location B Another player took the keys before us. Change the location and take the keys. Conflict. Rollback. Re-execute. Conflict. Rollback. Re-execute.

Using TM Aware Debugger 7 SV_LinkEdict 1 atomic { 2 InitializeBoundingBox(ent); 3 SV_FindTouchedLeafs(ent, sv.worldmodel->nodes); 4 node = FindNewLocation(ent, sv_areanode); 5 InsertLinkBefore(&ent->area, &node->trigger_edicts); 6 } // end atomic sv_areanode Moved from A to B and took the keys.

Isolation in Debugging What if we want to debug wrong code within atomic block? –Put breakpoint inside atomic block. –Validate the transaction –Step within the transaction. The user does not observe intermediate results of concurrently running transactions –Switch transaction to irrevocable mode after validation. 8 atomic { }

Debugging Wrong Code Inside Atomic Blocks Why isolation is important? 9 InsertSorted(object value) { Node n = new Node(value); atomic { Node previous = FindPrevious(value); n.Next = previous.Next; previous.Next = n; } 1 56

Example Importance of Isolation 10 InsertSorted(object value) { Node n = new Node(value); atomic { Node previous = FindPrevious(value); n.Next = previous.Next; previous.Next = n; } InsertSorted(4)

Example Importance of Isolation 11 InsertSorted(object value) { Node n = new Node(value); atomic { Node previous = FindPrevious(value); n.Next = previous.Next; previous.Next = n; }

Example Importance of Isolation 12 InsertSorted(object value) { Node n = new Node(value); atomic { Node previous = FindPrevious(value); n.Next = previous.Next; previous.Next = n; } Another transaction changed the value to 3. The current TX will be doomed and operate on invalid data.

Example Importance of Isolation 13 InsertSorted(object value) { Node n = new Node(value); atomic { Node previous = FindPrevious(value); n.Next = previous.Next; previous.Next = n; } Confuse the user because of consuming speculative values and not detecting conflict.

Why Isolate Speculative State? 14 InsertSorted(object value) { Node n = new Node(value); atomic { Node previous = FindPrevious(value); n.Next = previous.Next; previous.Next = n; } Confuse the user because of consuming speculative values and not detecting conflict.

Why Isolate Speculative State? 15 InsertSorted(object value) { Node n = new Node(value); atomic { Node previous = FindPrevious(value); n.Next = previous.Next; previous.Next = n; } Conflict. Rollback. Re-execute. Conflict. Rollback. Re-execute.

Debugging atomic blocks atomically Examining the TM state Managing the TM state at debug-time Conflict point discovery Design and implementation 16

Debugging at the Level of Transactions Assumes that atomic blocks are implemented with transactional memory. Examine the internal state of the TM –Read/write set, re-executions, status TM specific watch points –Break when conflict happens –Filters Concurrent work with Herlihy and Lev [PACT’ 09]. 17

Querying the TM State 18 atomic { } Read Set 0x30FA00 0x30FE16 0x320B0A 0x4A11F8 Write Set 0x30FE16 0x3AEE0D 0x4A1124 Status: Active Re-executions: 1 Query TM State Priority: 1 Nesting: 1

TM Specific Watchpoints 19 atomic { } Conflict Information Conflicting Threads: T1, T2 Address: 0x84D2F0 Symbol: Readers: T1 Writers: T2 Break when conflict happens Filter: Break if Address = Thread = T2 Filter: Break if Address = Thread = T2 AND

Debugging atomic blocks atomically Examining the TM state Managing the TM state at debug-time Conflict point discovery Design and implementation 20

Managing Transactions at Debug-Time At the level of atomic blocks –Debug time atomic blocks –Splitting atomic blocks At the level of transactions –Changing the state of TM system (i.e. adding and removing entries from read/write set, change the status, abort) Analogous to the functionality of existing debuggers to change the CPU state 21

Debug Time Atomic Blocks Create and remove atomic blocks while debugging. Useful to investigate and patch synchronization errors such as data races, atomicity, and order violation. User marks the places that should execute atomically. 22

Example Debug Time Atomic Bblocks 23

Example Debug Time Atomic Bblocks 24 StartDebugAtomic EndDebugAtomic User marks the start and the end of the transactions

Data Race 25 Thread 1 atomic { local = counter; local++; counter = local; } Thread 2 atomic { local = counter; local++; } counter = local; StartDebugAtomic atomic { local = counter; local++; } counter = local; EndDebugAtomic

Split Atomic Block Useful to find unnecessarily large atomic blocks or searching for data races 26 atomic { s1; s2; } atomic { s1; s2; } atomic { s1; } atomic { s2; }

Debugging atomic blocks atomically Examining the TM state Managing the TM state at debug-time Conflict point discovery Design and implementation 27

Conflict Point Discovery 28 TM applications have unanticipated overheads –Problem raised by Pankratius [talk at ICSE’09] and Rossbach et al. [PPoPP’10] Tells the users at which source lines how many conflicts happen. –Useful to profile and optimize TM applications. More comprehensive than Reach Points Gajinov et al. [ICS’ 09]

Example Output File:Line#Conf.MethodLine Hashtable.cs:51152AddIf (_container[hashCode]… Hashtable.cs:4862Adduint hashCode = HashSdbm(… Hashtable.cs:535Add_container[hashCode] = n … Hashtable.cs:835Addwhile (entry != null) … ArrayList.cs:793Containsfor (int i = 0; i < count; i++ ) ArrayList.cs:521Addif (count == capacity – 1) … 29

Optimizing Genome 30

Debugging atomic blocks atomically Examining the TM state Managing the TM state at debug-time Conflict point discovery Design and implementation 31

Design 32 Debugger Process WinDbg TmDbgExt DbgEng Target Process Program TmTargetDbg StmLib Show Read set Implements debugger commands such as setting watchpoints, query and modify the STM. Wrapper around the STM to hide its implementation details. Function call on the target process.

Conclusion New principles and approaches for debugging TM applications –Debugging at the level of atomic blocks –Debugging at the level of transactions –Managing transactions at debug-time Conflict point discovery –Optimized Genome Generic and decoupled design 33

Край Slides available at

Backup Slides 35

Implementing Conflict Point Discovery 36 atomic { a = 5; } Addr: 01 : StartAtomic(); 02 : OpenObjForWrite(a); 03 : a = 5; 04 : CommitAtomic(); Obj. Addr. 0x40D8E2 … … Ret. AddrCounter 0x03152 …… …… Compiler Instrumentation Conflict DbgEng Addr = 0x03 Hashtable.cs:51 Translate to source line Return Addr. 0x03 … … Log the address of a for conflict detection. To know where conflict happens log the return address of OpenObjForRead.

Internal Breakpoint Debugger breakpoint used to implement –Atomicity –Watchpoints –Splitting atomic blocks –Debug time atomic blocks 37

Breakpoint-time Callback Distinguishes ordinary breakpoints from internal breakpoints Overrides the debugger behavior of suspending the target process May execute complementary actions 38

Example Use of Internal Breakpoint 39 atomic { } Internal Breakpoint -> StartAtomic() -> Commit() Stepping over atomic block as if a single instruction

Atomicity Violations 40 initially a = b = 0; Thread 1 Thread 2 1 atomic{ 2 a++; 3 } atomic { 4 a++; 5 atomic{ } 6 b--; 7 assert(a + b == 0); 8 }

Atomicity Violations 41 initially a = b = 0; Thread 1 Thread 2 StartDebugAomic 1 atomic{ 2 a++; 3 } atomic { 4 a++; 5 atomic{ } 6 b--; 7 assert(a + b == 0); 8} EndDebugAtomic

Extending the Scope of Atomic Blocks We can build over debug time transactions to allow users to extend the scope of existing compile time atomic blocks. 42 atomic { } atomic { } StartDebugTx EndDebugTx We wantHow we do

Shrinking the Scope The implementation of shrinking the scope of atomic blocks might be tricky for STMs because of the code instrumentation. 43 atomic { } atomic { } StartTx - Ignore StartDebugTx EndDebugTx EndTx - Ignore We wantHow we do

Debugging Wrong Code Inside Atomic Blocks? 44 SV_LinkEdict 1 atomic { 2 InitializeBoundingBox(ent); 3 SV_FindTouchedLeafs(ent, sv.worldmodel->nodes); 4 node = FindNewLocation(ent, sv_areanode); 5 InsertLinkBefore(&ent->area, &node->trigger_edicts); 6 } // end atomic InsertLinkBefore(object value) { Node n = new Node(value); atomic { AddNode(n); RightRotate(ParentOf(n)); FixColors(); }

Isolating Speculative State Insert(3) Insert(object value) { Node n = new Node(value); atomic { AddNode(n); RightRotate(ParentOf(n)); FixColors(); } 3

Isolating Speculative State Insert(3) Insert(object value) { Node n = new Node(value); atomic { AddNode(n); RightRotate(ParentOf(n)); FixColors(); } Another transaction changed the value to 2. The current TX will be doomed and operate on invalid data. Another transaction changed the value to 2. The current TX will be doomed and operate on invalid data.

Insert(object value) { Node n = new Node(value); atomic { AddNode(n); RightRotate(ParentOf(n)); FixColors(); } Isolating Speculative State Rotate Right 5 Mislead the user because of consuming speculative values and not detecting conflict.

Isolating Speculative State Fix Colors Insert(object value) { Node n = new Node(value); atomic { AddNode(n); RightRotate(ParentOf(n)); FixColors(); } Conflict. Rollback. Re-execute. Conflict. Rollback. Re-execute.