Inferensys

Glossary

Arithmetic Intensity

Arithmetic intensity is a performance metric defined as the number of arithmetic operations performed per byte of data transferred between processor and main memory, used to classify workloads as compute-bound or memory-bound.
Data scientist building training data pipeline on laptop, data preprocessing visible, technical workspace.
PERFORMANCE METRIC

What is Arithmetic Intensity?

A fundamental metric for classifying computational workloads and predicting performance bottlenecks on modern hardware accelerators.

Arithmetic intensity is a key hardware-agnostic performance metric defined as the ratio of arithmetic operations (FLOPs) performed to the number of bytes transferred between the processor and main memory (DRAM). It quantifies the balance between computation and data movement for a given kernel or algorithm. A high arithmetic intensity indicates a compute-bound workload, where performance is limited by the processor's peak FLOP/s. A low arithmetic intensity indicates a memory-bound workload, where performance is limited by the available memory bandwidth.

This metric is central to performance modeling, most notably in the Roofline Model, which uses arithmetic intensity to plot an application's attainable performance against the hardware's theoretical ceilings. Optimizations like kernel fusion, loop tiling, and memory coalescing aim to increase arithmetic intensity by reusing data in fast cache hierarchies, thereby reducing costly off-chip memory accesses. For NPUs and GPUs accelerating deep learning, maximizing arithmetic intensity is critical to saturating the high compute throughput of specialized units like Tensor Cores.

PERFORMANCE METRICS

Key Characteristics of Arithmetic Intensity

Arithmetic intensity is a fundamental metric for classifying computational workloads and predicting their performance on modern hardware. Its characteristics determine whether an application will be limited by processor speed or memory bandwidth.

01

Definition and Formula

Arithmetic Intensity (AI) is formally defined as the ratio of total arithmetic operations (FLOPs) to the total bytes of data transferred between the processor and main memory (DRAM). It is calculated as:

AI = (Total FLOPs) / (Total Bytes Transferred)

  • A high AI (>10-20 Ops/Byte) indicates a compute-bound kernel, where performance is limited by the processor's peak FLOP/s.
  • A low AI (<1 Ops/Byte) indicates a memory-bound kernel, where performance is limited by the system's memory bandwidth (GB/s).
02

Determines Application Bounding

This metric is the primary classifier for application performance bottlenecks.

  • Compute-Bound: Kernels like dense matrix multiplication (GEMM) or convolution with large filters have high AI. Performance scales with processor clock speed and core count.
  • Memory-Bound: Kernels like element-wise operations (e.g., adding two vectors) or sparse matrix-vector multiply have low AI. Performance is dictated by the memory subsystem's bandwidth and latency. The Roofline Model uses AI to plot an application's attainable performance, capped by either the compute or memory roof.
03

Influenced by Memory Hierarchy

Effective AI is not fixed; it can be dramatically increased by compiler and programmer optimizations that exploit faster, on-chip memory.

  • Data Reuse: Keeping data in caches, shared memory, or registers across multiple operations reduces accesses to slow DRAM, increasing the effective AI.
  • Optimization Impact: Techniques like kernel tiling, loop fusion, and memory coalescing are designed specifically to reduce off-chip data movement, thereby transforming a memory-bound kernel into a compute-bound one for the hardware.
04

Hardware-Specific Target

The 'target' AI for a workload is hardware-dependent. It is the minimum AI required to become compute-bound on a given chip.

  • Calculation: Target AI = (Peak Compute (FLOP/s)) / (Peak Memory Bandwidth (Bytes/s)).
  • Example: An NPU with 100 TFLOPS and 400 GB/s bandwidth has a target AI of 250 Ops/Byte. A kernel must exceed this AI to fully utilize the compute units.
  • Implication: Hardware with extremely high compute throughput (like modern AI accelerators) requires correspondingly high AI kernels, motivating advanced data reuse strategies.
05

Relation to Kernel Fusion

Kernel fusion is a primary optimization to increase arithmetic intensity. By fusing multiple operations (e.g., a convolution, bias add, and ReLU) into a single kernel:

  • Eliminates Intermediate Stores: Outputs of one operation are kept in registers/cache and fed directly to the next operation.
  • Reduces Global Memory Traffic: The fused kernel writes only the final result to DRAM, not every intermediate tensor.
  • Increases Effective AI: The total FLOP count remains similar, but the total bytes transferred plummets, leading to a higher AI and moving the workload closer to being compute-bound.
06

Practical Examples and Ranges

Real-world AI values illustrate the spectrum of computational patterns:

  • Extreme Memory-Bound (AI < 0.1): Vector addition, data copy.
  • Memory-Bound (AI ~0.5-2): Sparse matrix operations, stencil computations.
  • Compute-Bound (AI > 10): Dense Linear Algebra (BLAS Level 3 GEMM).
  • Extreme Compute-Bound (AI > 100): Tensor Core operations on large matrices, where data is reused thousands of times. Understanding these ranges guides optimization priority: low-AI kernels benefit most from memory access optimizations, while high-AI kernels benefit from maximizing FLOP throughput.
CALCULATION AND THE ROOFLINE MODEL

Arithmetic Intensity

A fundamental metric for classifying computational workloads and predicting performance on modern hardware accelerators.

Arithmetic intensity is a key performance metric defined as the ratio of arithmetic operations (FLOPs) performed to the amount of data movement (bytes) between the processor and main memory (DRAM). It is the primary determinant of whether a computational kernel is compute-bound or memory-bound, directly informing optimization strategies within the Roofline Model.

A low arithmetic intensity indicates a memory-bound kernel, where performance is limited by available memory bandwidth. A high value indicates a compute-bound kernel, limited by peak processor throughput. Optimizations like kernel fusion and loop tiling aim to increase arithmetic intensity by reusing data in fast cache hierarchies, shifting the bottleneck from memory to compute.

CLASSIFICATION

Workload Examples by Arithmetic Intensity

Arithmetic intensity (AI = Ops/Byte) categorizes workloads as either compute-bound (limited by the processor's FLOPs) or memory-bound (limited by memory bandwidth). This classification dictates the optimal hardware target and compiler optimization strategy.

01

Memory-Bound Workloads (AI < 1)

These workloads perform few arithmetic operations per byte fetched from memory, saturating the memory bus long before the compute units. Performance is gated by DRAM bandwidth.

Key Examples:

  • Vector Addition (SAXPY): AI ≈ 0.25. For each two loads and one store, only a single multiply-add is performed.
  • Bandwidth-Bound Stencils: Simple nearest-neighbor operations on large grids.
  • Data-Intensive Lookups: Table searches and gather/scatter operations.

Optimization Focus: Memory access patterns, coalescing, and prefetching to maximize effective bandwidth.

< 1
Arithmetic Intensity (Ops/Byte)
02

Moderate-Intensity Workloads (AI ≈ 1-10)

These workloads balance compute and memory pressure. Performance can be limited by either bandwidth or compute, depending on the hardware architecture and optimization level.

Key Examples:

  • Matrix-Vector Multiplication (GEMV): AI typically between 1 and 5, depending on matrix size.
  • 1D and 2D Convolutions: With small kernels, the reuse of input data is limited.
  • Reduction Operations: Summation or finding max/min across arrays.

Optimization Focus: Exploiting data reuse via tiling to move data into caches, and improving instruction-level parallelism.

1-10
Arithmetic Intensity (Ops/Byte)
03

Compute-Bound Workloads (AI > 10)

These workloads perform many operations on each byte of data, keeping the compute units saturated. Performance approaches the processor's peak theoretical FLOPs.

Key Examples:

  • Dense Matrix Multiplication (GEMM): AI scales with matrix dimension (N), often reaching 100s of Ops/Byte for large N due to massive data reuse.
  • Deep Convolutional Layers: Large 3x3 or 7x7 kernels with many input/output channels enable high operational intensity.
  • Fast Fourier Transforms (FFTs): For large transforms, the log(N) stages enable significant data reuse.

Optimization Focus: Maximizing data reuse via multi-level tiling, leveraging specialized units (e.g., Tensor Cores), and minimizing operation overhead via kernel fusion.

> 10
Arithmetic Intensity (Ops/Byte)
05

Compiler Strategy by Intensity

The arithmetic intensity of a kernel dictates the primary compiler optimization strategy.

For Memory-Bound Kernels (Low AI):

  • Goal: Reduce bytes moved. Optimize for bandwidth.
  • Techniques: Memory coalescing, vectorized loads/stores, loop interchange for stride-1 access, software prefetching.

For Compute-Bound Kernels (High AI):

  • Goal: Maximize FLOP/s. Optimize for compute throughput.
  • Techniques: Aggressive loop tiling for cache/register reuse, kernel fusion to eliminate intermediate stores, loop unrolling and software pipelining for ILP, leveraging mixed-precision and Tensor Cores.
06

Impact of Kernel Fusion on Intensity

Kernel fusion is a primary technique for transforming memory-bound sequences into compute-bound kernels.

Mechanism: By fusing multiple operations (e.g., Conv → Bias → ReLU), intermediate results are kept in fast registers or shared memory instead of being written to and read from slow global memory.

Effect on Arithmetic Intensity:

  • Fused Kernel AI ≈ (Ops₁ + Ops₂) / (Bytes_in + Bytes_out)
  • The denominator (bytes transferred) is dramatically reduced by eliminating the intermediate Bytes_intermediate.
  • This can shift a workload from the memory-bound to the compute-bound region of the Roofline Model, unlocking higher performance.
COMPARATIVE ANALYSIS

Compiler Optimizations and Their Impact on Arithmetic Intensity

This table compares common compiler optimizations, their primary mechanism, and their direct effect on a kernel's arithmetic intensity, classifying them as either increasing, decreasing, or having a neutral impact on this key performance metric.

OptimizationPrimary MechanismImpact on Arithmetic IntensityTypical Effect on PerformanceApplicability to NPUs

Kernel Fusion

Merges separate kernels

Increases

Reduces global memory traffic, higher FLOPs/byte

Loop Fusion

Combines adjacent loops

Increases

Improves data locality, reduces loop overhead

Operation Fusion

Fuses primitive tensor ops

Increases

Eliminates intermediate stores/loads

Kernel Tiling

Partitions iteration space

Increases

Exploits faster memory (shared/registers)

Loop Unrolling

Replicates loop body

Neutral

Reduces loop overhead, increases ILP

Memory Coalescing

Combines thread memory accesses

Neutral

Maximizes effective memory bandwidth

Software Pipelining

Overlaps loop iterations

Neutral

Hides instruction/memory latency

Register Spilling

Moves values to memory

Decreases

Increases slower memory accesses

Warp Divergence

Serializes branch paths

Decreases

Reduces parallel efficiency, wastes cycles

Common Subexpression Elimination (CSE)

Removes redundant calculations

Increases

Reduces total FLOPs, constant effect on memory

ARITHMETIC INTENSITY

Frequently Asked Questions

Arithmetic intensity is a fundamental performance metric for computational workloads, especially on hardware accelerators like NPUs and GPUs. It determines whether a kernel's execution is limited by the processor's computational power or by its ability to move data.

Arithmetic intensity is a key performance metric defined as the ratio of the number of arithmetic operations (e.g., FLOPs) performed to the amount of data transferred between the processor and main memory (DRAM), measured in operations per byte. It classifies workloads as either compute-bound (high intensity) or memory-bound (low intensity). A high arithmetic intensity indicates that the processor performs many calculations for each byte fetched from memory, making it efficient. Conversely, low intensity means performance is gated by memory bandwidth, as the processor spends more time waiting for data than computing.

Formula: Arithmetic Intensity = Total Operations (FLOPs) / Total Data Movement (Bytes).

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.