transactional memory
play

Transactional Memory Companion slides for The Art of Multiprocessor - PowerPoint PPT Presentation

Transactional Memory Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit Moores Law Transistor count still rising Clock speed flattening sharply Art of Multiprocessor 2 Programming


  1. Processor Issues Load Request load x E cache cache cache Bus Bus Got it! memory data data 57 Art of Multiprocessor Programming

  2. Processor Issues Load Request Load x E data cache cache Bus Bus memory data 58 Art of Multiprocessor Programming

  3. Other Cache Responds Got it S S E data data cache cache Bus Bus memory data 59 Art of Multiprocessor Programming

  4. Modify Cached Data S S data data data cache Bus memory data 60 Art of Multiprocessor Programming

  5. Invalidate Invalidate x S S M I data data cache cache Bus Bus memory data 61 Art of Multiprocessor Programming

  6. Invalidate data cache cache Bus This cache acquires write permission memory data 62 Art of Multiprocessor Programming

  7. Invalidate Other caches lose read permission data cache cache Bus This cache acquires write permission memory data 63 Art of Multiprocessor Programming

  8. Invalidate Memory provides data only if not present in any cache, so no need to change it now (expensive) data cache cache Bus memory data 64 Art of Multiprocessor Programming

  9. HW Transactional Memory read active T caches Interconnect memory Art of Multiprocessor 65 65 Programming

  10. Transactional Memory active read active T T caches memory Art of Multiprocessor 66 66 Programming

  11. Transactional Memory active committed active T T caches memory Art of Multiprocessor 67 67 Programming

  12. Transactional Memory write committed active T D caches memory Art of Multiprocessor 68 68 Programming

  13. Rewind write aborted active active T T D caches memory Art of Multiprocessor 69 69 Programming

  14. Transaction Commit At Commit point … No cache conflicts? We win. Mark transactional cache entries … . Was: read-only, Now: valid Was: modified, Now: dirty (will be written back) That’s (almost) everything! Art of Multiprocessor 70 70 Programming

  15. Road Map Transactional Memory Hardware Transactional Memory Hybrid Transactional Memory Software Transactional Memory Research Questions 71

  16. Hardware Transactional Memory (HTM) IBM’s Blue Gene/Q & System Z & Power8 Intel’s Haswell TSX extensions 72

  17. Intel RTM if (_xbegin() == _XBEGIN_STARTED) { speculative code _xend() } else { abort handler }

  18. Intel RTM if (_xbegin() == _XBEGIN_STARTED) { speculative code _xend() } else { abort handler } start a speculative transaction

  19. Intel RTM if (_xbegin() == _XBEGIN_STARTED) { speculative code _xend() } else { abort handler } If you see this, you are inside a transaction

  20. Intel RTM if (_xbegin() == _XBEGIN_STARTED) { speculative code _xend() If you see anything else, } else { your transaction aborted abort handler }

  21. Intel RTM if (_xbegin() == _XBEGIN_STARTED) { speculative code _xend() } else { abort handler } you could retry the transaction, or take an alternative path

  22. Abort codes if (_xbegin() == _XBEGIN_STARTED) { speculative code } else if (status & _XABORT_EXPLICIT) { aborted by user code } else if (status & _XABORT_CONFLICT) { read-write conflict } else if (status & _XABORT_CAPACITY) { cache overflow } else { … }

  23. Abort codes if (_xbegin() == _XBEGIN_STARTED) { speculative code } else if (status & _XABORT_EXPLICIT) { aborted by user code } else if (status & _XABORT_CONFLICT) { read-write conflict } else if (status & _XABORT_CAPACITY) { speculative code can call cache overflow } else { _xabort() … }

  24. Abort codes synchronization conflict if (_xbegin() == _XBEGIN_STARTED) { speculative code occurred (maybe retry) } else if (status & _XABORT_EXPLICIT) { aborted by user code } else if (status & _XABORT_CONFLICT) { read-write conflict } else if (status & _XABORT_CAPACITY) { cache overflow } else { … }

  25. Abort codes if (_xbegin() == _XBEGIN_STARTED) { speculative code } else if (status & _XABORT_EXPLICIT) { read/write set too big aborted by user code (maybe don’t retry) } else if (status & _XABORT_CONFLICT) { read-write conflict } else if (status & _XABORT_CAPACITY) { cache overflow } else { … }

  26. Abort codes if (_xbegin() == _XBEGIN_STARTED) { speculative code } else if (status & _XABORT_EXPLICIT) { aborted by user code } else if (status & _XABORT_CONFLICT) { other abort codes … read-write conflict } else if (status & _XABORT_CAPACITY) { cache overflow } else { … }

  27. Too Big Transaction aborts if data set overflows caches, internal buffers

  28. Too Slow Transaction aborts on timer interrupt

  29. Just Not in the Mood Many other reasons: TLB miss, illegal instruction, page fault …

  30. Hybrid Transactional Memory

  31. Non-Speculative Fallback if (_xbegin() == _XBEGIN_STARTED) { read lock state if (lock taken) _xabort(); work; _xend() } else { lock->lock(); work; lock->unlock(); }

  32. Non-Speculative Fallback if (_xbegin() == _XBEGIN_STARTED) { read lock state if (lock taken) _xabort(); work; _xend() } else { reading lock ensures that lock->lock(); transaction will abort if another work; thread acquires lock lock->unlock(); }

  33. Non-Speculative Fallback if (_xbegin() == _XBEGIN_STARTED) { read lock state if (lock taken) _xabort(); work; _xend() } else { lock->lock(); abort if another thread has work; acquired lock lock->unlock(); }

  34. Non-Speculative Fallback on abort, acquire lock & do work (aborting concurrent speculative if (_xbegin() == _XBEGIN_STARTED) { transactions) read lock state if (lock taken) _xabort(); work; _xend() } else { lock->lock(); work; lock->unlock(); } Art of Multiprocessor Programming

  35. Lock Elision <HLE acquire prefix> lock(); do work; <HLE release prefix> unlock() 91 Art of Multiprocessor Programming

  36. Lock Elision <HLE acquire prefix> lock(); do work; <HLE release prefix> unlock() first time around, read lock and execute speculatively 92 Art of Multiprocessor Programming

  37. Lock Elision <HLE acquire prefix> lock(); do work; <HLE release prefix> unlock() if speculation fails, no more Mr. Nice Guy, acquire the lock 93 Art of Multiprocessor Programming

  38. Conventional Locks lock transfer latencies serialized execution locks 94 Art of Multiprocessor Programming

  39. Lock Elision locks lock elision 95 Art of Multiprocessor Programming

  40. Lock Teleportation 96

  41. Hand-over-Hand locking a b c Art of Multiprocessor 97 Art of Multiprocessor Programming Programming

  42. Hand-over-Hand locking a b c 98 Art of Multiprocessor Programming

  43. Hand-over-Hand locking a b c 99 Art of Multiprocessor Programming

  44. Hand-over-Hand locking a b c 100 Art of Multiprocessor Programming

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