INTERCONNECTION NETWORKS AND DATA PREFETCHINGFOR LARGE-SCALE MULTIPROCESSORS: DESIGN AND PERFORMANCE BY SUNIL KIM B.S., Seoul National University, 1985 M.S., Seoul National University, 1987 THESIS Submitted in partial fulfillment of the requirements for the degree of Doctor of Philosophy in Computer Science in the Graduate College of the University of Illinois at Urbana-Champaign, 1995 Urbana, Illinois INTERCONNECTION NETWORKS AND DATA PREFETCHING FOR LARGE-SCALE MULTIPROCESSORS: DESIGN AND PERFORMANCE Sunil Kim, Ph.D. Department of Computer Science University of Illinois at Urbana-Champaign, 1995 Alexander V. Veidenbaum, Advisor Increasing computing power demands higher memory performance than ever before, and memory access becomes a more serious bottleneck in high-performance computer systems. Therefore, reducing memory access latency or hiding the latency is crucial to achieving high performance. In shared memory multiprocessor systems, where memory access must traverse interconnection networks, the system performance and costs are directly affected by interconnection networks. Latency hiding techniques such as data prefetching affect interconnection network and memory performance by demanding more bandwidth. This dissertation studies interconnection networks and data prefetching. We establish a theoretical framework for routing in shuffle-exchange networks and develop an algorithm for shortest path routing in single stage shuffle-exchange networks. Single stage shuffle-exchange networks are attractive because of their relatively low cost and shorter average internode distance as compared to multistage shuffle-exchange networks. The theoretical framework and routing algorithm allow network size to be any multiple of the switch size. We evaluate the effect of shortest path routing on memory system performance. Three different network topologies are evaluated by varying system size, switch size and channel width under various design constraints. These networks are multistage and single stage shuffle-exchange networks and multidimensional torus networks. By employing detailed trace-driven simulations of an entire system, we conduct an extensive comparative study of these interconnection networks in terms of performance and cost. iii In general, multistage shuffle-exchange networks are the best network topology when cost is not the main limiting factor. Otherwise, single stage shuffle-exchange networks are the best network topology when cost is a main limiting factor. Multidimensional torus networks were seriously limited by their long average internode distance. We investigate the effect of data prefetching on interconnection networks and vice versa. When data prefetching is effective, the performance difference caused by different networks tends to be reduced. The high memory bandwidth demand of prefetching requires that the number of outstanding requests be controlled to effectively utilize network and memory bandwidth. Finally, we develop and evaluate a prefetching scheme that enables stride-directed prefetching at the second-level of a memory hierarchy and outside a processor chip. Using the prefetching scheme, we compare three different second-level memory organizations: traditional caches, prefetching without a cache, and prefetching with a small cache. Prefetching with a small cache shows strong potential to be an efficient second-level memory organization. iv To my parents v Acknowledgements First, I would like to thank my advisor Alexander Veidenbaum for his guidance and support throughout the research for this dissertation. I would also like to thank the members of my committee: Professors Michael Faiman, Efstratios Gallopoulos, Wen-Mei Hwu, and Daniel Reed. I am grateful to Yung-Chin Chen and Olivier Temam for writing the MIPS trace generator and Hoichi Cheong and Carl Beckman for building PARSIM simulation systems which were used throughout my study. I appreciate the kind help of CSRD's supporting members, Donna Guzy, Sheila Clark, Robert Schafer, and the OM group. I also would like to thank the many office mates and professionals with whom I have worked over the years, including Hoichi Cheong, Yung-Chin Chen, Mahdi Seddighnezhad, and Lani Granston. In particular, I would like to express my special thanks to those who shared room 440 in CSRL: Eddie Gornish, Sharad Mehrotra, and Steve Turner. I enjoyed discussing many research and non-research issues with them. Without their help, finishing my study would have been much harder. They provided moments where we could laugh and relax together throughout the last stage of my study. I also thank many members of the Korean community in this town for the many hours they shared with me. Particularly, Byung Joon Park, Taehwan Kim, and Kwang-Keun Yi provided many joyful moments during the early stages of my study at UIUC. vi I thank my wife, Youn Hee Lee, for her encouragement and love. She always understood, believed in me, and cheered me up when things were difficult. Finally, I would like to thank my parents and my family members. Without my parents' sacrifice, patience, and support throughout all these years, I would not have been able to finish this study and write this acknowledgment. With all my heart I would like to express my deepest gratitude and love to my parents. vii Table of Contents Chapter 1 Introduction : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 1 1.1 Interconnection Networks : : : : : : : : : : : : : : : : : : : : : : : : : : : 3 1.2 Data Prefetching : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 4 1.3 Thesis Overview : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 6 2 Background : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 8 2.1 Interconnection Networks : : : : : : : : : : : : : : : : : : : : : : : : : : : 8 2.1.1 Multidimensional Torus Networks : : : : : : : : : : : : : : : : : : 11 2.1.2 Multistage and Single Stage Shuffle-Exchange Networks : : : : : : 12 2.1.3 Flow Control and Deadlock : : : : : : : : : : : : : : : : : : : : : 13 2.2 Data Prefetching : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 14 2.2.1 Hardware Data Prefetching : : : : : : : : : : : : : : : : : : : : : 14 2.2.2 Software Data Prefetching : : : : : : : : : : : : : : : : : : : : : : 17 2.2.3 Hybrid Data Prefetching : : : : : : : : : : : : : : : : : : : : : : : 19 2.2.4 Data Prefetching and Memory Bandwidth : : : : : : : : : : : : : 19 2.3 Evaluation Methodology : : : : : : : : : : : : : : : : : : : : : : : : : : : 20 2.3.1 Trace Generation : : : : : : : : : : : : : : : : : : : : : : : : : : : 20 2.3.2 Benchmarks : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 21 2.3.3 Simulation Models : : : : : : : : : : : : : : : : : : : : : : : : : : 22 3 Shortest Path Routing in Single Stage Shuffle-Exchange Networks : 29 3.1 Introduction : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 29 3.2 Routing in Shuffle-Exchange Networks : : : : : : : : : : : : : : : : : : : 32 3.2.1 Network Structure : : : : : : : : : : : : : : : : : : : : : : : : : : 32 3.2.2 Multistage Shuffle-Exchange Networks : : : : : : : : : : : : : : : 34 3.2.3 Single Stage Shuffle-Exchange Networks : : : : : : : : : : : : : : 40 3.3 Performance Evaluation : : : : : : : : : : : : : : : : : : : : : : : : : : : 45 3.3.1 Average Internode Distance : : : : : : : : : : : : : : : : : : : : : 45 3.3.2 Results and Analysis : : : : : : : : : : : : : : : : : : : : : : : : : 49 3.4 Conclusions : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 51 viii 4 Interconnection Network Organization and Its Impact on Performance and Cost in Shared Memory Multiprocessors : : : : : : : : : : : : : : : 53 4.1 Introduction : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 53 4.2 Performance Metrics : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 57 4.3 Network Constraint Models : : : : : : : : : : : : : : : : : : : : : : : : : 59 4.4 Experiments and Analysis : : : : : : : : : : : : : : : : : : : : : : : : : : 61 4.4.1 Stage Delay and Memory Waiting Time : : : : : : : : : : : : : : 62 4.4.2 Fixed Switch Size and Channel Width : : : : : : : : : : : : : : : 68 4.4.3 Constant Number of Switch Pins : : : : : : : : : : : : : : : : : : 73 4.4.4 Constant Network Cost : : : : : : : : : : : : : : : : : : : : : : : : 77 4.5 Conclusions : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 82 5 The Impact of Data Prefetching on Interconnection Networks and Its Interface Design : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 85 5.1 Introduction : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 85 5.2 Evaluation Methodology : : : : : : : : : : : : : : : : : : : : : : : : : : : 87 5.2.1 Tagged Cache and Network Interface : : : : : : : : : : : : : : : : 88 5.3 Performance Metrics : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 90 5.4 Experiments and Analysis : : : : : : : : : : : : : : : : : : : : : : : : : : 92 5.4.1 Prefetching and Network Performance : : : : : : : : : : : : : : : 92 5.4.2 The Effects of The Number of Outstanding Requests : : : : : : : 104 5.5 Conclusions : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 115 6 Data Prefetching and Its Performance in Second-Level Caches : : : : 117 6.1 Introduction : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 117 6.2 Prefetching Architecture : : : : : : : : : : : : : : : : : : : : : : : : : : : 121 6.2.1 Stream Buffers : : : : : : : : : : : : : : : : : : : : : : : : : : : : 123 6.2.2 Miss Table Prefetching (MTP) Architecture : : : : : : : : : : : : 124 6.2.3 Loop-Based Prefetching (LBP) Architecture : : : : : : : : : : : : 125 6.2.4 Instruction-Address-Based Prefetching (IAP) Architecture : : : : 129 6.3 Evaluation Methodology : : : : : : : : : : : : : : : : : : : : : : : : : : : 131 6.3.1 Simulation : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 131 6.3.2 Benchmarks : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 132 6.3.3 Performance Metrics : : : : : : : : : : : : : : : : : : : : : : : : : 134 6.4 Experiments and Analysis : : : : : : : : : : : : : : : : : : : : : : : : : : 135 6.4.1 Prefetching without Caches : : : : : : : : : : : : : : : : : : : : : 136 6.4.2 Prefetching with Caches : : : : : : : : : : : : : : : : : : : : : : : 143 6.5 Conclusions : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 149 7 Conclusions : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 151 Bibliography : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 156 Vita : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 163 ix List of Tables 2.1 Benchmark Characteristics : : : : : : : : : : : : : : : : : : : : : : : : : : 22 3.1 Average Internode Distance: SHORT = Shortest Path Routing, MULT = Multistage Routing, S/M = Ratio of Shortest Path Routing to Multistage Routing (%) : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 49 3.2 Read Miss Latency: SHORT = Shortest Path Routing, MULT = Multistage Routing, S/M = Ratio of Shortest Path Routing to Multistage Routing (%) : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 50 4.1 Average Message Path Length : ARC3D1 : : : : : : : : : : : : : : : : : : 59 4.2 Network Capacity : Channel Width 1 Byte : : : : : : : : : : : : : : : : : 62 4.3 Percentage of Read Miss Latency Difference: System Size = 64 : : : : : : 69 4.4 Percentage of Read Miss Latency Difference: System Size = 128 : : : : : 70 4.5 Percentage of Read Miss Latency Difference: System Size = 256 : : : : : 71 5.1 Cache Hit Ratios: D1, D2, D4, D8 = Channel Width 1, 2, 4 and 8 Bytes, respectively. NPF = No Prefetching, PF = Prefetching : : : : : : : : : : 93 5.2 Average Read Access Time with Varying the Maximum Number of Outstanding Prefetches and Writes in the MSX network: MOP = the Maximum Number of Outstanding Prefetches : : : : : : : : : : : : : : : : : : 106 5.3 Average Read Access Time with Varying the Maximum Number of Outstanding Prefetches and Writes in the SSX Network: MOP = the Maximum Number of Outstanding Prefetches : : : : : : : : : : : : : : : : : : 107 5.4 Average Read Access Time Ratios: Separate Limit Control over Total Limit Control in MSX Network, MOP = the Maximum Number of Outstanding Prefetches : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 111 5.5 Average Read Access Time Ratios: Separate Limit Control over Total Limit Control in SSX Network, MOP = the Maximum Number of Outstanding Prefetches : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 112 6.1 Benchmark Characteristics : : : : : : : : : : : : : : : : : : : : : : : : : : 133 6.2 Read Characteristics : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 134 6.3 L1 and L2 Prefetching Prediction Hit Rate (PPHR), RPT size = 256 : : 136 6.4 Stream Buffer Miss Rate: m3, m5, m7 = Miss Table Size 8, 32 and 128, respectively : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 138 x 6.5 Stream Buffer Miss Rate: m3, m5, m7 = Miss Table Size 8, 32 and 128, respectively : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 139 6.6 Stream Buffer Hit Rate Distributions of LBP: 256 Stream Buffers, 32-entry Miss Table : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 141 6.7 Stream Buffer Hit Rate Distributions of MTP: 256 Stream Buffers, 32- entry Miss Table : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 142 xi List of Figures 2.1 12-node 3-D Torus Network: Each dimension has 3, 2 and 2 nodes, respectively : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 11 2.2 System Architecture : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 23 2.3 Non-Blocking Switch : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 25 2.4 Multidimensional Torus Network System : : : : : : : : : : : : : : : : : : 26 2.5 Multistage Shuffle-Exchange Network System : : : : : : : : : : : : : : : 27 2.6 Single Stage Shuffle-Exchange Network System : : : : : : : : : : : : : : : 28 3.1 Multistage Shuffle-Exchange Network : : : : : : : : : : : : : : : : : : : : 32 3.2 Single Stage Shuffle-Exchange Network : : : : : : : : : : : : : : : : : : : 33 3.3 Direct Connected Single Stage Network : : : : : : : : : : : : : : : : : : : 43 3.4 Average Internode Distance: SHORT = Shortest Path Routing, MULT = Multistage Routing, LOGN (X) = logN (X) : : : : : : : : : : : : : : : : : 47 3.5 Average Internode Distance Ratio: Shortest Path Routing versus Multistage Routing : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 48 4.1 Stage Delay (ARC3D) : : : : : : : : : : : : : : : : : : : : : : : : : : : : 64 4.2 Memory Waiting Time (ARC3D) : : : : : : : : : : : : : : : : : : : : : : 65 4.3 Stage Delay (MDG) : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 66 4.4 Memory Waiting Time (MDG) : : : : : : : : : : : : : : : : : : : : : : : 67 4.5 ARC3D: Read Miss Latency vs. Number of Switch Pins : : : : : : : : : : 74 4.6 MDG: Read Miss Latency vs. Number of Switch Pins : : : : : : : : : : : 75 4.7 ARC3D: Read Miss Latency vs. Normalized Network Cost : : : : : : : : 79 4.8 MDG: Read Miss Latency vs. Normalized Network Cost : : : : : : : : : 80 5.1 Network Interface : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 88 5.2 ARC3D: Read Miss Latency, Processor Read Latency, and Total Execution Time : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 94 5.3 EFLUX: Read Miss Latency, Processor Read Latency, and Total Execution Time : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 95 5.4 MDG: Read Miss Latency, Processor Read Latency, and Total Execution Time : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 96 5.5 MG3P: Read Miss Latency, Processor Read Latency, and Total Execution Time : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 97 xii 5.6 TRFD: Read Miss Latency, Processor Read Latency, and Total Execution Time : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 98 5.7 Average Read Access Time: d08, d16, d32, d64 = 1-byte, 2-byte, 3-byte, 4- byte Channels respectively, t = TORUS, tp = TORUS with Prefetching, m = MSX, mp = MSX with Prefetching, s = SSX, sp = SSX with Prefetching, : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 102 5.8 Changes in Average Read Access Time Distributions: MSX Network with 1-byte Channel and the Maximum Number of Outstanding Prefetches = 4 108 5.9 Changes in Average Read Access Time Distributions: SSX Network with 1-byte Channel and the Maximum Number of Outstanding Prefetches = 4 108 5.10 Average Read Access Time vs. Pending Request Buffer Size: Average Read Access Time is Normalized to that of the Case in which a Total of 3 Outstanding Requests is Allowed for Reads, Writes and Prefetches : : : : 114 6.1 Stride Detection Scenario Based on L1 Cache Misses: Cache Line Size = 4 words, Access Stride = 3 : : : : : : : : : : : : : : : : : : : : : : : : : : 120 6.2 System Architecture for Read Access : : : : : : : : : : : : : : : : : : : : 121 6.3 L2 Prefetching Architectures : : : : : : : : : : : : : : : : : : : : : : : : : 122 6.4 Reference Prediction Table Mapping in Loop-Based Prefetching : : : : : 126 6.5 Loop-Based Stream Detection Unit : : : : : : : : : : : : : : : : : : : : : 128 6.6 Instruction-Address-Based Prefetching Architecture : : : : : : : : : : : : 129 6.7 State Transition Diagram : : : : : : : : : : : : : : : : : : : : : : : : : : 130 6.8 Cache Miss Rate: L1 Cache Size = 8 Kbytes, Miss Table Size = 32 entries, L2 Cache Size = 32 Kbytes, s = Number of Stream Buffers, C = Cacheonly, M = MTP, L = LBP, P = IAP : : : : : : : : : : : : : : : : : : : 144 6.9 Cache Miss Rate: L1 Cache Size = 8 Kbytes, Miss Table Size = 32 entries, L2 Cache Size = 32 Kbytes, s = Number of Stream Buffers, C = Cacheonly, M = MTP, L = LBP, P = IAP : : : : : : : : : : : : : : : : : : : 145 6.10 Cache Miss Rate: L1 Cache Size = 8 Kbytes, Miss Table Size = 32 entries, L2 Cache Size = 32 Kbytes, s = Number of Stream Buffers, C = Cacheonly, M = MTP, L = LBP, P = IAP : : : : : : : : : : : : : : : : : : : : 146 6.11 Hit Ratio Difference Between Loop-Based Prefetching versus Secondary Cache: LBP uses 64 Stream Buffers, a 32-entry Miss Table, a Loop-Based Stream Detection Unit and a 32K L2 Cache. L2 Cache-only uses 32K, 64K, 128K, 256K, 512K, 1M, and 2M Caches. : : : : : : : : : : : : : : : 147 6.12 Prefetching Memory Traffic Increase over Cache-only System: L1 Cache Size = 8Kbytes, Number of Stream Buffers = 64, Miss Table Size = 32 entries, L2 Cache Size = 32 Kbytes, M = MTP, L = LBP, P = IAP : : 148 xiii Chapter 1 Introduction Advances in VLSI technology have dramatically increased the speed of processors and memory as well as overall system performance in the last decade. In particular, recent advances in processor architectures [1, 2, 3, 4] and compiler technologies [5, 6, 7] have achieved tremendous computing power, and this trend should continue for the foreseeable future. Increasing computing power demands higher memory performance than ever before, making high-performance memory systems crucial for high-performance computing. Unfortunately, memory speed has not improved as fast as processor speed, and memory access is a major bottleneck in high-performance computing. This memory access bottleneck is more serious in shared-memory multiprocessor systems, where processors and memory units are connected through interconnection networks. Processors cooperate to perform a task and communicate by sharing data. Shared data is accessed by sending and receiving requests to and from memory via interconnection networks. Such memory accesses tend to incur much larger latency than in uniprocessor systems due to interconnection network traversals. Every read and write accessing non-local memory experiences a large latency, which contributes to total execution time. Therefore, reducing memory access latency or hid1 ing the latency is crucial to achieve high performance. A simple approach to reduce memory access latency is to employ a high bandwidth and short latency interconnection network, such as a crossbar. However as the system size grows, not only physical limitations but also costs make such a network infeasible for use in large-scale multiprocessor systems. Many different network architectures have been employed in recent commercial multiprocessor systems. For example, the IBM SP-2 uses a bidirectional multistage shuffle-exchange network [8, 9], the Cray T3D uses a 3-D bidirectional torus network [10], the TMC CM-5 uses a fat-tree network [11], and the Intel Paragon uses a 2-D mesh network [12]. As yet there is no consensus on the best network organization for large-scale multiprocessor systems. This lack of agreement shows the need for an extensive comparative study of various interconnection network organizations in a given target system. Different approaches can be taken in order to reduce the effect of large memory access latency. These include caches, multithreading, and prefetching [13]. Caches have been very effective in certain application domains; however, programs accessing large data sets with little data reuse often show poor cache performance. Moreover, in multiprocessor systems the performance of caches is limited further by cache coherence misses and the loss of spatial and temporal locality in parallel programs. Therefore, in multiprocessor systems, more memory references experience a large latency due to the interconnection network and memory accesses. Data prefetching is an attractive solution to such large memory access latency. In data prefetching, future memory accesses are predicted, and data are moved to the upper levels of a memory hierarchy before they are referenced, thereby hiding memory access latency. However, prefetching has fundamental limitations because of its high memory bandwidth demand and inaccurate prefetch data prediction. The effect of such limitations must be evaluated in detail. 2 This thesis focuses on interconnection networks and data prefetching. In the next two sections, we describe the issues addressed in this thesis and our study goals and contributions. 1.1 Interconnection Networks Selecting an appropriate network for a given high-performance multiprocessor system requires an in-depth study of various aspects of network design and its trade-offs, not only in terms of performance but also of cost. However, very few comprehensive and detailed studies address both the performance and cost of a network for a given system. Moreover, most network performance studies [14, 15, 16, 17, 18] are based on open-loop systems [19] in which feedback effects [20] are completely ignored. As pointed out in [20, 21] feedback effects play an important role in determining achievable network performance. We need to evaluate and compare interconnection networks in terms of performance and cost, and such a study should be based on the actual network performance achievable in a system rather than the maximum possible network performance. This thesis conducts this type of detailed comparative study of interconnection networks. Routing in interconnection networks directly affects the performance and structure of interconnection networks. Shortest path routing is important because it reduces internode distance and eliminates cycles in a message path. If a cycle is allowed in a message path, the cycle creates potential deadlock situations and messages may collide with themselves, which complicates conflict resolution schemes. In single stage shuffleexchange networks, a shortest path exists between two nodes. Although the same routing scheme used in multistage shuffle-exchange networks can be used in single stage shuffleexchange networks, this scheme cannot take advantage of the shortest path. Previous work [22, 23, 24] presented a routing algorithm called fast-finishing, which provides a 3 shorter path than the routing scheme used in multistage shuffle-exchange networks. However, this algorithm requires the network size be a power of the switch size, which make incremental scaling of the network size difficult. This thesis addresses this problem by developing a shortest path routing algorithm and related theorem which allows for a more flexible incremental scaling of network size. 1.2 Data Prefetching Data prefetching is an attractive solution to large memory access latency. However, prefetching has fundamental limitations because of high memory bandwidth demand and inaccurate prefetch data prediction. As pointed out in [25], data prefetching is not effective if cache hit rate is already high without prefetching or if network and memory bandwidth is not sufficient to support it. Data prefetching tends to demand more memory bandwidth. Effective prefetching results in a faster memory access rate by reducing memory access stalls. Since data prefetching may cause additional cache conflict misses by prefetching data too early, and its prediction for future data accesses is not perfect, prefetching tends to increase the total number of memory accesses. Such high memory bandwidth demand of prefetching affects the relative performance of networks by favoring networks with higher bandwidth. Although there are several studies on prefetching in multiprocessor systems [26, 27, 28, 29, 30, 31], there is no detailed quantitative study on prefetching, various network organizations, and their mutual effects. This thesis evaluates quantitatively whether a certain network can provide sufficient bandwidth for effective prefetching and studies different interconnection networks under the heavy traffic caused by prefetching. Prefetching greatly affects other memory access operations, such as writes. Although writes can be overlapped with reads and computations by providing write buffers, intense 4 network traffic generated by prefetching is very likely to delay the completion of write operations. This delay may eventually lengthen program execution time by stalling a processor on write accesses. Therefore, prefetch and write traffic should be controlled to utilize optimally network and memory bandwidth. This thesis addresses the memory traffic control issue and evaluates the effects of different memory traffic control schemes. The increasing speed gap between processors and memory demands more sophisticated hierarchical memory systems. Two-level caches are one example of such memory systems. Conventional high performance systems have a small but fast first-level cache on a processor chip and a second-level larger cache outside of a processor chip. Data prefetching can be used at both levels of a memory hierarchy to hide memory access latency for accessing secondary caches or main memory. Most data prefetching studies [32, 33, 34, 35, 36] focus on first-level, on-chip prefetching. Although some of prefetching schemes can work without any problems at the second-level and off-chip, others such as stride-directed prefetching [32, 33, 34] may not work effectively. Stride-direct prefetching is necessary to prefetch data for long stride memory accesses and is effective at the first-level and on-chip. However, at the second-level of a memory hierarchy and off-chip, instruction addresses are not easily available and only first-level cache misses are visible. These make stride-directed prefetching difficult. This thesis develops and measures the performance of prefetching schemes that effectively perform stride-direct prefetching at the second-level and off-chip. Prefetching may replace large second-level caches as studied in [37] or prefetching can be used with second-level caches as in [38]. Though at least these two different secondlevel memory organizations were proposed for prefetching, no clear conclusion can be made as to what is the best second-level memory organization to use with prefetching. This thesis evaluates and compares the performance of different second-level memory organizations with prefetching in uniprocessor systems. 5 1.3 Thesis Overview This dissertation is organized as follows. Chapter 2 presents the background for this dissertation. First, we discuss issues in interconnection network design and evaluation. Three interconnection network topologies are described: multistage and single stage shuffle-exchange networks and multidimensional torus networks. We also present various data prefetching approaches and then describe our evaluation methodology in detail. Chapter 3 establishes a theoretical framework for routing in shuffle-exchange networks, and extends that work to derive a routing algorithm that finds a shortest path between nodes in single stage shuffle-exchange networks. The theorem and routing algorithm allow network size to be any multiple of the switch size. The performance improvement achieved with shortest path routing is evaluated. The routing scheme is also used later in comparing single stage shuffle-exchange networks with other networks. Chapter 4 compares multidimensional torus networks and multistage and single stage shuffle-exchange networks by varying system size, switch size and channel width. We evaluate these different networks under three constraints: fixed switch size and channel width, constant number of switch pins, and constant network cost. By employing tracedrive simulation of an entire system, the interconnection network performance and design trade-offs are studied in great detail. Chapter 5 evaluates the relation between prefetching and interconnection networks. We quantitatively compare network performance with and without prefetching. In addition, the design of a network interface is evaluated. The interface controls the rate at which memory requests are issued to the network and memory in order to achieve the optimal utilization of network and memory bandwidth. Chapter 6 evaluates data prefetching at the second-level of a memory hierarchy in uniprocessor systems. Assuming an implementation external to a processor chip, we 6 develop a new prefetching scheme which enables stride-directed prefetching at the secondlevel of a memory hierarchy and off-chip. We evaluate and compare three different secondlevel memory organizations with prefetching. These are traditional caches, prefetching without caches, and prefetching with a small cache. Finally, this dissertation is concluded in Chapter 7. 7 Chapter 2 Background This chapter presents background information for this dissertation, and describes the evaluation methodology used in this study. The first section discusses network evaluation and design issues and describes three different interconnection network structures used in this study. Flow control methods and deadlock-free routing are also briefly described. The second section surveys data prefetching methods and discusses the characteristics of different data prefetching methods and the relation between data prefetching and memory bandwidth. The last section describes the evaluation method employed, including benchmarks, trace generation, and simulation models of various system components. These methods are applied through Chapter 3 and Chapter 5. Chapter 6 uses the same trace generation method, but different benchmarks and system models. These are described in detail in that chapter. 2.1 Interconnection Networks In the implementation of interconnection networks, physical resources impose limitations on interconnection network structure. Among various resources, pins and wiring area are considered the most limiting factors in network design. Limits on the number of pins and 8 wiring area restrict the size of a switch used as a network building block and network channel width. Switch size K (or KxK) means a switch has K input ports and K output ports. Recent network studies [39, 40, 41, 42, 43, 44, 45] have incorporated such design constraints into their network evaluation. A message reaches its destination by traversing several switches. One hop is a traversal of one switch by a message. Average internode distance is the number of hops a message travels, on average, in uniform message routing [46]. In uniform message routing, the probability of source node i sending a message to destination node j is the same for all i and j, i 6= j. Every time a message travels through a switch, the message experiences a delay, which we refer to as switch latency. Even if there is no contention, minimum switch latency is required for a message to pass through a switch. In addition to switch latency, when messages need to traverse more hops, this tends to increase network contention. Therefore, average message path length, which is defined as an average number of hops a message traverses during program execution, directly affects network latency. The smaller the average message path length is, the more likely the network has a short latency. Average message path length is affected by average internode distance. When the traffic pattern of memory request and reply messages is completely random, the average internode distance is the same as the average message path length. In non-uniform memory access (NUMA) systems, it is possible to achieve a smaller average message path length than the average internode distance by carefully partitioning data and computations. However, it is still very likely that the average message path length will be proportional to the average internode distance. For a given network topology and system size, switch size determines average internode distance. System size (or network size) is the number of processors, which also is the 9 number of memory modules. For a given clock speed, channel width determines channel bandwidth, which represents the amount of data that can be transferred between two adjacent switches connected by the channel in a given time period. Channel bandwidth affects the time a channel is used for a message transfer. When more time is needed for a message transfer, it increases the possibility of contention and the penalty of contention, i.e., the waiting time for other messages to access the same channel. Since channel width determines channel bandwidth for a given clock speed, we use channel width and channel bandwidth interchangeably throughout this dissertation. Switch size and channel width consume the same resources: pins and wiring area. Given a fixed number of pins and a constant wiring area, increasing the switch size results in a narrower channel width. Therefore, a design trade-off exists between switch size and channel width. In [39], wiring area limitation is used to evaluate this trade-off. Constant bisection width is used in this evaluation. Bisection width [39, 47] is defined as the minimum number of wires cut when a network is divided into two equal halves. Constant bisection width represents wiring area constraints. When an interconnection network is implemented in a single VLSI chip, both pins and wiring area are limited. However, when several VLSI chips and boards are used to construct an interconnection network, pins are a more constrained resource due to packaging limitations [40, 48, 49]. Agarwal [40] evaluated design trade-offs based on such pin constraints. Other studies [41, 42, 43, 44, 45] also addressed such design trade-offs in pin, wiring constraints, or both. In this dissertation, we evaluate three different interconnection networks: multidimensional torus (TORUS) networks, multistage stage shuffle-exchange (MSX) networks and single stage shuffle-exchange (SSX) networks. We assume a system size from 64 to 256 processors. In such systems, we claim that the interconnection can be implemented ignoring wiring area, because pins are a much more limited resource. We use three con10 ( 0, 0, 0 ) ( 0, 0, 1 ) ( 0, 0, 2 ) ( 0, 1, 0 ) ( 0, 1, 1 ) ( 0, 1, 2 ) ( 1, 0, 0 ) ( 1, 0, 1 ) ( 1, 0, 2 ) ( 1, 1, 0 ) ( 1, 1, 1 ) ( 1, 1, 2 ) Figure 2.1: 12-node 3-D Torus Network: Each dimension has 3, 2 and 2 nodes, respectively straint models: fixed switch size and channel width, constant number of switch pins, and constant network cost. The network cost is based on pin constraint models. In next two sections, we briefly describe the three network topologies. 2.1.1 Multidimensional Torus Networks The topology of a multidimensional torus network is a k-ary n-cube [39] with wraparound connections. In an n-dimensional torus, each node can be expressed as a ntuple, (i0; i1; : : : ; in\Gamma 1), where 0 ^ ik ! nk and nk is the number of nodes in the kth dimension. Each number ik in the n-tuple corresponds to the node's position in the kth dimension. Node (i0; i1; : : : ; ip; : : : ; in\Gamma 1) is connected to (i0; i1; : : : ; iq; : : : ; in\Gamma 1), where ip = iq \Sigma 1 mod nk, and nk is the number of nodes in the dimension. It is possible that the number of nodes in each dimension may be different as long as the product of the number of nodes in each dimension is equal to the total number of nodes. This allows torus networks to scale more incrementally. The number of nodes in each dimension for a given system size can be determined so as to minimize the average 11 internode distance of the network. For example, a 128-node 2-D torus has 8 and 16 nodes in each dimension, instead of other combinations. Figure 2.1 shows a 12-node 3-D torus, which has 2, 2, and 3 nodes in each dimension. Messages can be routed to traverse each dimension in order. In one of the simplest routing methods, called dimension-order routing [50], a message is routed first in the highest dimension and then in the next highest dimension and so on. Within each dimension k, a message travels in one direction until it reaches the node whose address digit ik is the same as that of the destination node. After that, the next dimension to travel is selected in a fixed order. If links are bidirectional, the direction which leads to the shortest path is selected. 2.1.2 Multistage and Single Stage Shuffle-Exchange Networks A K-ary multistage shuffle-exchange network [51, 52, 53] consists of dlogK N e shuffleexchange stages. Each stage has N input and N output terminals that are connected to N output terminals of the previous stage and N input terminals of the next stage, respectively, as shown in Figure 3.1. In a stage, there are N=K crossbar switches of size K, i.e., the switch has K inputs and K outputs. The N input terminals of a stage are connected to the input ports of the switches through N links. These N link connections form a K-ary shuffle pattern. Nodes are connected to the network through the input terminal of the first stage or the output terminal of the last stage. In multistage shuffle-exchange networks, messages need to travel dlogK N e stages to reach their destination. When a network size is a power of the switch size, only one path exists between any two nodes, whereas when the network size is not a power of the switch size, multiple paths may exist for some pairs of nodes. A single stage shuffle-exchange network has only one stage. The output terminals of the stage are connected to the input terminals of the stage as shown in Figure 3.2. Nodes 12 are multiplexed onto the same links which connect both the input terminal and output terminals. Messages recirculate several times through a single stage shuffle-exchange network to reach their destinations. Since each node is directly connected to other nodes through a switch, messages may reach their destination with less than dlogK N e traversals. As in the multistage shuffle-exchange networks, multiple shortest paths may exist for some pairs of nodes when the network size is not a power of the switch size. When the system size is a power of the switch size in shuffle-exchange networks, the destination node address can be used as a routing tag without modification. When a message moves through a shuffle link, the message moves from address (an\Gamma 1; an\Gamma 2; : : : ; a1; a0) to address (an\Gamma 2; : : : ; a1; a0; an\Gamma 1), which is the other side of the link. After exchange routing in a switch, the message reaches the switch output port whose address is (an\Gamma 2; : : : ; a1; a0; dn\Gamma 1), where dn\Gamma 1 is one of the digits in the destination address and is used to select the corresponding output port of the switch. When the network size is not a power of the switch size, we cannot use the destination address as a routing tag. However, a routing tag can be generated for path selection in such shuffle-exchange networks. A related theorem and algorithm are described in detail in Chapter 3. 2.1.3 Flow Control and Deadlock When switches have a limited amount of queues, the message flow should be controlled so as not to overflow a switch. In store-and-forward routing [54], a message is completely stored before it is sent to the next switch. When a message size is large, this scheme increases routing time significantly. Other approaches are wormhole routing [55] and virtual cut-through [56] routing. In both schemes, a message advances to the next switch without waiting for the entire message to be stored if a corresponding channel is not busy. These methods are different in that when a message is blocked, the message stops advancing in wormhole routing, whereas in virtual cut-through routing, the message 13 keeps advancing forward until the entire message is stored in the next switch. Virtual cut-through routing is used throughout this thesis. In multidimensional torus networks and shuffle-exchange networks, deadlock situations may develop. Deadlock can be avoided by using various approaches proposed previously. These are structured buffer pools [54], virtual channels [55], deflection routing [57], Chaos routing [58], and abort-and-retry [59, 60]. The deadlock problem and the effect of deadlock-free routing on network performance is beyond the scope of this thesis. In our evaluation, we use infinite queues to avoid deadlock problems. However, the performance of networks measured should not be significantly different from that of networks using a deadlock-free routing technique, such as structured buffer pools or virtual channels, as long as a large queue is used with such methods [61, 17]. 2.2 Data Prefetching In data prefetching, future memory accesses are predicted and data are moved to upper levels of a memory hierarchy. Data prefetching can be broadly classified into three groups: hardware data prefetching, software data prefetching, and hybrid data prefetching. In the next three sections, we introduce these three prefetching schemes. In Section 2.2.4, we discuss the relationship between data prefetching and memory bandwidth. 2.2.1 Hardware Data Prefetching In hardware data prefetching, a hardware prefetching unit determines prefetch data addresses and initiates prefetches. Depending on the complexity and capability of the prefetching hardware to predict future data accesses, hardware prefetching schemes fall into two groups. 14 2.2.1.1 Tagged Prefetching Tagged prefetching [36] is simple and effective, but limited in predicting future data accesses. This scheme depends on the spatial locality of memory accesses. In tagged prefetching, whenever a cache line is accessed for the first time, the next line is prefetched. Therefore, either a cache miss or the first access to a prefetched line generates a prefetch for the next line. Another similar approach is stream buffers [35], in which a stream buffer is allocated when there is a cache miss. When a stream buffer is allocated, the line following the line containing the cache miss address is prefetched. Once stream buffers are allocated, if there is a hit in a stream buffer, the line following the last line stored in the stream buffer is prefetched. DO I = 1, N \Delta \Delta \Delta = A(I) \Delta \Delta \Delta = B(4*I) ENDDO Example 2.1: A Loop Example When the code shown in Example 2.1 is executed and the cache line size is one word, the memory accesses and prefetches which resulted from tagged prefetching are shown in the following examples: Memory accesses: A(1), B(4), A(2), B(8), A(3), B(12), : : : Prefetch addresses: A(2), B(5), A(3), B(9), A(4), B(13), : : : For the stride one accesses to array A, tagged prefetching successfully prefetches the data to be used in the next iteration. However, for the accesses to array B, tagged prefetching generates only unnecessary prefetches. Tagged prefetching is not effective for accesses whose stride is larger than twice the cache line size. 15 Several methods have been proposed [37, 31, 62] to reduce the number of unnecessary prefetches in tagged prefetching or stream buffers. In these methods, the next line is not prefetched until a specific memory access pattern, such as accesses to consecutive lines, is detected. 2.2.1.2 Stride-Directed Prefetching Stride-directed prefetching has been proposed in several previous papers [32, 33, 34]. In this scheme, the stride of memory accesses is detected and used for data prefetching. If memory is accessed with a constant stride, stride-directed prefetching can successfully prefetch data for such memory accesses. In this scheme, first a memory reference stream is identified. A memory reference stream is a sequence of data addresses generated by a single memory reference instruction. For example, the accesses to array B in Example 2.1, B(1), B(4),: : :, B(4\Theta N), belong to the same memory reference stream. Once such a memory reference stream is detected, the stride of the memory access can be obtained by comparing consecutive data addresses generated by the corresponding memory reference. This stride information is used to predict future data accesses. The following lines show the prefetch addresses generated by stride-directed prefetching for Example 2.1: Memory accesses: A(1), B(4), A(2), B(8), A(3), B(12), : : : Prefetch addresses: A(3), B(12), A(4), B(16), : : : During the second iteration of the loop, for each memory reference stream, prefetching hardware compares the previous data address and the data address of this iteration. For example, B(4) and B(8) are compared and the stride information is obtained. The stride, 4, is added to the address of B(8) and used to prefetch B(12). 16 Most previously proposed methods [32, 33, 34] use instruction addresses to identify memory reference streams. These methods use a table called the Reference Prediction Table (RPT). Memory reference instructions are mapped into entries of the table. The table keeps an instruction address, a data address, and a stride in each of its entries. Every time a memory access is generated by a memory reference instruction, the instruction address is used to index the table and the data address to obtain a stride. In another approach, proposed in [37], memory reference stream detection is attempted without instruction addresses for off-chip prefetching implementations. This method uses a non-unit stride filter that attempts to detect a memory reference stream and a stride. The filter uses the misses that fall into the same address space partition. The partition size is determined by programmers or compilers. 2.2.2 Software Data Prefetching In software data prefetching [63, 29, 64, 65], prefetching instructions are explicitly inserted in programs. If data access patterns can be detected at compile time, this scheme can prefetch data for any memory access pattern. Example 2.2 shows how prefetch instructions are added to the original code. On every iteration of the loop, the prefetch instruction is executed to prefetch data that is used in the next iteration. prefetch(A(1)) DO I = 1, N DO I = 1, N \Delta \Delta \Delta = A(I) prefetch(A(I+1)) ENDDO \Delta \Delta \Delta = A(I) ENDDO Example 2.2: Original Loop and Transformed Loop for Prefetching The execution of prefetch instructions may increase program execution time. Also, additional registers are needed to calculate and maintain the addresses of data to be 17 prefetched; this need may cause more register spills. Since one prefetch fetches a cache line which may be accessed several times, prefetch instruction execution can be reduced by eliminating prefetches that may fetch data already in the cache. As in Example 2.3, the number of prefetch instructions executed can be reduced by unrolling the loop as many times as the cache line size. Supposing that the cache line size is 4 words, this approach reduces the overhead of the prefetch instruction execution to one quarter of that in the previous example. prefetch(A(1)) DO I = 1, N, 4 prefetch(A(I+4)) \Delta \Delta \Delta = A(I) \Delta \Delta \Delta = A(I+1) \Delta \Delta \Delta = A(I+2) \Delta \Delta \Delta = A(I+3) ENDDO Example 2.3: Loop Transformed to Reduce Unnecessary Prefetching Mowry [66] developed a compiler algorithm to reduce the overhead of prefetch instruction execution. His scheme is based on data reuse and locality analysis so that prefetch instructions are added for the memory accesses that are very likely to generate cache misses. Code transformations, such as loop unrolling, are performed to eliminate redundant prefetches. Although this selective software prefetching scheme can reduce unnecessary prefetch instruction execution, when memory references do not have good spatial and temporal locality, the instruction execution overhead cannot be reduced so easily. For example, if memory references have a stride that is larger than the cache line size, loop unrolling is not very useful. In addition to the overhead of the prefetch instruction execution, 18 prefetches tend to compete with loads or stores for access to load/store units, which are a relatively scarce resource in most processor architectures. 2.2.3 Hybrid Data Prefetching In hybrid prefetching [67, 68], code is produced at compile-time to generate information on memory access patterns. The information is stored in a separate table and is later used by hardware to prefetch data. Such code is inserted outside a loop and is executed once for the entire loop. When the loop is executed, the table is indexed with the instruction addresses of the memory references and prefetch requests are generated accordingly. In a similar approach proposed in [69], prefetching hardware performs data prefetches autonomously by using additional loop bound information. Gornish [31] proposes another hybrid method in which a compiler generates information on prefetch degree for each memory reference. The prefetch degree is used to prefetch data several iterations ahead in the execution of a loop. The prefetch degree is defined as the number of lines in advance of the first reference to a line which is prefetched. This method can improve prefetching efficiency by reducing the time between the prefetch of a datum and the use of the datum. 2.2.4 Data Prefetching and Memory Bandwidth Data prefetching incurs overhead by demanding higher network and memory bandwidth than would be required by the system without prefetching. Ideally, if prefetching covers all memory accesses, and the prefetch requests are pipelined effectively in the memory and network to keep pace with a processor's data access rate, then any memory access latency can be hidden completely by prefetching data early enough. In reality, complete coverage is impossible, and unnecessary prefetches may be generated due to incorrect prefetch data prediction. In addition, prefetched data is stored in a cache of limited capacity. If data is 19 prefetched too early, it can evict useful data from the cache, causing additional memory accesses. Therefore, prefetching tends to generate more memory accesses. Furthermore, effective prefetching results in a faster memory access rate by reducing memory access stalls. This causes more intense memory access traffic. Since prefetching cannot cover all read accesses, some reads still access main memory. Prefetching may delay such read accesses due to limited memory and network bandwidth, offseting its benefits. It may even degrade the overall system performance, particularly when unnecessary prefetches consume significant bandwidth. In general, prefetching is effective only when there is sufficient network and memory bandwidth available to support it. 2.3 Evaluation Methodology In this section, we discuss our evaluation method, including trace generation, simulation models and benchmarks. The simulation models and benchmarks are used from Chapter 3 through Chapter 5. In Chapter 6, different simulation models and benchmarks are used, which are described in that chapter. 2.3.1 Trace Generation Traces are obtained via instrumentation and execution of benchmark programs. Programs are instrumented by the MIPS tracing tool [70], compiled with a MIPS optimizing Fortran compiler and executed on a MIPS M/120 processor system. When executed, the code instrumented by the MIPS tracing tool generates information on memory references and the elapsed time between such references, as well as information about parallel loop execution. The trace is then processed by a tool which reorders loop iterations via a static scheduling algorithm which assigns iterations to processors: ith processor gets the 20 ith, (i + N )th, (i + 2 \Lambda N )th .... loop iterations. All sequential execution is performed by processor 0. 2.3.2 Benchmarks Our application domain is computationally intensive numerical applications under a DOALL computational model [70]. These applications usually have large data set sizes and large amounts of data communication between computations. Most of them can be parallelized using DOALL parallel loops. We select our benchmarks from PERFECT [71] and NAS benchmarks [72]. These are ARC3D, FLO52, TRFD, MDG and MG3P. ARC3D and FLO52 are used to solve 3-D and 2-D CFD problems, respectively, and TRFD and MDG are used for two-electron integral transformations and molecular dynamics problems, respectively. MG3P implements a 3-D multigrid algorithm. Selected subroutines, which account for a large fraction of program execution time, are traced. Initially, parallel versions of the programs that ran on the CEDAR [73] multiprocessor were selected. These benchmarks were further modified to have better parallelism and cache performance through the introduction of local variables, loop interchange and unrolling. All parallelism is expressed in terms of DOALL loops. Table 2.1 shows the characteristics of each benchmark. The number of read messages is shown for a 128 processor system. The number changes with the number of caches in a system. The other measures are the same regardless of system size. When we trace a subroutine, this trace size tends to be small. However the size of a trace does not affect our results. For example, FLO52 has the smallest trace size because the trace contains only one execution of the EFLUX subroutine. EFLUX is executed 2514 times during the execution of a whole program. In each execution of EFLUX, the memory system is flushed by emptying the caches and network at synchronization points, 21 Benchmark Subroutines Global Read Global Write Read Message Write Message traced Access (M) Access (M) Generated(M)1 Generated(M) FLO52 EFLUX 0.725123 0.263424 0.160802 0.263424 MDG INTERF 4.550483 1.329371 1.098652 1.329371 TRFD Whole Prog 7.628555 0.267484 0.353330 0.267484 ARC3D STEP 2.675342 0.561258 0.438169 0.561258 MG3P Whole Prog 3.355304 0.192632 0.161779 0.192632 Table 2.1: Benchmark Characteristics which occur at several places, including the end of the last loop in EFLUX. Therefore, each execution of EFLUX exhibits the same cache, network and memory behavior. In such cases we trace only one execution of a subroutine, even though it generates only a small trace. 2.3.3 Simulation Models We evaluate interconnection networks in a shared memory system environment. Since each system component affects message traffic in interconnection networks, it is crucial to model all the components. In this section, we discuss these components in detail and describe benchmarks and trace generation. As shown in Figure 2.2, our system consists of scalar processors, caches, memories, and an interconnection network. 2.3.3.1 Shared Memory and Cache The shared memory is physically distributed and directly addressable by each processor. Weak ordering is used, which allows memory requests to be issued and completed out of order [74]. Every write is acknowledged to achieve weak ordering. The memory system is composed of interleaved and pipelined high-speed memory modules that store shared data. These memory modules are interleaved by cache line size. 1for system size 128 22 PROC CACHE MEM DMUX PROC CACHE MEM DMUX PROC CACHE MEM DMUX INTERCONNECT NETWORK Figure 2.2: System Architecture Memory operations are pipelined so that a memory module starts its operation while accepting and assembling the next message. The access latency of a memory module is 4 cycles. The memory cycle time is proportional to the length of a request message or a reply message, whichever is longer, because the memory does not accept a new request message until it finishes receiving the previous request message from the network or sending its reply message back to the network. We use a direct-mapped, write-though, no-write-allocate cache. The cache size is 8 Kbytes, the line size is 4 words, and the word size is 8 bytes. The cache takes one cycle to service a cache hit request from a processor. We use a simple cache invalidation method proposed in [75] to solve cache coherence problems. In this method, all caches are flushed at synchronization. A 64-entry write buffer is used to minimize processor's stall on a write. When a write buffer is full, a processor stalls on both writes and reads. On a read miss, a processor stalls until the request is satisfied. On a write, a processor continues as soon as the write buffer accepts the write, which takes 1 clock cycle. Only cache misses and writes generate request messages to the network. At most one outstanding read and one outstanding write request are allowed simultaneously in the network for a cache and write buffer. Read requests have priority over write requests on 23 accessing the network. If an address of a read matches an address of a write in the write buffer, the read request is not issued to the network until the all writes in the write buffer are processed and acknowledged. When a synchronization operation is performed, all pending read and write requests are completed first. This includes issuing all write requests in a write buffer to the network and waiting for acknowledgment messages for all outstanding memory requests in order to maintain the weak consistency. A read request message (8 bytes) consists of only a message header; a write request message (16 bytes) has a message header and one word. A write reply message (8 bytes) from a memory has only a message header, and a read reply message (40 bytes) has a message header and a line that contains 4 words, starting with the word requested by the processor. A request message is disassembled into flits [55] and sent out to the network. The size of a flit is determined by network channel width. A message is assembled when it arrives from memory before it is forwarded to a cache. If it is a read reply message, the word requested by a processor is forwarded to the processor as soon as the first data word is assembled from the message. Thus, the processor resumes its operation without waiting for an entire read reply message to be assembled. We assume all non-shared data and instructions are stored in local memory. Thus, only memory references to shared data are accessed through the network. 2.3.3.2 Scalar processor We assume a parallel system based on a modern RISC scalar processor. The instruction execution is modeled to derive timing information for use in simulation. We use a MIPS R3000/R3010 to obtain the timing information. Most instructions execute in one cycle with the exception of integer multiplication and division, floating-point addition, multi24 IN OUT Figure 2.3: Non-Blocking Switch plication and division, and a few other instructions. One difference is that the word size, the address bus and the data bus are assumed to be 64 bits instead of 32 bits. These address and data buses are directly connected to a cache. 2.3.3.3 Switch A non-blocking switch model is used [76, 77, 78] (see Figure 2.3). In this switch, a number of queues equal to the number of output ports are associated with each input port. On message arrival, an output port is selected by its destination tag, and the message is stored in the corresponding input queue. Since only messages destined to the same output port are stored in the same queue, there is no head-of-line (HOL) blocking. The switch model supports the virtual cut-through flow control scheme [56]. In this scheme, a switch does not need to wait for a whole message to be received before it can start to send the message out. Thus, if there is no contention and no previous messages in the queue, the message experiences only a minimum switch latency. A minimum latency for selecting a destination port and accessing a queue in a switch is 3 cycles. A message is completely buffered in a switch if it cannot move forward. 25 Node Node Node Node Node Node NodeNodeNode PROC CACHE MEM SWITCH NODE ARCHITECTURE DMUX Figure 2.4: Multidimensional Torus Network System In this study, we use unlimited queue size in a switch. This gives us an upper bound on network performance. Other network studies have found that there is not much difference in the performance of networks with unlimited queue size and with a reasonable queue size [61, 17]. A snapshot mechanism and fixed priority arbitration are used to select a message among several messages destined to the same output port. At each output port, a snapshot of all messages requesting access to the same output port is taken once the port becomes free, and then all messages are serviced with a fixed priority. Fairness is enforced between snapshots because no other message is serviced until all messages recorded in a snapshot are serviced. 2.3.3.4 Networks We study three different network topologies: multidimensional torus networks (TORUS), multistage shuffle-exchange (MSX) networks and single stage shuffle-exchange (SSX) networks. A torus network (Figure 2.4) uses bidirectional links, implemented by a pair of unidirectional in- and out-links of a switch, which can transfer messages in both directions 26 MEM PROC MEM PROC MEM PROC MEM PROC MEM PROC MEM PROC MEM PROC MEM PROC SW SW SW SW SW SW SW SW SW SW SW SW DMUX DMUX Figure 2.5: Multistage Shuffle-Exchange Network System simultaneously. The routing scheme is based on dimension-ordered routing. In each dimension, the shortest path is selected between two routing directions. Each switch has one out-link and in-link dedicated to a processor and memory connection. A processor with a cache and a memory share the links. A multiplexor and demultiplexor module (DMUX) is used to separate messages destined to a processor or a memory unit. A system with multistage shuffle-exchange networks (Figure 2.5) uses one unidirectional multistage network for forward traffic from processors to shared memory and backward traffic from shared memory to processors. Thus, a processor and a memory share links to the network through the DMUX that is connected to the first and last stage of the network. We use a tag-based distributed routing algorithm proposed in [79]. The single stage shuffle-exchange network (Figure 2.6) consists of only one shuffleexchange stage. A processor and a memory module is attached to a link of the switch through a multiplexor and demultiplexor (DMUX). This construction is used in many studies of single stage shuffle-exchange networks [80, 81]. A shortest path routing algorithm proposed in [82] is used. Wires between switches incur delays. We use one cycle for the wire delay. When a DMUX is used for a network, the DMUX causes an additional delay. Since the DMUX 27 PROC MEM PROC MEM PROC MEM PROC MEM PROC MEM PROC MEM PROC MEM PROC MEM DMUX DMUX SW SW SW SW Figure 2.6: Single Stage Shuffle-Exchange Network System is simpler than a switch, we assume one cycle for the minimum DMUX latency. The DMUX has infinite queues. Although the infinite queues shift a part of switch queueing delay to the DMUX queueing delay, this does not affect our conclusions. 28 Chapter 3 Shortest Path Routing in Single Stage Shuffle-Exchange Networks 3.1 Introduction Among various interconnection network architectures, shuffle-exchange networks [83, 51, 52, 53] have been one of the most popular architectures. These networks have distributed self-routing capabilities, and when network size is increased, the internode distance and the number of switch components are increased logarithmically. These features make shuffle-exchange networks suitable for large-scale multiprocessor systems. Shuffle-exchange networks can take two major configurations: multistage and single stage networks. The multistage network shown in Fig 3.1 consists of dlogK N e shuffleexchange stages, where N is a network size, and K is a (crossbar) switch size. The crossbar switch is a basic building block of the network. The single stage network consists of only one stage that has a circular connection between its input and output terminals, as shown in Figure 3.2. 29 Both types of networks use a common routing algorithm. For network sizes equal to a power of the switch size, the algorithm uses a destination address as a routing tag without modification. Although this simple routing tag generation is an attractive feature of shuffle-exchange networks, the network size restriction it imposes is a serious limitation on incremental network scalability. When we want to increase the size of a network, the new size has to be K times larger. In [83], a new approach is taken to allow a more flexible network size which can be a composite number instead of a power of K. In this approach, network size needs to be factored into r numbers so that each network terminal number can be expressed as an r-tuple. The switch size at each stage corresponds to one of r numbers, implying that it may need a different switch size depending upon how the network size is factored. Still, the increased network size needs to be a multiple of the previous network size. Padmanabhan lifted the limitation of network size from shuffle-exchange network routing, allowing a more flexible increase in network size. In [45, 53], he laid out a theoretical framework for a routing scheme requiring only that the network size be a multiple of K and investigated the properties of the scheme. Based on this work, a routing tag can be generated from source and destination addresses and all possible multiple paths can be detected. In Padmanabhan's routing scheme, which we refer to as multistage routing, dlogK N e hops are required to reach a destination for both multistage and single stage networks. One hop is equal to one stage traversal. In a single stage network, a node is connected to a input terminal of a switch leading directly to other neighboring nodes whose input terminal is connected to the same switch. A message needs to traverse a shuffle-exchange stage (a switch and a link) dlogK N e times or less in order to reach its destination. The direct connection structure and recirculation of messages in single stage networks, as opposed to multistage networks, allows a routing algorithm that provides the shortest path between nodes. Shortest path routing in single 30 stage networks is important because it reduces internode distances and eliminates cycles in a message path. If a cycle is allowed in a message path, it creates potential deadlock situations, and messages may collide with themselves to complicate conflict resolution schemes. In this chapter, we develop an algorithm that finds a routing tag for the shortest path in single stage networks. Although a fast-finishing routing algorithm was proposed in [22, 23, 24] to find shorter routes in single stage networks, it is limited to network sizes which are a power of K. In addition it has not been shown whether such a method guarantees the shortest path. The algorithm compares the destination and source addresses to find a matching pattern in both addresses. Suppose that the destination address is MnMn\Gamma 1 : : : M0Tm : : : T0 and the source address is Sm : : : S0MnMn\Gamma 1 : : : M0 such that there is a matching pattern MnMn\Gamma 1 : : : M0. Then, the unmatched address digits Tm : : : T0 are used for routing messages. Therefore, only a number of hops equal to the number of the unmatched address digits is necessary, as opposed to logK N hops. In this chapter, we extend and generalize Padmanabhan's work to provide a theoretical background for shortest path routing in single stage networks. The network size can be any multiple of K. An algorithm is presented for the routing tag generation. We evaluate the performance improvement achieved with the shortest path routing algorithm over the multistage routing algorithm in single stage networks. This chapter is organized as follows. In Section 3.2, we establish a theoretical framework on routing in shuffle-exchange networks and derive a shortest path routing algorithm for routing in single stage shuffle-exchange networks. We evaluate the characteristics and performance impact of the shortest path routing scheme on single stage shuffle-exchange networks in Section 3.3. We conclude this chapter in Section 3.4. 31 0 1 2 3 4 5 6 7 8 9 10 11 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 0 2 3 SW SW SW SW 1 0 2 3 SW SW SW SW 1 0 2 3 SW SW SW SW Stage 1 Stage 2 0 1 2 3 4 5 6 7 8 9 10 11 Stage 0 Stage 1Output terminals ofStage 1Input terminals of Figure 3.1: Multistage Shuffle-Exchange Network 3.2 Routing in Shuffle-Exchange Networks First, we introduce a theorem for routing in multistage networks. Routing in single stage networks can be considered a special case of the theorem. Based on this theorem, we develop an algorithm to find a routing tag for one of several shortest paths in single stage networks. Later, we extend the theorem for the shortest path routing in generalized de Bruijn Digraphs [84], which is another variant of single stage network architectures. 3.2.1 Network Structure A K-ary shuffle-exchange multistage network provides connections between N input terminals and N output terminals. The network consists of several shuffle-exchange stages. Each stage has N input and N output terminals that are connected to N output terminals of the previous stage and N input terminals of the next stage, respectively, as shown 32 1 0 2 3 SW SW SW SW 0 1 2 3 4 5 6 7 8 9 10 11 Stage 0 Figure 3.2: Single Stage Shuffle-Exchange Network in Figure 3.1. In a stage, there are N=K crossbar switches of size K (K inputs and K outputs). The N input terminals of a stage are connected to input ports of the switches through N links. The N link connections form a K-ary shuffle pattern. Messages are injected at the input terminals of a network, which are the input terminals of the first stage, and are delivered to the output terminals of the network, which are the output terminals of the last stage. As it is shown in the following theorems and corollaries, dlogK N e stages (hops) are needed for any network output terminal to be reachable from any network input terminal. A single stage network consists of only one stage. The stage output terminals are reconnected to the stage input terminals as shown in Figure 3.2. Messages are injected at the network input terminals and circulate in the network to reach their destinations. The output terminals can be reached in dlogK N e hops or less because the input and output terminals are directly connected through switches. 33 First, we define the shuffle connection in a stage using a definition from Padmanabhan [45, 53]. Definition 1 (Shuffle Connection) Let N be a multiple of K. Then, the K-ary shuffle of N terminals is given by ss(i) = (Ki + bKi=N c) mod N; 0 ^ i ! N: where terminal i maps to terminal ss(i). In each stage of a shuffle-exchange network, input terminal i of the stage is connected to switch input port ss(i) of the stage. A message starting from terminal i reaches the switch input port of address ss(i) after moving through a link of the shuffle connection. The exchange routing function is performed at a switch where a routing tag T is used to select a requested output port. A switch takes the most significant digit from the routing tag T in the radix-K number representation and uses it to select a switch output port. The routing tag T shifts by one digit to eliminate that most significant digit. For a multistage network, where the number of stages is fixed by its architecture, the tag T has the same number of digits as the number of stages. For a single stage network, the number of traversals of the network can vary depending on the source and destination, and thus vary the number of digits in T . 3.2.2 Multistage Shuffle-Exchange Networks Routing in multistage networks differs from that in single stage networks. In this section, a routing theorem for multistage networks is introduced based on the definitions in the previous section. The theorem provides a theoretical background not only for multistage routing in multistage networks but also for shortest path routing in single stage networks. 34 In addition, we investigate a fault-tolerance property of multistage networks by extending the theorem. We start with a few lemmas. Lemma 1 Let N be a multiple of K. The K-ary shuffle permutation can be specified by ss(i) = Ki mod N + bKi=N c; 0 ^ i ! N: Ki mod N is a multiple of K, and bKi=N c is the least significant digit of ss(i) in a radix-K number representation. Proof: Let m = Ki mod N and bKi=N c = t, that is, Ki = CN + m, where C * 0, and 0 ^ m ! N . Since 0 ^ i ! N , 0 ^ bKi=N c = t ! K. From Definition 1, ss(i) = (Ki + bKi=N c) mod N = (CN + m + t) mod N = (m + t) mod N: We will show that m + t ! N . Since Ki and N are multiples of K, m(= Ki \Gamma CN ) is also a multiple of K, that is, Ki mod N is a multiple of K. Because both N and m are multiples of K and m ! N , K ^ N \Gamma m. Now, we have t ! K ^ N \Gamma m, and therefore m + t ! N . Since m + t ! N , we have ss(i) = (m + t) mod N = m + t = Ki mod N + bKi=N c: 35 Let ss(i) be represented in the radix-K number system, i.e. ss(i) = (mn; mn\Gamma 1; : : : ; m0)K. From the above, bKi=N c ! K, and Ki mod N is a multiple of K, i.e, Ki mod N = (mx; mx\Gamma 1; : : : ; 0)K. Thus, bKi=N c = m0 and mx = mn; mx\Gamma 1 = mn\Gamma 1 : : : Therefore, bKi=N c is the least significant digit of ss(i) in the radix-K number representation. 2 In the above lemma, we gave a new function describing the shuffle permutation, and examined how each term is related to the radix-K representation of ss(i). Note that (Ki mod N )=K and bKi=N c correspond to the switch number in a stage and an input port number in a switch, respectively, as shown in Figure 3.1. Lemma 2 A message starting at input terminal i of a stage and given an one-digit routing tag t0 reaches output terminal SX(i; t0) of the stage specified by SX(i; t0) = Ki mod N + t0 = (Ki + t0) mod N: Proof: After a K-ary shuffle, terminal i maps to terminal (mn; mn\Gamma 1; : : : ; m1; m0)K , where Ki mod N = (mn; mn\Gamma 1; : : : ; m1; 0)K and m0 = bKi=N c: The routing tag t0 causes the switch to route to its output port t0 thus replacing the least significant digit of ss(i), m0 by t0. Therefore, the output terminal after the shuffle and exchange routing in a stage is SX(i; t0) = Ki mod N + t0: Note that N and Ki mod N are multiples of K, and Ki mod N ! N . Since t0 ! K, Ki mod N + t0 ! N . By applying the derivation used in Lemma 1, we have Ki mod N +t0 = (Ki+t0) mod N: 2 The above lemma defines the composite function of the shuffle and exchange routing in a stage, which is performed when a message advances through a stage. As one can 36 observe, the routing tag t0 is added to Ki before the modulo N function is applied. This leads to the next lemma generalizing the composite function. Lemma 3 After n stage traversals ( n K-ary shuffle and exchange routing steps) with a routing tag T = (tn\Gamma 1; : : : ; t0), an output terminal SXn(i; T ) in stage n can be reached from terminal i, where SXn(i; T ) = (Kni + Kn \Gamma 1tn \Gamma 1 + : : : + Kt1 + t0) mod N: Proof: From the previous lemma, we proved SX1(i; T ) = (Ki + tn\Gamma 1) mod N where T = (tn\Gamma 1). By the following the derivation for the K-ary shuffle and exchange of the first stage, we have SX 2(i; (tn \Gamma 1; tn\Gamma 2)) = (K \Theta SX(i; (tn\Gamma 1)) + tn\Gamma 2) mod N = (K((Ki + tn\Gamma 1) mod N ) + tn\Gamma 2) mod N = ((K2i + Ktn\Gamma 1) mod (N K) + tn\Gamma 2) mod N: Let (K2i + Ktn\Gamma 1) mod (N K) = m, and then, K2i + Ktn\Gamma 1 = CN K + m, where C is a constant * 0. Since (m + tn\Gamma 2) mod N = (CN K + m + tn\Gamma 2) mod N , ((K2i + Ktn\Gamma 1) mod (N K) + tn\Gamma 2) mod N = (m + tn\Gamma 2) mod N = (CN K + m + tn\Gamma 2) mod N = (K 2i + Ktn \Gamma 1 + tn\Gamma 2) mod N: Therefore, SX2(i; (tn\Gamma 1; tn\Gamma 2)) = ((K2i + Ktn\Gamma 1) mod (N K) + tn\Gamma 2) mod N = (K2i + Ktn\Gamma 1 + tn\Gamma 2) mod N: 37 Using mathematical induction on the stage number, we can show that the output terminal of stage n reachable from input terminal i is given by SXn(i; T ) = (Kni + Kn \Gamma 1tn \Gamma 1 + : : : + Kt1 + t0) mod N; where the sequence of routing tags T = (tn\Gamma 1; : : : ; t0). 2 Theorem 1 In a K-ary shuffle-exchange network whose size, N , is a multiple of K, a path can be set up from input terminal i to output terminal j of stage n if the routing tag Tn specified by Tn = CN + j \Gamma Kni; exists such that 0 ^ Tn ! Kn for some C * 0: Proof: From Lemma 3, we know that output terminal j at the stage n can be reached from terminal i with routing tag Tn, such that j = SXn(i; T ) = (Kni + Tn) mod N; where Tn = Kn \Gamma 1tn \Gamma 1 + : : : + Kt1 + t0: From the above equation, Kni + Tn = CN + j for some C * 0 Thus, routing tag Tn can be specified by Tn = CN + j \Gamma Kni; such that 0 ^ Tn = Kn \Gamma 1tn \Gamma 1 + : : : + Kt1 + t0 ! Kn. Therefore, if such Tn exists, then there is a path between i and j. 2 38 The theorem establishes the relation between a routing tag, an input terminal and an output terminal of any stage. As long as the equation and the conditions associated with it are satisfied, we can have several different routing tags for paths between i and j. For example, for given n; i; and j, we can have several Cs, if the resulting Tn satisfies the condition, 0 ^ Tn ! Kn. These different routing tags lead a message to different paths. However, in other cases, we may not find Tn satisfying the condition for any possible Cs. This implies that there is no path between i and j for a given n. In such cases, we need to increase n to find Tn, that is, a message needs to travel more hops than n to reach its destination. Note that n, the number of hops, is not fixed to dlogK N e, and it can be another parameter. 3.2.2.1 Multiple Paths for Fault-tolerance Multistage networks can be made to have multiple paths for fault-tolerance. The number of multiple paths can be increased by adding more stages to a multistage network. It is important to know the number of stages to guarantee a certain number of multiple paths for all pairs of source and destination. The following corollary of Theorem 1 shows the number of stages needed to guarantee M different paths for all source and destination pairs. Note that when M = 1, the corollary specifies the number of stages for the multistage network to have at least one path between any source and destination pair. Corollary 1 (Multiple Paths) M different paths for any source and destination pair in a K-ary multistage shuffle-exchange network exist if the number of stages is larger than or equal to logK(M N ) where N , the number of nodes, is a multiple of K and M * 1: Proof: Since different routing tags set up different paths, we show that M different routing tags exist for any source and destination pair under certain conditions. From Theorem 1, we know that for source i and destination j, a routing tag Tn should 39 satisfy the condition, 0 ^ Tn = CN + j \Gamma Kni ! Kn. That is equivalent to Kni ^ CN + j ! Kni + Kn; for some C * 0: Let C0 be the smallest C satisfying the condition Kni + Kn ^ C0N + j, i.e., (C0 \Gamma 1) \Theta N + j ! Kni + Kn. If Kn * N , then Kni + N ^ Kni + Kn ^ C0N + j. By subtracting N from each side, we show that Kni ^ (C0 \Gamma 1) \Theta N + j. Therefore, we have a Tn satisfying Kni ^ Tn = (C0 \Gamma 1) \Theta N + j ! Kni + Kn. Since we can have such a C0 for each i and j pair, the condition, Kn * N , guarantees at least one Tn for any i and j pair. By using a similar derivation, we can show that if Kn * M N , then Kni ^ CpN + j ! Kni + N M ^ Kni + Kn such that Cp = C0 \Gamma 1; : : : ; C0 \Gamma M . Hence, the condition, Kn * M N , guarantees M different Tn for any i and j pair. Therefore, if the number of stages, n = logK(Kn) * logK(M N ), then there are M different paths between any source and destination. 2 3.2.3 Single Stage Shuffle-Exchange Networks Multistage networks require a certain number of stages to provide the connectivity for all sources and destinations. On the other hand, single stage networks connect all nodes with only one stage, because an unlimited number of traversals of the stage is possible. A smaller number of traversals is sufficient for some source and destination pairs, although not for all pairs. For a given source and destination, it is possible to have multiple paths, and even multiple shortest paths. In this section, we derive an algorithm to find a routing tag for a shortest path in a single stage network. 40 From Theorem 1, we know that if Kni ^ CN + j ! Kn(i + 1) is satisfied, then a path between i and j exist with the routing tag Tn = CN + j \Gamma Kni. Since n means the number of hops to reach the destination, the Tn that satisfies the condition with the smallest n is the routing tag for a shortest path. By using an iterative method, we can find the smallest n that is the number of hops in the shortest path between i and j. Algorithm 1 Shortest Path Routing Tag Generation Input : i : source node, j : destination node. K : switch size, N : total number of nodes. Output : Tn : a shortest path routing tag. 1 : A Ki ; B K \Theta (i + 1) ; J j 2 : while (1) f 3 : if A ^ J then 4 : if J ! B then 5 : Tn J \Gamma A ; 6 : return Tn. 7 : else 8 : A KA ; B KB. 9 : endif 10 : else 11 : J J + N . 12 : endif g We will show that the alogrithm finds a shortest path routing tag in the following lemma. 41 Lemma 4 (Shortest Path Routing) Algorithm 1 finds a routing tag for a shortest path between node i and j in a single stage shuffle-exchange network. Proof: In order to find a shortest path routing tag, we find a value of C and the smallest n satisfying Kni ^ CN + j ! Kn(i + 1). When this condition is satisfied, the shortest path routing tag is Tn = CN + j \Gamma Kni. For any given C and n, n should be increased if Kn(i + 1) ^ CN + j, and C should be increased if CN + j ! Kni. In each iteration of the algorithm, these conditions are examined at line 3 and 4, and either n or C is increased at line 8 and 11 one at a time. Therefore, n is increased only when there is no smaller n satisfying Kni ^ CN + j ! Kn(i + 1) with the current C and all previous values of C. As soon as n is found to satisfy the condition, the algorithm returns the Tn obtained with the current n and C. This Tn is a shortest path routing tag. 2 3.2.3.1 Direct Connected Single Stage Shuffle-Exchange Network Single shuffle-exchange stage networks can take a different structure described in [45] as a direct connected single stage network (Direct SSX). So far we assumed that in a single stage network, a node injecting a message is connected to an input terminal of the stage. In this case, the message takes the shuffle permutation of links before the exchange function is performed at a switch. In a direct SSX, a node is connected to a switch itself instead of its input terminal, and each node is directly connected to other neighboring nodes via the switch, as shown in Figure 3.3. In this structure, when a message is initially routed from a node, the exchange function of the switch is performed before the shuffle function is executed through the shuffle connection between switches. Logically, it can be represented by a generalized de Bruijn Digraph defined in [84]. Since the application order of the shuffle and exchange function is reversed, the routing tag generation for the direct SSX networks may require a different algorithm. However, as the next corollary proves, the relation between routing tags and other parameters remains 42 1 0 2 3 0 1 2 3 4 5 6 7 8 9 10 11 SW SW SW 0 node Stage 0 SW node node node 1 2 3 Figure 3.3: Direct Connected Single Stage Network the same. The only two differences are that first, N does not need to be a multiple of K because it represents the number of nodes instead of the number of total links as in the previous theorem. Second, the source and destination are represented in the node number instead of the input and output terminal numbers. Therefore, Algorithm 1 can be applied to the shortest path routing of direct SSX networks without modification. We now define the connection structure of a direct single stage network. Definition 2 (Direct SSX connection) Let N be the number of nodes in a direct SSX network, and the size of the switching element in a node is K. The connection between nodes i and j can be specified by j (Ki + t) mod N where node i is connected to node j through its output port t. 43 From this definition, a message injected from node i can reach node j through output port t of node i after one hop. Note that t is added to Ki before the modulo N function is applied. Corollary 2 (Routing in Direct SSX) In a direct connected single stage K-ary shuffleexchange network whose size is N , a path can be set up from source node i to destination node j at the n\Gamma th hop if the routing tag Tn specified by Tn = CN + j \Gamma Kni; exists such that 0 ^ Tn ! Kn for some C * 0: Proof: The proof is similar to the one used for theorem 1. From the definition of a connection, node i can set up a path to j by a routing tag tn such that j = (Ki + tn) mod N; 0 ^ i; j ! N: By using the same derivation as in Lemma 3, we can show that given a routing tag of (tn; tn\Gamma 1; : : : ; t0), the destination node j is j = (Kni + Kn \Gamma 1tn \Gamma 1 + : : : + Kt1 + t0) mod N: Thus, the routing tag Tn = Kn \Gamma 1tn \Gamma 1 + : : : + Kt1 + t0 can be specified by Tn = CN + j \Gamma Kni; for some C * 0; such that 0 ^ Tn = Kn \Gamma 1tn \Gamma 1 + : : : + Kt1 + t0 ! Kn. Therefore, if such Tn exists, then there is a path between i and j. 2 44 3.3 Performance Evaluation Shortest path routing provides several advantages over multistage routing. First, it eliminates all cycles in a message path. Since there is no self-cycle, single stage networks are less susceptible to deadlock. Second, the shortest path routing scheme provides the shortest internode distance for a given source and destination. The reduction in internode distance can boost network performance because messages traverse fewer hops, and network contention is reduced. 3.3.1 Average Internode Distance In our evaluation, we focus on the effects on network performance of shorter internode distance resulting from the shortest path routing scheme. We examine the average internode distances of single stage networks for the shortest path routing scheme and the multistage routing scheme by using various switch and network sizes. The average internode distance is an expected number of hops a message has to traverse when destination and source nodes are selected randomly. Therefore, under random traffic, the average internode distance directly affects network performance. The graphs in Figure 3.4 show the average internode distance for the two different routing schemes and various switch and network sizes. The network size is increased from 32 to 4096 in increments of 16. In multistage routing, the average internode distance changes as a step function of the network size, such that the average internode distance jumps to the next natural number after the network size passes the power of the switch size. In shortest path routing, the increase in the average internode distance is closer to a logarithmic function of the network size. For some network and switch sizes, the average internode distance is less than the logarithmic value of the network size. Particularly, for switch sizes 2 and 4, the average internode distance is less than the logarithmic value for 45 all network sizes. Also note that when the switch size is smaller, the average internode distance increases more smoothly. Figure 3.5 shows the ratio of the average internode distance in shortest path routing to that in multistage routing, which indicates the relative performance of these routing schemes. The ratio is as low as 66 % and as high as 97 % for network sizes ranging from 32 to 4096. A lower ratio implies better performance for shortest path routing. A significant decrease in the ratio is found when a network size is near the next increment to the power of the switch size. This is because multistage routing is most inefficient at these network sizes. When a switch size is smaller, a larger number of network sizes show a significant decrease in the ratio. These results indicate that shortest path routing can provide a shorter average internode distance and result in more gradual changes in network performance as the network size increases. The routing scheme may improve network performance most when the network size is just over a power of the switch size. Also, a smaller switch size tends to result in larger improvements for a wider range of network sizes if the shortest path routing scheme is used. Although the average internode distance reveals certain properties of shortest path routing, we still need to know how much these properties affect actual system performance. In order to measure this, we employ a trace-driven simulation of an entire shared memory system that includes processors, caches, memories and a single stage interconnection network, as described in Chapter 2. By simulating the entire system instead of just a network in isolation, we can accurately evaluate the effects of shortest path routing on memory system performance. In the next section, we present and analyze the results. 46 0 2 4 6 8 10 12 0 500 1000 1500 2000 2500 3000 3500 4000 Average Inter-node Distance Network Size < Averag Inter-node Distance : Switch Size=2 > LOG2(x)SHORT MULT 0 1 2 3 4 5 6 0 500 1000 1500 2000 2500 3000 3500 4000 Average Inter-node Distance Network Size < Averag Inter-node Distance : Switch Size=4 > LOG4(x)SHORT MULT 0 0.5 1 1.5 2 2.5 3 3.5 4 0 500 1000 1500 2000 2500 3000 3500 4000 Average Inter-node Distance Network Size < Averag Inter-node Distance : Switch Size=8 > LOG8(x)SHORT MULT 0 0.5 1 1.5 2 2.5 3 0 500 1000 1500 2000 2500 3000 3500 4000 Average Inter-node Distance Network Size < Averag Inter-node Distance : Switch Size=16 > LOG16(x)SHORT MULT Figure 3.4: Average Internode Distance: SHORT = Shortest Path Routing, MULT = Multistage Routing, LOGN (X) = logN (X) 47 68 70 72 74 76 78 80 82 84 86 88 0 500 1000 1500 2000 2500 3000 3500 4000 Average Inter-node Distance Ratio(%) Network Size < Averag Inter-node Distance Ratio(%): Switch size=2 > 70 75 80 85 90 95 0 500 1000 1500 2000 2500 3000 3500 4000 Average Inter-node Distance Ratio(%) Network Size < Averag Inter-node Distance Ratio(%) : Switch size=4 > 65 70 75 80 85 90 95 100 0 500 1000 1500 2000 2500 3000 3500 4000 Average Inter-node Distance Ratio(%) Network Size < Averag Inter-node Distance Ratio(%) : Switch size=8 > 65 70 75 80 85 90 95 100 0 500 1000 1500 2000 2500 3000 3500 4000 Average Inter-node Distance Ratio(%) Network Size < Averag Inter-node Distance Ratio(%) : Switch size=16 > Figure 3.5: Average Internode Distance Ratio: Shortest Path Routing versus Multistage Routing 48 System Size Switch 64 128 256 Size SHORT MULT S/M SHORT MULT S/M SHORT MULT S/M 4 2.64 3 88.02 3.24 4 80.96 3.6 4 89.97 8 1.88 2 93.75 2.41 3 80.21 2.7 3 89.84 16 1.75 2 87.50 1.88 2 93.75 1.94 2 96.88 Table 3.1: Average Internode Distance: SHORT = Shortest Path Routing, MULT = Multistage Routing, S/M = Ratio of Shortest Path Routing to Multistage Routing (%) 3.3.2 Results and Analysis These experiments use system sizes of 64, 128, and 256 with switch sizes 4, 8, and 16. The average internode distances of single stage networks for shortest path routing and multistage routing are shown in Table 3.1. The columns SHORT and MULT show the average internode distance of shortest path routing and multistage routing, respectively. The column S/M lists the average internode distance ratios of shortest path routing and multistage routing. The highest ratio, 96.88 % occurs at system size 256 with switch size 16, and the lowest ratio, 80.21 % occurs at system size 128 with switch size 8. Table 3.2 shows the read miss latencies of the single stage network systems, which are measured through system simulations. The columns SHORT, MULT, and S/M shows the read miss latency for shortest path routing, multistage routing, and their ratios, respectively. We chose read miss latency as a major performance metric in the comparison of routing schemes. Although read miss latency is affected by both network and memory performance, we can evaluate the effect of the routing schemes on memory system performance. As we see in the Table 3.2, for all benchmarks, shortest path routing provides better memory system performance: shorter read miss latency. The improvement varies depending on different benchmarks. However, there is a close relation between the S/M ratios in the Table 3.1 and Table 3.2. The ratios are not the same because the read 49 System Size Switch 64 128 256 Size SHORT MULT S/M SHORT MULT S/M SHORT MULT S/M ARC3D 4 115.7 134.8 85.81 154.4 190.7 80.94 179.4 196.3 91.39 8 79.97 86.38 92.59 112.4 137.9 81.52 131 144 91 16 76.14 86.25 88.28 84.55 89.51 94.46 95.89 98.04 97.81 EFLUX 4 217.4 250.4 86.81 276.9 330.2 83.85 311.7 338 92.22 8 149.4 160.4 93.16 205.8 246.7 83.43 229.7 246.9 93.05 16 141.1 159.5 88.46 149.9 158.8 94.38 160.3 164.3 97.56 MDG 4 218.5 238.9 91.45 292.8 332.4 88.09 329.9 350.6 94.11 8 177.8 185.5 95.89 257.6 279.7 92.11 271.3 279.7 97.01 16 172.2 185.2 92.98 224.1 230.3 97.31 246.7 250.2 98.58 MG3P 4 129.6 150.4 86.17 183.2 226.3 80.94 219.2 240.6 91.13 8 88.79 96.41 92.1 134.6 163.2 82.47 164.3 178.6 92 16 83.26 95.27 87.39 99.05 105.8 93.66 117.3 120.9 97.01 TRFD 4 120.1 134.2 89.48 145.1 170.7 84.97 162.1 177.3 91.44 8 90.33 96.15 93.95 113.3 132.7 85.34 129.5 140 92.45 16 86.36 95.68 90.26 90.84 95.99 94.63 99.89 102.2 97.7 Table 3.2: Read Miss Latency: SHORT = Shortest Path Routing, MULT = Multistage Routing, S/M = Ratio of Shortest Path Routing to Multistage Routing (%) miss latency ratios in Table 3.2 include the effects of the delay caused by memory access as well as by network itself, whereas the S/M ratios in Table 3.1 reflect only network effects. The memory access delay is relatively constant and independent of the routing schemes. A large memory access delay reduces the relative difference in read miss latency for both routing schemes and results in a higher S/M ratio. Therefore, the S/M ratios in Table 3.2 tend to be larger than those in Table 3.1 because of the constant delay attributed to memory access delay. For example, the S/M ratio of MDG is most affected by the memory access delays. This is the reason why the S/M ratios of MDG 50 in Table 3.2 and the S/M ratio in Table 3.1 show bigger differences than those of other benchmarks. MDG has a hot spot memory access pattern, so memory access time is a dominant delay component in read miss latency. The differences between S/M ratios of the other benchmarks and the average internode distance ratios are very close. From these comparisons, we expect the network performance improvement caused by shortest path routing to be reflected in the overall memory system performance. Therefore, for certain system and switch sizes, we can expect more than 30 % performance improvement. 3.4 Conclusions We provided the theoretical background and a routing tag generation algorithm for shortest path routing in single stage networks. This shortest path routing scheme can be applied to any network whose size is a multiple of the crossbar switch size. We extended the results to show a condition necessary to have a given number of multiple paths for all source and destination pairs in multistage networks. The routing scheme and routing tag generation algorithm can be used for direct connected single stage network architectures, generalized de Bruijn Digraphs, without modification. Shortest path routing can improve single stage network performance in several aspects. By eliminating self-cycles in a message path, shortest path routing reduces potential deadlock situations and also simplifies conflict resolution hardware. Most importantly, shortest path routing results in a shorter average internode distance, which directly improves network performance. We compared average internode distance in single stage networks for shortest path routing and multistage routing, and studied the effects of shortest path routing on the average internode distance. Average internode distance increases more gradually with 51 shortest path routing and results in a shorter internode distance than with multistage routing. The most improvement in average internode distance with shortest path routing over multistage routing occurs when the network size is slightly larger a power of the switch size. Smaller switches tend to show larger improvements for a wider range of network sizes. By using simulation studies, we evaluated how the shorter internode distance affects system performance. Our evaluation revealed a close relationship between the average internode distance improvements due to shortest path routing and the overall memory system performance improvement for our benchmarks. From these experiments, we can predict that shortest path routing can improve system performance by more than 30 %, depending on system and switch sizes. 52 Chapter 4 Interconnection Network Organization and Its Impact on Performance and Cost in Shared Memory Multiprocessors 4.1 Introduction In shared memory multiprocessor systems, non-local memory accesses tend to incur much larger memory access latency than memory accesses in uniprocessor systems due to interconnection network traversals. Such long memory access latency directly contributes to the total execution time of a program. Although several approaches such as caches, multithreading, and data prefetching may be taken in order to hide memory access latency by overlapping memory accesses with other useful operations, these methods are only partially successful. That is, some portion of memory access latency is inevitably 53 exposed because of the nature of the programs and architectural limitations. Ideally, memory access latency should be made as small as possible. Memory access latency consists of network latency and memory latency in multiprocessor systems. Network latency is a delay experienced by a message until it arrives at its destination in a network. Memory latency is a latency associated with accessing a memory module. In general, network latency is more important because it tends to be larger than memory latency, and it increases as system size increases. The other important characteristic of networks that affects its performance is network bandwidth. Since memory accesses are pipelined in high performance systems, and several memory accesses may be outstanding at any given time, network bandwidth should be high enough to support such simultaneous operations. Therefore, short-latency and high-bandwidth networks are essential for high performance multiprocessor systems. A high performance network is expensive and often a major cost factor in a large-scale multiprocessor system. For a small-scale multiprocessor system that consists of less than 16 processing nodes, bus networks are known to be very effective and have been used widely. However, for a large-scale multiprocessor system, there is no consensus on the best network organization. Consequently, many different network architectures have been employed. For example, the IBM SP-2 uses a bidirectional multistage shuffle-exchange network [8, 9], the Cray T3D uses a 3-D bidirectional torus network [10], the TMC CM-5 uses a fat-tree network [11] and the Intel Paragon uses a 2-D mesh network [12]. An appropriate network selection for a given system requires an in-depth study of various aspects of network design and trade-offs, not only for performance but also for cost. However, comprehensive and detailed studies addressing both the performance and network costs of a given system are virtually non-existent. This chapter performs such a detailed study of network behavior and design trade-offs with respect to performance and cost. The only previous work, to our knowledge, in which such a detailed study has been 54 attempted is [20, 21, 85], yet network cost was not taken into account in these studies. As pointed out in [20], most previous network studies have relied on analytical modeling and/or simulations which are based on simplified assumptions. These approaches are sufficient for studying first-order effects, but not adequate for understanding the behavior and design trade-offs in detail. In order to overcome this limitation, interconnection networks are studied in the context of the entire system via very detailed system simulations. The simulation of the entire system makes it possible to incorporate the feedback effect [21, 20] and the pipeline effect into a network study. The feedback effect is the dependence of message injection rates on the arrival rates of replies which, in turn, is affected by network and memory contention. The feedback effect bounds the message injection rate within a certain range. The pipeline effect occurs when message assembly/disassembly from a narrow data path overlaps with other operations. if the message assembly/disassembly is not overlapped, the assembly/disassmbly may significantly contribute to the memory access latency. This network study is confined to cache-based shared memory multiprocessor systems with sizes ranging from 64 to 256 processors. The study mainly focuses on the actual network performance achieved in a system rather than the maximum possible network performance. The analysis of the performance and cost trade-offs among different network organizations is evaluated using the actual network performance. Hence, the system environment in which the networks are used makes a big difference in our analysis and results. For example, in cache-based shared memory multiprocessor systems, caches can reduce the number of network accesses, and the longest message size is bounded by the cache line size. In contrast, message-passing or vector multiprocessor systems have longer messages and generate more burst network traffic. These different network traffic patterns can result in different network choices than our conclusions would lead to. The 55 system size also affects the actual network performance achievable for a given network organization. As the system size increases, a network with higher maximum bandwidth is very likely preferred; moreover, the cost of wiring between nodes may substantially increases to become another main cost factor. We limit the system size to between 64 and 256 processors, and within this system size range, make a claim that an interconnection network can be implemented ignoring wiring constraints. In order to obtain the actual network performance, we use trace-driven simulations with traces gathered by executing real benchmarks. In recent network studies [42, 41, 40, 39, 43] physical implementation constraints, such as a constant number of available pins and wires, have been incorporated into network performance evaluation. Under such constraints, the switch size and channel width are limited. Increasing the switch size and channel width requires the same resources: pins and wires. Hence, when such resources are limited, trade-offs exist between the switch size and channel width: increasing the channel width results in a smaller switch size and vice versa. In previous studies [42, 41, 40, 39], the effects of such trade-offs are evaluated for a given network topology. In these analyses, a fixed number of pins or wires is used to compute the switch size and channel width for a network. Although these studies reveal a certain aspect of the trade-offs, they do not show how the trade-off effect varies given a different number of available pins and wires, which may allow wider channels and larger switch sizes. Instead of using a fixed number of pins or wires, we directly vary the channel width and switch size under different pin limitations to study the trade-off effects. This study uses three different constraint models: fixed switch size and channel width, constant number of switch pins, and constant network cost. The latter two constraint models rely only on the pin constraint and not on the wiring constraint. This is justified by the fact that within the system sizes studied, a network design is not re56 stricted by wiring area. Instead, the pin constraint is often a more serious limitation than wiring area [40, 48, 49]. We evaluate three network topologies, namely multidimensional torus (TORUS) networks, multistage shuffle-exchange (MSX) networks, and single stage shuffle-exchange (SSX) networks, with respect to memory latency under these three constraint models. For fair comparisons, the same detailed behavioral and timing models for switches, processors, caches and memory are used for all networks. This chapter is organized as follows. Performance metrics and the constraint models are discussed in Section 4.2 and 4.3, respectively. Experiments and results are presented in Section 4.4. The summary and conclusions of this chapter are in Section 4.5. 4.2 Performance Metrics We use read miss latency as a main performance metric. Since a processor stalls on a read miss, the read miss latency seen at the processor directly adds to the total execution time. The read miss latency also represents the performance of the entire memory system. On the other hand, write latency is not as important, because writes are buffered. Read miss latency (LR) results from delays experienced in the network, memory and caches. Network delay is the sum of the stage delays for a round-trip to memory. The stage delay is the time required for a message to advance to the next switch in a message path. It contains a minimum switch latency and a switch queueing delay. Memory delay has two components: memory module latency and memory waiting time. The memory module latency is the delay from when the memory module starts servicing a request until it starts sending out the corresponding reply message. The memory waiting time is the delay while a message waits in a queue before it is serviced by the memory. The memory module latency is fixed, whereas the memory waiting time is affected by memory cycle time and contention at a memory module. The memory 57 cycle time is proportional to the length of either a request or reply message, whichever is longer. After a read reply message reaches a cache, it needs to be assembled before a word is sent to a processor. This assembly time contributes to the read miss latency. The following equation shows the relation between each delay component and read miss latency. LR = Ds \Theta PL + Dm + Ta where LR : Read miss latency Ds : Stage delay PL : Average message path length for a round-trip to memory Dm : Memory delay Dm = Tmw + Lml Tmw : Memory waiting time Lml : Memory module latency (4 cycles) Ta : Assembly time at a cache seen by a processor, (= 128/Wc) Wc : Channel width We measure read miss latency and each of its delay components for all network configurations and benchmarks through trace-driven simulations. Among the delays, Lml is fixed to 4 cycles, and Ta depends only on the channel width. Ds and Tmw vary with network configurations as well as benchmarks. For MSX networks, all message path lengths are the same, and PL is determined by the switch size and network size. For TORUS networks and SSX networks, PL is determined by the network size, the switch size and the source and destination of a message generated during the execution of benchmarks. This is because even in the same network the message path length varies depending on the source and destination. Table 4.1 lists the values of PL's for different networks. 58 switch TORUS switch MSX SSX size system size size system size system size 64 128 256 64 128 256 64 128 256 5x5 9.96 13.98 17.98 4x4 6 8 8 5.2 6.42 7.17 7x7 7.96 9.98 11.99 8x8 4 6 6 3.69 4.77 5.37 9x9 7.96 8.98 9.99 16x16 4 4 4 3.44 3.72 3.86 Table 4.1: Average Message Path Length : ARC3D2 The measured average message path length1 of a TORUS network is almost the same for all benchmarks (not shown). This is also true for a SSX network. 4.3 Network Constraint Models The implementation of interconnection networks is constrained by physical resources such as pins and wires. In practical network design where an interconnection network is composed of several VLSI components, the number of pins available in a chip is often considered a more serious limitation than wiring area [40, 48, 49]. Also, the packaging cost for a large number of pins tends to increase exponentially and becomes a dominant cost factor. Moreover, it is impossible to find a package accommodating more than a certain number of pins. As a result, the pin requirement of an interconnection network is a very important measure of network cost. In several papers [42, 40, 45], a constant pin limitation is imposed on a node, and network performance is evaluated by varying node degree and channel width under the pin constraint. While the pin constraint model focuses on the packaging constraint in network implementation, another important criteria for network evaluation is total network cost in which both packaging constraints and total number of components in a 1We count the number of switches that a message has to pass through to reach a destination as the message path length 2The other benchmarks have almost the same average message path length 59 network are considered together. In our analysis, we examine interconnection networks under three different constraint models. The three constraint models are based on ffl fixed switch size and channel width. ffl constant number of switch pins. ffl constant network cost. The network cost model is based on the switch cost and the total number of switches. We assume the following and derive a cost model based on these assumptions: ffl The same technology is used across all networks. ffl A switch is implemented as a single IC. ffl The switch cost is a major cost factor of a network. ffl The switch cost is linearly proportional to the number of pins. The actual cost of a switch chip depends on various parameters such as wafer cost, yield, chip area, and packaging, and it is difficult to estimate the actual cost. However, the assumption on the switch cost and the number of pins is based on the following observations. Some portion of chip area should be allocated for I/O pads, which is a function of the number of pins and increases the chip area accordingly. In many cases, the number of I/O pads completely determines die size. For a certain range of the number of switch pins, the packaging cost tends to increase linearly in proportion to the number of pins [86]. In addition, a switch with wider channels can be constructed from switches with smaller channels by using a bit-slicing technique. For example, a 4x4 switch with 4-byte channels can be made from four 4x4 switches with 1-byte channels by splitting the 4-byte channel into the 1-byte channels of the four switches and synchronizing the 60 four switches. Based on the bit-slicing technique being applied, the relative switch cost can be approximated by the number of pins when the switch cost is normalized to that of the smallest switch. Although this assumption holds for a certain range of switch sizes, the cost of a large switch tends to be a greater than the linear function of the number of switch pins because the complexity and packaging difficulty of large switches increases exponentially. We take this fact into account in our analysis. From the above assumptions, we define a switch cost (Csw) and extend it to the network cost (CN ) as follows. Csw = 2 \Theta K \Theta Wc CN = 8???? ??! ??????: Csw \Theta N for TORUS networks Csw \Theta N=K for SSX networks Csw \Theta (N=K) \Theta dlogK N e for MSX networks where CN : Network cost K : Switch size Wc : Channel width N : System size (the number of processors), a multiple of K For a fair comparison, only the portion of a switch used for network connections is considered as the switch size. For example, the 5x5 switch of TORUS networks is considered to have only 4x4 connections, excluding the switch ports for connections to a processor and memory. 4.4 Experiments and Analysis We vary switch size, channel width and system size for the three network topologies. We use the switch sizes 4, 8 and 16 for 4-ary, 8-ary and 16-ary MSX and SSX networks, respectively, and 5, 7 and 9 for TORUS networks which make 2-D, 3-D and 4-D bidirec61 switch TORUS switch MSX SSX size system size size system size system size 64 128 256 64 128 256 64 128 256 5x5 2048 4096 8192 4x4 1536 4096 8192 512 1024 2048 7x7 3072 6144 12288 8x8 1024 3072 6144 512 1024 2048 9x9 4096 8192 16384 16x16 1024 2048 4096 512 1024 2048 Table 4.2: Network Capacity : Channel Width 1 Byte tional torus networks, respectively. For each network configuration, we vary the channel width of each link as 1, 2, 4 and 8 bytes and the system size as 64, 128 and 256 processors. Table 4.2 lists network capacities for various networks. Network capacity is defined as the product of the number of links and the channel width. Theoretically, network capacity determines the maximum amount of messages a network can move at the same time. Although network capacity is not a direct measure of network performance, a network with a higher capacity is less likely to suffer from network contention and tends to cost more. Since Tmw and Ds most affect read miss latency, it is necessary to examine how the delays change under different network configurations. The analysis of Tmw and Ds helps in understanding the network comparison results under three different constraint models. After this analysis, we present the results of the network comparison under the three constraint models. 4.4.1 Stage Delay and Memory Waiting Time We show the results for Tmw and Ds for ARC3D in Figure 4.1 and Figure 4.2 and for MDG in Figure 4.3 and Figure 4.4 as the system size varies. The results of the other benchmarks are qualitatively similar to that of ARC3D. 62 Channel widths significantly affect Tmw and Ds for all system sizes. Different switch sizes cause only small variations in Tmw and Ds as compared to the difference caused by the channel widths. This result implies that channel width has more impact on network contention than switch size. The different network topologies also exhibit significant differences in Ds, especially when a narrow channel is used, but do not affect Tmw much. The delay Ds of SSX networks is higher than that of other networks with the same channel width. This result can be explained by the fact that the network capacity of SSX networks is the least among the three network topologies, thereby causing more network contention. Increasing the channel width from 1 to 2 bytes and 2 bytes to 4 bytes considerably reduces Tmw and Ds. The improvement is the largest for SSX networks. However, the channel width change from 4 to 8 bytes improves Tmw and Ds by a small amount. The delay Ds is near its minimum at the channel widths of 4 and 8 bytes for TORUS and MSX networks and at the channel width 8 bytes for SSX networks. The minimum Ds is 4 cycles for TORUS and MSX networks owing to the minimum switch latency and wire delay, and 5 cycles for SSX networks owing to the minimum switch latency, DMUX delay and wire delay. The low Ds is achieved because caches can eliminate a large number of shared memory accesses and reduce network contention. When the channel width is 4 or 8 bytes, Tmw also is near its minimum for the benchmarks other than MDG, which still has a noticeable delay. The high Tmw in MDG is due to hot-spot memory accesses. In MDG, a inner loop is parallelized, and shared scalar variable references exist inside of the parallel loops. These references cannot be moved outside the loop because the compiler fails to remove the scalar variable references in the presence of library function calls. Since caches are flushed after each iteration of the outer loops at synchronization, processors have to fetch the shared scalar variables from 63 468101214161820 64 128 256 Stage Delay(cycles) System SizeTORUS Network Legend : Stage Delay, Memory Waiting Time for TORUS NetworkSwitch Channel Size Width(bytes)5x5 1 7x7 1 9x9 1 5x5 2 7x7 2 9x9 2 5x5 4 7x7 4 9x9 4 5x5 8 7x7 8 9x9 8 468101214161820 64 128 256 Stage Delay(cycles) System SizeSSX Network 468101214161820 64 128 256 Stage Delay(cycles) System SizeMSX Network Legend : Stage Delay, Memory Waiting Time for SSX and MSX Network Switch Channel Size Width(bytes)4x4 1 8x8 1 16x16 1 4x4 2 8x8 2 16x16 2 4x4 4 8x8 4 16x16 4 4x4 8 8x8 8 16x16 8 Figure 4.1 :Stage Dela y(AR C3D) 64 0123456789 64 128 256 Memory Waiting Time(cycles) System SizeTORUS Network 0123456789 64 128 256 Memory Waiting Time(cycles) System SizeSSX Network 0123456789 64 128 256 Memory Waiting Time(cycles) System SizeMSX Network Figure 4.2 :Memory Waiting Time (AR C3D) 65 4681012141618202224 64 128 256 Stage Delay(cycles) System SizeTORUS Network Legend : Stage Delay, Memory Waiting Time for TORUS NetworkSwitch Channel Size Width(bytes)5x5 1 7x7 1 9x9 1 5x5 2 7x7 2 9x9 2 5x5 4 7x7 4 9x9 4 5x5 8 7x7 8 9x9 8 4681012141618202224 64 128 256 Stage Delay(cycles) System SizeSSX Network 4681012141618202224 64 128 256 Stage Delay(cycles) System SizeMSX Network Legend : Stage Delay, Memory Waiting Time for SSX and MSX Network Switch Channel Size Width(bytes)4x4 1 8x8 1 16x16 1 4x4 2 8x8 2 16x16 2 4x4 4 8x8 4 16x16 4 4x4 8 8x8 8 16x16 8 Figure 4.3 :Stage Dela y(MDG) 66 01020304050607080 64 128 256 Memory Waiting Time(cycles) System SizeTORUS Network 01020304050607080 64 128 256 Memory Waiting Time(cycles) System SizeSSX Network 01020304050607080 64 128 256 Memory Waiting Time(cycles) System SizeMSX Network Figure 4.4 :Memory Waiting Time (MDG) 67 shared memory modules whenever they execute the inner parallel loops. These accesses to shared scalar variables cause the hot-spot. As the system size increases, Tmw increases while Ds remains virtually the same, particularly with the channel widths equal to or larger than 4 bytes. For ARC3D, Tmw increases more when the system size changes from 128 to 256, whereas for MDG, Tmw increases more when the system size is changed from 64 to 128. Note that Ds is not affected significantly by the hot-spot memory accesses in MDG nor by the system size changes. In summary, the channel width has significant effects on Ds and Tmw. Increasing the channel width improves dramatically Ds and Tmw when the channel width is smaller than 4 bytes. However, as the channel width increases beyond 4 bytes, the improvement quickly disappears, and different network topologies and system sizes make only insignificant differences in Ds and Tmw. Therefore, with such wide channels, average message path length becomes a major factor in determining the performance difference of the networks. 4.4.2 Fixed Switch Size and Channel Width In this section, we compare the performance of different network topologies when using the same switch size and channel width. Tables 4.3, 4.4, and 4.5 list the performance difference between the networks for system sizes 64, 128, and 256, respectively. The percentage in a table entry represents the read miss latency difference between two networks relative to the read miss latency of one of the networks. For instance, the percentage under the column "SSX/TORUS" is obtained by (RT ORUS \Gamma RSSX )=RT ORUS \Theta 100 where RSSX is the read miss latency of a SSX network and RT ORUS is that of a TORUS network. The column shows a read miss latency improvement of SSX networks over TORUS networks. When TORUS networks are compared to the other networks, only 5x5 and 68 channel SSX/TORUS MSX/TORUS MSX/SSX width (bytes) 4x4 8x8 4x4 8x8 4x4 8x8 16x16 ARC3D 1 -31.8 -11.3 22.6 20.4 49.6 33.8 34.2 2 3.9 15.5 26.2 28.5 32.5 20.8 21.2 4 21.8 28.4 28.9 33.4 19 12.3 12.4 8 28.4 33.5 30.3 35.8 12.8 8.49 8.47 EFLUX 1 -74.3 -55.8 18.2 9.14 59.3 45.7 46.2 2 -36.6 -13.3 23.6 22.6 51.3 36.5 36.4 4 6.34 18 27.9 30.8 32.1 20.8 20.7 8 24.5 30.6 30 34.8 17.1 11.2 11.1 MDG 1 -23.1 -10.2 8.13 4.6 31.8 17 17.2 2 -3.66 5.79 14.3 14.4 24.7 13.2 13.6 4 15.6 21.1 22.7 24.3 16.7 8.47 8.7 8 25.3 30 27.3 31.8 11.6 7.39 7.25 MG3P 1 -38.9 -16.8 22.3 18.5 51.8 35.8 35.1 2 3.43 14.3 26 27.7 33.3 21.1 20.9 4 21.6 27.9 28.6 32.8 19 12.2 12.2 8 27.9 32.9 30.1 35.3 12.9 8.58 8.54 TRFD 1 -27 -13.2 19.3 15.9 43.1 30.2 30.1 2 -5.66 4.88 24 24.8 35.5 25.3 25.5 4 14.3 22.7 28.1 31.5 24.4 16.5 16.3 8 26.6 31.9 30.2 35 14.5 9.48 9.53 Table 4.3: Percentage of Read Miss Latency Difference: System Size = 64 69 channel SSX/TORUS MSX/TORUS MSX/SSX width (bytes) 4x4 8x8 4x4 8x8 4x4 8x8 16x16 ARC3D 1 -26.2 -40.4 34.4 12.8 58 49.3 32.6 2 9.52 0.453 33.3 19.1 39.5 32.2 20.4 4 28.3 19.9 34 22.7 23.2 19 11.9 8 35.5 26.7 35 24.3 15.6 12.8 8.39 EFLUX 1 -56.5 -100 38.1 4.14 66.8 60 45.1 2 -30.4 -45.1 35.4 14.1 59 51.1 35.8 4 11.2 3.24 34.1 20.5 38.8 31.9 20.8 8 31.1 22.5 35 23.7 21.3 17.6 11.5 MDG 1 -11.1 -20.5 15 1.56 32.6 24.7 11.9 2 1.08 -3.76 18.1 6.95 26.7 18.2 9.26 4 19.5 11.9 25 13.6 18.5 12.3 5.65 8 29.3 21.2 29 19.1 12.2 9.41 5.61 MG3P 1 -35.4 -52.7 33.3 10 60.2 51.4 35 2 3.62 -3.82 32 17.6 42.9 34.6 21.2 4 26.7 18.3 33.3 21.7 24.4 19.4 11.9 8 34.8 26 34.6 23.8 15.7 12.9 8.41 TRFD 1 -17.8 -33 30.2 10 49.6 42.3 29.8 2 3.91 -8.11 31.9 16.6 39.8 33.9 23.9 4 22.8 13.7 33.7 22 27.1 23.1 15.4 8 33.9 25.2 35.2 24.3 17.2 14.1 9.04 Table 4.4: Percentage of Read Miss Latency Difference: System Size = 128 70 channel SSX/TORUS MSX/TORUS MSX/SSX width (bytes) 4x4 8x8 4x4 8x8 4x4 8x8 16x16 ARC3D 1 -15.9 -39.5 41.7 14.6 54 44.3 28.4 2 17.8 -0.219 42.7 22.2 36.5 28.8 17.7 4 35.3 18.6 44.8 26.9 21.9 17.5 10.9 8 42.3 25.7 46.4 29.3 14.8 12.1 7.76 EFLUX 1 -48 -113 46.2 8.33 66.5 59.9 45.3 2 -21.7 -52.4 45.9 19.6 59.2 51.3 36.4 4 18.8 0.198 46.2 26.4 39.5 32.5 21.2 8 38.4 21.3 47.3 29.8 22 18.3 12 MDG 1 -5.53 -18.4 12.8 0.782 22.3 18.7 13.3 2 6.57 -2.92 20.4 6.8 20.4 13.4 10.2 4 23.5 10.5 30.2 14.5 14.1 8 4.52 8 32.9 17.5 36.1 19.8 9.91 7.04 4.08 MG3P 1 -26.1 -50.6 37.7 11.6 54.9 46 29.6 2 10.1 -5.94 39.3 19.3 38.8 30.4 17.7 4 32.9 16.3 42.8 25 22.3 17.4 10.6 8 40.9 24.3 45.2 27.8 14.8 11.9 7.74 TRFD 1 -5.96 -30.5 37.3 13.4 45.9 38.7 25.9 2 16.4 -3.69 41.3 21.2 34.8 29.2 19.9 4 33.5 15.7 44.7 27.1 23 19.5 12.5 8 42 25.3 46.7 29.8 15.2 12.7 8.21 Table 4.5: Percentage of Read Miss Latency Difference: System Size = 256 71 9x9 switch configurations are considered under the column 4x4 and 8x8, respectively, because TORUS networks do not have configurations corresponding to the 16x16 switch of MSX and SSX networks. For all system sizes, MSX networks show the best performance for all configurations. When the channel width is 1 byte, SSX networks have the worst performance. However, as the channel width increases, the relative performance of SSX networks improves significantly. The relative performance between SSX networks and TORUS networks reverses between the channel width 2 bytes and 4 bytes. As the channel width continues to increase for all configurations, SSX networks have shorter read miss latencies than TORUS networks. This change is dramatic, as the performance difference ranges from -113 % to 42.3 %. Between MSX and SSX networks, MSX networks perform better than the corresponding SSX networks by up to 66.8 %. As the channel width increases, the performance gap between SSX networks and MSX networks narrows, and for most cases, the difference in read miss latency becomes less than 10 % when the channel width is 8 bytes. The performance difference between MSX and TORUS networks increases as the channel width increases, and the maximum difference reaches 47.3 %. On the other hand, the difference is reduced for system sizes 128 and 256, when the switch size shifts from 4x4 to 8x8. This relative performance improvement of TORUS networks is also observed between TORUS and SSX networks. This result is supported by a large improvement in the average message path length of 4-D TORUS networks for the system size 128 and 256, as shown in Table 4.1. Also note that for MDG, the relative performance of MSX networks is worse than for the other benchmarks. The read miss latency for MDG are largely determined by Tmw, and the difference in Tmw between the different networks is relatively small as compared 72 to Tmw itself. Thus, the performance improvement of MSX networks in MDG is less than in the other benchmarks. 4.4.3 Constant Number of Switch Pins In the previous constraint model, we fixed the switch size and channel width and compared network performance. In this constraint model, we restrict only the number of switch pins and allow the switch size and channel width to change within that limitation. A trade-off exists between the switch size and channel width under the constraint of a constant number of switch pins. We examine the trade-off and look at how the effects of the trade-off vary when more pins are allowed in a switch. We present the results of ARC3D in Figure 4.5 and MDG in Figure 4.6. The results of the other benchmarks are qualitatively similar to that of ARC3D. In Figures 4.5 and 4.6, the results of three different system sizes are listed: 64, 128, and 256. Each figure contains 2-D, 3-D, 4-D TORUS and 4-ary, 8-ary, 16-ary multistage and single stage networks. The smallest number of switch pins allowed is 64 when the switch is 4x4 and the channel width is 1 byte, and the largest one is 2048 when the switch is 16x16 and the channel width is 8 bytes. Also note that within a graph, the leftmost point corresponds to a network with 1-byte channels, the next point corresponds to a network with 2-byte channels and so on. We discuss ARC3D results first followed by MDG results. 4.4.3.1 ARC3D For all system sizes, MSX networks have configurations showing the best performance for the entire range. When only 64 switch pins are allowed, SSX networks have the worst performance; however, when 128 and more pins are allowed, SSX networks have at least one configuration that is better than all TORUS networks. As the pin limita73 20406080100120140160180 64 128 256 512 1024 2048 Read Miss Latency(cycles) Number of Switch Pins< System Size : 64 > TORUS 5x5 switchTORUS 7x7 switchTORUS 9x9 switchMSX 4x4 switchMSX 8x8 switchMSX 16x16 switchSSX 4x4 switchSSX 8x8 switchSSX 16x16 switch 20406080100120140160180 64 128 256 512 1024 2048 Read Miss Latency(cycles) Number of Switch Pins< System Size : 128 > TORUS 5x5 switchTORUS 7x7 switchTORUS 9x9 switchMSX 4x4 switchMSX 8x8 switchMSX 16x16 switchSSX 4x4 switchSSX 8x8 switchSSX 16x16 switch 20406080100120140160180 64 128 256 512 1024 2048 Read Miss Latency(cycles) Number of Switch Pins< System Size : 256 > TORUS 5x5 switchTORUS 7x7 switchTORUS 9x9 switchMSX 4x4 switchMSX 8x8 switchMSX 16x16 switchSSX 4x4 switchSSX 8x8 switchSSX 16x16 switch Figure 4.5 :AR C3D: Read Miss Latency vs. Num ber of Switc hPins 74 50100150200250300350 64 128 256 512 1024 2048 Read Miss Latency(cycles) Number of Switch Pins< System Size : 64 > TORUS 5x5 switchTORUS 7x7 switchTORUS 9x9 switchMSX 4x4 switchMSX 8x8 switchMSX 16x16 switchSSX 4x4 switchSSX 8x8 switchSSX 16x16 switch 50100150200250300350 64 128 256 512 1024 2048 Read Miss Latency(cycles) Number of Switch Pins< System Size : 128 > TORUS 5x5 switchTORUS 7x7 switchTORUS 9x9 switchMSX 4x4 switchMSX 8x8 switchMSX 16x16 switchSSX 4x4 switchSSX 8x8 switchSSX 16x16 switch 50100150200250300350 64 128 256 512 1024 2048 Read Miss Latency(cycles) Number of Switch Pins< System Size : 256 > TORUS 5x5 switchTORUS 7x7 switchTORUS 9x9 switchMSX 4x4 switchMSX 8x8 switchMSX 16x16 switchSSX 4x4 switchSSX 8x8 switchSSX 16x16 switch Figure 4.6 :MDG: Read Miss Latency vs. Num ber of Switc hPins 75 tion approaches near 2048, the performance difference between SSX and MSX networks becomes very small. For MSX networks, when the number of switch pins reaches a point where a MSX network can have 4-byte wide channels, the performance of the network is almost equal to that of a MSX network that has twice as large switch size and half of the channel width. For example, when the system size is 256, the read miss latency of the 4-ary MSX network with 4-byte channels becomes almost equal to that of the 8-ary MSX network with 2-byte channels. As the number of switch pins increases past such a point, the networks with larger switches perform better than the networks with wider channels at a given number of switch pins. Such points are at 256 switch pins for 4-ary and 8-ary MSX networks, and at 512 switch pins for 8-ary and 16-ary MSX networks. This result shows that the effect of the trade-off changes such that the relative benefit from increasing switch size and channel width reverses at the points where a MSX network can have 4-byte wide channels. One exception to the trend occurs in the case of system size 64 and between 8-ary and 16-ary multistage networks. In this case, 8-ary networks with wider channels are always better because doubling the switch size does not reduce the average message path length. SSX networks show a similar trend, except that the change of the trade-off effect occurs at the point where a network can have 8-byte wide channels. These points are at 512 switch pins for 4-ary and 8-ary SSX networks, and at 1024 switch pins for 8-ary and 16-ary SSX networks. As in the case for 8-ary and 16-ary MSX networks of the system size 64, the trade-off effect does not change for 8-ary and 16-ary SSX networks when the system size is 64. This is because the average message path length is not changed significantly between these two configurations. TORUS networks have different trends for the trade-off effects. Between 2-D and 4-D TORUS networks, there is no change in the trade-off effect for system sizes 128 and 256. 76 For these system sizes, 4-D TORUS or 3-D TORUS are always better than 2-D TORUS networks over the entire range of the switch pins. This is explained by a large reduction in the average message path length between 2-D TORUS and 3-D or 4-D TORUS networks. On the other hand, for system size 64, the trade-off effects change between 2-D and 4-D TORUS networks when 2-D TORUS networks have 4-byte channels at 256 switch pins. It is hard to directly compare 3-D TORUS networks with other TORUS networks because they do not have the same number of switch pins. However, note that 3-D TORUS and 4-D TORUS networks have very small performance difference for all system sizes. 4.4.3.2 MDG MDG shows different trends from ARC3D and the other benchmarks. For MSX and SSX networks, the network with wider channels always perform better at a given number of switch pins. This is true throughout the entire range of system sizes. On the other hand, for TORUS networks the change of the trade-off effects is found between 2-D and 4-D TORUS when 2-D TORUS networks have 8-byte channels. Also, note that the performance difference between MSX and SSX networks is very small when the number of switch pins is equal to or more than 256. This trend is explained by the dominant effect Tmw has on read miss latency as previously shown in Section 4.4.1. Since the read miss latency is almost completely determined by Tmw, and Tmw is most affected by the channel width, wider channels improve network performance much more than larger switches. Thus, all results strongly favor the networks with wider channels. 4.4.4 Constant Network Cost Previously, we compared networks under design constraints such as fixed switch size and channel width, and constant number of switch pins. Another interesting question 77 is which network performs better than other networks at a given cost. In this section, we try to answer this question based on our network cost model. Although in the cost model, the switch cost increases linearly as the number of switch pins increases, when the switch size and number of switch pins is very large, the switch cost tends to increase more than linearly. In our analysis, we take such cost effects into account by limiting our comparison to a certain range of the switch size and number of pins, assuming the linear cost model is applied only within the range of the switch size and number of pins. Figures 4.7 and 4.8 illustrate the performance of networks for all system sizes based on network cost. Again only ARC3D and MDG are shown because the other benchmarks show qualitatively similar results to that of ARC3D. All network costs are normalized to that of 4-ary SSX network with 1-byte channels. The normalized cost ranges from 1 to 64 (the cost of a 4-D TORUS network with 8-byte wide channels). Also note that within a graph, the leftmost point corresponds to a network with 1-byte channels, the next point corresponds to a network with 2-byte channels and so on. Network costs vary differently according to the change of the switch size and channel width. When the channel width increases, the network cost increases accordingly. On the other hand, when the switch size changes, the network cost varies differently depending on the network topology. If the switch size is doubled with the same channel width, the cost of SSX networks remains the same, whereas the cost of TORUS networks doubles. This is because in SSX networks the switch size increase doubles the switch cost, but it cuts the number of switches in half, resulting in the same total cost. In MSX networks, increasing the switch size reduces the number of switches by more than half, depending on system size and switch size, and thus tends to reduce network costs. We first look at the ARC3D results. For all system sizes, the best networks are SSX networks, and the worst networks are TORUS networks at any given cost. Among SSX networks, the 16-ary networks have the best performance for the entire cost range. 78 20406080100120140160180 1 2 4 8 16 32 64 Read Miss Latency(cycles) Normalized Network Cost< System Size : 64 > TORUS 5x5 switchTORUS 7x7 switchTORUS 9x9 switchMSX 4x4 switchMSX 8x8 switchMSX 16x16 switchSSX 4x4 switchSSX 8x8 switchSSX 16x16 switch 20406080100120140160180 1 2 4 8 16 32 64 Read Miss Latency(cycles) Normalized Network Cost< System Size : 128 > TORUS 5x5 switchTORUS 7x7 switchTORUS 9x9 switchMSX 4x4 switchMSX 8x8 switchMSX 16x16 switchSSX 4x4 switchSSX 8x8 switchSSX 16x16 switch 20406080100120140160180 1 2 4 8 16 32 64 Read Miss Latency(cycles) Normalized Network Cost< System Size : 256 > TORUS 5x5 switchTORUS 7x7 switchTORUS 9x9 switchMSX 4x4 switchMSX 8x8 switchMSX 16x16 switchSSX 4x4 switchSSX 8x8 switchSSX 16x16 switch Figure 4.7 :AR C3D: Read Miss Latency vs. Normalized Net work Cost 79 50100150200250300350 1 2 4 8 16 32 64 Read Miss Latency(cycles) Normalized Network Cost< System Size : 64 > TORUS 5x5 switchTORUS 7x7 switchTORUS 9x9 switchMSX 4x4 switchMSX 8x8 switchMSX 16x16 switchSSX 4x4 switchSSX 8x8 switchSSX 16x16 switch 50100150200250300350 1 2 4 8 16 32 64 Read Miss Latency(cycles) Normalized Network Cost< System Size : 128 > TORUS 5x5 switchTORUS 7x7 switchTORUS 9x9 switchMSX 4x4 switchMSX 8x8 switchMSX 16x16 switchSSX 4x4 switchSSX 8x8 switchSSX 16x16 switch 50100150200250300350 1 2 4 8 16 32 64 Read Miss Latency(cycles) Normalized Network Cost< System Size : 256 > TORUS 5x5 switchTORUS 7x7 switchTORUS 9x9 switchMSX 4x4 switchMSX 8x8 switchMSX 16x16 switchSSX 4x4 switchSSX 8x8 switchSSX 16x16 switch Figure 4.8 :MDG: Read Miss Latency vs. Normalized Net work Cost 80 This is because the cost of SSX networks remain the same, but the network performance improves when the switch size increases. Similar trends are shown among MSX networks. The 16-ary MSX networks perform better than the MSX networks of the other switch sizes at the same cost. Note that when the system size is 64, the performance of 8-ary and 16-ary SSX networks is almost the same, and the same relationship holds between 8-ary and 16-ary MSX networks. This is because both 8-ary and 16-ary networks have the same average message path length. TORUS networks show a different trend, because increasing the switch size also increases the network cost accordingly. When the system size is 64, initially 2-D TORUS networks perform better than 4-D TORUS networks at a given cost. As the network cost increases, 4-D TORUS networks become better than 2-D TORUS networks. For other system sizes, 4-D TORUS networks are always better than the corresponding 2-D TORUS networks for the entire cost range. The difference between 3-D and 4-D TORUS networks is smaller than that between 2-D and 4-D TORUS networks. The small difference in the average message path lengths of both networks accounts for these results. Note that a higher network cost does not guarantee higher performance, and that the performance differences between the networks that have the same cost are very high. For instance, when the system size is 256 and the network cost is 8, the best network has a read miss latency of 32.5 cycles and the worst network has 108 cycles: a latency increase of over 300 %. This large difference shows the importance of network choice in multiprocessor systems. Another consideration is the cost and performance trade-off. By sacrificing a small amount of network performance, the network cost can be greatly reduced. For example, when the system size is 128, an MSX network costs 16 for a read miss latency of 29 cycles, whereas an SSX network has a read miss latency only 5.8 cycles longer (34.8 cycles) at one quarter of the MSX network cost. 81 When we incorporate limitations on the switch sizes and pins in addition to the network cost, the results vary depending on the limits. Suppose that the switch size is limited to smaller than 8x8 and the number of switch pins is limited to fewer than 256, then 8-ary MSX networks with 2-byte channels show the best performance among the network given these limitations. In general, within a given set of limitations, SSX networks have lower cost ranges than the corresponding MSX networks, though their performance is slightly worse than that of the MSX networks. As the limitations are relaxed such that more pins and larger switches are allowed, the performance difference between SSX networks and MSX networks is reduced. For MDG, the SSX networks show a shorter read miss latency than any other networks at a given cost. Even when we take the limitation on the switch sizes and pins into account, the SSX networks are the best networks in terms of both cost and performance. As in ARC3D, TORUS networks show a worse performance than SSX and MSX networks at any given cost. In MDG, as explained before, the performance of networks is most affected by the channel width. Thus, increasing channel width improves network performance more than increasing switch size. Increasing channel width costs less for SSX networks than for MSX networks, which is the reason why the SSX networks show a significantly better relative performance in MDG than in ARC3D. 4.5 Conclusions We studied the performance and design trade-offs of three interconnection network topologies for shared memory multiprocessor systems. By employing a trace-driven simulation of the entire system, instead of evaluating the networks in isolation, we were able to incorporate the effects of other system components, such as cache stalls, the feedback effect, and the pipeline effect, into our network study. The greater accuracy inherent in 82 our approach enabled a detailed and accurate analysis of the network design trade-offs under different constraints. We employed three different constraint models that reflect the limitations imposed on network structure, packaging and network cost. Under each constraint model, the networks were evaluated by varying the switch size, channel width and system size for five benchmarks. The switch size and channel width significantly affected network performance and cost. This is because the switch size and channel width largely determined the average message path length and message size, respectively. We first investigated the stage delay and memory waiting time, which contributed the most to the read miss latency when the network organizations and benchmarks were changed. The stage delay was affected most by the channel width and network topology, whereas the memory waiting time was affected most by the channel width, system size and memory access pattern. As the channel width increased up to 4 bytes and more, the stage delay quickly dropped to near its minimum. This was partly due to caches which eliminated a large portion of the shared memory read accesses and thereby reduced network load. When such wide channels were used, the difference in the stage delay and memory waiting time of different networks was so small that the the average message path length became a dominant cause of the network performance difference. When the switch size and channel width were fixed, multistage shuffle-exchange (MSX) networks performed better than the other networks. The performance difference between networks of different topologies was as high as 113 % and varied dramatically as the channel width changed. Increasing channel width was the most beneficial to single stage shuffle-exchange (SSX) networks and the least to multidimensional torus (TORUS) networks. As the channel width increased, the performance of SSX networks improved past that of TORUS networks and was closer to that of MSX networks with less than a 10 % performance difference for most cases. 83 When the number of switch pins was limited, trade-offs existed between the switch size and channel width. If more than a certain number of switch pins were available, increasing the switch size was more beneficial than increasing the channel width. Otherwise, the reverse was true. Under a packaging constraint limiting the number of switch pins, MSX networks showed the best performance. As more switch pins were allowed, SSX networks improved over the TORUS networks, as the SSX network performance came closer to that of the MSX networks. When network cost was considered, there were significant differences in the read miss latency among different networks at a given cost. A substantial network cost reduction was possible when a small performance degradation could be tolerated. Since it is hard to change network configurations such as topology, switch size, and channel width after they are selected, these results show the importance of network choice in terms of cost and performance. In general, the best networks at a given cost were SSX networks, whereas TORUS networks showed the worst performance at the same cost. In addition to network cost, when the switch size and the number of switch pins were also limited, trade-offs existed between network performance and cost, such that MSX networks performed better at higher costs and SSX networks had slightly worse performances at lower costs. In conclusion, MSX networks are the best network topology when cost is not the main limiting factor. Otherwise, SSX networks are the best network topology when cost is a main limiting factor. TORUS networks were seriously limited by their longer average message path lengths. This is in spite of the fact that full-duplex bidirectional channels were used, and the TORUS networks had highest overall network capacity. 84 Chapter 5 The Impact of Data Prefetching on Interconnection Networks and Its Interface Design 5.1 Introduction In shared memory multiprocessor systems, as discussed in Chapter 4, memory access latency is relatively large and increases as system size increases. Large memory access latency is a major bottleneck in high-performance multiprocessor systems. Physical implementation and cost limitations imposed on interconnection network architectures make it infeasible to employ very short-latency and high-bandwidth networks, such as a crossbar, for large-scale multiprocessor systems. Therefore, large memory access latency is unavoidable in such multiprocessor systems. Data prefetching is an attractive solution to large memory access latency. When data prefetching is successfully used, it can hide memory access latency by overlapping memory accesses with useful computations. However, prefetching has fundamental lim85 itations because of its high memory bandwidth demand and inaccurate predictions of future data accesses. Such limitations should be evaluated quantitatively to maximize system performance with prefetching. In [25], prefetching was evaluated under limited bus bandwidth. The results showed that although an idealized "oracle" prefetching approach was used, prefetching only slightly improved system performance, and sometimes prefetching degraded performance. In the oracle approach, all cache misses are identified and prefetching instructions are inserted for such cache misses. As observed in [25], if the cache hit rate is already very high without prefetching, and the network bandwidth is not sufficient, it is hard to achieve better performance with prefetching. In general, there is a consensus that prefetching can be beneficial only when there is sufficient memory and network bandwidth to support it. In Chapter 4, we have evaluated three different network topologies: multidimensional torus networks (TORUS), multistage shuffle-exchange (MSX) networks and single stage shuffle-exchange (SSX) networks. The results showed that as the channel bandwidth increases up to 4 bytes/cycle, the average message path length plays a more important role in determining the network performance than does the network bandwidth. TORUS networks have the longest average message path length among the networks examined and shows a relatively poor performance when compared to MSX and SSX networks. However, when prefetching is used, the relative performance of these different networks may change. This is because prefetching demands more network bandwidth and may make the network performance less susceptible to the average message path length. Therefore, networks with higher bandwidth may be preferable if used with prefetching. For example, TORUS networks, which have relatively high bandwidth but a long average message path length, may perform well if prefetching is employed. In this chapter, we reevaluate and compare TORUS, MSX and SSX networks using a prefetching method; we also address prefetching and network bandwidth issues. Although 86 there are several studies on prefetching in multiprocessor systems [26, 27, 28, 29, 30, 31], there is no detailed quantitative study on the prefetching and various network organizations and their mutual effects. This study investigates if these three different networks can provide sufficient bandwidth for prefetching and how the channel bandwidth affects the network performance with prefetching. Another important issue addressed in this chapter is how to optimally use a given memory and network bandwidth. This issue becomes more important when prefetching is introduced, because prefetching tends to demand more network and memory bandwidth. Turner and Veidenbaum [87] showed that limiting the number of outstanding requests can sometimes help to minimize network latency. However, their study was done with vector multiprocessor systems, which tend to demand much higher memory and network bandwidth. We evaluate the effect of the number of outstanding requests on the network and memory performance with respect to prefetching and scalar accesses in cache-based shared memory systems. This chapter is organized as follows. Section 5.2 presents the system architecture used in this chapter. Section 5.3 describes our performance metrics. In Section 5.4, we discuss our results and analysis. We conclude this chapter in Section 5.5. 5.2 Evaluation Methodology The same simulation methodology described in Chapter 2 is used in this chapter. The only difference is the change in the cache architecture and network interface of the prefetching cache. This section describes the architectural model in detail. 87 CO NT RO L CP U RB = Read Buffer PB = Prefetch Buffer WB = Write Buffer PRB = Pending Request Buffer CA CH E RB PB WB PRB et wo rk N Network Interface Figure 5.1: Network Interface 5.2.1 Tagged Cache and Network Interface A tagged cache model [36] replaces the cache model used in the previous chapters. Tagged cache is very effective for short stride accesses and tend to generate intense memory traffic. Each cache line has one additional flag, called the prefetch bit, to mark whether a read has accessed the line or not. When a line is prefetched into the cache, the bit is set to indicate that the line is a prefetched line. On a cache read miss, the missed line and the next line are fetched. A processor stalls on a read miss. On a cache read hit, the cache returns the word. If the prefetch bit of the line is set, indicating that the line was prefetched and has not yet been accessed by a read, the next line is prefetched, and the prefetch bit is reset to 0. Write-through policy is used, and the writes are put in a separate write buffer. The network interface of the tagged cache consists of the control logic and four buffers: a read buffer, a write buffer, a prefetch buffer, and a pending request buffer. A diagram of the network interface is shown in Figure 5.1. Once a memory request is generated, it is stored in the corresponding buffer. These buffers are organized as circular FIFO's. When the write buffer is full, and a processor needs to access memory, the processor stalls until 88 the write buffer has an empty entry. When the prefetch buffer is full, additional prefetch requests generated are discarded. When the network interface becomes idle, the control logic examines the read buffer, prefetch buffer and write buffer in an order specified by the network access priorities for any pending requests. The highest priority is given to reads, and the second highest given to prefetches. Writes have the lowest priority because if a large write buffer is used, writes rarely stall a processor. If a buffer has a request, a corresponding message is issued to the network, and the request is removed from the top of the buffer. All outstanding requests are recorded in a buffer called a pending request buffer. When a read or a prefetch is returned or a write is acknowledged, the corresponding entry in the pending request buffer is freed. The pending request buffer is used to maintain memory access ordering among different memory requests. Before a prefetch request is issued to the network, cache tags are checked and the prefetch is discarded on a hit. In addition to the cache tag check, the pending list is searched for a matching memory address. If the matching request is a read request or a prefetch request, the prefetch is discarded. If it is a write request, the prefetch is not issued to the network until the write is completed. Issuing read and write requests is also affected by pending prefetch requests. If there is a matching pending prefetch request, the read or the write request is not issued to a network until the matching prefetch request is completed. When a prefetch is returned, it checks for a read blocked due to the pending prefetch request. If one is found, the read returns a word to the processor as soon as the prefetched line is assembled and loaded into the cache. A returning prefetch request also checks the write buffer, and if a matching write is found, it updates the prefetched line accordingly before it is loaded into the cache. A cache line is not reserved for a pending prefetch, but allocated only when the prefetch is returned from memory. 89 Prefetches and writes may be generated faster than they can be completed. A prefetch buffer and a write buffer may contain several prefetch and write requests, respectively. These requests can be serviced in a pipelined fashion in the network and memory without waiting for the previous requests to be completed. Several outstanding requests may be allowed to fully utilize the network and memory bandwidth. The total number of such outstanding requests is limited by the pending request buffer size. In our experiments, we allow a maximum of 128 outstanding requests, unless mentioned otherwise. One entry of the pending request buffer is always reserved for one outstanding read. In all cases, the pending request buffer size of 128 is more than sufficient; we observed that far fewer than 128 simultaneous requests are normally outstanding at a given time. A read request is always guaranteed to access the network and memory systems, whereas write and prefetch requests compete with each other to obtain access. This is because once the pending request buffer is full, no requests are allowed to issue to a network. In these experiments, the number of outstanding requests is controlled based on either the type of requests, i.e., writes and prefetches, or based on the sum of writes and prefetches together. In a baseline architecture, the maximum number of outstanding requests for write and prefetch requests is one each. Therefore, only 3 entries in the pending request buffer are used for each outstanding read, write and prefetch request. The maximum number of outstanding writes and prefetches is varied later in our experiments to evaluate the effect on memory system performance. 5.3 Performance Metrics In previous chapters, the read miss latency is used as a major metric for network performance evaluation. The introduction of prefetching makes additional metrics necessary. 90 Without prefetching, the read miss latency directly affects the read latency seen by a processor. Yet with prefetching, the read miss latency affects the read latency less directly. Prefetching increases network contention by issuing more message into networks, and therefore, read requests may have a longer latency. However, successful prefetching may greatly reduce the number of cache misses. Even if a read access misses in the cache, the line may be already being prefetched, resulting in a smaller read miss latency. Therefore, prefetching may reduce the average read latency seen by a processor, although the read miss latency increases. We use read latency seen by a processor, called processor read latency, to show all the effects of prefetching on read accesses, such as read hits and read misses. The total execution time of a program is also used as a performance measure. In addition to the above metrics, when necessary the average read access time (TR) is measured. The average read access time is obtained by TR = TM =NR TM : total memory access time. NR : total number of read accesses The total memory access time is the time spent on read accesses and write buffer full stalls for all processors. Therefore, the average read access time shows the memory access time distributed over all read accesses. The total memory access time consists of the following components: ffl Read hit time: the time taken for read hits. ffl Read miss time: the time taken for reads that miss in a cache and access the network and memory. For such missed reads, there is no corresponding pending prefetch, and the reads have to experience full network and memory access time. ffl Read wait time: the time taken for reads that hit the line being prefetched. The reads have to wait for the pending prefetch to return from the network and memory. 91 ffl Write stall time: the processor stall time due to full write buffers When the average read access time is used as a metric, it shows the contribution of each memory access time component to the average read access time. Note that the processor read latency contains only read hit time, read miss time, and read wait time, whereas the average read access time contains all time components, including write stall time. 5.4 Experiments and Analysis 5.4.1 Prefetching and Network Performance From the various network configurations studied in the previous chapter, the following three networks are chosen: 2-D bidirectional torus, 4-ary multistage and single stage shuffle-exchange networks. These networks are constructed from the same 4x4 crossbar switches. The experiments use the baseline architecture for the systems with and without prefetching. In the baseline architecture, only one outstanding request is allowed for each write and prefetch request. The system size is 128 nodes. 5.4.1.1 Cache Hit Ratios We first look at how the cache hit ratio is improved when prefetching is employed for each network. Table 5.1 shows the cache hit ratios of the three different networks for channel widths of 1, 2, 4, and 8 bytes for each benchmark. Cache hits count only those read accesses that hit a cache line which is already in the cache. For EFLUX and MG3P, prefetching improves the cache hit ratio by up to 20 %. ARC3D has only a moderate improvement in the cache hit ratio with prefetching because it has a large number of long stride accesses. Tagged prefetching is not effective for such long stride accesses. MDG shows very small improvements because it has a relatively large 92 TORUS MSX SSX D08 D16 D32 D64 D08 D16 D32 D64 D08 D16 D32 D64 ARC3D NPF 83.6 83.6 83.6 83.6 83.6 83.6 83.6 83.6 83.6 83.6 83.6 83.6 PF 86.2 86.3 86.4 86.4 86.3 86.4 86.4 86.4 86.1 86.2 86.4 86.4 EFLUX NPF 77.8 77.8 77.8 77.8 77.8 77.8 77.8 77.8 77.8 77.8 77.8 77.8 PF 92.5 94.8 95.7 96.2 95.5 96.6 97.5 97.5 92.2 93.9 96.1 97.4 MDG NPF 75.3 75.3 75.3 75.3 75.3 75.3 75.3 75.3 75.3 75.3 75.3 75.3 PF 75.5 75.7 76.3 76.5 75.8 75.7 76.5 76.7 75.6 75.7 76.2 76.5 MG3P NPF 89.5 89.5 89.5 89.5 89.5 89.5 89.5 89.5 89.5 89.5 89.5 89.5 PF 97.9 98.2 98.2 98.2 98.2 98.2 98.3 98.3 96 98.1 98.2 98.3 TRFD NPF 97.9 97.9 97.9 97.9 97.9 97.9 97.9 97.9 97.9 97.9 97.9 97.9 PF 98.7 98.7 98.7 98.7 98.7 98.7 98.7 98.7 98.7 98.7 98.7 98.7 Table 5.1: Cache Hit Ratios: D1, D2, D4, D8 = Channel Width 1, 2, 4 and 8 Bytes, respectively. NPF = No Prefetching, PF = Prefetching number of stride 0 accesses and frequent synchronizations that flush the caches. These cause unnecessary prefetches and make tagged prefetching ineffective in MDG. TRFD already has a high cache hit ratio without prefetching, making further improvements with prefetching difficult. Less than 1.5 % cache hit ratio increases are observed for both MDG and TRFD. In general, as the channel width of a network increases, the cache hit ratio increases as well. Since the memory access latency is reduced with wider channels, this allows prefetched lines to return to a cache sooner, improving the cache hit ratio. 5.4.1.2 Read Miss Latency Figures 5.2-5.6 show the read miss latency, the processor read latency, and the total execution time of each benchmark with and without prefetching for the three different networks. Prefetching increases the read miss latency of all networks, because the increased network traffic due to prefetch requests causes more network contention, and 93 050100150200250300 1 2 4 8 Read Miss Latency(cycles) Channel Width (bytes) MSX SSX TORUS MSX + PrefetchingSSX + PrefetchingTORUS + Prefetching 510152025303540 1 2 4 8 Processor Read Latency(cycles) Channel Width (bytes) MSX SSX TORUS MSX + PrefetchingSSX + PrefetchingTORUS + Prefetching 2e+062.2e+062.4e+062.6e+062.8e+063e+063.2e+06 1 2 4 8 Total Execution Time(cycles) Channel Width (bytes) MSX SSX TORUS MSX + PrefetchingSSX + PrefetchingTORUS + Prefetching Figure 5.2 :AR C3D: Read Miss Latency ,Pro cessor Read Latency ,and Total Execution Time 94 050100150200250300350 1 2 4 8 Read Miss Latency(cycles) Channel Width (bytes) MSX SSX TORUS MSX + PrefetchingSSX + PrefetchingTORUS + Prefetching 010203040506070 1 2 4 8 Processor Read Latency(cycles) Channel Width (bytes) MSX SSX TORUS MSX + PrefetchingSSX + PrefetchingTORUS + Prefetching 1e+051.5e+052e+052.5e+053e+053.5e+054e+054.5e+055e+055.5e+056e+056.5e+05 1 2 4 8 Total Execution Time(cycles) Channel Width (bytes) MSX SSX TORUS MSX + PrefetchingSSX + PrefetchingTORUS + Prefetching Figure 5.3 :EFLUX: Read Miss Latency ,Pro cessor Read Latency ,and Total Execution Time 95 50100150200250300350400 1 2 4 8 Read Miss Latency(cycles) Channel Width (bytes) MSX SSX TORUS MSX + PrefetchingSSX + PrefetchingTORUS + Prefetching 102030405060708090100 1 2 4 8 Processor Read Latency(cycles) Channel Width (bytes) MSX SSX TORUS MSX + PrefetchingSSX + PrefetchingTORUS + Prefetching 1.4e+071.6e+071.8e+072e+072.2e+072.4e+072.6e+072.8e+073e+073.2e+07 1 2 4 8 Total Execution Time(cycles) Channel Width (bytes) MSX SSX TORUS MSX + PrefetchingSSX + PrefetchingTORUS + Prefetching Figure 5.4 :MDG: Read Miss Latency ,Pro cessor Read Latency ,and Total Execution Time 96 050100150200250300 1 2 4 8 Read Miss Latency(cycles) Channel Width (bytes) MSX SSX TORUS MSX + PrefetchingSSX + PrefetchingTORUS + Prefetching 0246810121416182022 1 2 4 8 Processor Read Latency(cycles) Channel Width (bytes) MSX SSX TORUS MSX + PrefetchingSSX + PrefetchingTORUS + Prefetching 1e+061.1e+061.2e+061.3e+061.4e+061.5e+061.6e+061.7e+061.8e+06 1 2 4 8 Total Execution Time(cycles) Channel Width (bytes) MSX SSX TORUS MSX + PrefetchingSSX + PrefetchingTORUS + Prefetching Figure 5.5 :MG3P: Read Miss Latency ,Pro cessor Read Latency ,and Total Execution Time 97 406080100120140160180200220 1 2 4 8 Read Miss Latency(cycles) Channel Width (bytes) MSX SSX TORUS MSX + PrefetchingSSX + PrefetchingTORUS + Prefetching 1.522.533.544.5 1 2 4 8 Processor Read Latency(cycles) Channel Width (bytes) MSX SSX TORUS MSX + PrefetchingSSX + PrefetchingTORUS + Prefetching 3.36e+063.38e+063.4e+063.42e+063.44e+063.46e+063.48e+06 1 2 4 8 Total Execution Time(cycles) Channel Width (bytes) MSX SSX TORUS MSX + PrefetchingSSX + PrefetchingTORUS + Prefetching Figure 5.6 :TRFD: Read Miss Latency ,Pro cessor Read Latency ,and Total Execution Time 98 therefore, read requests experience longer latency. The read miss latencies with and without prefetching are much closer with wider channels. For example, when the channel width is 1 byte, there is a difference of up to 42 % between the read miss latency with and without prefetching. However, for most benchmarks, only a minimal difference is found for the channel width of 8 bytes. Prefetching also affects the relative performance in the read miss latency between different networks. For example, without prefetching SSX networks show a smaller read miss latency than TORUS networks when the channel width is 2 bytes for most benchmarks. But with prefetching, SSX networks need a channel width of 4 bytes to have a smaller read miss latency than TORUS networks. In general, wider channels are needed with prefetching than without prefetching for SSX networks to have a smaller read miss latency than TORUS networks. Since prefetching demands more network bandwidth, it favors TORUS networks, which have larger bandwidth than SSX networks. 5.4.1.3 Processor Read Latency Prefetching tends to increase the read miss latency. However, it reduces the average read latency seen by a processor. Successful prefetching increases the cache hit ratio and thus reduces the number of read accesses that need memory and network accesses. The processor read latency varies differently with prefetching depending on the benchmarks and network configurations. For ARC3D, prefetching improves the processor read latency only when the channel width reaches 2 bytes for the TORUS and MSX networks and 4 bytes for the SSX networks. EFLUX and MG3P show that prefetching successfully reduces the processor read latency for all channel widths, in spite of the increase in the read miss latency, by increasing the cache hit ratio significantly. Although TRFD also shows some improvement, the amount of improvement is very small. This can be expected given the small cache hit ratio increase with prefetching. MDG shows the 99 opposite result: prefetching can increase the processor read latency. Since MDG already suffers from hot-spot memory accesses, and prefetching does not improve the cache hit ratio considerably, MDG cannot overcome the increase in the network contention caused by prefetching. Also notice that when prefetching successfully predicts future data accesses, the difference in the processor read latency between different networks is reduced considerably when compared to the difference observed without prefetching. For example, in EFLUX and MG3P, with a channel width larger than 2 bytes, there are very small differences in the processor read latency between different networks. In particular, the relative performance of TORUS networks improves more as compared to SSX and MSX networks, implying that the long message path length of TORUS networks is compensated by prefetching. 5.4.1.4 Total Execution Time For most benchmarks, the total execution time of programs is relatively consistent with their processor read latency, implying that they are memory access bound. However, EFLUX and MDG show a deviation from this trend. In EFLUX, the processor read latency of systems with prefetching is much lower than that of systems without prefetching. However, the total execution time of the program does not show such a big difference, particularly when the channel width is 1 or 2 bytes. Further examination reveals that writes greatly affect the total execution time. We describe this effect in detail in the next section. MDG shows different characteristics. Compared to networks without prefetching, networks with prefetching generally show a longer total execution time, which qualitatively tracks their processor read latency results. However, the total execution time shows different trends than the processor read latency, particularly between SSX networks and 100 TORUS networks. For example, when the channel width is 1 byte, SSX networks have larger processor latencies than TORUS networks, but the total execution time of SSX networks is smaller than that of TORUS networks. Also, as the channel width increases, SSX networks show more improvements in total execution time than in processor read latency with respect to TORUS networks. Further examination reveals that the sequential execution time dominates the total total execution time. For example, after each parallel task, processor 0 executes a sequential section. Processor 0 generates more than 10 times as many memory accesses as the other processors during its sequential execution. Since the memory access latency of TORUS networks is the longest, and prefetching is not effective for MDG, the sequential execution of the TORUS networks takes the longest time. The sequential execution time directly adds to the total execution time, increasing it significantly. 5.4.1.5 Write Stall Time We further analyze the results of EFLUX, measuring the average read access time and the contribution of each memory access time component to the average read access time. Figure 5.7 shows the average read access time for all channel widths and the contributions of each memory access time component: read hit time, read miss time, read wait time, and write stall time. When prefetching is not used, the read miss time contributes the major portion of the average read access time, and the write stall time is relatively small in comparison. When prefetching is used, it helps reduce the read hit time, read miss time, and read wait time, but prefetching significantly increases the write stall time. This happens because prefetch requests have a higher priority than writes in accessing the network. Prefetches frequently block writes from accessing the network. Hence, the actual network and memory bandwidth available to writes is not sufficient to support the write traffic generated in EFLUX. This is further aggravated because only 101 ||0 |9 |19 |28 |37 |46 |56 |65 |74 |84 |93 Average Read Access Time (cycles) write stall timeread wait time read miss timeread hit time 47.1 44.0 28.9 21.1 71.4 70.6 t tp m mp s sp d08 ||0 |4 |9 |14 |18 |22 |27 |32 |36 |40 |45 Average Read Access Time (cycles) write stall timeread wait time read miss timeread hit time 27.2 18.4 17.5 8.8 34.3 28.8 t tp m mp s sp d16 ||0 |3 |5 |8 |11 |14 |16 |19 |22 |24 |27 Average Read Access Time (cycles) write stall timeread wait time read miss timeread hit time 20.7 10.2 13.6 5.3 18.3 10.5 t tp m mp s sp d32 ||0 |2 |5 |8 |10 |12 |15 |18 |20 |22 |25 Average Read Access Time (cycles) write stall timeread wait time read miss timeread hit time 19.0 8.6 12.2 4.4 13.0 5.5 t tp m mp s sp d64 Figure 5.7: Average Read Access Time: d08, d16, d32, d64 = 1-byte, 2-byte, 3-byte, 4-byte Channels respectively, t = TORUS, tp = TORUS with Prefetching, m = MSX, mp = MSX with Prefetching, s = SSX, sp = SSX with Prefetching, 102 one write can be outstanding at a time in the baseline architecture. The large write stall time directly affects the total execution time of EFLUX. Therefore, the improvement in the total execution time due to prefetching is not as great as the improvement in the processor read latency. As the channel width increases, the stall time caused by writes is reduced. However, it is still a significant portion of the average read access time in EFLUX. 5.4.1.6 Summary These experiments show prefetching can improve the memory system performance, although it increases the network latency. This is particularly true when there is sufficient network and memory bandwidth. Depending on the bandwidth, prefetching may or may not help reduce the processor read latency, as shown in ARC3D. When prefetching substantially increases the cache hit ratio, as in EFLUX and MG3P, it is more likely to reduce the total memory access time. For all types of networks and most benchmarks, prefetching is helpful if the channel width is larger than 2 bytes. In our experiments, the performance improvement with prefetching is limited by tagged prefetching more than by the network and memory bandwidth, as observed in ARC3D and MDG. When prefetching is successful in predicting future data accesses, it reduces the performance difference among networks and is particularly helpful for networks with a long average message path length, such as TORUS networks. While prefetching reduces the read latency, it may not directly affect the total execution time because it delays writes, as we have seen in the case of EFLUX. Our results indicate that in order to maximize the benefits of prefetching and reduce the total execution time, write and prefetch traffic should be controlled so as to balance their sharing of limited network and memory bandwidth. The next section discusses how to balance 103 writes and prefetches in network and memory access to achieve the best possible improvement for a given network and memory system. 5.4.2 The Effects of The Number of Outstanding Requests When prefetching is not used, the number of outstanding writes does not greatly affect the network and memory performance, because a relatively large write buffer is used and the read miss time contributes the most to the average read access time. However, when prefetching is used, it increases the network latency and reduces the bandwidth available for write requests. Two different types of memory requests, prefetches and writes, compete with each other for network and memory accesses. In the baseline architecture, only one outstanding request for each write or prefetch request is allowed in order to prevent the network and memory from being overloaded. EFLUX showed that it may be helpful to allow more outstanding writes. But if too many outstanding writes and prefetches are generated, it may overload the network and memory, delay read requests, and eventually degrade the memory system performance. Therefore, it is important to know how many outstanding write and prefetch requests should be allowed per processor to maximize memory system performance. We limit the number of outstanding requests in order to measure the effectiveness of throttling memory request issuing rates. First, the number for each type of request is limited. That is, we set a maximum number of outstanding prefetches and a maximum number of outstanding writes. Later, limits are imposed on the total number of outstanding requests, regardless of type. This experiment uses MSX and SSX networks with 4x4 switches and 1-byte wide channels. These networks were chosen because the MSX network has the largest bandwidth, and the SSX network has the smallest bandwidth for a given channel width. Also, 1-byte 104 channels and 4x4 switches were chosen because this configuration has the most limited channel bandwidth, in which it is more important to control the number of outstanding requests. 5.4.2.1 The Optimal Number of Outstanding Requests Tables 5.2 and 5.3 show the average read access time for each benchmark while varying the limit on the number of outstanding writes and prefetches in the MSX and SSX networks. The maximum number of outstanding writes and prefetches varies from 1 to 32. In addition, an unlimited number of outstanding writes and prefetches is allowed. In this case, only the total number of outstanding requests is limited by the pending request buffer size because each outstanding request must be recorded in the buffer. The buffer size is 128-entry. The last column and row under u shows the average read access time with an unlimited number of outstanding writes and prefetches. The bold numbers in the tables represents the lowest average read access time for a given benchmark. Therefore, the maximum number of outstanding writes and prefetches associated with the minimum value are the optimal maximum number of outstanding requests among all the write and prefetch parameters for a given benchmark. As shown in Tables 5.2 and 5.3, the maximum number of outstanding writes and prefetches resulting in the best system performance depends on the benchmarks and networks. Changes in the maximum number of outstanding writes affect the average read access time more than changes in the maximum number of outstanding prefetches. For all benchmarks except for EFLUX, only a small maximum number of outstanding writes and prefetches, such as 4, is enough to obtain the performance close to the best performance. EFLUX needs a relatively large maximum number of outstanding writes because it has intensive write traffic. The average read access time of EFLUX improves until the maximum number of outstanding writes reaches 16. 105 maximum N of outstanding writes MOP 1 2 4 8 16 32 u ARC3D 1 17.6 16.7 16.5 16.6 16.6 16.6 16.6 2 17.9 16.8 16.3 16.3 16.3 16.3 16.3 4 18 16.9 16.3 16.2 16.3 16.3 16.3 8 18 17 16.4 16.2 16.2 16.2 16.2 16 18 17 16.4 16.2 16.2 16.2 16.2 32 18 17 16.4 16.2 16.2 16.2 16.2 u 18 17 16.4 16.2 16.2 16.2 16.2 EFLUX 1 21.1 16 15.3 15.5 15.5 15.6 15.6 2 21.8 14.1 12.7 12.4 12.3 12.4 12.4 4 22.5 14.7 12.2 11.8 11.5 11.5 11.5 8 22.7 14.9 12.5 11.6 11.1 11.2 11.2 16 22.6 14.9 12.6 11.7 11 11.2 11.2 32 22.6 14.9 12.6 11.7 11 11.2 11.2 u 22.6 14.9 12.6 11.7 11 11.2 11.2 MDG 1 63.2 62.5 62.6 62.7 62.7 62.7 62.7 2 63.3 62.5 62.6 62.7 62.7 62.7 62.7 4 63.3 62.5 62.6 62.7 62.7 62.7 62.7 8 63.3 62.5 62.6 62.7 62.7 62.7 62.7 16 63.3 62.5 62.6 62.7 62.7 62.7 62.7 32 63.3 62.5 62.6 62.7 62.7 62.7 62.7 u 63.3 62.5 62.6 62.7 62.7 62.7 62.7 MG3P 1 3.89 3.88 3.89 3.89 3.89 3.89 3.89 2 3.85 3.85 3.85 3.85 3.85 3.85 3.85 4 3.86 3.87 3.88 3.88 3.88 3.88 3.88 8 3.87 3.88 3.89 3.89 3.89 3.89 3.89 16 3.87 3.88 3.89 3.89 3.89 3.89 3.89 32 3.87 3.88 3.89 3.89 3.89 3.89 3.89 u 3.87 3.88 3.89 3.89 3.89 3.89 3.89 TRFD 1 2.47 2.35 2.36 2.36 2.35 2.35 2.35 2 2.49 2.37 2.37 2.37 2.37 2.37 2.37 4 2.49 2.37 2.37 2.37 2.37 2.37 2.37 8 2.49 2.37 2.37 2.37 2.37 2.37 2.37 16 2.49 2.37 2.37 2.37 2.37 2.37 2.37 32 2.49 2.37 2.37 2.37 2.37 2.37 2.37 u 2.49 2.37 2.37 2.37 2.37 2.37 2.37 Table 5.2: Average Read Access Time with Varying the Maximum Number of Outstanding Prefetches and Writes in the MSX network: MOP = the Maximum Number of Outstanding Prefetches 106 maximum N of outstanding writes MOP 1 2 4 8 16 32 u ARC3D 1 44.1 42.9 42.7 42.9 42.8 42.9 42.9 2 44.5 43.2 42.5 42.5 42.5 42.6 42.6 4 44.7 43.3 42.6 42.3 42.3 42.3 42.3 8 44.8 43.5 42.6 42.3 42.3 42.4 42.4 16 44.8 43.5 42.6 42.3 42.3 42.4 42.4 32 44.8 43.5 42.6 42.3 42.3 42.4 42.4 u 44.8 43.5 42.6 42.3 42.3 42.4 42.4 EFLUX 1 70.6 63.4 63 63.1 63.2 63.3 63.3 2 72.7 59.8 55.9 55.7 55.7 55.9 55.8 4 73.8 61.6 55.4 53.4 53.6 53.9 53.9 8 74.3 62.1 56.7 54.3 54.4 54.4 54.5 16 74.2 62.3 56.8 54.4 54.2 54.8 55 32 74.2 62.3 56.8 54.4 54.2 54.8 55 u 74.2 62.3 56.8 54.4 54.2 54.8 55 MDG 1 92.9 92.7 92.3 92.5 92.6 92.6 92.6 2 93.2 93 92.6 92.8 92.8 92.8 92.8 4 93.2 93 92.6 92.8 92.9 92.9 92.9 8 93.2 93 92.6 92.8 92.9 92.9 92.9 16 93.2 93 92.6 92.8 92.9 92.9 92.9 32 93.2 93 92.6 92.8 92.9 92.9 92.9 u 93.2 93 92.6 92.8 92.9 92.9 92.9 MG3P 1 12.8 12.8 12.8 12.8 12.8 12.8 12.8 2 10.5 10.6 10.6 10.6 10.6 10.6 10.6 4 10.3 10.4 10.4 10.4 10.4 10.4 10.4 8 10.4 10.5 10.6 10.6 10.6 10.6 10.6 16 10.4 10.5 10.6 10.5 10.5 10.5 10.5 32 10.4 10.5 10.6 10.5 10.5 10.5 10.5 u 10.4 10.5 10.6 10.5 10.5 10.5 10.5 TRFD 1 4.15 3.96 3.97 3.97 3.97 3.97 3.97 2 4.19 3.98 4 4 4 4 4 4 4.18 3.98 3.99 4 4.01 4 4 8 4.19 3.97 4 4 4 4 4 16 4.19 3.97 4 4 4 4 4 32 4.19 3.97 4 4 4 4 4 u 4.19 3.97 4 4 4 4 4 Table 5.3: Average Read Access Time with Varying the Maximum Number of Outstanding Prefetches and Writes in the SSX Network: MOP = the Maximum Number of Outstanding Prefetches 107 ||0 | 3 |6 | 9 |12 | 15 |18 | 21 |24 | 27 |30 Average Read Access Time (cycles) write stall timeread wait time read miss timeread hit time 22.5 14.7 12.2 11.8 11.5 11.5 11.5 1 2 4 8 16 32 u maximum # of outstanding writes Figure 5.8: Changes in Average Read Access Time Distributions: MSX Network with 1-byte Channel and the Maximum Number of Outstanding Prefetches = 4 ||0 | 10 |19 | 29 |38 | 48 |58 | 67 |77 | 86 |96 Average Read Access Time (cycles) write stall timeread wait time read miss timeread hit time 73.8 61.6 55.4 53.4 53.6 53.9 53.9 1 2 4 8 16 32 u maximum # of outstanding writes Figure 5.9: Changes in Average Read Access Time Distributions: SSX Network with 1-byte Channel and the Maximum Number of Outstanding Prefetches = 4 108 Figures 5.8 and 5.9 show how the memory access time components change in EFLUX for MSX and SSX networks, as more outstanding writes are allowed. In this case, the maximum number of outstanding prefetches is fixed at 4. In EFLUX, the write stall time is very large when the maximum number of outstanding writes is only one. In this case, the write stall time is the main contributor to the average read access time. When the maximum number of outstanding writes increases, the write stall time is reduced quickly. However, as the maximum number of outstanding writes increases beyond 4, the read wait time starts to increase noticeably. When the maximum number of outstanding writes reaches 32, the write stall time is minimized, but the read wait time account for a large portion of the average read access time. Since a large number of outstanding writes increases network contention, this delays prefetch accesses and results in the read wait time increase. 5.4.2.2 Memory Traffic Control Schemes So far, the maximum number of outstanding write and prefetch requests have been separately limited. When requests are issued to a network, the outstanding requests need to be tracked. The baseline architecture uses the pending request buffer to keep the information on outstanding requests. The pending request buffer is necessary to maintain memory access ordering and to acknowledge writes. Since the buffer size is limited, there is a limit on the total number of outstanding requests. This then implies that a buffer size equal to the sum of the maximum number of outstanding writes and prefetches is needed. This buffer size guarantees that both writes and prefetches can be issued up to their maximum limits. Otherwise, one type of request may fill the buffer, and the other type of request be blocked more frequently, although the number of outstanding requests of the second type does not exceed its limit. 109 The pending request buffer needs to be fully-associative. Thus it is impractical to have a large buffer, and very important to fully utilize the pending request buffer. When the maximum number of outstanding requests is limited separately for write and prefetch requests, the pending request buffer may not be fully utilized. It is possible that even when there are empty entries, a request cannot be issued, because the request type already consumed all of its quota of the pending request buffer. If the maximum number of outstanding requests is not limited separately for write and prefetch requests, the pending request buffer may be utilized better, but requests of one type may monopolize the buffer. We usually give a higher priority to prefetches in accessing networks. It is possible for prefetches to monopolize the buffer and delay write operations, and as a result, this may increase the write stall time. Two different schemes for controlling the maximum number of outstanding requests are examined. One scheme limits issuing requests to the network separately, based on the number of outstanding write and prefetch requests. We refer to this scheme as separate limit control. The other scheme limits issuing requests to the network based on the total number of outstanding requests, regardless of whether they are write or prefetch requests. We refer to this scheme as total limit control. Next, the average read access time of the two schemes is compared. In both cases, the sum of the limits on the number of each outstanding write and prefetch request is the same and equal to the limit on the total number of outstanding requests. Tables 5.4 and 5.5 show the ratio of the average read access time between these two different schemes for the MSX and SSX networks. Each column and row represents a different maximum number of outstanding writes and prefetches, respectively. Each value represents a ratio of the average read access time of the separate limit control over that of the total limit control. When i and j are used for the maximum number of outstanding 110 maximum N of outstanding writes MOP 1 2 4 8 16 32 ARC3D 1 102 99.5 100 102 102 102 2 106 102 99.5 101 101 101 4 109 103 100 100 100 100 8 111 105 102 100 100 100 16 112 105 102 99.9 99.7 100 32 111 105 101 99.8 99.6 100 EFLUX 1 115 110 118 128 138 140 2 149 104 100 105 110 111 4 174 116 99.9 100 104 103 8 187 125 106 102 101 99.8 16 200 133 113 106 99.3 100 32 203 134 112 105 98.6 100 MDG 1 101 100 100 100 100 100 2 102 100 99.9 100 100 100 4 101 99.8 99.9 99.9 100 100 8 101 99.8 99.8 99.9 100 100 16 101 99.7 99.8 99.9 100 100 32 101 99.7 99.8 99.9 100 100 MG3P 1 101 100 100 99.9 99.9 99.9 2 99.3 99.3 99 99 99 99 4 99.4 99.6 99.9 99.9 99.9 99.9 8 99.4 99.7 100 100 100 100 16 99.4 99.7 100 100 100 100 32 99.4 99.7 100 100 100 100 TRFD 1 104 99.5 99.6 99.5 99.2 99.2 2 105 100 99.8 100 100 100 4 105 99.9 100 100 100 100 8 105 100 100 100 100 100 16 105 99.9 99.9 100 100 100 32 105 99.9 99.9 100 100 100 Table 5.4: Average Read Access Time Ratios: Separate Limit Control over Total Limit Control in MSX Network, MOP = the Maximum Number of Outstanding Prefetches 111 maximum N of outstanding writes MOP 1 2 4 8 16 32 ARC3D 1 101 99.5 99.9 101 101 101 2 103 101 99.8 100 101 100 4 105 102 100 99.9 100 99.8 8 106 102 101 100 99.8 100 16 106 103 101 99.9 99.8 100 32 106 103 101 99.8 99.8 100 EFLUX 1 103 102 109 115 117 116 2 117 101 99.2 102 103 102 4 128 109 100 98.6 98.8 98.6 8 136 114 105 101 99.6 99.7 16 137 115 105 99.7 99.2 100 32 136 114 104 99.7 99.2 99.9 MDG 1 100 100 99.6 99.6 99.7 99.7 2 101 101 99.9 100 99.9 99.9 4 101 100 99.8 99.9 100 100 8 100 100 99.7 99.9 100 100 16 100 100 99.7 99.9 100 100 32 100 100 99.7 99.9 100 100 MG3P 1 121 124 122 121 121 121 2 102 102 101 100 101 101 4 98.7 99.2 98.9 98.6 99.1 99.1 8 98.6 99.7 100 100 100 100 16 98.8 100 100 100 100 100 32 98.9 100 100 100 100 100 TRFD 1 103 99.5 99.4 99.1 99.3 99.1 2 105 99.5 99.9 99.9 100 99.8 4 105 99.4 99.7 100 100 99.8 8 105 99.4 100 100 99.9 100 16 105 99.3 100 100 99.9 100 32 105 99.2 99.9 100 99.9 100 Table 5.5: Average Read Access Time Ratios: Separate Limit Control over Total Limit Control in SSX Network, MOP = the Maximum Number of Outstanding Prefetches 112 writes and prefetches in the separate limit control, i + j is used as the limit on the total number of outstanding requests in the total limit control. The results show that once a sufficient number of requests are allowed to access a network simultaneously, there is not much difference between the two limit controlling schemes. However, when a pending request buffer is small, total limit control is better than separate limit control. This is clearly shown in EFLUX, which requires a relatively large number of outstanding writes for a reasonable performance. In most cases, the total limit control maximizes the pending request buffer utilization, thus resulting in a smaller average read access time than does the separate limit control. Since prefetch requests have a higher priority, and prefetches do not generate many outstanding requests, the pending request buffer is rarely monopolized by prefetches, even with its small size. Although there are several cases in which separate limit control is better than total limit control, the differences between the two schemes are very minimal. Since the total limit control is simpler than the separate limit control, the first approach would be a better choice. The next experiments examine how large a pending request buffer should be if the total limit control policy is employed. The pending request buffer size determines the maximum number of outstanding requests. Figure 5.10 shows how the average read access time changes as the buffer size is varied for each benchmark in the MSX and SSX networks. The average read access time is normalized to that of the case in which a total of 3 outstanding requests is allowed for reads, writes and prefetches. The figures show that only a small buffer is necessary to achieve near-optimal performance for most benchmarks. The only exception is EFLUX, which generates more intense memory traffic. Until the buffer size is 15 and 20, respectively, for each MSX and SSX network, the average read access time keep being 113 7580859095100105 0 10 20 30 40 50 60 70 80 90 100 Normalized Average Read Access Time Pending Request Buffer Size (Number of Entries) MSX Network AR3DEFLUXMDGMG3PTRFD 556065707580859095100105 0 10 20 30 40 50 60 70 80 90 100 Normalized Average Read Access Time Pending Request Buffer Size (Number of Entries) SSX Network AR3DEFLUXMDGMG3PTRFD Figure 5.10 :Av erage Read Access Time vs. Pending Request Buffer Size: Av erage Read Access Time is Normalized to that of the Case in whic ha Total of 3Outstanding Requests isAllo wed for Reads, Writes and Prefetc hes 114 noticeably reduced for EFLUX. For both networks, however, a 20-entry pending request buffer is enough to achieve near-optimal performance. 5.5 Conclusions We studied the impact of prefetching on network and memory performance. Most networks handled the increasing network traffic rather well. Although prefetching increases read miss latency, it reduced processor read latency by increasing the cache hit ratio. In general, as the network bandwidth increased, prefetching showed larger improvements. However, for some benchmarks, such as ARC3D and MDG, prefetching did not help much to reduce the processor read latency. This poor prefetching performance was mainly caused by inaccurate prefetch data address prediction. For ARC3D and MDG, tagged prefetching did not increase the cache hit ratio enough to overcome the negative effect of increased read miss latency. We need more precise prefetching methods for applications like ARC3D and MDG, which have a large number of long stride accesses or stride 0 accesses. When prefetching was successful, the difference in the processor read latency between systems with different networks was smaller. In particular when the channel width was larger than 2 bytes, only minimal differences were observed. This resulted in performance improvements for networks with long average message path length, such as TORUS networks. When prefetching was used, writes could have a significant impact on the memory and network performance. Write accesses demanded high bandwidth in some benchmarks, which would be true even if a write-back cache was used instead of a write-through cache. When programs do not have good spatial locality in write accesses, write-back caches 115 may cause more write traffic because a whole line is written back, even though only a few words in the line are dirty. We initially allowed only one outstanding request for each write and prefetch request type to prevent the network and memory from being overloaded. However, our results showed that the maximum number of outstanding writes should be larger than one. The optimal values for the maximum number of outstanding write and prefetch requests depended on the networks and benchmarks. However, for all benchmarks except EFLUX, 4 outstanding writes and prefetches resulted in a memory access time which is almost optimal. Only EFLUX needed more than 4 outstanding requests, particularly for writes. We found that it was more appropriate to limit the number of outstanding requests based on the total requests than based on each request type. Once a higher priority was given to prefetches which did not generate a large number of outstanding requests, the pending request buffer was hardly monopolized by prefetches. In addition, it is simpler to control network traffic if we limit issuing requests to the network based on the total number of outstanding requests, rather than based on the number of outstanding writes and prefetches, separately. When the total number of outstanding requests is limited by a pending request buffer, only a small-size pending request buffer is needed. A buffer size of 20 entries is sufficient for all our benchmarks, including EFLUX. 116 Chapter 6 Data Prefetching and Its Performance in Second-Level Caches 6.1 Introduction As the speed gap between processors and memory increases, more sophisticated cache memory systems are employed, such as two-level caches. Although two-level caches are used to reduce cache misses and the primary cache miss penalty, memory access latency for secondary caches and main memory is still significant. Conventional high performance workstations have a small fast first-level (L1) cache on a processor chip and a larger second-level (L2) cache outside of a processor chip. For applications accessing large data sets, the L1 cache miss rate is relatively high, as shown in Table 6.2, where more than half of the benchmarks have 10 % or higher L1 cache miss rates. With a 4 cycle L2 cache hit, a 30 cycle L2 cache miss penalty, and a 10 % L1 cache miss rate, the average memory latency, Tm = 0:9+0:1\Theta (4+26\Theta ML2 ) = 1:3+2:6\Theta ML2, where ML2 is L2 cache miss rate. In such a case, an L2 cache miss rate of only 10 % 117 contributes more than 16 % of the average memory latency. Hence, achieving a low L2 cache miss rate is very important for high-performance memory systems. Secondary caches tend to have a lower hit rate than the primary cache [88]. For applications accessing large data sets, even large L2 caches cannot provide enough space and cause a lot of main memory accesses. For such applications, data prefetching at the second-level of a memory hierarchy is an attractive solution to hide a large main memory access latency. However, only a few studies have been conducted on data prefetching at the second-level of a memory hierarchy. A previous L2 prefetching study [37] showed that prefetching alone can replace L2 caches. On the other hand, another L2 prefetching method proposed in [38] used a small L2 cache in addition to prefetching hardware. Although at least these two different L2 memory organizations have been proposed for prefetching, no clear conclusion can be made as to what is the best L2 memory organization with prefetching. This chapter evaluates three different L2 memory organizations with prefetching in uniprocessor systems and compares their performance. These organizations are a traditional cache (cache-only), prefetching without a cache (prefetchingonly), and prefetching with a small cache. In order to evaluate these memory organizations, an appropriate L2 prefetching architecture needs to be found. Second-level, off-chip (L2) prefetching is different from L1 prefetching because only L1 cache miss addresses are visible, and instruction addresses may not be readily available. Such differences require a different approach to L2 prefetching. Although various hardware data prefetching methods have been extensively studied in the literature [32, 33, 34, 35, 37, 36], most of them focus on first-level, on-chip (L1) prefetching. Simple hardware prefetching schemes such as tagged prefetching [36] and stream buffers [35] can be used for L2 prefetching. These methods are attractive for L2 prefetching because only L1 cache miss addresses are necessary to determine the data to be 118 prefetched. However, these prefetching methods are effective only for memory accesses with good spatial locality or with short strides. Another prefetching scheme is stridedirected prefetching [32, 33, 34, 37]. In stride-directed prefetching, a memory reference stream, which is a sequence of data addresses generated by a specific memory reference instruction, is detected and used to calculate the stride associated with the memory reference stream. The calculated stride is used to predict future memory accesses. Stride-directed prefetching is effective for memory references with any constant stride. In most previous studies [32, 33, 34], a memory reference stream is detected by using the instruction address of the memory reference. This approach, which we refer to as instruction-address-based prefetching, is quite successful in L1 prefetching. Instruction-address-based prefetching cannot be directly applied to L2 prefetching because instruction addresses may not be readily available at L2. Therefore, it is difficult to accurately detect memory reference streams at L2. In addition, a constant stride is not easily obtained even though the given memory reference stream is generated with a constant stride. This is because not all data accesses are visible, and only L1 cache miss addresses are available to L2 prefetching units. Since the stride detection relies solely on consecutive data addresses of a memory reference instruction, miss addresses may lead to a wrong stride prediction. For example, if a cache line size is 4 words and memory is accessed with stride 3, then a stride calculation based on two consecutive miss addresses alternates between 3 and 6. Figure 6.1 illustrates such a case. When the stride of a reference is greater than a cache line size or the line size is divisible by the stride, a constant stride can be detected from the miss addresses. However, when different memory references access the same cache line so that one of the memory accesses hits in the cache line brought in by the other references, the strides of miss addresses for the memory reference get changed. Because of L1 caches and spatial locality between different memory references, some of the cache misses, which are other119 AddressLine 0 1 2 3 4 5 2 310 Cache MissAddress CalculatedStride 0 6 9 12 18 21 3 6 3 6 3 Cache Miss Cache Hit Figure 6.1: Stride Detection Scenario Based on L1 Cache Misses: Cache Line Size = 4 words, Access Stride = 3 wise visible to the prefetching unit, are lost. Additionally, cache conflict misses generate more misses to the prefetching unit. This screening effect of L1 caches and cache conflict misses disturbs miss address streams and makes it hard to predict a constant stride based on miss addresses. These characteristics make stride-directed prefetching more difficult at L2 than at L1, and it is not clear that L2 stride-directed prefetching alone can be effective. However, the issue of L2 stride-directed prefetching is not well studied in other literature. L2 stride-directed prefetching was studied in [37]. The authors used stream buffers and a stride detection method. In their method, the address space is partitioned in order to separate references in different streams and to detect strides for references accessing in the same partition and thus in the same stream. However, the prefetching performance of this scheme is sensitive to the address space partition size, which should be supplied by either programmers or compilers. This is not an easy task, and a new solution is required. This study explores L2 prefetching characteristics and evaluates L2 prefetching architecture in uniprocessor systems. We propose a new stride-directed prefetching scheme, called loop-based prefetching, to address the problem of memory reference stream detec120 C P U DataCache (L1) CacheData UnitPrefetching(L2) (L2) To main memory Figure 6.2: System Architecture for Read Access tion at L2. This scheme does not rely on instruction addresses and address space partitions. Also, the stride detection problem at L2 is examined and evaluated for its effect on L2 stride-directed prefetching. Finally, Three L2 memory organizations are evaluated and compared: cache-only, prefetching-only, and prefetching with a small cache. L2 prefetching architectures and the main idea behind loop-based prefetching are discussed in Section 6.2. The evaluation methodology is described in Section 6.3, and the results and analysis presented in Section 6.4. This chapter is concluded in Section 6.5. 6.2 Prefetching Architecture In this section, the L2 prefetching architectures used in this study are presented. A general organization of the system architectures, which includes a CPU, L1 and L2 caches, and an L2 prefetching unit, is shown in Figure 6.2. We use stream buffers and a miss table unit, which is similar to the unit-stride filter [37], as a baseline prefetching architecture. This baseline architecture is chosen because it does not rely on memory reference stream and stride detection, and has been shown effective in L2 prefetching in [37]. A loop-based stream detection unit, which detects memory reference streams based on loop-based prefetching, is added to the baseline 121 misstable miss prefetchdata stream bufferallocation constantstride detected MissTable stream bufferallocation Address, Stride Detection Unit Miss table prefetching architecture Loop-based prefetching architecture bufferstream misstablehit hit miss address signaliteration start StreamBuffers bufferstream)miss( address,Miss linea(prefetched line) L(a) +1 See the LBP Loop-Based Stream L1 cache stream detection figure Figure 6.3: L2 Prefetching Architectures architecture. This architecture is referred to as loop-based prefetching architecture. The performance of the baseline architecture (also called miss table prefetching) and the loopbased prefetching architecture is evaluated. For comparative purposes, an instructionaddress-based prefetching architecture is also evaluate by assuming that the addresses of memory reference instructions are available to L2 prefetching units. With the three prefetching architectures mentioned above, two different L2 memory organizations are evaluated: one with L2 caches and one without L2 caches. When L2 caches are used, the prefetched data is stored in the cache, and the stream buffers keep only the information needed for prefetching. When no L2 cache is used, the stream buffers store prefetched lines. In this case, each RPT entry of the instruction-addressbased prefetching architecture also stores a prefetched line in the additional storage associated with the entry. Figure 6.3 shows the baseline prefetching architecture and the loop-based prefetching architecture. 122 The stream buffers, the miss table, loop-based prefetching and its architecture are described in the next three sections. The instruction-address-based prefetching architecture is described in the fourth section. 6.2.1 Stream Buffers Stream buffers were initially proposed in [35] and were also used in [37]. This study employs a similar stream buffer architecture with slight modifications. The stream buffers keep and update memory access history, and prefetch data according to this information. A stream buffer stores a data address (DA) and stride (St) information, and is indexed by the line address of the data address. The initial values of DA and St are assigned when a stream buffer is allocated by separate memory stream detection units, such as miss tables and loop-based stream detection units. Also, several lines can be prefetched initially when a stream buffer is allocated. The number of lines is referred to as stream buffer depth, which this study assumes is a depth of one. When there is an L1 cache miss, the stream buffers are checked in parallel with an L2 cache. If there is no L2 cache, only stream buffers are accessed with the L1 cache miss address. The stream buffers are searched with the line address of the miss address. If there is more than one matching stream buffer, only one of them is selected. After a matching stream buffer is found, a prefetch request is issued for data address DA + St, and the DA is incremented by the St. The matching of an L1 cache miss in stream buffers is considered as a stream buffer hit; otherwise it is a stream buffer miss. When there is an L2 cache, the cache is checked before a prefetch request is issued to memory. If the cache already has the line containing the data to be prefetched, the prefetch request is discarded. Otherwise, the prefetch request fetches the line into the cache from the main memory. When there is no L2 cache, the stream buffer keeps the prefetched line until it is accessed by an L1 cache miss, or the stream buffer is replaced 123 to allocate a new stream. Stream buffers are replaced based on the LRU replacement policy. 6.2.2 Miss Table Prefetching (MTP) Architecture Similar to the filter-based unit stride stream method proposed in [37], this architecture uses miss tables to detect memory accesses with short strides or with good spatial locality and allocates stream buffers for such accesses. Note that it needs only L1 cache miss addresses to detect such memory access patterns. A miss tables stores line addresses. The table is fully-associative and indexed by line addresses. When a data address (Ma) misses in the stream buffers, miss table prefetching (MTP) operates as follows with the data address. Note that L(Ma) is the line address of data address Ma. if L(Ma) hits in the miss table then allocate a stream buffer(DA the first word address of line L(Ma) + 1, St the line size). issue a prefetch for DA. else allocate a new entry in the miss table with line address L(Ma) + 1. endif The new entries are allocated in circular FIFO order. When a matching entry is found, the entry is not freed or invalidated. This method of managing a miss table is chosen to simplify its architecture. 124 6.2.3 Loop-Based Prefetching (LBP) Architecture Miss table prefetching is effective for detecting memory access patterns with short strides or with good spatial locality. However, long stride memory accesses cannot be detected in miss table prefetching. In order to detect long stride memory accesses, memory reference streams must be identified. In the loop-based prefetching (LBP) architecture, a loopbased stream detection unit is added to MTP. The unit implements loop-based prefetching, which detects memory reference streams without instruction addresses. In the next subsections, we discuss loop-based prefetching and describe the loop-based stream detection unit. 6.2.3.1 Loop-Based Prefetching Memory references with a constant stride are usually generated by load/store instructions which are repeatedly executed in a loop. During the execution of a loop body, if there are no changes in control flow, the execution sequence of load/store instructions inside the loop body is constant between iterations. Let us assume initially that this is the case. If the start of an iteration can be detected, it is possible to identify a memory reference stream by its appearance order relative to the start of an iteration. Figure 6.4 shows how each load is identified and mapped into a reference prediction table (RPT) entry. Each iteration of a loop starts with an iteration start signal, which informs a prefetching unit of the start of an iteration, and is followed by a sequence of loads. A prefetching unit identifies each load by its relative position with respect to the iteration start signal. As memory addresses referenced by the loads appear in a sequential order to a prefetching unit, entries in the RPT are also mapped sequentially to calculate a stride and prefetch address for the load instruction. When the prefetching unit detects an iteration start, it resets its index to the first entry of the RPT, and the RPT entry 125 load B(2*i) do i = 1 to n enddo .. . . load A(i). load A(5*i) load C(i) Address of B(2*(i-1)) Address of A(i-1) Address of C(i-1) Address of A(5*(i-1)) < iteration_start > Reference Prediction Table Stride = 1 Stride = 2 Stride = 1 Stride = 5 Figure 6.4: Reference Prediction Table Mapping in Loop-Based Prefetching mapping starts from the first entry for subsequent loads in the loop. This sequential match maps a load to the same RPT entry from iteration to iteration. The operation requires a very simple RPT mapping hardware mechanism. Since the RPT is always accessed sequentially, only an RPT index counter is needed to access an entry. The counter is incremented by 1 each time a load is executed, and reset to the first entry of the RPT when the prefetching unit receives the iteration start signal. When there are more loads than the total number of entries in the RPT, the RPT overflows. In such a case, after the last entry of the RPT is mapped, subsequent load executions are ignored until the iteration start signal is received again. Other operations, such as updating memory access history and obtaining strides, can be implemented similarly to the methods proposed in [32, 33, 34]. This method can be extended to handle multiple nested loops and control flow changes inside loops. By providing additional loop execution information, such as loop start and loop exit, and branch information about which branches are taken, it is possible to accurately identify any memory reference stream generated by a load in a loop. However, generating this additional information incurs more overhead, and the prefetching unit handling the information becomes very complex. 126 In our approach, we use the simple RPT mapping hardware mechanism, ignoring data prefetching for other parts of the program and control flow changes. The RPT mapping scheme can detect memory reference streams of the innermost loops, because only the memory references of the innermost loops can continuously map into the same entry between consecutive iterations without other references mapping to the entry. Therefore, constant strides can be obtained for the innermost-loop memory accesses and used for prefetching. Since the innermost loops generate much greater memory accesses than the other parts of a program, the innermost loops should be the most important target of prefetching. The RPT mapping scheme can exploit the dominance of the innermost loops in memory accesses. We refer to this simple approach as loop-based prefetching. Loop-based prefetching requires an iteration start signal, which can be implemented by either hardware or software. In a hardware implementation, the detection of a backward branch can be used as the signal, which is presented on a processor chip pin. In a software implementation, an instruction can be used for the signal. To avoid using an extra pin, a memory mapped instruction can be used. 6.2.3.2 Loop-Based Stream Detection Unit A loop-based stream detection unit implements loop-based prefetching to detect memory reference streams and strides. The unit consists of a Reference Prediction Table (RPT), an RPT index counter, a comparator, an address adder, and a stride calculator as shown in Figure 6.5. Each RPT entry keeps a data address (DAl) and a stride (Stl). It is similar to other stream detection units [32, 33, 34], but uses loop information to identify memory reference streams. The stream detection unit is accessed with the data addresses (Ma) that miss in both the stream buffers and the miss table unit. An RPT entry pointed by the RPT index counter is accessed with the miss address, and Stl is computed. As soon as a stable stride 127 prefetchaddressstream bufferallocation incrementreset Reference Prediction Table index counter adder comparator stridecalculator data address data path control path miss stridedata address stride Figure 6.5: Loop-Based Stream Detection Unit is detected, that is, a newly calculated stride is equal to the old stride, a new stream buffer is allocated with the stride and the data address equal to the miss address plus the stride. When a new stream buffer is allocated, a prefetch request is issued for the data address as well. The following algorithm describes the operation of the prefetching unit when an RPT entry is accessed with the miss address, Ma. if Ma = DAl then allocate a stream buffer(DA DAl + Stl, St Stl). issue a prefetch for DA. else Stl Ma \Gamma (DAl \Gamma Stl). /* calculate a new stride */ endif DAl Ma + Stl. 128 prefetchaddress Reference Prediction Table adder comparator stridecalculator data addressload data path control path load instructionaddress data address stride stable bitinstruction address Figure 6.6: Instruction-Address-Based Prefetching Architecture The RPT index counter is incremented by one after an RPT entry is processed, and thereby, the next miss maps into the next RPT entry. The RPT entries are accessed in sequential order for every miss. The RPT index counter is reset to 0 upon detection of an iteration start signal. When the RPT counter increases beyond the total number of the RPT entries, it overflows, and the following accesses are ignored until the RPT index counter is reset. 6.2.4 Instruction-Address-Based Prefetching (IAP) Architecture For comparative purposes, the performance of the instruction-address-based prefetching (IAP) method is evaluated. The instruction-address-based prefetching architectures we simulate are similar to those proposed in [33, 34]. The IAP architecture consists of an RPT, a comparator, an address adder and a stride calculator, as show in Figure 6.6. Each RPT entry contains an instruction address, a data address (DAp), a stride (Stp), and a stable bit (Sb). 129 / p p UnstableState Sb = 0 Sb = 1 StableState a aL(M ) = L(DA ) M = DA Figure 6.7: State Transition Diagram The RPT is organized as a fully-associative table indexed by instruction addresses. When a load instruction is executed and the load misses the L1 cache, the instruction address is supplied to the prefetching unit along with the miss address (Ma). The instruction address is used to find a matching RPT entry. If a matching RPT entry is not found, a new entry is allocated for the load instruction, replacing an RPT entry using the Least Recently Used (LRU) replacement policy. The initial stride and stable bit are set to 0. The prefetching unit operates by having each entry make a state transition between the stable state and the unstable state, as shown Figure 6.7. This state transition is required to obtain a stable stride. In the two states, the prefetching unit reacts differently to an incoming L1 cache miss address (Ma). These operations and state transitions are similar to those of IAP methods proposed in [32, 33, 34]. The following algorithm describes the operation of the prefetching unit in each state. Note that L(Ma) is the line address of the data address Ma. Unstable State (Sb = 0) : if Ma = DAp then Sb 1. /* transition to the stable state, a stable stride detected. */ issue a prefetch for DAp + Stp. else 130 Stp Ma \Gamma (DAp \Gamma Stp). /* calculate a new stride */ endif DAp Ma + Stp. Stable State (Sb = 1): if L(Ma) = L(DAp) then issue a prefetch for Ma + Stp. else Sb 0. /* transition to the unstable state */ Stp Ma \Gamma (DAp \Gamma Stp). /* calculate a new stride */ endif DAp Ma + Stp. 6.3 Evaluation Methodology 6.3.1 Simulation Trace-driven simulations were conducted for the performance analysis. The traces of memory addresses referenced by loads and timing information are obtained via instrumentation and execution of programs. Programs are instrumented by the MIPS tracing tool [70], compiled with a MIPS optimizing Fortran compiler, and executed on a MIPS M120 system that has a R3000/3010 processor. The address traces are supplied to prefetching architecture simulators developed for this study. We assume that instructions are stored in a separate instruction cache with a one cycle access time and a perfect hit rate. We do not simulate instructions. The first and 131 second-level data caches are located on-chip and off-chip, respectively. The organization of the caches is direct-mapped and write-through. A cache line size is 4 words, and a word is 8 bytes in each case. We use an 8 Kbyte L1 data cache throughout our experiments. A processor stalls on a read miss and does not stall on a write miss. On a write miss, no cache line is allocated and all writes are put in a separate write buffer of infinite size. A read hit and a write hit take one cycle to complete. Prefetching operations are performed only for reads because writes rarely stall a processor if a large write buffer is employed. When a prefetching unit has a prefetch request to issue, it searches a cache tag store for a matching cache line. If a matching cache line is found, the prefetching request is discarded. When a prefetch request is issued, a cache line is reserved for the prefetched line and kept reserved until the prefetched line is returned. A processor stalls on a read hit in the prefetched line that is not yet fetched from main memory. A write hit on a reserved line proceeds without any delay, taking one cycle. If the reserved line contains a word accessed by an already pending write request, the line is updated accordingly. The iteration start signal for a loop is obtained by inserting a special mark command inside the loop. According to the mark command, the MIPS trace tool generates a special instruction that is recognized as an iteration start by the simulators during program execution. 6.3.2 Benchmarks Table 6.1 shows the characteristics of the benchmarks used. All are computationally intensive numerical applications. These applications usually exhibit large data set sizes. Except for ARC3D, they are selected from among the PERFECT [71] and NAS bench132 Benchmark Description Read Write Total Memory Access (M) Access (M) Access (M) APPBT BT simulated CFD 17.47 6.51 23.98 APPSP SP simulated CFD 16.49 5.31 21.8 ARC3D 3-D CFD 20.33 9.61 29.95 CG Conjugate gradient 14.4 7.33 21.73 DYFESM Structural dynamics 18.08 6.75 24.84 FLO52 2-D fluid dynamics 15.03 6.79 21.83 MDG Molecular dynamics 20.70 8.96 29.66 MGRID Multigrid kernel 14.53 8.6 15.39 OCEAN 2-D fluid dynamics 13.21 11.69 24.91 TRFD Molecular dynamics 15.39 7.98 23.38 Table 6.1: Benchmark Characteristics marks [72]: DYFESM, FLO52, MDG, OCEAN and TRFD are PERFECT benchmarks, and APPBT, APPSP, CG, and MGRID are NAS benchmarks. Table 6.2 shows the read characteristics of each benchmark. The third column of the table shows the L1 cache hit ratio of each benchmark. The fourth column shows the ratio of the total number of innermost reads to the total number of reads executed in each program. The innermost reads are the reads generated inside the innermost loops. The fifth column shows the ratio of constant stride read accesses to total read accesses. When a load generates a data address, a stride is calculated between the address and the last data address of the load. If the stride is equal to the previously calculated stride of the load, we consider it as a constant stride and count the access as a constant stride read access. These ratios were measured dynamically during program execution. In the last column, the ratio of the constant long stride read accesses to the total constant stride read accesses is shown. When a stride is larger than a cache line size (or negative), it is considered as a long stride in the statistics. Notice the large number of long stride accesses for some benchmarks. 133 Benchmark Total Read Hit Innermost Constant Stride Constant Read (M) Ratio (L1) Read Read Long Stride Percentage Percentage Read Percentage APPBT 17.4 93.2 86.6 80.51 57.88 APPSP 16.4 86.1 95.7 86.41 44.6 ARC3D 20.3 86.8 86.1 83.37 31.87 CG 14.3 67.5 95.5 61.55 0.05 DYFESM 18.0 87.0 89.3 71.92 5.97 FLO52 15.0 82.5 99.5 92.64 5.75 MDG 20.7 96.9 65.4 82.47 2.64 MGRID 14.5 94.8 99.9 92.49 0.40 OCEAN 13.2 76.3 99.3 96.93 31.9 TRFD 15.4 92.0 97.6 87.16 49.49 Table 6.2: Read Characteristics For programs other than MDG, the innermost reads account for the most read accesses of a program. MDG shows a noticeably lower innermost read percentage, 65.4 %, as compared to the other benchmarks. Note that CG and DYFESM have relatively low constant stride read access ratios, and APPBT, APPSP, ARC3D, OCEAN and TRFD have higher long stride ratios. CG and DYFESM showed such low constant stride ratios because they have a large number of array indirections. 6.3.3 Performance Metrics Cache miss (hit) rate is used as the main performance metric. A read access on a reserved cache line for prefetched data is counted as a cache hit. This is because such hits can reduce memory access latency, even though they cannot completely hide the latency. Prefetch prediction hit rate (PPHR) is also used to evaluate how well future data accesses are predicted by prefetching units, the prefetching prediction performance. These 134 metrics are defined by PPHR = The number of memory accesses that hit in a prefetching unitThe number of prefetch requests generated \Theta 100 A memory access hits in a prefetching unit if the corresponding data address matches a data address in the prefetching unit. This hit is referred to as a prefetching prediction hit. Note that the stream buffer hit mentioned in Section 6.2.1 is equivalent to the prefetching prediction hit of stream buffers. In addition to the above metrics, we present total memory traffic, that is, the total number of memory requests generated by cache misses and prefetch requests. In a cachebased system, a higher cache hit rate directly implies less main memory accesses and a reduction of memory contention. Prefetching, however, may increase the total amount of memory accesses and memory contention even though it improves the cache hit rate. It is necessary to look at the total memory traffic as well as the cache hit rate. We do not use performance metrics such as execution time because these require detailed timing information about the memory subsystem, and the results may vary widely depending on memory subsystem characteristics. These measures also depend on how far in advance prefetches are issued before actual memory accesses take place, a different issue in prefetching studies, which is not addressed here. 6.4 Experiments and Analysis Stride detection in L2 prefetching is difficult, and this study examines how much the efficiency of prefetch prediction is affected by this difficulty. Table 6.3 shows the prefetch prediction hit rate (PPHR) of the L1 and L2 IAP method. The RPT size used in both IAP methods is 256. Although we use the same prefetching method by supplying instruction addresses to the L2 IAP unit, for most benchmarks the prefetch prediction hit rate of 135 Benchmark L1 IAP L2 IAP PPHR PPHR APPBT 69.6 51.1 APPSP 79.8 61.3 ARC3D 73 57.3 CG 62.6 41.9 DYFESM 67.9 60.9 FLO52 89.8 86.3 MDG 74.1 46.4 MGRID 93.6 76.9 OCEAN 95.5 89.9 TRFD 81.1 18.2 Table 6.3: L1 and L2 Prefetching Prediction Hit Rate (PPHR), RPT size = 256 the L2 IAP is much lower than that of the L1 IAP method. This low PPHR is caused by the difficulty in detecting a constant stride at L2. The screening effect of L1 caches and conflict misses disturbs the miss address streams, which otherwise would be consistently visible to L2 prefetching units. The results indicate that stride-directed prefetching is not as effective at L2 as at L1, even if memory reference streams are accurately detected. 6.4.1 Prefetching without Caches The prefetching methods, IAP, LBP and MTP, are first examined without L2 caches. This system organization is similar to the prefetching system studied in [37], in that prefetched data are stored in stream buffers. For the IAP method studied, the prefetched data are assumed to be stored in the RPT, which has a storage associated with each entry. Since the RPT and stream buffers are similar in their function and organization, the term stream buffer is used for both if not mentioned otherwise. In this experiment, the number of stream buffers (RPT size) varies as 16, 32, 64, 128, and 256, and the miss table size varies as 8, 32, and 128. Because 136 the stream buffers and miss tables need to be fully associative, it is not very practical to increase their size beyond 64 entries. In this study, however, a larger number of stream buffers and a larger size miss table are used to investigate how the parameters affect the performance of the prefetching methods. In addition to the stream buffers and the miss table, the LBP method needs an RPT for loop-based stream detection. In the experiments, the size of the additional RPT is fixed at 64 entries. We observed that no more than 33 entries were used in any of our benchmarks. Note that the RPT for loop-based prefetching is used only for stream detection and does not issue prefetch requests as done by the stream buffers or the RPT in the IAP method. Tables 6.4 and 6.5 show stream buffer miss rates for each benchmark. The stream buffer miss rate is measured as the number of stream buffer misses over the total number of L2 memory accesses, that is, L1 cache misses. As the number of stream buffers and the miss table size increases, the stream buffer miss rate is continuously improved in most cases. For most benchmarks, the change in the number of stream buffers affects performance more than the change in the miss table size. Increasing the miss table size beyond 32 entries does not significantly improve the miss rate. For some benchmarks, a large miss table increases the miss rate, due to a large miss table catching more misses and resulting in too many stream buffer allocations. This over-allocation may replace some of the useful stream buffers. Increasing the number of stream buffers beyond 32 entries, however, still shows a large improvement, especially for the MTP and LBP methods. For example, when the number of stream buffers increases from 64 to 128, APPBT, ARC3D, and CG show large improvements. Increasing the number of stream buffers is beneficial because this increases storage for prefetched data and provides more chances to initiate prefetches. 137 APPBT N of Stream MTP LBP IAP Buffers m3 m5 m7 m3 m5 m7 - 16 52.5 51.8 50 48.6 48.9 47.1 80.1 32 48.7 48 46.5 46.4 45.7 44.2 60.2 64 42 41.2 41 40 38.9 38.7 53.1 128 33.9 32.8 32.2 31.2 30.5 29.8 49.1 256 33.6 32.4 31.8 31 29.9 29.4 48.9 APPSP 16 68.6 67.6 71.4 42.8 45.9 51 53.7 32 65.4 63 63.7 38.8 41 47.5 43.3 64 64.3 59.3 55.2 35.5 35.2 38.3 39.6 128 64.1 58.4 50.8 34.2 32.1 33.1 39 256 63.6 57.9 50.3 33.9 31.2 31.4 38.7 ARC3D 16 67.3 65.2 64.6 59.7 58.8 57.4 77.1 32 66.4 63.6 63.1 58.7 57.6 56.5 48.7 64 64.8 61.8 61.1 56.9 55.5 54.4 47.6 128 47.9 45.7 45.1 37.3 37.5 37.5 47.2 256 40.1 37.8 37.5 24.6 25.1 25.5 42.7 CG 16 47.4 47.8 47.9 47.4 47.8 47.9 58.4 32 44.5 44.6 45.2 44.5 44.6 45.2 58.1 64 39.2 39.3 39.9 39.2 39.4 39.9 58.1 128 31.1 30.4 31.3 31.2 30.4 31.3 58.1 256 21.9 20.3 19.4 21.9 20.3 19.4 58.1 DYFESM 16 17.6 17.1 16.8 16.6 16 15.9 42.3 32 15.8 15.6 15.5 14.8 14.7 14.7 42.1 64 15.4 15.2 14.9 14.3 14.1 14 40.2 128 14 13.9 13.8 13.1 13.1 12.9 39.3 256 13.1 13.1 13.2 12.5 12.4 12.1 39.1 Table 6.4: Stream Buffer Miss Rate: m3, m5, m7 = Miss Table Size 8, 32 and 128, respectively 138 FLO52 N of Stream MTP LBP IAP Buffers m3 m5 m7 m3 m5 m7 - 16 13.3 12 11.9 10.4 10.6 10.5 15.9 32 12.8 9.65 9.59 9.41 8.2 8.12 14.1 64 12.7 9.54 9.46 9.21 7.82 7.75 13.9 128 12.7 9.52 9.44 9.19 7.81 7.74 13.8 256 12.6 9.49 9.41 8.98 7.77 7.69 13.7 MDG 16 61.1 57.4 58 46.4 45.4 46.7 72.7 32 57.4 50.6 49.7 39.6 35.2 34.9 61.8 64 56.2 49.4 48.2 37.3 33.4 32 57.2 128 54.2 48.1 47 32.8 30.2 30.3 53.6 256 51.3 45.4 44.3 26.6 24.7 24.5 53.6 MGRID 16 15.3 15.1 15 10 10.3 10.2 24.6 32 14.6 14.5 14.4 7.99 8.44 8.91 23.2 64 13.7 13.6 13.5 7.42 7.68 7.94 23.2 128 13.6 13.5 13.4 7.27 7.51 7.77 23.2 256 13.3 13.3 13.2 7.26 7.45 7.73 23.1 OCEAN 16 46.7 46.5 47.6 11.8 12.9 15.1 10.6 32 44.4 46.2 46.1 11.7 12.2 15.4 10.2 64 35.4 34.5 32.6 8.82 7.87 10.5 10.1 128 33.3 31.9 25.4 7.98 6.04 6.5 10.1 256 30.6 29.5 24.2 8.49 7.47 6.64 10.1 TRFD 16 69.6 67.1 67.9 66.4 64 64.9 81.8 32 68 58.3 57.9 64.7 56.4 55.7 81.8 64 66.8 52.8 51.9 63.7 51 49.5 81.8 128 64.1 50.3 49.3 61.5 48.3 46.9 81.8 256 60.3 48.5 47.6 56.7 46.3 43.9 81.8 Table 6.5: Stream Buffer Miss Rate: m3, m5, m7 = Miss Table Size 8, 32 and 128, respectively 139 For all benchmarks and most parameters, MTP and LBP perform better than IAP. This is partially because data in the stream buffers is looked up by data addresses in MTP and LBP, whereas it is looked up by instruction addresses in IAP. A more important reason for the different performances is the different prefetching styles. IAP is based on memory access patterns of each memory reference stream, whereas MTP and LBP can exploit memory access patterns with good spatial locality even if they are observed across several memory reference streams. In MTP and LBP, a relatively large portion of prefetching is based on such memory access patterns. Table 6.6 and 6.7 show the stream buffer hit distributions of LBP and MTP, respectively. When a stream buffer is allocated by a miss table or a loop-based stream detection unit, the consecutive L1 cache misses causing the allocation may or may not belong to the same memory reference stream. If these belong to the same memory reference stream, a stream buffer is exactly allocated for the memory reference stream and belongs to the memory reference stream. Depending on the stream buffer and the L1 cache miss that hits the stream buffer, we classify the stream buffer hits into the following different types. ffl Type 1 hit: the stream buffer is not exactly allocated. ffl Type 2 hit: the stream buffer is exactly allocated, but the L1 cache miss and the stream buffer belong to different memory reference streams. ffl Type 3 hit: the stream buffer is exactly allocated, and the L1 cache miss and the stream buffer belong to the same memory reference stream. The type 1 and type 2 hits indicate successful prefetching based on memory access patterns with good spatial locality. The type 3 hit implies successful prefetching based on memory access patterns of one memory reference, for which stride-directed prefetching is good. 140 Benchmark Type 1 Type 2 Type 3 Total Hit rate APPBT 59.4 4.05 6.68 70.1 APPSP 28.3 5.58 34.9 68.8 ARC3D 53.8 9.6 11.6 74.9 CG 41 32 6.7 79.7 DYFESM 47.8 25.4 14.4 87.6 FLO52 20.5 8.59 63.2 92.2 MDG 26.4 16.8 32.2 75.3 MGRID 25 28.1 39.4 92.6 OCEAN 26.4 35.6 30.6 92.5 TRFD 5.16 11.5 37.1 53.7 Table 6.6: Stream Buffer Hit Rate Distributions of LBP: 256 Stream Buffers, 32-entry Miss Table As shown in Tables 6.6 and 6.7, a large portion of the stream buffer hits are contributed by the type 1 and type 2 hits for MTP and LBP. In IAP, only type 3 hits are possible because its prefetching is based on each memory reference stream, and therefore a memory reference cannot access data prefetched for other memory references. Recall that the RPT of IAP is indexed by instruction addresses. Since stride detection is difficult at L2, a prefetching method based solely on the constant stride of a memory reference stream is not as effective as in L1 prefetching. Therefore, stride-directed prefetching alone cannot be an efficient L2 prefetching method. On the other hand, prefetching methods based on memory access patterns with good spatial locality become important in L2 prefetching. Although L2 stride-directed prefetching is not as effective as L1 stride-directed prefetching, it is the only way to prefetch data with long stride accesses. LBP improves over MTP for long stride accesses by using loop-based prefetching. Loop-based prefetching helps with detecting and prefetching long stride memory accesses. Between LBP and MTP, LBP shows lower stream buffer miss rates for all benchmarks and parameters than does 141 Benchmark Type 1 Type 2 Type 3 Total Hit rate APPBT 60.4 4.14 3.04 67.6 APPSP 33.4 1.51 7.15 42.1 ARC3D 56.2 2.99 3.05 62.2 CG 44.5 29 6.15 79.7 DYFESM 47.6 26.7 12.6 86.9 FLO52 40.4 11.1 39 90.5 MDG 29.2 13.1 12.3 54.6 MGRID 49.3 16.1 21.4 86.7 OCEAN 40.2 25.3 4.97 70.5 TRFD 5.74 9.56 36.2 51.5 Table 6.7: Stream Buffer Hit Rate Distributions of MTP: 256 Stream Buffers, 32-entry Miss Table MTP. Except for TRFD, the LBP with the smallest miss table has a lower miss rate than MTP with the largest miss table at a given number of stream buffers. APPSP, ARC3D, and OCEAN show the largest differences because they have a relatively large portion of L1 cache misses caused by long stride accesses. The results show that for such long stride accesses, stride-directed prefetching in LBP is still effective even if it is performed at L2. On the other hand, APPBT, which has many long stride accesses, does not show much improvement with LBP. As it turns out, more than 60 % of long stride misses have strides shorter than 2 line sizes. Therefore, miss tables can successfully capture such accesses and allocate stream buffers, resulting in only small improvements from LBP. TRFD also has a large percentage of long stride L1 cache misses, but shows only small improvements with LBP. As observed from the IAP performance of TRFD, it is hard to obtain a constant stride. The loop-based stream detection unit is not effective in such cases. 142 6.4.2 Prefetching with Caches So far, L2 prefetching without caches has been studied. In the next set of experiments, a small L2 cache is used together with a prefetching unit. The prefetched data is directly stored into the cache, and stream buffers store only data address and stride information. The L2 cache is 32 Kbytes, direct-mapped, and write-through. A line contains 4 words and the word size is 8 bytes. The number of stream buffers varies as 16, 32, 64, 128, and 256, and the miss table size is fixed at 32. The L2 cache miss rates of each prefetching method and the L2 cache alone are shown in Figures 6.8-6.10. First, the miss rates of the prefetching systems with caches are compared to the previous results, the miss rates of the prefetching systems without caches, already shown in Table 6.4 and 6.5. Although the additional L2 cache size is small, for most benchmarks, prefetching systems with caches improve the performance substantially over the prefetching systems without caches. In addition, with caches, the performance difference caused by a different number of stream buffers becomes very small. In other words, even with a small number of stream buffers, when prefetching is used with caches, it is very effective. The cache is most beneficial for the IAP method because the cache can take advantage of the memory reference locality among several memory reference streams. When the IAP method is used without caches, the memory reference locality cannot be exploited very well because the RPT is indexed by instruction addresses. For TRFD, the performance of the prefetching systems with caches is not as good as the systems without caches for some parameters. As it turns out, the L2 cache has a large number of conflict misses. When we replace the L2 cache with a fully-associative cache, the cache miss rate improves dramatically even with a smaller cache. For example, with an 8-Kbyte fully-associative L2 cache, all three prefetching methods reduce the cache miss rate to less than 3 %. 143 ||0 | 8 |16 | 24 |32 | 40 |49 | 57 |65 | 73 |81 APPBT Miss Rate (%) 80.7 30.7 29.6 61.0 29.5 28.4 40.9 27.0 25.4 37.2 24.1 22.4 36.3 24.0 22.2 36.2 C M L P s = 16 M L P s = 32 M L P s = 64 M L P s = 128 M L P s = 256 ||0 | 8 |17 | 25 |34 | 42 |50 | 59 |67 | 76 |84 APPSP Miss Rate (%) 83.3 51.9 30.1 35.2 49.6 27.8 28.8 47.7 24.4 27.7 47.4 23.0 27.6 47.2 22.6 27.5 C M L P s = 16 M L P s = 32 M L P s = 64 M L P s = 128 M L P s = 256 ||0 | 2 |5 | 7 |9 | 12 |14 | 16 |18 | 21 |23 ARC3D Miss Rate (%) 22.1 16.8 13.5 18.8 16.4 13.2 10.3 16.2 13.0 10.0 15.8 11.8 10.0 15.4 10.1 9.2 C M L P s = 16 M L P s = 32 M L P s = 64 M L P s = 128 M L P s = 256 ||0 | 7 |13 | 20 |26 | 33 |40 | 46 |53 | 59 |66 CG Miss Rate (%) 65.4 15.7 15.7 23.3 15.0 15.0 23.2 14.3 14.3 23.2 12.9 12.9 23.2 11.6 11.5 23.2 C M L P s = 16 M L P s = 32 M L P s = 64 M L P s = 128 M L P s = 256 Figure 6.8: Cache Miss Rate: L1 Cache Size = 8 Kbytes, Miss Table Size = 32 entries, L2 Cache Size = 32 Kbytes, s = Number of Stream Buffers, C = Cache-only, M = MTP, L = LBP, P = IAP 144 ||0 | 3 |6 | 8 |11 | 14 |17 | 20 |22 | 25 |28 DYFESM Miss Rate (%) 27.5 7.7 6.9 14.3 7.6 6.9 14.3 7.6 6.8 13.6 7.3 6.5 13.3 7.2 6.6 13.1 C M L P s = 16 M L P s = 32 M L P s = 64 M L P s = 128 M L P s = 256 ||0 | 8 |17 | 26 |34 | 42 |51 | 60 |68 | 76 |85 FLO52 Miss Rate (%) 84.1 7.4 7.4 11.5 6.5 6.4 10.5 6.4 6.3 10.4 6.4 6.4 10.4 6.4 6.4 10.3 C M L P s = 16 M L P s = 32 M L P s = 64 M L P s = 128 M L P s = 256 ||0 | 2 |4 | 5 |7 | 9 |11 | 13 |14 | 16 |18 MDG Miss Rate (%) 17.1 4.0 3.8 14.0 3.6 3.3 12.1 3.6 3.2 12.0 3.6 3.2 11.9 3.5 3.2 11.9 C M L P s = 16 M L P s = 32 M L P s = 64 M L P s = 128 M L P s = 256 ||0 | 6 |13 | 20 |26 | 32 |39 | 46 |52 | 58 |65 MGRID Miss Rate (%) 64.1 9.8 5.6 13.4 9.6 5.0 13.1 9.5 4.9 13.1 9.4 4.9 13.1 9.4 5.0 13.0 C M L P s = 16 M L P s = 32 M L P s = 64 M L P s = 128 M L P s = 256 Figure 6.9: Cache Miss Rate: L1 Cache Size = 8 Kbytes, Miss Table Size = 32 entries, L2 Cache Size = 32 Kbytes, s = Number of Stream Buffers, C = Cache-only, M = MTP, L = LBP, P = IAP 145 ||0 | 9 |19 | 28 |37 | 46 |56 | 65 |74 | 84 |93 OCEAN Miss Rate (%) 92.8 39.9 9.6 8.0 38.3 9.7 7.9 31.6 6.4 7.9 30.3 6.8 7.9 29.3 9.3 7.9 C M L P s = 16 M L P s = 32 M L P s = 64 M L P s = 128 M L P s = 256 ||0 | 8 |16 | 24 |32 | 40 |47 | 55 |63 | 71 |79 TRFD Miss Rate (%) 78.7 54.1 51.8 63.0 52.3 50.5 63.0 51.5 50.0 63.0 51.2 49.4 63.0 50.7 49.2 63.0 C M L P s = 16 M L P s = 32 M L P s = 64 M L P s = 128 M L P s = 256 Figure 6.10: Cache Miss Rate: L1 Cache Size = 8 Kbytes, Miss Table Size = 32 entries, L2 Cache Size = 32 Kbytes, s = Number of Stream Buffers, C = Cache-only, M = MTP, L = LBP, P = IAP Second, the hit rates of L2 caches and prefetching with a small cache are compared. Figure 6.11 shows that the hit ratio difference between LBP with a 32K cache and L2 caches whose size varies as 32K, 128K, 256K, 512K, 1M, and 2M. A negative value means the LBP system has a higher hit ratio than the L2 caches by the amount shown. In general, as the L2 cache size increases, the hit ratio of L2 caches becomes higher than that of the LBP system. For all benchmarks except TRFD, L2 caches need to be at least almost four times larger (128K) than the cache used with LBP to match the hit rate. Recall that in TRFD, LBP suffered from cache conflict misses, but a smaller fully-associative cache solved the problem, achieving a cache hit ratio higher than 97 %. When the LBP system is compared with a 16 times larger L2 cache (512K), it can attain up to 40 % higher hit rates in half of the benchmarks. 146 -80 -60 -40 -20 0 20 40 60 80 32K 64K 128K 256K 512K 1M 2M Hit Ratio Difference L2 Cache Size APPBTAPPSP ARC3DCG DYFESM -80 -60 -40 -20 0 20 40 60 80 32K 64K 128K 256K 512K 1M 2M Hit Ratio Difference L2 Cache Size FLO52MDG MGRIDOCEAN TRFD Figure 6.11: Hit Ratio Difference Between Loop-Based Prefetching versus Secondary Cache: LBP uses 64 Stream Buffers, a 32-entry Miss Table, a Loop-Based Stream Detection Unit and a 32K L2 Cache. L2 Cache-only uses 32K, 64K, 128K, 256K, 512K, 1M, and 2M Caches. Although the best possible performance of the LBP system is compared with that of L2 caches, the large cache size difference strongly implies that LBP systems can be more efficient than L2 caches when sufficient memory bandwidth is available. In addition, these results are consistent with [37] which already showed that prefetching alone can perform better than a large L2 cache for scientific codes with large data sets. Since adding a small cache to a prefetching-only system significantly boosts the performance even with a smaller number of stream buffers for most benchmarks, the combined organization would be a better choice than prefetch-only or cache-only systems. Finally, the three different prefetching methods are compared when they are used with a small L2 cache. The relative performance of prefetching systems does not change much with the caches, even though the differences are reduced. Among the three prefetching methods, LBP shows the best performance for all benchmarks except ARC3D. In ARC3D, 147 ||0 | 2 | 3 | 5 | 6 | 8 | 10 | 11 | 13 | 14 |16 Memory Traffic Increase (%) 5.9 5.6 3.8 7.5 8.5 3.4 4.5 7.4 7.6 1.0 1.0 0.52 15.1 13.5 5.3 M L P APPBT M L P APPSP M L P ARC3D M L P CG M L P DYFESM ||0 | 2 |5 | 8 | 10 |12 | 15 | 18 | 20 | 22 | 25 Memory Traffic Increase (%) 3.6 4.1 3.7 10.9 10.5 10.0 4.9 2.2 1.2 0.91 2.0 1.1 24.7 23.4 1.8 M L P FLO52 M L P MDG M L P MGRID M L P OCEAN M L P TRFD Figure 6.12: Prefetching Memory Traffic Increase over Cache-only System: L1 Cache Size = 8Kbytes, Number of Stream Buffers = 64, Miss Table Size = 32 entries, L2 Cache Size = 32 Kbytes, M = MTP, L = LBP, P = IAP the IAP method is the best when the number of stream buffers is larger than 16. For benchmarks other than ARC3D, the IAP method shows the worst performance because of its previously mentioned limitations in L2 prefetching. On the other hand, MTP is effective in reducing miss rates, as compared to IAP for most of the benchmarks except APPSP, ARC3D, and OCEAN. LBP further improves the miss rate over MTP. This result shows that loop-based prefetching is still effective at L2. As in the previous experiments without caches, in APPSP, ARC3D, and OCEAN, LBP has significant improvements over MTP, because the benchmarks have a relatively large portion of their L1 cache misses caused by long stride accesses. 148 One of problems associated with prefetching is the extra memory traffic increased by unnecessary prefetches. We compare memory traffic increase of MTP, LBP, and IAP with respect to the memory traffic generated with a 32 Kbyte L2 cache. Figure 6.12 shows the memory traffic increase for each prefetching method. For most benchmarks, the increase is not very large, because constant stride detection is used and the stream buffer depth is only one. Only DYFESM, MDG and TRFD show more than a 10 % increase in memory traffic. For most benchmarks, IAP shows the smallest increase because it does not prefetch data much as its low stream buffer hit rates show. For APPBT, DYFESM, MGRID and TRFD, LBP has lower memory traffic increase than MTP. Considering the better cache miss rates and a relatively small memory traffic increase of LBP among the three prefetching methods, LBP with a small cache is the most efficient architecture among various L2 memory organizations studied. 6.5 Conclusions Off-chip, second-level (L2) prefetching has different characteristics than on-chip, firstlevel (L1) prefetching. At L2, only L1 cache miss address are visible, and it is hard to obtain instruction addresses. These characteristics make stride-directed prefetching difficult at L2. We proposed loop-based prefetching that enables stride-directed prefetching at L2. Loop-based prefetching relies on loop execution information and does not need instruction addresses to identify memory reference streams. Stride-directed prefetching was shown not to be as effective at L2 as at L1 because of the difficulty in detecting a constant stride. On the other hand prefetching methods such as MTP, which depend on memory access patterns with good spatial locality, became more important. However, MTP has its limitations in prefetching for long-stride memory accesses. When loop-based prefetching 149 was combined with MTP, it improved performance significantly over MTP for such longstride memory accesses and became the best L2 prefetching method. Three different second-level memory organizations were compared: a traditional cache (cacheonly), prefetching without a cache (prefetching-only), and prefetching with a small cache. Prefetching-only systems had been shown to achieve comparable hit rates to large L2 caches [37]. Adding a small L2 cache to the prefetching systems boosted the performance significantly, because the cache took advantage of spatial and temporal locality among prefetched data. It also allowed the prefetching systems to work reasonably well with a small number of stream buffers. The loop-based prefetching architecture combined with a small L2 cache performed significantly better than prefetching-only systems. Compared with L2 cache-only systems, the prefetching architecture attained considerably higher cache hit rates (up to 40 %) than an L2 cache which is 16 times larger (512K) than its 32Kbyte cache in half of the benchmarks. This combined architecture seems to be one of the best L2 memory organizations. Although our experiments are limited to uniprocessor systems, the loop-based prefetching architecture combined with a small L2 cache also can be used effectively in multiprocessor systems, where memory access is a more serious performance bottleneck. 150 Chapter 7 Conclusions A major performance bottleneck in multiprocessor systems is memory access latency, most of which is contributed by interconnection network traversals of memory request and reply messages. Therefore, selecting an appropriate interconnection network for a given system is crucial in terms of performance and cost of the system. This dissertation conducted an extensive comparative study of different interconnection network organizations under various design constraints. Detailed trace-driven simulations of a whole system were employed to incorporate the effects of other system components, such as cache stalls, feedback effects, and pipeline effects, into our network study. Routing in shuffle-exchange shuffle-exchange networks were first investigated. A theoretical framework was established for routing in multistage networks, and an algorithm was derived to find a shortest path routing tag in single stage shuffle-exchange networks. In the theorem and algorithm, the system size is limited to a multiple of the switch size rather than a power of the switch size, allowing a more flexible incremental scaling of the system size. We evaluated the effect of shortest path routing in single stage shuffle-exchange networks and compared it with multistage routing, which requires dlogK N e hops in message 151 routing. As system size increased, average internode distance increased more gradually with shortest path routing than with multistage routing. Shortest path routing improved average internode distance the most when the network size was slightly larger than a power of the switch size. Additional simulation studies confirmed that the average internode distance improvements with shortest path routing directly affected the overall memory system performance for the chosen benchmarks. From these results, we predict that shortest path routing can improve the system performance up to 30 %, depending on the system and switch sizes. The performance and design trade-offs of three interconnection network topologies in shared memory multiprocessor systems were evaluated: multistage shuffle-exchange (MSX) networks, single stage shuffle-exchange (SSX) networks, and multidimensional torus (TORUS) networks. We employed three different constraint models that reflect the limitations imposed on network structure, packaging and network cost. These constraint models are fixed switch size and channel width, constant number of switch pins, and constant network cost. Under each constraint model, the networks were evaluated by varying the switch size, channel width and system size for five benchmarks. We first investigated the stage delay and memory waiting time, which contributed to read miss latency the most. As the channel width increased up to 4 bytes and more, the stage delay quickly dropped to near its minimum. When such wide channels were used, the difference in the stage delay and memory waiting time of different networks was so small that the the average message path length became a dominant cause of the network performance difference. When the switch size and channel width were fixed, the performance difference between networks of different topologies was as high as 113 % and varied dramatically as the channel width changed. MSX networks showed better performance than the other networks. As the channel width increased, SSX networks improved dramatically to be152 come better than TORUS networks and their performance was close to that of MSX networks. When the number of switch pins was limited, trade-offs existed between the switch size and channel width. If more than a certain number of switch pins were available, increasing the switch size was more beneficial than increasing the channel width. MSX networks showed the best performance under this constraint, and as more switch pins were allowed, SSX networks became better than TORUS networks, showing performance close to that of MSX networks. When network cost was considered, there were significant differences in the read miss latency among different networks at a given cost. A substantial network cost reduction was possible when a small performance degradation could be tolerated. In most cases, the best network at a given cost was an SSX network, whereas TORUS networks showed the worst performance at the same cost. In general, MSX networks are the best network topology when cost is not the main limiting factor. Otherwise, SSX networks are the best network topology when cost is a main limiting factor. TORUS networks were seriously limited by their longer average message path length. Data prefetching is an attractive solution to large memory access latency. However, prefetching has fundamental limitations because of high memory bandwidth demand and inaccurate prefetch address prediction. The impact of tagged prefetching on network and memory performance was studied. Although prefetching increased read miss latency, it still reduced total read latency by increasing the cache hit ratio. Most networks handled the increasing network traffic rather well when the channel width was larger than 2 bytes. However, for ARC3D and MDG, prefetching did not help much to reduce read latency because tagged prefetching was not effective for long stride accesses and stride 0 accesses. When prefetching was effective, the difference in the processor read latency between systems with different networks became small. In particular, when the channel width was 153 larger than 2 bytes, only minimal differences were observed. Data prefetching resulted in more performance improvements for networks with long average message path length, such as TORUS networks than for multistage and single stage networks. This was possible because data prefetching effectively covered the memory access latency caused by long message paths. In general, when networks are evaluated with data prefetching, the results are more favorable for networks of higher bandwidth. When prefetching was used, writes could have a significant impact on memory and network performance, because both requests compete for network and memory accesses. Issuing prefetches and writes should be controlled to optimally use a given network and memory bandwidth. The effect of the varying number of outstanding requests was evaluated. Our results showed that the maximum number of outstanding writes should be larger than one. The optimal values for the maximum number of outstanding write and prefetch requests depended on the networks and the benchmarks. However, for all benchmarks except EFLUX, 4 outstanding writes and prefetches resulted in a memory access time which was almost optimal. Only EFLUX needed more than 4 outstanding requests, particularly for writes. It was found to be more appropriate to limit the number of outstanding requests based on the total requests rather than based on each request type. The former approach could more fully utilize pending request buffers whose size limits the total number of outstanding requests. Once a higher priority was given to prefetches which did not generate a large number of outstanding requests, the pending request buffer was hardly monopolized by prefetches. In this case, only a small size pending request buffer was needed. A buffer size of 20 entries was sufficient for all our benchmarks including EFLUX. Finally, we studied prefetching at the second-level of a memory hierarchy and outside a processor (off-chip) in uniprocessor systems. At the second-level and off-chip, only 154 first-level cache miss addresses are visible, and it is hard to obtain instruction addresses. These characteristics make stride-directed prefetching difficult. Loop-based prefetching was proposed to enable stride-directed prefetching at the second-level and off-chip. Loop-based prefetching relies on loop execution information and does not need instruction addresses to identify memory reference streams. Stridedirected prefetching was shown to be not as effective at the second-level and off-chip as at the first-level and on-chip because of the difficulty in detecting a constant stride. On the other hand, prefetching methods such as miss table prefetching, which depend on memory access patterns with good spatial locality, became more important. When loopbased prefetching was combined with miss table prefetching, it improved performance significantly over miss table prefetching for long stride memory accesses and became the best second-level prefetching method. Three different second-level memory organizations were compared: a traditional cache (cacheonly), prefetching without a cache (prefetching-only), and prefetching with a small cache. Adding a small cache to prefetching-only systems boosted the performance significantly, because the cache took advantage of spatial and temporal locality among prefetched data. It also allowed the prefetching systems to work reasonably well with a small number of stream buffers. The loop-based prefetching architecture combined with a small cache performed significantly better than prefetching-only systems. Compared with cache-only systems, the prefetching architecture can attain considerably higher cache hit rates than a very large second-level cache for most benchmarks. 155 Bibliography [1] J. Chang, P. S. Song, and et al., "The PowerPC 604 RISC microprocessor," IEEE Micro, vol. 14, Oct. 1994. [2] L. Gwennap, "Digital leads the pack with 21164: First of next-generation RISCs extends Alpha's performance lead," Microprocessor Report, vol. 8, Sept. 1994. [3] L. Gwennap, "620 fills out PowerPC production line," Microprocessor Report, vol. 8, Oct. 1994. [4] L. Gwennap, "MIPS R10000 uses decoupled architecture," Microprocessor Report, vol. 8, Oct. 1994. [5] G. P. Lowney, S. M. Freudenberger, and et al., "The multiflow trace scheduling compiler," The Journal of Supercomputing, vol. 7, pp. 51-142, may 1993. [6] W.-M. W. Hwu, S. A. Mahlke, and et al., "The superblock: An effective technique for VLIW and superscalar compilation," The Journal of Supercomputing, vol. 7, pp. 229-248, 1993. [7] D. F. Bacon, G. L. Susan, and O. J. Sharp, "Compiler transformations for highperformance computing," ACM Computing Surveys, vol. 26, Dec. 1994. [8] C. B. Stunkel, D. G. Shea, D. G. Grice, P. H. Hochschild, and M. Tsao, "The SP1 high-performance switch," in Proceedings of the Scalable High Performance Computing Conference, pp. 150-157, May 1994. [9] C. B. Stunkel, D. G. Shea, B. Abali, M. M. Denneau, P. H. Hochschild, D. J. Joseph, B. J. Nathanson, M. Tsao, and P. R. Varker, "Architecture and implementation of Vulcan," in Proceeding of the 8th International Parallel Processing Symposium, pp. 268-274, Apr. 1994. [10] R. K. Koeninger, M. Furtney, and M. Walker, "A shared memory MPP from Cray research," Digital Technical Journal, vol. 6, pp. 8-21, Spring 1994. [11] C. Leiserson and et al., "The network architecture of the connection machine CM-5," in Symposium on Parallel Algorithms and Architectures92, pp. 272-285, June 1992. 156 [12] R. Berrendorf, H. C. Burg, U. Detert, R. Esser, M. Gerndt, and R. Knecht, "Intel Paragon XP/S - architecture, software environment, and performance," Tech. Rep. KFA-ZAM-IB-9409, KFA Research Centre, Juelich, 1994. [13] A. Gupta, J. Hennessy, K. Gharachorloo, T. Mowry, and W.-D. Weber, "Comparative evaluation of latency reducing and tolerating techniques," in International Symposium on Computer Architecture, pp. 254-263, May 1991. [14] C. P. Kruskal and M. Snir, "The performance of multistage interconnection networks for multiprocessors," IEEE Transactions on Computers, vol. C-32, pp. 1091-1098, Dec. 1983. [15] L. N. Bhuyan, Q. Yang, and D. P. Agrawal, "Performance of multiprocessor interconnection networks," IEEE Computer, vol. 22, pp. 25-37, Feb. 1989. [16] J. H. Patel, "Performance of processor-memory interconnections for multiprocessors," IEEE Transactions on Computers, vol. C-30, pp. 301-310, Oct. 1981. [17] D. M. Dias and J. R. Jump, "Analysis and simulation of buffered delta networks," IEEE Transactions on Computers, vol. C-30, pp. 331-340, Apr. 1981. [18] S. Abraham and K. Padmanabhan, "Performance of the direct binary n-cube network for multiprocessor," IEEE Transactions on Computers, vol. 38, pp. 1000-1011, July 1989. [19] G. Lee, "A performance bound of mulitstage combining networks," IEEE Transactions on Computers, vol. C-32, no. 12, pp. 1091-1098, 1989. [20] J. E. Smith and W. R. Taylor, "Accurate modeling of interconnection networks in vector supercomputers," in International Conference on Supercomputing, pp. 264- 273, June 1991. [21] S. Turner and A. Veidenbaum, "Performance of a shared-memory system in a vector multiprocessor," in International Conference on Supercomputing, pp. 315-325, July 1988. [22] X.-N. Tan and K. C. Sevcik, "Reduced distance routing in single-stage shuffleexchange interconnection networks," tech. rep., University of Toronto, Sept. 1986. [23] P.-C. Yew, On The Design of Interconnection Networks For Parallel and Multiprocessor Systems. PhD thesis, University of Illinois at Urbana-Champaign, 1981. [24] P.-C. Yew, D. A. Padua, and D. H. Lawrie, "Stochastic properties of a multiple-layer single-stage shuffle-exchange network in a message switching environment," Journal of Digital Systems, vol. VI, no. 4, pp. 387-410, 1980. 157 [25] D. M. Tullsen and S. J. Eggers, "Limitations of cache prefetching on a bus-based multiprocessor," in International Symposium on Computer Architecture, pp. 278- 288, May 1993. [26] J. W. Fu and J. H. Patel, "Data prefetching in multiprocessor vector cache memories," in International Symposium on Computer Architecture, pp. 54-63, May 1991. [27] T. Mowry and A. Gupta, "Tolerating latency through software-controlled prefetching in shared-memory multiprocessors," Journal of Parallel and Distributed Computing, pp. 87-106, June 1991. [28] F. Dahlgren, M. Dubois, and P. Stenstrom, "Fixed and adaptive sequential prefetching in shared memory multiprocessors," in International Conference on Parallel Processing, pp. 56-63, Aug. 1993. [29] E. H. Gornish, E. D. Granston, and A. V. Veidenbaum, "Compiler-directed data prefetching in multiprocessors with memory hierarchies," in International Conference on Supercomputing, pp. 354-368, June 1990. [30] T.-F. Chen, Data Prefetching for High-Performance Processors. PhD thesis, University of Washington, 1993. [31] E. H. Gornish, Adaptive and Integrated Data Prefetching for Shared-Memory Multiprocessors. PhD thesis, University of Illinois at Urbana-Champaign, Center for Supercomputing Research and Development, 1995. [32] J.-L. Baer and T.-F. Chen, "An effective on-chip preloading scheme to reduce data access penalty," in Supercomputing, pp. 176-186, IEEE, Nov. 1991. [33] J. W. Fu, J. H. Patel, and B. L. Janssens, "Stride directed prefetching in scalar processors," in International Symposium on Microarchitecture, pp. 102-110, Dec. 1992. [34] Y. Jegou and O. Temam, "Speculative prefetching," in Supercomputing, pp. 57 - 66, 1993. [35] N. P. Jouppi, "Improving direct-mapped cache performance by the addition of a small fully-associative cache and prefetch buffers," in International Symposium on Computer Architecture, pp. 364-373, May 1990. [36] A. J. Smith, "Cache memories," Computing Surveys, vol. 14, pp. 473-530, Sept. 1982. [37] S. Palacharla and R. E. Kessler, "Evaluating stream buffers as a secondary cache replacement," in International Symposium on Computer Architecture, pp. 24-33, May 1994. 158 [38] K. Krishnamohan, "Applying Rambus technology to desktop computer main memory subsystems," Mar. 1992. [39] W. J. Dally, "Performance analysis of k-ary n-cube interconnection networks," IEEE Transactions on Computers, vol. 39, pp. 775-784, June 1990. [40] A. Agarwal, "Limits on interconnection network performance," IEEE Transactions on Computers, vol. 2, pp. 398-412, Oct. 1991. [41] S. Abraham and K. Padmanabhan, "Constraint based evaluation of multicomputer networks," in International Conference on Parallel Processing, vol. I, pp. 521-525, 1990. [42] S. Abraham, Issues in the Architecture of Direct Interconnection Schemes for Multiprocessors. PhD thesis, University of Illinois at Urbana-Champaign, march 1990. [43] S. Konstantinidou, Deterministic and Chaotic Adaptive Routing in Multicomputers. PhD thesis, University of Washington, may 1991. [44] K. Bolding and S. Konstantinidou, "On the comparison of hypercube and torus networks," in International Conference on Parallel Processing, vol. I, pp. 62-66, 1992. [45] K. Padmanabhan, "On the tradeoff between node degree and communication channel width in shuffle-exchange networks," in Proceedings, IEEE Symposium on Parallel and Distributed Processing, pp. 120-127, IEEE, Dec. 1991. [46] D. A. Reed and R. M. Fujimoto, Multicomputer Networks: Message-Based Parallel Processing. The MIT Press, 1987. [47] C. D. Thompson, "Area-time complexity for VLSI," in Caltech Conference on VLSI, pp. 495-508, Jan. 1979. [48] R. Cyper, "Theoretical aspects of VLSI pin limitation," SIAM Journal on Computing, vol. 22, pp. 356-379, Apr. 1993. [49] M. A. Franklin, D. F. Wann, and W. J. Thomas, "Pin limitations and partitioning of VLSI interconnection networks," IEEE Transactions on Computers, vol. C-31, pp. 1109-1116, Nov. 1982. [50] L. M. Ni and P. K. McKinley, "A survey of wormhole routing techniques in direct networks," IEEE Computer, vol. 26, pp. 62-76, Feb. 1993. [51] C. P. Kruskal and M. Snir, "A unified theory of interconnection network structure," Theoretical Computer Science, vol. 48, pp. 75-94, Aug. 1986. [52] D. H. Lawrie, "Access and alignment of data in an array processor," IEEE Transactions on Computers, vol. C-24, pp. 173-182, Dec. 1975. 159 [53] K. Padmanabhan, "Design and analysis of even-sized binary shuffle-exchange networks for multiprocessors," IEEE Transactions on Parallel and Distributed Systems, vol. 2, pp. 385-397, Oct. 1991. [54] D. Gelernter, "A DAG-based algorithm for prevention of store-and-forward deadlock in packet networks," IEEE Transaction on Computers, vol. C-30, pp. 709-715, Oct. 1981. [55] W. J. Dally and C. L. Seitz, "Deadlock-free message routing in multiprocessor interconnection networks," IEEE Transactions on Computers, vol. C-36, pp. 547-553, May 1987. [56] P. Kermani and L. Kleinrock, "Virtual cut-through: A new computer communication switching technique," Computer Networks, vol. 3, pp. 267-286, 1979. [57] N. F. Maxemchuk, "Comparison of deflection and store-and-forward techniques in the manhattan street and shuffle-exchange networks," in Proceedings IEEE INFOCOM 89 : The Conference on Computer Communication, pp. 800-809, 1989. [58] S. Konstantinidou and L. Snyder, "Chaos router : architecture and performance," in International Symposium on Computer Architecture, pp. 212-221, May 1991. [59] D. S. Reeves, D. F. Gehringer, and A. Chandiramani, "Adaptive routing and deadlock recovery: A simulation study," in The 4th Conference on Hypercubes, Concurrent Computers and Applications, pp. 331-337, Mar. 1989. [60] J. H. Kim, Z. Liu, and A. A. Chien, "Compressionless routing," in International Symposium on Computer Architecture 94, 1994. [61] P.-Y. Chen, D. H. Lawrie, P.-C. Yew, and D. A. Padua, "Interconnection networks using shuffles," IEEE Computers, pp. 55-64, 1981. [62] A. Varma and G. Sinha, "A class of prefetch schemes for on-chip data caches," in International Symposium on Computer Architecture, May 1992. [63] D. Callahan, K. Kennedy, and A. Porterfield, "Software prefetching," in Architectural Support for Programming Languages and Operating Systems, pp. 40-52, Apr. 1991. [64] A. C. Klaiber and H. M. Levy, "An architecture for software-controlled data prefetching," in International Symposium on Computer Architecture, pp. 43-53, May 1991. [65] T. C. Mowry, M. S. Lam, and A. Gupta, "Design and evaluation of a compiler algorithm for prefetching," in Architectural Support for Programming Languages and Operating Systems, pp. 62-73, 1992. [66] T. C. Mowry, Tolerating Latency Through Software-Controlled Data Prefetching. PhD thesis, Stanford University, Computer Systems Laboratory, Mar. 1994. 160 [67] R. Bianchini and T. J. LeBlanc, "A preliminary evaluation of cache-miss-initiated prefetching techniques in scalable multiprocessors," tech. rep., University of Rochester, May 1994. [68] C.-H. Chi, "Compiler optimization technique for data cache prefetching using a small CAM array," in International Conference on Parallel Processing, vol. I, pp. 263-266, 1994. [69] T. Chiueh, "Sunder: A programmable hardware prefetch architecture for numerical loops," in Supercomputing, pp. 488-497, Nov. 1994. [70] Y.-C. Chen, Cache Design and Performance in a Large-Scale Shared-Memory Multiprocessor System. PhD thesis, University of Illinois at Urbana-Champaign, 1993. [71] G. Cybenko, L. Kipp, L. Pointer, and D. Kuck, "Supercomputer performance evaluation and the perfect benchmarks," in International Conference on Supercomputing, 1990. [72] D. Bailey, H. Simon, J. Barton, and T.Lasinski, "The NAS parallel benchmarks," Tech. Rep. RNR-91-02, NASA Ames Research Center, 1991. [73] D. Gajski, D. Kuck, D. Lawrie, and A. Sameh, "Cedar - a large scale multiprocessor," in International Conference on Parallel Processing, pp. 524-529, 1983. [74] M. Dubois, S. C, and F. Briggs, "Memory access buffering in multiprocessors," in International Symposium on Computer Architecture, pp. 434-442, 1986. [75] A. Veidenbaum, "A compiler-assisted cache coherence solution for multiprocessors," in International Conference on Parallel Processing, pp. 1029-1036, 1986. [76] M. J. Karol, M. G. Hluchyj, and S. P. Morgan, "Input versus output queueing on a space-division packet switch," IEEE Transactions on Communications, vol. COM35, pp. 1347-1356, Dec. 1987. [77] M. Kumar and J. R. Jump, "Performance enhancement in buffered delta networks using crossbar switches and multiple links," Journal of Parallel and Distributed Computing, no. 1, pp. 81-103, 1984. [78] O. E. Percus and S. R. Dickey, "Performance analysis of clocked-regulated queues with output multiplexing in three different 2x2 crossbar switch architectures," Journal of Parallel and Distributed Computing, no. 16, pp. 27-40, 1992. [79] K. Padmanabhan, "Design and analysis of even-sized binary shuffle-exchange networks for multiprocessor," IEEE Transactions on Parallel and Distributed Systems, vol. 2, pp. 385-397, Oct. 1991. 161 [80] P.-Y. Chen, P.-C. Yew, and D. Lawrie, "Performance of packet switching in buffered single-stage shuffle-exchange networks," in International Conference on Distributed Computing Systems, pp. 622-627, 1982. [81] D. H. Lawrie and D. A. Padua, "Analysis of message switching with shuffle-exchanges in multiprocessors," in The Proceedings of the Workshop on Interconnection Networks for Parallel and Distributed Processing, pp. 116-123, 1980. [82] S. Kim and A. Veidenbaum, "On shortest path routing in single stage shuffleexchange networks," in Seventh Annual ACM Symposium on Parallel Algorithms and Architectures 95, July 1995. [83] L. N. Bhuyan and D. P. Agrawal, "Design and performance of generalized interconnection networks," IEEE Transactions on Computers, vol. C-32, pp. 1081-1090, Dec. 1983. [84] D. Z. Du and F. K. Hwang, "Generalized de Bruijn Diagraphs," Networks, vol. 18, pp. 27-38, 1988. [85] J. Torrellas and Z. Zhang, "The performance of the Cedar multistage switching network," in Supercomputing, Nov. 1994. [86] L. Gwennap, "Alternative packages emerge for processors." Microprocessor Report, Oct. 1993. [87] S. W. Turner and A. V. Veidenbaum, "Scalability of the Cedar system," in Supercomputing, Nov. 1994. [88] S. A. Przybylski, Cache and Memory Hierarchy Design. Morgan Kaufmann Publishers, Inc., 1990. 162 Vita Sunil Kim was born on January 7, 1963 in Seoul, Korea. He obtained his Bachelor of Science degree in Computer Engineering from Seoul National University in 1985. He started his graduate study in 1985 and received his Master of Science degree from Seoul National University in 1987. He served in the Korean Army in 1987, where he achieved the rank of lieutenant. In Fall 1988, he continued his graduate study in the University of Illinois at Urbana-Champaign, working as a graduate research assistant in the Center for Supercomputing Research and Development. After completing the Ph.D. degree in Computer Science at the University of Illinois, he joined IBM in Austin, Texas. 163