Abstract
For decades, memory capabilities have scaled up much slower than compute capabilities, leaving memory utilization as a major bottleneck. Prefetching and cache hierarchies mitigate this in applications with easily predictable memory accesses or those with high locality. In other applications like sparse linear algebra or graph-based applications, these strategies do not achieve effective utilization of memory. This is the case for the von Neumann model of computation, but other program execution models (PXM) provide different opportunities. Furthermore, the problem is complicated by increasing levels of heterogeneity and devices' varying memory subsystems. The Codelet PXM presented in this paper provides a program structure that allows for well-defined prefetching, streaming, and recoding operations to improve memory utilization and efficiently coordinate data movement with respect to computation. We propose the Memory Codelet, an extension to the original Codelet Model, to provide users these functionalities in a well-defined manner within the Codelet PXM.
Introduction: The Memory Wall in Heterogeneous Systems
The "Memory Wall" describes the widening gap between processor performance and memory latency/bandwidth. While traditional hardware caches and automatic prefetchers are effective for linear, predictable data access, they often fail when faced with "irregular" workloads—such as graph processing or sparse linear algebra—where data is scattered and access patterns involve heavy pointer chasing.
In modern heterogeneous environments comprising CPUs, GPUs, and specialized accelerators, this challenge is amplified. Current programming models typically rely on manual "offloading," placing the burden of data management on the developer. This approach often leaves the system scheduler unaware of the semantic relationship between memory operations and computation. To address this, a holistic Program Execution Model (PXM) is required that treats memory and compute as integrated first-class entities.
The Memory Codelet Model
The proposed solution builds upon the Codelet Model, a dataflow-inspired execution model where programs are decomposed into "Codelets"—small, non-preemptive functional units with explicit inputs and outputs. The core innovation is the introduction of the Memory Codelet and the Memory Codelet Unit (MCU).
As shown in Figure 1, the MCU is a specialized hardware component (or near-memory processor) designed for data transformation and movement rather than arithmetic. This architecture enables several key capabilities:
- Explicit Prefetching: Developers can write Memory Codelets that leverage domain knowledge to perform complex "pointer chasing," fetching data before it is required by the compute unit.
- Data Streaming: Utilizing hardware-based FIFO queues, Memory Codelets can pipe data directly into compute units, effectively overlapping data movement with active calculation.
- On-the-fly Recoding: The MCU can transform data formats during transit. For instance, it can convert a matrix from Compressed Sparse Column (CSC) to Compressed Sparse Row (CSR) format while moving it from main memory to a local scratchpad, ensuring the compute unit receives data in its most efficient representation.
Key Insights and Architectural Advantages
By decoupling orchestration from computation, the system can schedule data movement independently yet in coordination with compute-heavy tasks. Because Codelets define data dependencies explicitly, the scheduler can perform "smart" memory management, such as pre-loading data into cache just before a specific Codelet is triggered.
Furthermore, Memory Codelets offer a software-defined alternative to hardware coherency. In massive-scale systems, maintaining hardware-level cache coherency is prohibitively expensive in terms of power and silicon area. By explicitly defining data ownership and timing, the Codelet model prevents data races without the overhead of complex hardware protocols.
Conceptual Results and Acceleration
While this work presents a qualitative framework, the authors demonstrate the potential for significant performance gains through conceptual examples like Sparse General Matrix-Matrix Multiplication (Sparse GEMM).
As illustrated in Figure 2, the integration of prefetching, recoding, and streaming can theoretically reduce execution time from T5 to T1. By eliminating pipeline stalls and cache thrashing (Case 1), and progressively overlapping memory loads with computation (Cases 2-5), the model achieves higher utilization of both memory and compute resources.
Conclusion and Future Work
The Memory Codelet model provides a formal definition of how an MCU interacts with Scheduling Units (SUs) and Compute Units (CUs). While currently a theoretical framework, it sets the stage for future implementation on physical heterogeneous architectures. Future research will focus on developing compiler integration to automatically generate Memory Codelets from high-level code and refining the silicon requirements for low-power, high-throughput MCUs.
Summary updated