
Two Techniques to Enhance the Performance of Memory Consistency Models Kourosh Gharachorloo, Anoop Gupta, and John Hennessy Computer Systems Laboratory Stanford University, CA 94305 Abstract tency, for example, it is sufficient to delay each access until the previous access completes. The more relaxed models require The memory consistency model supported by a multiprocessor fewer such delay constraints. However, the presence of delay directly affects its performance. Thus, several attempts have constraints still limits performance. been made to relax the consistency models to allow for more This paper presents two novel implementation techniques that buffering and pipelining of memory accesses. Unfortunately, alleviate the limitations imposed on performance through such the potential increase in performance afforded by relaxing the delay constraints. The first technique is hardware-controlled consistency model is accompanied by a more complex program- non-binding prefetch. It provides pipelining for large latency ming model. This paper introduces two general implementation accesses that would otherwise be delayed due to consistency techniques that provide higher performance for all the models. constraints. The second technique is speculative execution for The first technique involves prefetching values for accesses that load accesses. This allows the processor to proceed with load are delayed due to consistency model constraints. The second accesses that would otherwise be delayed due to earlier pend- technique employs speculative execution to allow the proces- ing accesses. The combination of these two techniques provides sor to proceed even though the consistency model requires the significant opportunity to buffer and pipeline accesses regardless memory accesses to be delayed. When combined, the above of the consistency model supported. Consequently, the perfor- techniques alleviate the limitations imposed by a consistency mance of all consistency models, even the most relaxed mod- model on buffering and pipelining of memory accesses, thus els, is enhanced. More importantly, the performance of different significantly reducing the impact of the memory consistency consistency models is equalized, thus reducing the impact of the model on performance. consistency model on performance. This latter result is notewor- thy in light of the fact that relaxed models are accompanied by a more complex programming model. 1 Introduction The next section provides background information on the vari- ous consistency models. Section 3 discusses the prefetch scheme Buffering and pipelining are attractive techniques for hiding the in detail. The speculative execution technique is described in latency of memory accesses in large scale shared-memory multi- Section 4. A general discussion of the proposed techniques and processors. However, the unconstrained use of these techniques the related work is given in Sections 5 and 6. Finally, we con- can result in an intractable programming model for the machine. clude in Section 7. Consistency models provide more tractable programming mod- els by introducing various restrictions on the amount of buffering and pipelining allowed. 2 Background on Consistency Models Several memory consistency models have been proposed in the literature. The strictest model is sequential consistency A consistency model imposes restrictions on the order of shared (SC) [15], which requires the execution of a parallel program memory accesses initiated by each process. The strictest model, to appear as some interleaving of the execution of the parallel originally proposed by Lamport [15], is sequential consistency processes on a sequential machine. Sequential consistency im- (SC). Sequential consistency requires the execution of a parallel poses severe restrictions on buffering and pipelining of memory program to appear as some interleaving of the execution of the accesses. One of the least strict models is release consistency parallel processes on a sequential machine. Processor consis- (RC) [8], which allows significant overlap of memory accesses tency (PC) was proposed by Goodman [9] to relax some of the given synchronization accesses are identified and classified into restrictions imposed by sequential consistency. Processor con- acquires and releases. Other relaxed models that have been dis- sistency requires that writes issued from a processor may not be cussed in the literature are processor consistency (PC) [8, 9], observed in any order other than that in which they were issued. weak consistency (WC) [4, 5], and data-race-free-0 (DRF0) [2]. However, the order in which writes from two processors occur, These models fall between sequential and release consistency as observed by themselves or a third processor, need not be models in terms of strictness. identical. Sufficient constraints to satisfy processor consistency The constraints imposed by a consistency model can be satis- are specified formally in [8]. fied by placing restrictions on the order of completion for mem- A more relaxed consistency model can be derived by relating ory accesses from each process. To guarantee sequential consis- memory request ordering to synchronization points in the pro- gram. The weak consistency model (WC) proposed by Dubois 1 et al. [4, 5] is based on the above idea and guarantees a con- LOAD LOAD STORE STORE LOAD LOAD STORE STORE sistent view of memory only at synchronization points. As an example, consider a process updating a data structure within a LOAD STORE LOAD STORE critical section. Under SC, every access within the critical sec- LOAD STORE LOAD STORE tion is delayed until the previous access completes. But such Sequential Consistency (SC) Processor Consistency (PC) delays are unnecessary if the programmer has already made sure that no other process can rely on the data structure to be con- sistent until the critical section is exited. Weak consistency ACQUIRE A 1 ACQUIRE A 1 exploits this by allowing accesses within the critical section to LOAD/STORE ACQUIRE B 5 be pipelined. Correctness is achieved by guaranteeing that all 2 LOAD/STORE LOAD/STORE 2 4 previous accesses are performed before entering or exiting each LOAD/STORE critical section. LOAD/STORE LOAD/STORE LOAD/STORE 6 Release consistency (RC) [8] is an extension of weak consis- RELEASE A 3 LOAD/STORE RELEASE A 3 tency that exploits further information about synchronization by LOAD/STORE classifying them into acquire and release accesses. An acquire 4 RELEASE B 7 synchronization access (e.g., a lock operation or a process spin- LOAD/STORE ning for a flag to be set) is performed to gain access to a set of Release Consistency (RC) shared locations. A release synchronization access (e.g., an un- ACQUIRE B 5 lock operation or a process setting a flag) grants this permission. u An acquire is accomplished by reading a shared location until LOAD/STORE v cannot perform 6 until u is performed v an appropriate value is read. Thus, an acquire is always associ- LOAD/STORE ated with a read synchronization access (see [8] for discussion of read-modify-write accesses). Similarly, a release is always LOAD/STORE LOADs and STOREs can RELEASE B 7 perform in any order as long associated with a write synchronization access. In contrast to as local data and control LOAD/STORE WC, RC does not require accesses following a release to be de- Weak Consistency (WC) dependences are observed layed for the release to complete; the purpose of the release is to signal that previous accesses are complete, and it does not have Figure 1: Ordering restrictions on memory accesses. anything to say about the ordering of the accesses following it. Similarly, RC does not require an acquire to be delayed for its previous accesses. The data-race-free-0 (DRF0) [2] model accesses have performed. An interesting alternative is to allow as proposed by Adve and Hill is similar to release consistency, the access to partially or fully proceed even though the delay although it does not distinguish between acquire and release arcs demand that the access be delayed and to simply detect accesses. We do not discuss this model any further, however, and remedy the cases in which the early access would result because of its similarity to RC. in incorrect behavior. The key observation is that for the ma- jority of accesses, the execution would be correct (according to The ordering restrictions imposed by a consistency model can the consistency model) even if the delay arcs are not enforced. be presented in terms of when an access is allowed to perform. Such accesses are allowed to proceed without any delay. The A read is considered performed when the return value is bound few accesses that require the delay for correctness can be prop- and can not be modified by other write operations. Similarly, erly handled by detecting the problem and correcting it through a write is considered performed when the value written by the reissuing the access to the memory system. Thus, the com- write operation is visible to all processors. For simplicity, we mon case is handled with maximum speed while still preserving assume a write is made visible to all other processors at the correctness. same time. The techniques described in the paper can be easily extended to allow for the case when a write is made visible to The prefetch and speculative execution techniques described other processors at different times. The notion of being per- in the following two sections are based on the above observa- formed and having completed will be used interchangeably in tions. For brevity, we will present the techniques only in the the rest of the paper. context of SC and RC since they represent the two extremes in the spectrum of consistency models. Extension of the techniques Figure 1 shows the restrictions imposed by each of the con- for other models should be straightforward. sistency models on memory accesses from the same process.1 As shown, sequential consistency can be guaranteed by requir- ing shared accesses to perform in program order. Processor consistency allows more flexibility over SC by allowing read 3 Prefetching operations to bypass previous write operations.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages10 Page
-
File Size-