arXiv:2610.17167cs.ETOct 2026

Manuscript Offprint

arXiv:2610.17167

PRIM: Energy- and Endurance-Aware Compiler Optimization for Digital Compute in Non-volatile Memory

Patrick Miller, Ulya R. Karpuzcu

Patrick Miller and Ulya R. Karpuzcu

University of Minnesota, Twin Cities, USA

Abstract—Compute-in-Memory (CiM) is an alternative computing paradigm that circumvents the memory bandwidth bottleneck. Variants utilizing non-volatile memory cells (NVCiM) to perform Boolean operations directly within memory arrays offer significant density and energy-efficiency advantages. Fully realizing this potential, however, requires NVCiM-specific compiler optimizations. In conventional digital NVCiM systems, an output cell must be written—or preset—to an operation-specific value before any Boolean operation can occur. Preset-induced extra writes can degrade energy efficiency and cell endurance, often to the point of negating CiM's efficiency gains. In this paper, we introduce PRIM (Preset Reduction In Memory), a compiler optimization framework tailored for digital NVCiM that effectively minimizes preset overhead without compromising computational accuracy or architectural complexity. Unlike existing optimization approaches, PRIM is not restricted to specific types of Boolean operations. Experimental results show that PRIM can reduce execution time and energy consumption by up to 50% and 44%, respectively, while boosting cell endurance by up to 50%.

I. INTRODUCTION

Performance scaling in emerging applications of practical importance such as genomics [26] or artificial intelligence [6] is limited by the memory bandwidth. One promising computational paradigm is the integration of processing capability into or near memory, known as Compute in Memory (CiM). In the rich design space of CiM, architectures utilizing nonvolatile memory-based CiM (NVCiM) stand out [4], [11], [14], [19], where the storage arrays of a persistent memory technology are modified to perform digital computation by directly using the memory cells. The non-volatile memory provides density and energy benefits, and utilizing memory cells as compute elements enables the tightest possible coupling between computing and memory, which in turn maximizes bandwidth and minimizes data movement. At the same time, these CiM systems do not need complex analog or special-purpose circuitry at the array periphery.

In order to perform computation, NVCiM systems equip memory arrays with a few extra control lines to connect multiple memory cells to form a logic gate – typically one or more cells serve as the inputs; another cell, as the output. All such cells reside either in the same row or in the same column. Before the computation starts, the output cell Out is preset, i.e., a gate-specific, known value voutv_{out} is written to the output cell. Once the computation is fired using dedicated control lines, the output cell may or may not change state depending on the logic states of the input cells. The purpose of presetting the output cell to a known value is to enable deterministic Out state transitions matching the truth table of the targeted gate, which is crucial for correctness.

Typical NVCiM architectures, as such, can support universal Boolean gates. Therefore, we can map any digital computation to NVCiM by translating the underlying computational steps into a sequence of Boolean operations. At the same time, all rows or columns in the memory array can perform the same operation on different data simultaneously, and multiple arrays can compute in parallel. The very same method to implement logic operations applies across different NVM technologies such as Resistive Random Access Memory (ReRAM) or Magnetoresistive Random Access Memory (MRAM), which otherwise rely on different physical phenomena to represent logic states [4], [11], [14], [19].

A major bottleneck to fully realizing the energy-efficiency and performance potential of digital NVCiM is the overhead imposed by preset operations. Because each logic operation requires presetting (writing) the destination cell, it inherently incurs substantial latency and energy penalties. Consequently, the total preset overhead scales directly with the number of preset operations required by an application. Compounding this problem, non-volatile memory technologies exhibit finite write endurance, which limits the number of writes to each cell during the lifetime of the memory array. Since output cells already undergo accelerated wear from repeated logic updates, additional preset-induced writes can significantly degrade overall lifetime.

Typical NVCiM compilers focus on minimizing the total number of logic operations, NopN_{op}, because end-to-end execution time and energy consumption scale directly with NopN_{op}. However, state-of-the-art compilers treat each preset as an atomic component tightly bound to a gate operation—a design choice that leaves significant optimization opportunities untapped. Crucially, we observe that numerous presets across long chains of dependent operations can be safely eliminated through strategic operation scheduling and reordering.

Naively eliminating a preset—the dedicated write to an output cell (Out)—compromises functional correctness. Executing a logic operation requires Out to hold an operation-specific initial value, voutv_{out}, prior to computation. In the absence of an explicit preset, correctness can only be guaranteed if Out=vOutOut = v_{Out} already holds before execution begins. The core principle behind PRIM is to fulfill this requirement through operation reordering and scheduling. Specifically, PRIM identifies operations whose Out, if shared as the output of subsequent operations, leads to modified behaviors that recreate a)

Figure

b)

Figure

Fig. 1. Digital NVCiM: (a) Logic gate formation. (b) Electrical equivalent of a logic gate; a resistive network.

the desired outcome. This bypasses the need for the later preset writes, and enables further optimization opportunities for eliminating and/or coalescing remaining logic operations.

Safely eliminating presets directly improves performance, energy efficiency, and cell endurance. Furthermore, reducing preset interventions simplifies in-memory implementation of several useful NVCiM primitives which require keeping a history of computation results from consecutive execution steps—such as maintaining sticky bits, constructing n-input logic gates (n > 3) from 2- or 3-input building blocks, and scanning bit vectors.

In the following, we cover fundamental principles and challenges of NVCiM in Section II; basics of PRIM, in Section III; experimental setup, in Section IV; a quantitative characterization of energy efficiency and endurance implications, in Section V; and related work in Section VI.

References (33)