MetaSys: A Practical Open-Source Metadata Management System to Implement and Evaluate Cross-Layer Optimizations

Nandita Vijaykumar, Ataberk Olgun, Konstantinos Kanellopoulos, Nisa Bostanci, Hasan Hassan, Mehrshad Lotfi, Phillip B. Gibbons, Onur Mutlu

TL;DR

This paper introduces MetaSys, a novel open-source FPGA-based infrastructure that significantly simplifies the implementation and evaluation of cross-layer hardware-software optimizations. By providing a flexible metadata management system and a rich hardware-software interface, MetaSys enables researchers to rapidly test new optimization techniques on real hardware with minimal effort, paving the way for more efficient and performant processors.

What Problem Does This Paper Address?

Modern processors are increasingly leveraging "cross-layer" techniques, where software provides hints or metadata to hardware to enable more intelligent optimizations. These techniques span areas like performance enhancement (prefetching, cache management), security (bounds checking), and quality of service. However, implementing and evaluating these ideas on real hardware is notoriously difficult. It requires deep modifications across the entire system stack: hardware, operating system, compiler, and instruction-set architecture (ISA). This complexity hinders rapid prototyping and thorough evaluation, slowing down innovation in processor design. Existing frameworks are often specialized for specific types of optimizations or lack the necessary flexibility and ease of use for a broad range of cross-layer techniques.

Methods

MetaSys tackles this challenge by providing a unified, flexible, and open-source infrastructure. Its core components are:

  • Rich Hardware-Software Interface: MetaSys introduces new RISC-V instructions (MAP/UNMAP and CREATE) that allow applications to dynamically communicate metadata to the hardware at runtime. This metadata can describe various program properties, such as memory access patterns, data types, or security-critical regions.
  • Metadata Management: A lightweight, tagged-memory-based system manages this metadata. It includes a hardware cache (MMC) for frequently accessed metadata tags and a main memory table (MMT) for storing the full mapping. Private Metadata Tables (PMTs) are used by individual hardware components (like prefetchers or bounds checkers) to store their specific metadata.
  • Modular Design: The system is designed with modular interfaces, allowing new hardware optimization components to be easily integrated and connected to the metadata lookup unit.

The system is implemented on an FPGA using the RISC-V Rocket Chip, providing a full-system prototype that can be readily used for experimentation.

Datasets

The paper evaluates MetaSys using:

  • Polybench: A suite of building block kernels for linear algebra, scientific computation, and machine learning.
  • Ligra: A benchmark suite for graph analytics workloads.
  • Microbenchmarks: Custom benchmarks designed to stress MetaSys and identify worst-case overheads (e.g., Stream, Linked List Traversal, Random Access, 3D Array).

No new datasets were introduced; rather, existing benchmarks were used to evaluate the performance and overheads of MetaSys itself and the implemented cross-layer techniques.

Key Insights and Ideas

  • Generality Pays Off: A single, general-purpose metadata management system like MetaSys can efficiently support a diverse set of cross-layer optimizations, amortizing the hardware cost and complexity compared to specialized solutions.
  • Runtime Metadata is Crucial: The ability to dynamically communicate metadata at runtime (via the CREATE instruction) unlocks a much wider range of optimizations, especially for data-dependent or input-sensitive scenarios, compared to static compile-time approaches.
  • MMC Hit Rate is King: The performance overhead of MetaSys is primarily dictated by the efficiency of its Metadata Mapping Cache (MMC). Workloads with poor spatial and temporal locality in metadata accesses lead to higher MMC miss rates, resulting in significant performance degradation due to increased memory accesses.
  • Physical Addresses Simplify: Bypassing virtual address translation for metadata lookups can significantly reduce overheads, particularly for irregular workloads that stress the TLB.
  • Tagging Granularity Matters: While smaller tagging granularities enable more fine-grained optimizations (like bounds checking), they can increase MMC miss rates. Larger granularities generally reduce overheads by improving MMC hit rates.

Key Results

  • Low Average Overhead: MetaSys itself incurs a very low average performance overhead of 2.7% across various workloads, even when metadata lookups are performed on every memory access.
  • Efficient Use Cases:
    • Graph Prefetching: Achieved an 11.2% average speedup over a baseline stride prefetcher, outperforming specialized hardware prefetchers.
  • Bounds Checking: Showed a significant reduction in overhead compared to software-based solutions, with MetaSys incurring only a 14% average overhead versus 36% for software.
  • Return Address Protection: Demonstrated a minimal overhead of 1.2% compared to software-based stack canaries, which incurred 5.5% overhead.
  • Scalability: MetaSys scales well to multiple optimization clients, with minimal performance impact on average, provided there is sufficient locality in metadata accesses.
  • Area Overhead: The hardware implementation of MetaSys adds a negligible area overhead (0.02% of a modern CPU core).

Limitations and Future Work

  • Instruction and Register Tagging: MetaSys currently does not support tagging of instructions or registers, limiting its applicability to techniques like taint-tracking or certain security mechanisms that require such fine-grained control.
  • Fine-Granularity Tagging Overheads: While MetaSys supports flexible granularity, byte/word-level tagging for the entire program data could lead to high MMC miss rates and increased overheads.
  • One-Way Metadata Flow: The current interface primarily supports communicating metadata from software to hardware. The authors suggest that extending PMTs to collect program information and supply it back to the application would be a valuable future enhancement.
  • MMC Contention Mitigation: While techniques like partitioning and prioritized insertion were explored to alleviate MMC contention, further research into more advanced strategies could be beneficial.
  • TLB Misses: The overhead associated with address translation for metadata lookups can be significant. Future work could explore dedicated TLBs for metadata or direct physical address access to mitigate this.

Summary updated

Abstract

This paper introduces the first open-source FPGA-based infrastructure, MetaSys, with a prototype in a RISC-V core, to enable the rapid implementation and evaluation of a wide range of cross-layer techniques in real hardware. Hardware-software cooperative techniques are powerful approaches to improve the performance, quality of service, and security of general-purpose processors. They are however typically challenging to rapidly implement and evaluate in real hardware as they require full-stack changes to the hardware, OS, system software, and instruction-set architecture (ISA). MetaSys implements a rich hardware-software interface and lightweight metadata support that can be used as a common basis to rapidly implement and evaluate new cross-layer techniques. We demonstrate MetaSys's versatility and ease-of-use by implementing and evaluating three cross-layer techniques for: (i) prefetching for graph analytics; (ii) bounds checking in memory unsafe languages, and (iii) return address protection in stack frames; each technique only requiring ~100 lines of Chisel code over MetaSys. Using MetaSys, we perform the first detailed experimental study to quantify the performance overheads of using a single metadata management system to enable multiple cross-layer optimizations in CPUs. We identify the key sources of bottlenecks and system inefficiency of a general metadata management system. We design MetaSys to minimize these inefficiencies and provide increased versatility compared to previously-proposed metadata systems. Using three use cases and a detailed characterization, we demonstrate that a common metadata management system can be used to efficiently support diverse cross-layer techniques in CPUs.
BibTeX
@article{vijaykumar2021metasys,
  author = {Nandita Vijaykumar and Ataberk Olgun and Konstantinos Kanellopoulos and Nisa Bostanci and Hasan Hassan and Mehrshad Lotfi and Phillip B. Gibbons and Onur Mutlu},
  title = {{MetaSys: A Practical Open-Source Metadata Management System to Implement and Evaluate Cross-Layer Optimizations}},
  journal = {ACM Trans. Archit. Code Optim.},
  year = {2021},
  doi = {10.1145/3505250},
}
Figure