Chips & architecture · Research feature

DCC: Data-Centric Compilation of Machine Learning Kernels for Processing-In-Memory Architectures

A new compiler jointly optimizes data layout and compute code for machine learning kernels running on processing-in-memory architectures.

Adapted from research by Peiming Yang, Sankeerth Durvasula, Ivan Fernandez and colleagues.

arXiv preprint revision · 2026-08-28 · Attribution & reuse
In this article
Editorial illustration of processor die.

Editor’s introduction

The study evaluates seven memory-intensive machine learning kernels, including GEMV, reduction, and attention operations, across two PIM architectures: HBM-PIM and AttAcc. Researchers compare performance gains from data rearrangements and compute code optimization, showing that these factors are interdependent and must be co-optimized. DCC, a data-centric compiler, integrates multi-layer PIM abstractions and uses a performance prediction model to select optimal configurations. Results show up to 13.17x speedup on AttAcc and 7.68x on HBM-PIM over GPU-only execution. The evaluation includes end-to-end inference on GPT-3 and LLaMA-2 models, with average speedups of 4.52x. The study measures compilation time and evaluates the impact of draft pruning, noting reduced search space and faster compilation when pruning is enabled.

Introduction

Machine Learning (ML) models provide state-of-the-art results across numerous domains including finance, retail, healthcare, education, entertainment, and autonomous systems. ML models process increasingly large datasets and comprise both compute-intensive kernels such as General Matrix-Matrix Multiplication (GEMM) and convolutions, as well as memory-intensive kernels such as General Matrix-Vector Multiplication (GEMV) and element-wise operations. For instance, Large Language Models (LLMs) contain both compute-intensive fully-connected layers with GEMM kernels and memory-intensive attention layers with GEMV kernels. However, when executed on processor-centric CPU or GPU systems, memory-intensive ML kernels are significantly bottlenecked by data movement between off-chip memory and processors. Such memory bottlenecks increasingly limit end-to-end ML execution performance.

Processing-In-Memory (PIM) has emerged as a promising paradigm to alleviate data movement bottlenecks by placing low-power processing units (PIM cores) near memory arrays. Numerous works show that PIM can provide significant performance benefits for memory-intensive ML kernels by reducing data movement costs.

A PIM system includes multiple PIM-enabled memory devices connected to a high-performance Host processor (e.g., CPU, GPU, TPU). Near-bank PIM devices tightly couple a PIM core with one or few DRAM banks, exploiting bank-level parallelism to enable large aggregate memory bandwidth. Each PIM core can only access data from its local bank(s). PIM cores of a device may not be able to directly communicate with each other, and inter-core communication can happen via Host. Manufacturers have already started to commercialize near-bank PIM devices (referred to as PIM backend). UPMEM PIM is the first commercialized near-bank PIM device, and can be integrated with CPUs. Samsung HBM-PIM and SK Hynix GDDR6-AiM PIM devices have been prototyped and validated, and can be integrated with GPUs. These PIM systems can enable heterogeneous ML execution, where memory-intensive kernels run on PIM cores and compute-intensive kernels run on Host processor.

Host and PIM cores require fundamentally different data layouts to exploit large available memory bandwidth. The Host system distributes consecutive elements across multiple DRAM banks to exploit bank-level parallelism, and enables large bandwidth when accessing data at cache line granularity. In contrast, a PIM core can access data only from its local bank(s), and thus in PIM, consecutive elements must be placed within the same bank to enable efficient multi-element accesses and maximize local bandwidth. Consequently, the PIM execution of a kernel has three steps: (1) input data rearrangements to place consecutive elements within the same banks for local PIM processing, (2) computation on PIM cores, and (3) output data rearrangements to merge partial results produced from step (2) on PIM cores or prepare output data for Host access by redistributing consecutive elements across banks. These data rearrangements are typically performed via the Host memory bus (outside PIM devices), and thus incur large data movement costs that can dominate end-to-end performance.

Therefore, programming PIM devices is a challenging task. Programmers must manually craft data rearrangement strategies that balance data movement costs with computation efficiency, which requires deep understanding of both the PIM system and the kernel-specific access patterns of each ML kernel. Doing so also demands expertise in low-level programming across multiple PIM backends (e.g., ), which may expose different programming interfaces and optimization capabilities. This complexity necessitates compilation tools that automatically and intelligently generate and optimize data rearrangement strategy (i.e., how tensor data is partitioned across PIM cores) and loop-level compute schedule (i.e., how the computation of nested nested loops is split and assigned to PIM cores) to enhance programmability and minimize end-to-end execution time.

Processing-In-Memory (PIM) Architectures

Processing-In-Memory (PIM) places low-power processing units near memory arrays, and can alleviate data movement bottlenecks in processor-centric CPU/GPU systems. Near-bank PIM designs tightly couple each core with one (or a few) DRAM banks that can supply data to the core. Near-bank PIM provides larger aggregate memory bandwidth and parallelism compared to near-rank PIM, where cores are placed at DRAM buffer chip. UPMEM PIM is the first commercialized PIM system. Samsung HBM-PIM, Alibaba HB-PNM and SK Hynix GDDR6-AiM have also been prototyped.

UPMEM PIM is built on DDR4 interfaces for CPU systems, has limited hardware multiplication support and no floating-point arithmetic units. Due to these limitations, UPMEM PIM with CPU-PIM co-execution in ML workloads cannot typically outperform GPU-only execution. In contrast, Samsung HBM-PIM, Alibaba HB-PNM and SK Hynix GDDR6-AiM are 3D PIM memory devices that can integrate with a high-performance xPU processor such as a GPU or TPU, provide hardware multiplication and floating-point units (e.g., FP16), which makes them suitable for ML acceleration. Building on these industry products, numerous research works explore enhanced PIM core microarchitectures and system designs to further accelerate ML kernels. In this work, we target near-bank PIM devices that can be integrated with GPUs/TPUs, have hardware multiplication support and/or floating-point arithmetic units.

Need for Data-Centric ML Compiler Support for PIM Architectures

PIM software support remains in early stages, with limited automation and compilation frameworks. SimplePIM optimizes only 1D tensor kernels on UPMEM PIM. PIM-DL effectively supports only the GEMM kernel. CINM integrates multi-level intermediate representations to lower abstractions to PIM, again targeting UPMEM. PIMFlow supports only convolution kernels, automating kernel offloading to GPU or PIM, but without kernel-level tuning optimizations and largely ignoring data rearrangement costs. These works lack systematic optimization and auto-tuning for diverse ML kernels and support for multiple PIM backends. Moreover, most of them target UPMEM PIM, a CPU-integrated DDR4-based device that has no floating-point support and weak multiplication support. This makes UPMEM unsuitable for ML models, where compute-intensive kernels typically run on GPUs/TPUs and memory-intensive kernels on PIM cores may need floating-point arithmetic and strong multiplication units.

ATiM is a search-based tensor compiler designed for UPMEM PIM. ATiM tunes ML kernels on CPU-PIM systems, however, CPU-PIM co-execution on UPMEM systems typically performs worse than GPU-only execution. In contrast, GPU-PIM co-execution can deliver substantial performance benefits in ML over GPU-only execution. Although ATiM considers data rearrangement costs, it could not achieve best performance due to its compute-centric tuning approach. ATiM has a three-step sequential process: it (i) uses TVM to find and fix a set of templates for compute schedule generation, (ii) generates data rearrangements needed for each template using UPMEM-specific optimizations, and (iii) searches within this fixed set of templates to find the best-performing configuration. This sequential approach is suboptimal, because it treats compute schedule optimization and data rearrangement as independent problems, while they are fundamentally interdependent. A compute schedule that appears efficient in isolation may require expensive data rearrangements, while a slightly less efficient schedule might enable cheaper data rearrangement costs, yielding better end-to-end performance. By fixing compute templates before generating data rearrangements, ATiM explores only a restricted search space and cannot discover configurations where alternative compute schedules paired with different data transformations could minimize total time.

PIM-Specific Code Optimizer

Once tiling drafts are generated, data is mapped across PIM banks and compute loop partitions is mapped to PIM cores. DCC then applies a PIM-specific code optimizer for each tiling draft that further optimizes performance. We exploit common PIM architectural characteristics to enable one optimization that reduces data rearrangement costs and one that improves the execution efficiency of loop-level compute schedule.

II) Compute Code Optimization. PIM backends can use specialized DRAM commands to control computation on PIM cores. However, when all PIM cores perform computations in parallel, the Host memory controller must issue significantly more commands than in conventional DRAM, creating a control bottleneck due to the limited memory bus bandwidth. To address this, PIM backends introduce group-level commands that provide SIMD-style control: instead of issuing individual compute commands to each PIM core, a single compute command is broadcast to all cores within a group, with each core operating on its own local data, significantly reducing command bus overhead. DCC employs a hierarchical command generation strategy leveraging both group-level and bank-level control to balance efficiency and flexibility. DCC detects and prioritizes group-level commands wherever possible. Since DRAM command formats constrain group-level commands to use identical address offsets for all cores in the group, DCC pads each core’s tensor data to the same size to ensure consistent local addressing. This way DCC allows the memory controller to issue one command per PIM group, significantly reducing command traffic. If the backend lacks group-level command support or when cores need to access different address offsets, DCC generates parallel bank-level commands, achieving fine-grained, bank-level parallelism. This hierarchical command generation strategy adapts to different PIM backends, and minimizes command traffic.

Our optimizer applies PIM-specific optimizations that accelerate performance while remaining backend-agnostic. It has a modular design that facilitates the integration of additional optimizations shared across multiple PIM backends. Developers can also extend DCC with custom optimization passes tailored to specific PIM backends, creating specialized compiler variants (e.g., DCC +HBM for HBM-PIM-specific optimizations).

Coupled Performance Predictor

Although pruning substantially reduces the number candidate drafts, the schedule generator can still produce thousands of valid tiling drafts. Profiling all drafts on the target PIM system can be prohibitively expensive. To efficiently identify the best draft, DCC employs a coupled learning-based performance predictor that estimates end-to-end execution time. The coupled predictor serves two purposes: (i) co-estimating data rearrangement and compute costs to find the best tiling draft, and (ii) providing fast and accurate predictions across multiple PIM backends. We choose a learning-based model (already effectively adopted by widely-used ML compilers ) that can be easily trained (retrained or fine-tuned) for a new PIM backend, and provide both low latency and high prediction accuracy. We use an XGBoost model to predict end-to-end kernel time, because XGBoost has been proven highly effective for compiler cost modeling in prior works.

While analytical models can achieve sufficient accuracy with PIM device-specific formulas and parameters, they are difficult to generalize across multiple PIM backends with competitive accuracy and maintain as PIM architectures evolve. Moreover, unlike neural predictors (e.g., these used in ), XGBoost is lightweight in memory and compute requirements.

The coupled predictor supports both static and dynamic tensor sizes. For static sizes, where model and input dimensions are fixed during inference, DCC trains the predictor offline and configures the best-performing schedule during model initialization (similarly to prior ML compilers ). For dynamic inputs, which occur in LLMs, DCC finds and selects the best-performing schedules at inference time.

Programming Interface & Intermediate Representation (IR)

Users can integrate a kernel executed on PIM into an ML model using DCC.Layer to create ML layers that replace existing model layers. PIM-running kernels must be initialized with input tensor sizes. DCC provides DCC.Tensor and DCC.Tensor.zero to create and initialize temporary tensors. After adding PIM-accelerated layers to the model, DCC initializes necessary model metadata, infers all tensor sizes, and performs offline training. At inference, when a request is received, DCC asynchronously infers tensor sizes for all kernels executed on PIM, and selects their best-performing schedules. Users can override the function DCC.Layer.update to pre-load data to PIM devices using DCC.Kernel.preLoad before running the kernel. When forward is called, the kernel is executed on PIM cores with the input data and returns the results as a torch.Tensor. DCC synergistically works with xPU compilers (e.g., ML compilers for GPUs) via PyTorch. During the optimization for xPU, the PIM layer will be configured as non-fusible to enable intra- and inter-kernel optimizations. DCC compiles and optimizes this layer for the PIM backend.

Evaluation

ML Kernels and Models. We evaluate seven memory-intensive ML kernels. In AttAcc, we evaluate the general-matrix-vector-multiplication (GEMV), reduction (RED) and attention (ATTN) kernels. In HBM-PIM, we evaluate the GEMV, RED, vector addition (VA) and RELU kernels. Attention requires a softmax unit which only exists on AttAcc. However, AttAcc does not have near-bank compute units that could support and run RELU and VA. For GEMV and ATTN, we use input size 128, the most common per-head dimension in LLMs. We also evaluate end-to-end inference using GPT3-13B and LLAMA2-33B models. We evaluate FP16 data type.

Comparison Points. We evaluate five comparison points. (1) GPU: all kernels run on an A100 GPU configured in AttAcc and Ramulator 2.0 simulators. (2) AttAcc: AttAcc’s default open-source implementation that distributes different batches or attention heads across 16 pCHs, partitions the first tensor dimension across 16 bank groups per pCH, and partitions the second tensor dimension across 4 banks per bank group. (3) AttAcc+DCC: we enable DCC compiler on AttAcc. (4) HBM-PIM: we use AttAcc’s data distribution. (5) HBM-PIM+DCC: we enable DCC compiler on HBM-PIM.

To our knowledge, this is the first work to (i) consider data rearrangement strategies and their associated costs during ML kernel tuning for xPU-integrated PIM devices, and (ii) propose a compiler that jointly optimizes them with compute code.

Compiler Support for PIM. Prior works design compilation tools for PIM systems, but lack systematic optimization and auto-tuning capabilities. They target a single ML kernel or a single PIM backend. ATiM is a search-based tensor compiler for UPMEM PIM. However, UPMEM’s DDR4-based architecture targets CPU memory channels, thus preventing GPU-PIM co-executions for ML models. ATiM employs compute-centric tuning, generating data rearrangement strategies in isolation from compute code generation. Such compute-centric process yields sub-optimal performance (§2.2). Instead, DCC has a unified data-centric approach that co-optimizes compute-data to minimize end-to-end time.

Software for PIM Systems. Prior works propose libraries, frameworks, and benchmark suites for the UPMEM PIM spanning linear algebra, graph processing, image processing, machine learning, databases, and concurrent data structure domains. UPMEM PIM is primarily designed for CPUs and has limited hardware multiplication support. DCC is designed for PIM devices that efficiently support ML kernels.

Communication and System Integration for PIM. Prior works design efficient data transfers, memory management, synchronization, virtualization of PIM, and simulation tools. PIMCARE is a compiler-assisted scheduler to allocate the correct amount of PIM devices for an application. UniNDP is a simulation and compilation framework for different PIM architecture types (near-bank, near-device, near-rank, near-channel) to guide programmers how to develop their kernels. To run a kernel on a target PIM backend, programmers still need to manually implement it using backend-specific low-level programming interface. Instead, DCC directly takes kernels written in high-level Python interface (§4.5), and automatically generates optimized low-level code for a PIM backend. Programmers using DCC require no expertise in the target PIM backend’s programming interface or architecture.

ML Compilers for Commodity Systems. Prior works propose ML compilers for CPU, FPGA and GPU systems by leveraging their shared memory model and deep cache hierarchies (on-chip caches). Prometheus optimizes kernels on FPGAs via loop transformations for cache locality, and overlapping computation with off-chip data transfers to main memory. Instead, PIM systems have a distributed memory model and shallow cache hierarchy, and may not have hardware support to overlap PIM computation with off-chip data transfers. Thus, compiler techniques such as cache tiling, loop transformations, and compute-communication overlapping cannot enable high performance on PIM. ML compilers for CPU/GPU/FPGA cannot be directly used in PIM systems, or would cause high performance costs because they do not optimize data how data is distributed across DRAM banks.

Abstract

The Artifact Appendix describes how to reproduce the main results of this paper. It includes the source code of DCC, benchmark scripts, and step-by-step instructions for the key evaluation results. The experiments require a server equipped with a CPU with at least 64 hardware threads, 128GB of main memory, disk space of at least 128GB, and an NVIDIA GPU with an up-to-date NVIDIA driver installed. Note that our artifact needs Anaconda 25.6.1+ and CMake 3.16.3 to be installed in the server. We provide a README.md file that describes the required hardware and software dependencies and provides step-by-step instructions. This artifact is used to support our major claims (See Appendix §A.6), demonstrating DCC’s performance benefits in Figures 8, 9 and 11. We expect the full evaluation pipeline, including the setup and simulations, to take approximately 7-10 days. We also expect that the trace files generated for trace-driven simulations take approximately 90GB disk space.