<?xml-model href='http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng' schematypens='http://relaxng.org/ns/structure/1.0'?><TEI xmlns="http://www.tei-c.org/ns/1.0">
	<teiHeader>
		<fileDesc>
			<titleStmt><title level='a'>(MC)^2: Lazy MemCopy at the Memory Controller</title></titleStmt>
			<publicationStmt>
				<publisher>ACM</publisher>
				<date>06/29/2024</date>
			</publicationStmt>
			<sourceDesc>
				<bibl> 
					<idno type="par_id">10521201</idno>
					<idno type="doi"></idno>
					
					<author>Aditya K Kamath</author><author>Simon Peter</author>
				</bibl>
			</sourceDesc>
		</fileDesc>
		<profileDesc>
			<abstract><ab><![CDATA[(MC)^2 is a lazy memory copy mechanism which canbe used within memcpy-like functions to significantly reduce theCPU overhead for copies that are sparsely accessed. It can alsohide copy latencies by enhancing the CPU’s ability to executethem asynchronously. (MC)^2’s lazy memcpy avoids copying dataat the time of invocation. Instead, (MC)^2 tracks prospectivecopies. If copied data is later accessed by a CPU or the cache,(MC)^2 uses the tracking information to lazily execute a copy,when necessary. Placing (MC)^2 at the memory controller putsit at the perfect vantage point to eliminate the largest source ofmemcpy overhead—CPU stalls due to cache misses in the criticalpath—while imposing minimal overhead itself.(MC)^2 consists of three main components: memory controllerextensions that implement a lazy memcpy operation, a newinstruction exposing the lazy memcpy, and a flexible softwarewrapper with semantics identical to memcpy. We implementand evaluate (MC)^2 in the gem5 simulator using a variety ofmicrobenchmarks and workloads, including Google’s Protobuf,where (MC)^2 provides a 43% speedup and Linux huge pagecopy-on-write faults, where (MC)^2 provides 250× lower latency.]]></ab></abstract>
		</profileDesc>
	</teiHeader>
	<text><body xmlns="http://www.tei-c.org/ns/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">
<div xmlns="http://www.tei-c.org/ns/1.0"><head>I. INTRODUCTION</head><p>Memory copies significantly impact the execution latency and computational overhead of modern applications. Profiling of Google's datacenters shows that more than 5% of CPU cycles are consumed by memory copy (memcpy / memmove) operations <ref type="bibr">[25,</ref><ref type="bibr">47]</ref>, a substantial overhead at that scale. Additionally, waiting for copy completion adds "killer microseconds" <ref type="bibr">[5]</ref> to application processing which aren't hidden by classical means like out-of-order processing. As we will see in &#167;II-C, most CPU cycles for memcpy are spent stalled, waiting for memory.</p><p>CPU memory access latency is not expected to improve in the future due to the classic "memory wall" problem, where technological advances improve clock speeds for CPUs, while memory latencies remain largely stagnant <ref type="bibr">[7]</ref>. For example, DDR5 improves memory bandwidth by up to 2&#215; over DDR4 at a slight memory access latency cost <ref type="bibr">[12]</ref>. In fact, memory latencies may worsen in the future as cloud providers add higher capacity memories at the expense of latency <ref type="bibr">[17,</ref><ref type="bibr">21,</ref><ref type="bibr">32,</ref><ref type="bibr">35]</ref>.</p><p>Common use cases of memory copies are for temporary buffers. Consider serialization and deserialization mechanisms used to transfer objects across processes and servers <ref type="bibr">[2,</ref><ref type="bibr">3,</ref><ref type="bibr">53]</ref>. During serialization, a process converts an object into a bytestream and sends it to another process. The receiving process then deserializes this stream, transforming it back into an object. Both serialization and deserialization can involve many data copy operations as data is moved between the object and the byte-stream. Databases with multi-version concurrency control (MVCC) often use a form of read-copy-update to maintain transactional isolation <ref type="bibr">[58]</ref>. Here, the transaction duplicates data it wishes to modify. Modifications happen locally and the duplicate is merged into the database during the commit stage. Copies are also common in operating systems, such as for many IO system calls, for memory defragmentation, and for the fork system call. In many of these cases, only a fraction of each copy may be accessed or modified, making the remainder redundant. Further, many accesses occur with a time delay and do not require eager execution of the copy.</p><p>A variety of techniques to reduce the overhead of copies have been proposed <ref type="bibr">[43,</ref><ref type="bibr">44,</ref><ref type="bibr">55,</ref><ref type="bibr">61]</ref>. For example, Demikernel <ref type="bibr">[61]</ref> adds zero-copy APIs to IO stacks, along with programming language based object ownership tracking features. zIO <ref type="bibr">[49]</ref> reduces copy overheads in the IO stack without API changes by unmapping copied pages and marking these memory locations as copy-on-access. When a copy is not accessed, the copy latency is saved. Only accessed memory pages incur the copy overhead upon first access. Unfortunately, existing techniques have drawbacks. Zero-copy APIs require significant program redesign to use efficiently. Existing transparent approaches, such as zIO, have high page remapping overheads and thus only provide benefits for large (&gt;16KB) copies of which only a small fraction (&#8804;25%) is accessed, with high performance penalties when this is not the case. Hardware offload techniques, such as DMA engines, have high startup overheads making them similarly impractical for smaller copies <ref type="bibr">[52]</ref>.</p><p>To alleviate the drawbacks of prior approaches, our proposal relies on lazy execution of each memory copy. Laziness is a common technique used across different domains in computer science. When an expensive operation is requested, laziness delays the operation until time of use. For example, functional languages <ref type="bibr">[20]</ref> use it to allow declaration of infinitely sized data structures that consume limited memory-only upon data access are the operations resolved and memory is allocated. Operating systems use copy-on-write <ref type="bibr">[48]</ref> to avoid performing copies until pages are modified. Laziness provides the advantage that penalties are paid only upon use.</p><p>Recent advances in memory and processing logic have allowed significant compute logic to be placed near memory Redis advocate against the use of huge pages <ref type="bibr">[45]</ref> due to the copy overhead causing high operation latency spikes. Memory access stalls are the source of copy overhead: To understand the source of copy overhead in more detail, we perform a deeper analysis of the Protobuf workload. Figure <ref type="figure">3</ref> shows memory access statistics obtained from perf during the memcpy calls of the Protobuf workload. We see that more than 25% of data accesses end up missing in the cache and have to be serviced from memory. More than 90% of the time, at least one instruction within the CPU is waiting for a memory access to be serviced (Mem miss cycles). These instructions take up a slot in the CPU's reorder buffer (ROB) and can reduce the CPU's effective throughput by blocking further instructions from entering the ROB <ref type="bibr">[23]</ref>. Due to this, for more than 60% of the cycles spent in memcpy, the CPU is completely stalled (Mem miss stall cycles). Many memcpys are too small for OS-based avoidance: We also analyzed the sizes of memcpy operations executed by the Protobuf workload, shown in Figure <ref type="figure">4</ref>. We find that the majority of copies (&#8764; 56%) copy a single kilobyte. An ideal solution to resolve this overhead must thus be able to speed up sub-page sized copies. Existing OS techniques <ref type="bibr">[49]</ref> that require page-sized or larger copies cannot provide any benefit. III. (MC) 2 DESIGN (MC) 2 's primary goal is to eliminate copy overhead in the critical path. (MC) 2 has to accomplish this while ensuring data consistency. Figure <ref type="figure">5</ref> contains all the modifications and new features (MC) 2 introduces to accomplish these goals. The left side shows the modifications we make to the memory controller. The right side shows two instructions we introduce, along with the software support that we provide for (MC) 2 . We now cover the hardware changes made to support (MC) 2 , then look at its software interface and how memcpy operations can be transparently replaced with their lazy alternative.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>A. (MC) 2 memory controller design</head><p>We start by making changes to the memory controller (MC) to provide support for lazy copies. For clarity, we use the term prospective copy to refer to a lazy copy that the processor has requested. This copy is not immediately performed. Instead, we add a copy tracking table (CTT) to each MC to track each prospective copy. We use the term lazy copy to refer to the act of finally copying data from the source to the destination, typically triggered by an access to either buffer that requires the copy. To manage in-progress writes to source buffers, we extend each MC's existing write pending queue with a bounce pending queue (BPQ) to hold the corresponding write, while the lazy copy is performed. The left side of Figure <ref type="figure">5</ref> depicts these changes with our additions highlighted in purple. We assume memory accesses reaching the memory controller are at cacheline granularity, typical of most modern systems. (MC) 2 supports prospective copies at a byte granularity, but we simplify MC design by restricting tracked destination buffers and lazy copy sizes to be of cacheline granularity. A software wrapper (III-D) converts byte-granularity memcpys to equivalent cacheline-granularity prospective copies.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>1) Copy Tracking Table (CTT):</head><p>We add a copy tracking table (CTT) to each MC that tracks prospective copies. The CTT is an SRAM-based module that performs lookups using the physical address of memory accesses. These lookups are in parallel with the memory access, avoiding overheads on the critical path of access. The CTT ensures that reads to destination buffers are correctly routed (bounced) to corresponding source buffers. As the source and destination buffers may be placed across multiple memory modules, we ensure that CTTs across MCs are kept consistent. This is done by snooping the interconnect for broadcast messages informing the MCs of table modifications. Table <ref type="table">entries</ref>: Each entry in the CTT occupies 16 bytes consisting of a 52-bit source physical address, 52-bit destination physical address, 21-bit size, an active bit (as shown in Figure <ref type="figure">5</ref>) and 2 unused bits. Addresses are tracked with 52 bits as this is the upper limit of physical address sizes that most systems support <ref type="bibr">[14,</ref><ref type="bibr">60]</ref>. A 21-bit size allows a single entry in the CTT to track a lazy copy of up to 2MB, the size of a huge page. Many copied buffers do not exceed this size. Further, memory fragmentation causes larger physically contiguous regions to be rare <ref type="bibr">[64]</ref>, making larger tracking granularities unnecessary.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Table logic:</head><p>The CTT contains logic to ensure that tracked destination buffers do not overlap. Specifically, if an existing entry contains (part of) a destination buffer that a new operation is inserting, the existing entry is removed (or resized) so that the new and existing entries' destination buffers do not overlap. This corresponds to the case where data is copied to a buffer and then new data is copied to the same buffer. Every destination buffer thus has a unique source buffer.</p><p>In addition, when a new entry is inserted into the CTT, we cachelines). It also broadcasts a message on the interconnect for the other MCs to update their CTTs.</p><p>Read from destination: As this is a prospective copy, the data in the destination buffer in memory is stale. Retrieving the correct data involves 3 steps, shown in Figure <ref type="figure">7:</ref> 1 The MC fetches the appropriate source buffer address corresponding to the destination address from the CTT.</p><p>2 It bounces the request to the MC containing the source. This MC then reads the respective source cacheline from memory and stores the data in the destination response packet.</p><p>3 This packet is sent back to the core as if it was read from the destination. As we now have the up-to-date version of the destination cacheline, a copy of this packet is also sent as a write to the MC containing the destination buffer, eventually removing the corresponding entry from the CTT. This prevents future accesses to the cacheline from suffering further overheads. Write to source: If a write to a source buffer cacheline reaches the MC, we need to execute a lazy copy. To do so, the write is first held in the BPQ and a read to the same source cacheline is generated and sent to memory. Once the source cacheline is obtained from memory, the MC generates packets for each destination cacheline that has a prospective copy with the source. The data read from the source cacheline is copied into these packets. The completed destination cachelines are then written to memory and corresponding CTT entries are removed (or resized). Once complete, the corresponding BPQ entries are written to memory. Unaligned copies: If source and destination copy buffers are not cacheline-aligned with each other, a lazy copy to a destination cacheline may require data from multiple source cachelines. This results in multiple bounces to fetch the entire destination cacheline. For example, if a prospective copy was from physical address 100 (source) to address 512 (destination), we require two bounces to reconstruct the destination; the first access to address <ref type="bibr">[64 -127]</ref> and the second to <ref type="bibr">[128 -191]</ref>, which may lie in separate memory modules. Reducing bandwidth contention: When a destination buffer is read, a copy of the reconstructed cacheline is sent as a write to memory. To avoid contending on memory bandwidth, if the WPQ of the destination MC is more than 75% full, it rejects the write to prioritise the memory bandwidth for accesses from the caches. Otherwise, it writes the destination to memory and removes (or resizes) the corresponding CTT entry. Further reads to this destination cacheline are serviced from memory as normal. &#167;V-A2 evaluates the associated overhead reduction.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>C. (MC) 2 ISA design</head><p>We provide two new instructions for programmers to take advantage of lazy memcpy, shown on the right in Figure <ref type="figure">5</ref>. Lazy copy: MCLAZY enables the lazy memcpy. It takes three register operands. The first register contains the virtual address of the destination buffer, the second register contains the virtual address of the source buffer, while the last register contains the lazy memcpy size. The destination buffer cachelines encompassed by the operation are invalidated while the source buffer cachelines are written back from the cache (see &#167;III-B1).</p><p>Alignment requirements: The destination address must be cacheline-aligned and the value contained in R size must be a multiple of the cacheline size. This simplifies the MC logic, as destination cachelines are guaranteed to be lazily copied in their entirety, and avoids partial cacheline invalidations for the destination buffer. In &#167;III-D we shall see how a software wrapper removes these requirements.</p><p>The source and destination must each be contiguous in physical memory. For user-space applications with buffers spanning multiple pages, the instruction must be called separately for each page. The instruction requires at most two address translations, one for the source and one for the destination. Instruction parallelism: MCLAZY obeys memory consistency similar to CLFLUSHOPT and CLWB <ref type="bibr">[22]</ref>. This means that separate invocations of the instruction proceed in parallel, without serialization required for stores in the x86-TSO memory model <ref type="bibr">[41]</ref>. To enforce ordering with future operations, an MFENCE or SFENCE operation must be called. Freeing: Finally, we provide an MCFREE operation that takes two operands: an address register and a size register. MCFREE sends a hint to the MC that the buffer defined by the address and size registers is no longer useful and can be freed. The MC can remove all entries in the CTT where the destination buffer is contained in the freed buffer. Data in the freed buffer needs to be reinitialized before reuse, i.e., a read operation to a freed buffer following an MCFREE call is undefined. This instruction can be called within functions like munmap where the buffer is guaranteed to no longer be used.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>D. Software Design</head><p>C/C++ function: To remove constraints on the programmer, we provide a C/C++ library function memcpy_lazy that has the same semantics as a standard memcpy call. Internally, this function calls MCLAZY for each page in the buffers and ensures that the destination is cacheline-aligned. The pseudocode for this function is shown in Figure <ref type="figure">8</ref>. Here, CL_SIZE refers to the cacheline size, while the macro ALIGN_REM returns the number of bytes required to align a given address to a given alignment size. First, we identify the number of bytes needed to be added to the dest address to cacheline-align it (line 3). We then copy these bytes from the source to destination (line 4). The destination is now cacheline aligned. We then identify the number of bytes remaining in the source and destination pages (lines 10 -11) and pick the smaller one (line 13). This ensures that the copy is being performed on a single page for both the source and destination. If this is smaller than the cacheline size, we manually memcpy it (line 15). Otherwise, we make the copy size a multiple of the cacheline size and call MCLAZY for it (lines 18 -19). We then repeat the process until the entire copy is complete. We finally issue an mfence call to order the prospective copies with future memory accesses (line 23). The read and write operations of a standard memcpy are replaced by a MCLAZY call per copied buffer page, enabling our lazy memcpy goal. Memcpy interposition: We provide an additional interposer library (copy_interpose.so) that converts memcpy calls to lazy memcpy calls for legacy applications. This removes the need to rewrite code to take advantage of (MC) 2 .</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>E. Data protection and correctness</head><p>We now look at (MC) 2 's data protection and correctness guarantees. For concreteness, we assume the x86 CPU architecture and x86-TSO memory model <ref type="bibr">[41]</ref>, although (MC) 2 may be applied to other models with minor modifications. Protection: As (MC) 2 deals with only physical addresses, regular address translation occurs within the CPU where page protection bits are checked. If a process tries to copy data it does not have access to, the MMU raises a page fault. On unmapping pages, the operating systems zeroes out the newly freed pages before providing them to new processes. This eventually reaches the MC as writes, removing entries from the CTT and avoiding data leaks from occurring between processes. This ensures that (MC) 2 does not expose data protection risks.</p><p>Memory consistency: (MC) 2 must ensure that reads and writes to source and destination buffers preserve memory consistency. In (MC) 2 , each destination cacheline behaves independently. This destination cacheline is a prospective copy of a single source cacheline if they are cacheline-aligned. In cases of misalignment, the destination is split across two source cachelines. To examine the interaction of memory accesses with (MC) 2 , we make use of a state transition diagram, seen in Figure <ref type="figure">9</ref>. States 1 -4 cover the transitions for when source and destination are cacheline-aligned. When misaligned, we have additional states 5 -6 .</p><p>Assume 1 We start with an empty CTT and BPQ. In this state, (MC) 2 has no impact. On receiving a prospective copy, we transition to state 2 . 2 In this state, the CTT contains an entry noting that S1 and S2 have been lazily copied to D. Writing to D removes the entry from the CTT and transitions us back to state 1 , while reading S1 or S2 has no impact. Performing another prospective copy with destination D retains us in the same state, with the CTT entry being modified to contain the new source(s). On writing to either S1 or S2 (denoted by Si), we move to state 3 , where the write is kept in the BPQ. 3 This is a transitional state, where a bounce packet is generated which reads S1 and S2 from memory (and not the BPQ) and then writes to cacheline D. On completion of the write, we move to state 4 , denoted by the "Bounce D" transition. A similar transition occurs when the CPU directly writes to D. Reads and writes to Si issued by the CPU are merged and serviced directly from the BPQ. On a write to Sj (j != i) we move to state 5 . 4 This is also a transitional state. D is removed from the CTT as its data has been retrieved and written to memory, i.e., the lazy memcpy is complete. Reads and writes to D are serviced normally by the memory as the CTT does not contain an entry for it. The BPQ writes Si to memory to move back to stable state 1 . If Si is a common source for multiple prospective copy destinations, e.g., D1, D2, D3..., the BPQ must wait until all entries with Si as source are removed from the CTT before writing Si to memory. 5 This is also a transitional state, where both S1 and S2 are kept in the BPQ (denoted by Si and Sj). Similar to state 3 , all reads and writes to S1 and S2 from the CPU are serviced by the BPQ, while the bounce packet for D reads directly from memory. Writing to D or completion of the bounce operation moves us to state 6 . 6 Similar to state 4 , D is removed from the CTT. S1 and S2 are written back to memory to move back to state 1 . It may occur that S1 and S2 lie in different memory modules operated by different MCs, with both independently generating identical bounce requests for D. One may complete, while the other is still pending. For this, bounce requests for D are dropped on reaching this state.</p><p>In all the transitional states where the BPQ contains either S1 or S2 ( 3 -6 ), prospective copies involving S1 or S2 are stalled until S1 and S2 have been written back to memory.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>F. Performance Tradeoff Discussion</head><p>While (MC) 2 provides the same semantics as the standard memcpy and aims to accelerate it, there are performance tradeoffs. We discuss them in this section. Cached source buffers may harm performance: When the source buffer is already present in the cache, the overhead of copying is low as the CPU fetches data from the cache instead of memory. Replacing these copies with (MC) 2 could harm performance. Despite this, we shall see in V-A1 that the latency of (MC) 2 is not significantly worse than a cached copy. Reduced cache pollution: Cache pollution is a common problem associated with buffer copies <ref type="bibr">[52,</ref><ref type="bibr">66]</ref>, where the destination of the copy is not immediately accessed after the copy. As (MC) 2 explicitly invalidates destination buffers from the cache, it avoids this problem.</p><p>Copy-and-access may harm performance: If a destination buffer is immediately accessed after a prospective copy, (MC) 2 could reduce performance, as the destination buffer's cache lines have We shall see in V-A2 that prefetching eliminates this performance impact in many cases. Memory footprint: Prior work, such as zIO <ref type="bibr">[49]</ref>, performed copy elision by unmapping destination pages and marking them copy-on-access, reducing the memory footprint for copies with unaccessed destination buffers. (MC) 2 does not reduce memory footprint, as both source and destination buffers must be physically allocated by the OS before lazy copying. This allows (MC) 2 to remain transparent to the OS and support lazy copies at sub-page granularity, avoiding hardware interrupts and page faults on access to destination buffers. Nevertheless, for an application like Protobuf, we found that zIO provided no memory footprint reduction due to sub-page sized copies. For MongoDB, we found only a modest 6 -8% reduction in memory caused by copied data frequently being accessed.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>IV. EVALUATION METHODOLOGY</head><p>We simulate the performance of (MC) 2 by extending GEM5-v22.1 <ref type="bibr">[6]</ref>. Table <ref type="table">I</ref> gives the configuration details of our simulation. Our system resembles a scaled-down server node.</p><p>We use CACTI 7.0 <ref type="bibr">[4]</ref>, a tool that calculates cache specifications based on provided parameters, to obtain the CTT access latency and area. For our configuration, with a 22 nm transistor size, we find that the CTT area is 0.14 mm 2 which is negligible compared to I/O die areas of 100 mm 2 <ref type="bibr">[40]</ref>. The bank leakage power is 33.8 mW. The CTT latency is 0.79 ns,</p><p>TABLE I: Simulated configuration. Hardware CPUs 8 Clock speed 4 GHz Private L1 cache 64 KB/CPU, Stride prefetcher Shared L2 cache 2 MB, Stride prefetcher DRAM size 3 GB DRAM channels 2 DRAM config. DDR4 BPQ size 8 entries CTT entries 2,048 CTT latency 0.79 ns Software OS kernel Linux 5.7.0 Distribution Ubuntu 20.04</p><p>significantly lower than typical DRAM access latencies (15 -90 ns <ref type="bibr">[12]</ref>). The CTT latency is incurred when the destination of a prospective copy is read. The entry in the CTT is looked up and the ongoing access is preempted, incurring the CTT latency. The packet is then bounced towards the source.</p><p>Throughout our evaluation we make use of our C wrapper function memcpy_lazy. To accurately model the performance of cacheline writebacks required by MCLAZY, this function calls the CLWB instruction <ref type="bibr">[22]</ref> for each cacheline that needs to be written back. It also cacheline-aligns the provided destination, calling memcpy for unaligned fringes (as mentioned in &#167;III-D). Baselines: We compare our approach to a baseline memcpy operation. We also compare against zIO <ref type="bibr">[49]</ref>, a state-of-the-art approach for OS-assisted zero-copy IO. zIO elides memcpy operations and tracks the copies in a skiplist. The page table entries are marked as copy-on-access using userfaultfd <ref type="bibr">[1]</ref>. On a page fault, zIO allocates physical memory for the destination buffer and performs the copy. We modify zIO to perform elision on all memcpy calls instead of just IO-based copies.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>V. EVALUATION</head><p>We evaluate (MC) 2 and tease out the performance implications of the lazy memcpy technique through a set of microbenchmarks. We then look at the full-system performance of (MC) 2 through benchmarks and applications consisting of Google's Protobuf, MongoDB, and Cicada. We also analyze the impact of (MC) 2 on Linux kernel buffer copies and huge page faults. We conclude by examining (MC) 2 's sensitivity to different configuration parameters.</p><p>Our evaluation answers the following questions:</p><p>1) How much lower is (MC) 2 's memcpy critical path overhead? What are the main sources of overhead for (MC) 2 's memcpy? ( &#167;V-A1) 2) What is the impact of lazily copying data upon access?</p><p>( &#167;V-A2) 3) What benefit does (MC) 2 provide to applications? ( &#167;V-B) 4) How do (MC) 2 's parameters impact its performance?</p><p>( &#167;V-C)</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>B. Artifact check-list (meta-information)</head><p>&#8226; Compilation: GCC 9 or higher.</p><p>&#8226; Binary: All required binaries are included.</p><p>&#8226; Data set: Scripts are provided to generate necessary datasets.</p><p>&#8226; Run-time environment: Simulator can be run on an x86 machine. We evaluated on a machine with Ubuntu 22.04.</p><p>&#8226; Hardware: An x86 machine with at least 100 GB of disk space that supports KVM.</p><p>&#8226; Output: Text files containing the summarized results are generated as well as PNG files of the graphs in the Evaluation section ( &#167;V). Raw performance can be found in the results as well.</p><p>&#8226; How much disk space required (approximately)?: 100GB..</p><p>&#8226; How much time is needed to prepare workflow (approximately)?: 30 minutes &#8226; How much time is needed to complete experiments (approximately)?: 42 hours &#8226; Publicly available?: Yes &#8226; Archived (provide DOI)?: 10.5281/zenodo.10884322</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>C. Description</head><p>The artifact contains the source code of (MC) 2 along with all evaluated benchmarks and datasets. This allows for reproducing figures 10 -21 contained in &#167;V.</p><p>1) How to access: The artifact can be downloaded from <ref type="url">https://github.com/AKKamath/MCSquare-ISCA24</ref> or <ref type="url">https://  zenodo.org/doi/10.5281/zenodo.10884322</ref>.</p><p>2) Hardware dependencies: The artifact requires an x86 machine with around 100 GB of free disk space that supports KVM. To see if your CPU supports KVM run:</p><p>egrep -c '(vmx|svm)' /proc/cpuinfo If it returns 0, your processor does not support KVM. If the command returns 1 or more, your processor supports KVM.</p><p>3) Software dependencies: The gem5 simulator requires either Ubuntu 20.04 or 22.04. Root privilege is required to run the experiments. Detailed instructions on how to build can be found here: <ref type="url">https://www.gem5.org/documentation/general_</ref> docs/building. This page also contains Docker Images with all dependencies already installed.</p><p>For Ubuntu 22.04, the following installs all dependencies:</p><p>sudo apt install build-essential git m4 scons \ zlib1g zlib1g-dev libprotobuf-dev python3-dev \ protobuf-compiler libprotoc-dev qemu-kvm \ libvirt-daemon-system libgoogle-perftools-dev \ libboost-all-dev pkg-config python3-tk \ libvirt-clients bridge-utils unzip wget \ python3-matplotlib python3-numpy</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>D. Installation</head><p>The artifact can be built using the following Linux commands:</p><p>sudo adduser id -un libvirt # FOR KVM sudo adduser id -un kvm # FOR KVM unzip MCSquare-AE.zip -d mcsquare_ae cd mcsquare_ae scons build/X86/gem5.opt -j ${CPUS} ${CPUS} is the number of threads to use to build the simulator. A single-threaded build takes around 2 hours.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>E. Experiment workflow</head><p>Most of the folders contained in the repository are for the gem5 simulator. The relevant files and folders specific to (MC) 2 are contained in a folder called "mcsquare/". In this folder, a Makefile is provided which contains all the commands necessary to run the different experiments. The scripts/ directory contains all the scripts used with gem5 to run specific experiments, which are called by the Makefile. These have been organized into folders based on their benchmark. The os/ directory contains the disk and kernel images used by the simulator. On running experiments, a results/ folder will be created within the mcsquare/ directory which will contain all the raw results from the experiments. A figures/ folder will be created on completion of experiments, which shall contain the final plotted figures generated from the results.</p><p>The experiments can be launched in parallel and run in the background, to reduce overall time for simulation. If experiments take much longer than the listed time, it's likely the simulator hung during launch and the experiment should be relaunched.</p><p>The following commands can be executed within the "mcsquare/" folder to generate the different results:</p><p>make launch_micro_latency #Figure 10: 10 min make launch_micro_breakdown #Figure 11: 10 min make launch_micro_seq #Figure 12: 30 min make launch_micro_rand #Figure 13: 1 hr make launch_protobuf #Figure 14,20: 2 hr make launch_mongo #Figure 15: 15 hr make launch_mvcc #Figure 16a,17a: 10 hr make launch_mvcc_8T #Figure 16b,17b: 10 hr make launch_hugepage_access #Figure 18 20 min make launch_pipe #Figure 19: 15 min make launch_src_write #Figure 21: 10 min make launch_ctt_free #Figure 22: 2 hr</p><p>The commands require sudo priviledges, and the account password will be asked when the command is run.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>F. Evaluation and expected results</head><p>For each key result, a tab-separated result .TXT file and a .PNG graph are generated. The results/ folder contains all generated tab-separated text files with filenames figureX.txt. The figures/ folder contains the PNG graphs with filenames figureX.png, where X is the figure number. The exception is Figure <ref type="figure">20</ref> where only a .TXT file containing the result table is outputted. These outputs can be matched against figures reported in the paper. Minor variances in performance numbers occur from run to run, but general trends should remain stable.</p></div></body>
		</text>
</TEI>
