Prof John D. Kubiatowicz

Slides:



Advertisements
Similar presentations
Chapter 5 Part I: Shared Memory Multiprocessors
Advertisements

Extra Cache Coherence Examples In the following examples there are a couple questions. You can answer these for practice by ing Colin at
Lecture 7. Multiprocessor and Memory Coherence
CSE 490/590, Spring 2011 CSE 490/590 Computer Architecture Snoopy Caches II Steve Ko Computer Sciences and Engineering University at Buffalo.
CS252 Graduate Computer Architecture Lecture 25 Memory Consistency Models and Snoopy Bus Protocols Prof John D. Kubiatowicz
Computer Architecture II 1 Computer architecture II Lecture 8.
CIS629 Coherence 1 Cache Coherence: Snooping Protocol, Directory Protocol Some of these slides courtesty of David Patterson and David Culler.
EECC756 - Shaaban #1 lec # 10 Spring Shared Memory Multiprocessors Symmetric Memory Multiprocessors (SMPs): commonly 2-4 processors/node.
CS 258 Parallel Computer Architecture Lecture 13 Shared Memory Multiprocessors March 10, 2008 Prof John D. Kubiatowicz
EECC756 - Shaaban #1 lec # 11 Spring Shared Memory Multiprocessors Symmetric Multiprocessors (SMPs): –Symmetric access to all of main memory.
CS252/Patterson Lec /23/01 CS213 Parallel Processing Architecture Lecture 7: Multiprocessor Cache Coherency Problem.
1 Lecture 3: Snooping Protocols Topics: snooping-based cache coherence implementations.
Computer architecture II
Cache Coherence: Part 1 Todd C. Mowry CS 740 November 4, 1999 Topics The Cache Coherence Problem Snoopy Protocols.
Bus-Based Multiprocessor
CPE 731 Advanced Computer Architecture Snooping Cache Multiprocessors Dr. Gheith Abandah Adapted from the slides of Prof. David Patterson, University of.
CS 258 Parallel Computer Architecture Lecture 12 Shared Memory Multiprocessors II March 1, 2002 Prof John D. Kubiatowicz
Snooping Cache and Shared-Memory Multiprocessors
©RG:E0243:L2- Parallel Architecture 1 E0-243: Computer Architecture L2 – Parallel Architecture.
CS492B Analysis of Concurrent Programs Coherence Jaehyuk Huh Computer Science, KAIST Part of slides are based on CS:App from CMU.
Presented By:- Prerna Puri M.Tech(C.S.E.) Cache Coherence Protocols MSI & MESI.
Spring EE 437 Lillevik 437s06-l21 University of Portland School of Engineering Advanced Computer Architecture Lecture 21 MSP shared cached MSI protocol.
Ch4. Multiprocessors & Thread-Level Parallelism 2. SMP (Symmetric shared-memory Multiprocessors) ECE468/562 Advanced Computer Architecture Prof. Honggang.
Cache Coherence CSE 661 – Parallel and Vector Architectures
Evaluating the Performance of Four Snooping Cache Coherency Protocols Susan J. Eggers, Randy H. Katz.
Shared Memory Consistency Models. SMP systems support shared memory abstraction: all processors see the whole memory and can perform memory operations.
CS252 Graduate Computer Architecture Lecture 18 April 4 th, 2011 Memory Consistency Models and Snoopy Bus Protocols Prof John D. Kubiatowicz
December 1, 2006©2006 Craig Zilles1 Threads and Cache Coherence in Hardware  Previously, we introduced multi-cores. —Today we’ll look at issues related.
Cache Coherence Protocols A. Jantsch / Z. Lu / I. Sander.
1 Memory and Cache Coherence. 2 Shared Memory Multiprocessors Symmetric Multiprocessors (SMPs) Symmetric access to all of main memory from any processor.
Lecture 9 ECE/CSC Spring E. F. Gehringer, based on slides by Yan Solihin1 Lecture 9 Outline  MESI protocol  Dragon update-based protocol.
Cache Coherence for Small-Scale Machines Todd C
1 Lecture 3: Coherence Protocols Topics: consistency models, coherence protocol examples.
Cache Coherence CS433 Spring 2001 Laxmikant Kale.
CSC/ECE 506: Architecture of Parallel Computers Bus-Based Coherent Multiprocessors 1 Lecture 12 (Chapter 8) Lecture 12 (Chapter 8)
Outline Introduction (Sec. 5.1)
COSC6385 Advanced Computer Architecture
COMP 740: Computer Architecture and Implementation
CS 152 Computer Architecture and Engineering Lecture 18: Snoopy Caches
Cache Coherence in Shared Memory Multiprocessors
Shared Memory Multiprocessors
Cache Coherence: Part 1 Todd C. Mowry CS 740 October 25, 2000
CS 704 Advanced Computer Architecture
Cache Coherence for Shared Memory Multiprocessors
Multiprocessor Cache Coherency
Lecture 9 Outline MESI protocol Dragon update-based protocol
Prof. Gennady Pekhimenko University of Toronto Fall 2017
Example Cache Coherence Problem
Flynn’s Taxonomy Flynn classified by data and control streams in 1966
Prof John D. Kubiatowicz
Protocol Design Space of Snooping Cache Coherent Multiprocessors
Cache Coherence (controllers snoop on bus transactions)
Lecture 2: Snooping-Based Coherence
Chip-Multiprocessor.
Cache Coherence in Bus-Based Shared Memory Multiprocessors
CMSC 611: Advanced Computer Architecture
Multiprocessors - Flynn’s taxonomy (1966)
Symmetric Multiprocessors
Lecture 4: Update Protocol
Bus-Based Coherent Multiprocessors
Shared Memory Multiprocessors
Multiprocessor Highlights
Chapter 5 Exploiting Memory Hierarchy : Cache Memory in CMP
Lecture 24: Multiprocessors
Lecture 3: Coherence Protocols
Lecture 8 Outline Memory consistency
Coherent caches Adapted from a lecture by Ian Watson, University of Machester.
CS 258 Parallel Computer Architecture Lecture 16 Snoopy Protocols I
Prof John D. Kubiatowicz
CSE 486/586 Distributed Systems Cache Coherence
Presentation transcript:

Prof John D. Kubiatowicz CS 258 Parallel Computer Architecture Lecture 15 Sequential Consistency and Snoopy Protocols March 17, 2008 Prof John D. Kubiatowicz http://www.cs.berkeley.edu/~kubitron/cs258 CS258 S99

Recall: Sequential Consistency LD1 A  5 LD2 B  7 ST1 A,6 … LD3 A  6 LD4 B  21 ST2 B,13 ST3 B,4 LD5 B  2 … LD6 A  6 ST4 B,21 LD7 A  6 LD8 B  4 LD1 A  5 LD2 B  7 LD5 B  2 ST1 A,6 LD6 A  6 ST4 B,21 LD3 A  6 LD4 B  21 LD7 A  6 ST2 B,13 ST3 B,4 LD8 B  4 “A multiprocessor is sequentially consistent if the result of any execution is the same as if the operations of all the processors were executed in some sequential order, and the operations of each individual processor appear in this sequence in the order specified by its program.” [Lamport, 1979]

Recall: Happens Before: arrows are time Tricky part is relationship between nodes with respect to single location Program order adds relationship between locations Easy topological sort comes up with sequential ordering assuming: All happens-before relationships are time Then – can’t have time cycles (at least not inside classical machine in normal spacetime ). Unfortunately, writes are not instantaneous What do we do?

Recall: Ordering: Scheurich and Dubois P : R R R W R P : R R R R 1 P : R R R R R 2 Exclusion Zone “Instantaneous” Completion point Sufficient Conditions for Sequential Consistency every process issues mem operations in program order after a write operation is issued, the issuing process waits for the write to complete before issuing next memory operation after a read is issued, the issuing process waits for the read to complete and for the write whose value is being returned to complete (gloabaly) before issuing its next operation

What about reordering of accesses? LD0 B  4 LD1 A  6 … LD2 B  4 ST1 B  21 ST2 A  6 Proc 1 Proc 2 Allow LD2 to Issue Before LD1 LD0 B  4 LD1 A  6 … LD2 B  21 ST1 B  21 ST2 A  6 Proc 1 Proc 2 Strict Sequential Issue Order Can LD2 issue before LD1? Danger of getting CYCLE! (i.e. not sequentially consistent What can we do? Go ahead and issue ld early, but watch cache If value invalidated from cache early: Must squash LD2 and any instructions that have used its value Reordering of Stores Must be even more careful

Write-back Caches (Uniprocessor) 2 processor operations PrRd, PrWr 3 states invalid, valid (clean), modified (dirty) ownership: who supplies block 2 bus transactions: read (BusRd), write-back (BusWB) only cache-block transfers  treat Valid as “shared” and Modified as “exclusive”  introduce one new bus transaction read-exclusive: read for purpose of modifying (read-to-own) PrRd/— PrW r/BusRd BusRd/— r/— V M I Replace/BusWB PrRd/BusRd Replace/-

MSI Invalidate Protocol Three States: “M”: “Modified” “S”: “Shared” “I”: “Invalid” Read obtains block in “shared” even if only cache copy Obtain exclusive ownership before writing BusRdx causes others to invalidate (demote) If M in another cache, will flush BusRdx even if hit in S promote to M (upgrade) What about replacement? S->I, M->I as before PrRd/— PrW r/— M PrW r/BusRdX BusRd/Flush PrW r/BusRdX S BusRdX/Flush BusRdX/— PrRd/BusRd PrRd/— BusRd/— I

Example: Write-Back Protocol I/O devices Memory u :5 P0 P1 P4 PrRd U PrRd U PrRd U BusRd U PrWr U 7 BusRdx U U S 5 U S 7 U S 5 U M 7 BusRd U BusRd Flush

Correctness When is write miss performed? How does writer “observe” write? How is it “made visible” to others? How do they “observe” the write? When is write hit made visible to others? When does a write hit complete globally?

Write Serialization for Coherence Writes that appear on the bus (BusRdX) are ordered by bus performed in writer’s cache before other transactions, so ordered same w.r.t. all processors (incl. writer) Read misses also ordered wrt these Write that don’t appear on the bus: P issues BusRdX B. further mem operations on B until next transaction are from P read and write hits these are in program order for read or write from another processor separated by intervening bus transaction Reads hits?

Sequential Consistency Bus imposes total order on bus xactions for all locations Between xactions, procs perform reads/writes (locally) in program order So any execution defines a natural partial order Mj subsequent to Mi if (i) Mj follows Mi in program order on same processor, (ii) Mj generates bus xaction that follows the memory operation for Mi In segment between two bus transactions, any interleaving of local program orders leads to consistent total order w/i segment writes observed by proc P serialized as: Writes from other processors by the previous bus xaction P issued Writes from P by program order Insight: only one cache may have value in “M” state at a time…

Sufficient conditions issued in program order after write issues, the issuing process waits for the write to complete before issuing next memory operation after read is issues, the issuing process waits for the read to complete and for the write whose value is being returned to complete (globally) before issuing its next operation Write completion can detect when write appears on bus Write atomicity: if a read returns the value of a write, that write has already become visible to all others already

Lower-level Protocol Choices BusRd observed in M state: what transition to make? M ----> I M ----> S Depends on expectations of access patterns How does memory know whether or not to supply data on BusRd? Problem: Read/Write is 2 bus xactions, even if no sharing BusRd (I->S) followed by BusRdX or BusUpgr (S->M) What happens on sequential programs?

MESI (4-state) Invalidation Protocol Four States: “M”: “Modified” “E”: “Exclusive” “S”: “Shared” “I”: “Invalid” Add exclusive state distinguish exclusive (writable) and owned (written) Main memory is up to date, so cache not necessarily owner can be written locally States invalid exclusive or exclusive-clean (only this cache has copy, but not modified) shared (two or more caches may have copies) modified (dirty) I -> E on PrRd if no cache has copy => How can you tell?

Hardware Support for MESI I/O devices Memory u :5 P0 P1 P4 shared signal - wired-OR All cache controllers snoop on BusRd Assert ‘shared’ if present (S? E? M?) Issuer chooses between S and E how does it know when all have voted?

MESI State Transition Diagram BusRd(S) means shared line asserted on BusRd transaction Flush’: if cache-to- cache xfers only one cache flushes data Replacement: SI can happen without telling other caches EI, MI MOESI protocol: Owned state: exclusive but memory not valid PrW r/— BusRd/Flush PrRd/ BusRdX/Flush r/BusRdX PrRd/— BusRd/Flush’ ¢ E M I S PrRd BusRd(S) BusRdX/Flush’ BusRd/ Flush BusRd (S )

Lower-level Protocol Choices Who supplies data on miss when not in M state: memory or cache? Original, lllinois MESI: cache, since assumed faster than memory Not true in modern systems Intervening in another cache more expensive than getting from memory Cache-to-cache sharing adds complexity How does memory know it should supply data (must wait for caches) Selection algorithm if multiple caches have valid data Valuable for cache-coherent machines with distributed memory May be cheaper to obtain from nearby cache than distant memory, Especially when constructed out of SMP nodes (Stanford DASH)

Update Protocols If data is to be communicated between processors, invalidate protocols seem inefficient consider shared flag p0 waits for it to be zero, then does work and sets it one p1 waits for it to be one, then does work and sets it zero how many transactions?

Dragon Write-back Update Protocol 4 states Exclusive-clean or exclusive (E): I and memory have it Shared clean (Sc): I, others, and maybe memory, but I’m not owner Shared modified (Sm): I and others but not memory, and I’m the owner Sm and Sc can coexist in different caches, with only one Sm Modified or dirty (D): I and, noone else No invalid state If in cache, cannot be invalid If not present in cache, view as being in not-present or invalid state New processor events: PrRdMiss, PrWrMiss Introduced to specify actions when block not present in cache New bus transaction: BusUpd Broadcasts single word written on bus; updates other relevant caches

Dragon State Transition Diagram Sc Sm M PrW r/— PrRd/— PrRdMiss/BusRd(S) rMiss/(BusRd(S); BusUpd) rMiss/BusRd(S) r/BusUpd(S) BusRd/— BusRd/Flush BusUpd/Update

Lower-level Protocol Choices Can shared-modified state be eliminated? If update memory as well on BusUpd transactions (DEC Firefly) Dragon protocol doesn’t (assumes DRAM memory slow to update) Should replacement of an Sc block be broadcast? Would allow last copy to go to E state and not generate updates Replacement bus transaction is not in critical path, later update may be Can local copy be updated on write hit before controller gets bus? Can mess up serialization Coherence, consistency considerations much like write-through case

Assessing Protocol Tradeoffs Tradeoffs affected by technology characteristics and design complexity Part art and part science Art: experience, intuition and aesthetics of designers Science: Workload-driven evaluation for cost-performance want a balanced system: no expensive resource heavily underutilized

Summary Shared-memory machine Memory Coherence: Memory Consistency: All communication is implicit, through loads and stores Parallelism introduces a bunch of overheads over uniprocessor Memory Coherence: Writes to a given location eventually propagated Writes to a given location seen in same order by everyone Memory Consistency: Constraints on ordering between processors and locations Sequential Consistency: For every parallel execution, there exists a serial interleaving