NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Tensor Processing Primitives: A Programming Abstraction for Efficiency and Portability in Deep Learning and HPC Workloads

Evangelos Georganas, Dhiraj D. Kalamkar, Sasikanth Avancha, Menachem Adelman, Deepti Aggarwal, Cristina Anderson, Alexander Breuer, Jeremy Bruestle, Narendra Chaudhary, Abhisek Kundu, Denise Kutnick, Frank Laub, Md. Vasimuddin, Sanchit Misra, Ramanarayan Mohanty, Hans Pabst, Brian Retford, Barukh Ziv, Alexander HeineckeFrontiers Appl. Math. Stat 2022 · DOI

Abstract

Modern Deep Learning (DL) and High-Performance Computing (HPC) workloads face a persistent "performance vs. productivity" deadlock. Developers must often choose between inflexible, monolithic vendor libraries that offer high performance and generic framework primitives that provide flexibility at the cost of efficiency. This paper introduces Tensor Processing Primitives (TPP), a programming abstraction that defines a "virtual Tensor ISA." By providing a compact set of 2D-tensor building blocks and a JIT-compiled backend, TPP enables near-peak hardware performance across diverse architectures while maintaining a single, portable codebase.

Introduction

The programming methodology for high-performance systems has reached a plateau. Currently, developers are forced into a binary choice. On one hand, highly-optimized vendor libraries like oneDNN or cuDNN offer exceptional performance but are monolithic and inflexible; implementing a novel operator often requires waiting for a library update. On the other hand, framework primitives (e.g., PyTorch or TensorFlow operators) are flexible but frequently yield underwhelming performance because they lack optimization for specific hardware nuances. While tensor compilers like XLA or TVM attempt to bridge this gap, they often struggle with long compilation times or fail to reach the achievable peak performance for complex, large-scale operators.

Researchers from Intel and Friedrich-Schiller-Universität Jena propose Tensor Processing Primitives (TPP) as a middle ground. TPP is an abstraction low-level enough to map to hardware efficiently but high-level enough to remain platform-agnostic.

The TPP Specification: A Virtual Tensor ISA

The core of this work is the TPP Specification, which defines a "virtual Tensor ISA" focused on 2D tensors. The authors argue that 2D is the "sweet spot" for primitives: high-level enough to be portable, yet low-level enough to map directly to hardware vector and matrix units.

Building Blocks

TPPs are categorized into Unary (e.g., ReLU, Exp), Binary (e.g., Add, Mul), and Ternary operators. The primary "workhorse" is the Batch-Reduce GEMM (BRGEMM), a versatile operator capable of expressing convolutions, fully-connected layers, and attention mechanisms.

Memory-to-Memory Design

Unlike physical ISAs that rely on specific registers, TPPs are specified as memory-to-memory operations. This design abstracts away the number of physical registers and vector lengths of the underlying hardware, allowing the same TPP code to run on different architectures without modification.

Matrix Equations and Optimization

To handle complex operations, the authors developed a mini-embedded Domain Specific Language (eDSL) that allows users to compose TPPs into "equation trees." To optimize these equations, a recursive "register scoring" algorithm is used to assign nodes in the tree, minimizing the need for temporary memory buffers by maximizing register reuse during execution.

Implementation and Portability

The proof-of-concept implementation utilizes the LIBXSMM library to JIT-compile these primitives at runtime. This allows the code to be tailored to the specific CPU features available on the host machine, such as AVX-512, Intel AMX, or ARM SVE.

One significant advantage of this virtualization is the ability to perform "hardware emulation." For instance, the authors implemented mixed-precision (BF16) GEMM kernels that run bit-accurately on older AVX-512 hardware. This allows researchers to test and validate new algorithmic concepts before the latest hardware is even commercially available.

Experimental Results

The evaluation of TPP spanned a diverse range of workloads, including CNNs (ResNet50), Recommendation Systems (DLRM), Natural Language Processing (BERT Large), Graph Neural Networks (GraphSAGE), and HPC applications (CP2K and EDGE).

Performance Highlights

  • BERT Training: TPP-based BERT implementations achieved speedups ranging from 1.5x to 8.5x over standard Hugging Face reference code across multiple platforms.
  • Hardware Efficiency: TPP kernels consistently achieved 66% to 84% of the theoretical machine peak performance across various architectures.
  • Cross-Platform Portability: The exact same TPP-based code for 1D Dilated Convolutions outperformed vendor libraries on both Intel (x86) and Amazon Graviton2 (ARM) processors.
  • HPC Impact: In the EDGE seismic wave simulation, TPPs enabled a 6.55x speedup in time-to-solution compared to the baseline.

Conclusion and Future Work

TPP successfully demonstrates that a 2D-tensor abstraction can resolve the tension between performance and productivity. By separating the "what" (the algorithm) from the "how" (platform-specific optimization), TPP allows developers to write high-performance code once and deploy it across different CPU architectures.

While the current implementation is focused on CPUs, the abstraction is theoretically extensible to GPUs. Future work aims to mature the Matrix Equation framework and integrate TPP more deeply into the MLIR (Multi-Level Intermediate Representation) ecosystem, potentially allowing higher-level compilers to automatically lower standard framework code into TPPs.

Summary updated

BibTeX
@article{georganas2022tensor,
  author = {Evangelos Georganas and Dhiraj D. Kalamkar and Sasikanth Avancha and Menachem Adelman and Deepti Aggarwal and Cristina Anderson and Alexander Breuer and Jeremy Bruestle and Narendra Chaudhary and Abhisek Kundu and Denise Kutnick and Frank Laub and Md. Vasimuddin and Sanchit Misra and Ramanarayan Mohanty and Hans Pabst and Brian Retford and Barukh Ziv and Alexander Heinecke},
  title = {{Tensor Processing Primitives: A Programming Abstraction for Efficiency and Portability in Deep Learning and HPC Workloads}},
  journal = {Frontiers Appl. Math. Stat.},
  year = {2022},
  doi = {10.3389/fams.2022.826269},
}
Figure