Introduction
As Large Language Models (LLMs) move toward handling million-token context windows, they encounter a severe "memory wall." The autoregressive decoding phase is inherently memory-bound, making Processing-in-Memory (PIM)—where compute units are integrated directly into DRAM—an attractive solution. However, standard PIM systems struggle with long-context efficiency. This paper introduces PIMphony, an orchestration framework that optimizes PIM for massive context lengths through token-centric partitioning and dynamic scheduling.
The Memory Wall in Long-Context LLMs
The primary challenge in scaling LLM context length is the exponential growth of the Key-Value (KV) cache. Traditional GPU-based systems quickly run out of memory as context length increases, as shown in the scaling trends below.
Existing PIM systems, while promising, suffer from three major inefficiencies when handling long contexts:
- Channel Underutilization: Static partitioning by head or batch leaves memory channels idle when batch sizes are small due to high memory pressure.
- I/O Bottlenecks: Rigid, in-order command scheduling creates "bubbles" in the compute pipeline while waiting for internal data movement.
- Static Memory Waste: Pre-allocating KV cache for maximum context length wastes over 60% of memory capacity for shorter requests.
PIMphony: Orchestrating for Efficiency
PIMphony addresses these gaps with three co-designed techniques integrated into a unified architecture, managed by an MLIR-based compiler.
1. Token-Centric PIM Partitioning (TCP)
TCP shifts the parallelization strategy from the batch/head dimension to the token dimension. By distributing segments of a single head's tokens across all available PIM channels, TCP ensures high hardware utilization even with a batch size of one, which is common in memory-constrained long-context scenarios.
2. Dynamic PIM Command Scheduling (DCS)
DCS implements an out-of-order execution engine for PIM. By tracking data readiness via a hardware dependency table, it overlaps data transfers with computation, effectively hiding internal bus latency and eliminating pipeline bubbles.
3. Dynamic PIM Access (DPA)
DPA acts as a lightweight Memory Management Unit (MMU) for PIM. It enables "lazy" allocation of the KV cache in 1MB chunks. By embedding virtual-to-physical address translation directly into the PIM hub, it breaks the requirement for contiguous static allocation and significantly improves memory utilization.
Key Results and Impact
Evaluated using cycle-accurate simulations across benchmarks like LongBench and LV-Eval, PIMphony demonstrates substantial performance gains:
- Throughput: Achieves up to 11.3× speedup over baseline PIM systems and 8.4× over heterogeneous NPU+PIM systems.
- Memory Utilization: Increases average capacity utilization from 36.2% to 75.6%, effectively doubling the number of concurrent requests the system can handle.
- Scalability: Maintains high performance up to 1 million tokens, outperforming baselines by 46.6× at extreme scales.
- Efficiency: Reduces total energy consumption by 3.46× by accelerating attention layers and minimizing background power waste.
Conclusion
PIMphony bridges the gap between PIM hardware capabilities and the demands of million-token LLMs. By rethinking partitioning, scheduling, and memory management, it enables efficient long-context decoding with a modest 4% area overhead. Future work will explore its application to multi-modal models and physical silicon implementation.
Summary updated