Kernel tiling is a loop transformation that partitions a large iteration space—such as a matrix multiplication or convolution—into smaller, regular blocks or tiles. The primary goal is to fit the working set of data for a tile into a faster, limited memory hierarchy like shared memory or registers, thereby drastically reducing expensive accesses to slower global memory. This transformation is critical for achieving high performance on memory-bound operations by increasing data locality and enabling efficient reuse of loaded data across multiple computations within a tile.
Glossary
Kernel Tiling

What is Kernel Tiling?
Kernel tiling is a foundational compiler transformation for optimizing compute-intensive workloads on parallel hardware accelerators like NPUs and GPUs.
The effectiveness of tiling depends on selecting optimal tile sizes, which balance the available fast memory capacity against the parallelism exposed to the hardware. Compilers and auto-tuners empirically search this parameter space. Tiling is often combined with other loop nest optimizations (LNO) like loop interchange to ensure memory access patterns are coalesced for the target architecture. This technique is a cornerstone of high-performance libraries and is essential for maximizing the arithmetic intensity and utilization of specialized units like Tensor Cores in modern AI accelerators.
Key Characteristics of Kernel Tiling
Kernel tiling is a foundational loop transformation for hardware accelerators. Its primary characteristics focus on managing data locality, parallelism, and hardware constraints to maximize computational throughput.
Data Locality Optimization
The core objective of tiling is to exploit temporal locality and spatial locality within a faster memory hierarchy. By partitioning a large iteration space into smaller tiles, the working set of data (the tile) is designed to fit entirely into a limited, fast memory like shared memory (on GPUs) or scratchpad memory/L1 cache (on NPUs). This drastically reduces the number of accesses to slower global memory (DRAM). For example, in a matrix multiplication, tiling allows a sub-block of matrices A and B to be loaded once into shared memory and reused for many computations.
Hierarchical Memory Management
Effective tiling is explicitly designed for a target accelerator's memory hierarchy. A multi-level tiling strategy is often employed:
- Register Tiling: The innermost tile size is chosen to keep operands in thread-private registers for the lowest latency access.
- Shared Memory/Scratchpad Tiling: An intermediate tile is sized to fit the software-managed cache shared by a thread block or workgroup.
- Cache Tiling: Outer tiles may be sized for the hardware-managed L2/L3 cache. This hierarchical blocking minimizes data movement at every level of the memory pyramid.
Tile Size as a Critical Parameter
The tile dimensions (e.g., TILE_M, TILE_N, TILE_K for GEMM) are not arbitrary. They are pivotal optimization parameters that must balance multiple, often conflicting, hardware constraints:
- Shared Memory Capacity: Total tile data must not exceed available shared memory per thread block.
- Register Count: Per-thregister usage, determined by the innermost tile, must avoid register spilling.
- Thread Block Size: Tile dimensions often map directly to the number of threads, affecting kernel occupancy.
- Memory Coalescing: Tile dimensions should be chosen to enable aligned, contiguous memory accesses by threads. Finding the optimal tile size is a classic target for auto-tuning.
Enabler for Parallelism
Tiling decomposes a large problem into independent or partially independent sub-problems (tiles). This creates natural units of work that can be:
- Distributed across multiple thread blocks or workgroups for coarse-grained parallelism.
- Assigned to threads within a block for fine-grained parallelism. The tile becomes the fundamental unit of data parallelism. Furthermore, tiling can expose pipeline parallelism; while one thread block processes its tile, others can be loading their data, hiding memory latency.
Interaction with Other Optimizations
Tiling is rarely applied in isolation. It is a prerequisite or synergistic with several other critical compiler passes:
- Loop Unrolling: Applied to the innermost loops within a tile to reduce loop overhead and increase instruction-level parallelism (ILP).
- Vectorization: The regular, predictable access patterns within a tile are ideal for SIMD or SIMT vectorization.
- Memory Coalescing: Tiling, when combined with proper thread mapping, transforms scattered memory accesses into contiguous, coalesced transactions.
- Kernel Fusion: Tiling can be applied across fused operation boundaries, keeping intermediate results within fast memory across multiple operations.
Application in Core Operations
Tiling is essential for accelerating the compute-bound kernels that dominate deep learning:
- General Matrix Multiply (GEMM): The canonical example. Tiling is applied across all three loops (M, N, K) to block matrices for register and shared memory.
- Convolutions: The input image and filter are tiled to maximize reuse of input pixels across multiple output positions and filters.
- Reductions: Tiling is used to perform partial reductions within a thread block using shared memory, followed by a final reduction across blocks. The performance of frameworks like cuBLAS, oneDNN, and MLIR-based compilers hinges on sophisticated tiling strategies.
Kernel Tiling vs. Related Loop Transformations
A comparison of kernel tiling with other fundamental compiler loop transformations used in NPU and accelerator programming, highlighting their primary objectives, effects on data locality, and typical use cases.
| Transformation | Primary Objective | Effect on Data Locality | Typical Use Case | Applicability to NPUs |
|---|---|---|---|---|
Kernel Tiling | Partition iteration space into blocks to fit working set into faster memory (e.g., shared memory/registers). | Dramatically improves locality by promoting data reuse within a tile before eviction. | Large matrix multiplications, convolutions with large feature maps. | |
Loop Fusion | Merge adjacent loops with the same iteration space to reduce loop overhead. | Improves locality by keeping producer-consumer data in registers/cache between fused operations. | Fusing element-wise operations (e.g., add, ReLU) following a convolution. | |
Loop Unrolling | Replicate loop body to reduce branch overhead and increase instruction-level parallelism (ILP). | Minor improvement; primarily reduces control overhead, not data movement. | Innermost loops with small, fixed trip counts to expose ILP. | |
Loop Interchange | Swap order of nested loops to match memory access patterns to data layout. | Can significantly improve locality and enable coalescing by accessing contiguous memory. | Transforming column-major accesses to row-major in nested loops for coalesced loads. | |
Loop Fission (Distribution) | Split a single loop into multiple loops to reduce register pressure or enable separate optimizations. | Often harms locality by separating producer-consumer pairs, causing intermediate writes to memory. | Isolating a memory-intensive section from a compute-intensive section within a loop. | |
Software Pipelining | Reorder instructions across loop iterations to hide instruction and memory latency. | No direct effect on locality; focuses on overlapping execution to hide latency. | Loops with long-latency operations (e.g., dependent FP operations, memory loads). | |
Kernel Vectorization | Convert scalar operations to SIMD/vector instructions to utilize vector units. | Improves bandwidth utilization but does not inherently improve cache locality. | Inner loops with data-parallel, stride-1 access patterns. |
Frequently Asked Questions
Kernel tiling is a fundamental compiler optimization for hardware accelerators. This FAQ addresses common questions about its purpose, mechanics, and relationship to other performance techniques.
Kernel tiling is a loop transformation that partitions a large iteration space into smaller, regular blocks or tiles to fit the working set of data into a faster, limited memory hierarchy like shared memory or registers. Its primary purpose is to reduce expensive accesses to slower global memory (DRAM). By reusing data loaded into fast on-chip memory across multiple computations, tiling dramatically improves data locality and is essential for achieving peak performance on parallel architectures like GPUs and NPUs, where memory bandwidth is often the primary bottleneck.
Without tiling, each data element might be fetched from global memory repeatedly. With tiling, a tile of data is loaded once into shared memory, then all necessary computations on that tile are performed, minimizing global memory traffic. This transformation directly targets the memory wall problem, making applications less memory-bound and more compute-bound, allowing the hardware's arithmetic units to be fully utilized.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Kernel tiling is a foundational loop transformation for memory hierarchy optimization. The following terms are essential compiler techniques and hardware concepts that interact with or enable effective tiling strategies.
Loop Fusion
A compiler optimization that combines two or more adjacent loops with the same iteration space into a single loop. This reduces loop overhead and improves data locality by keeping intermediate results in faster memory hierarchies like registers or caches, which can complement tiling by creating larger, more efficient tiles.
- Primary Benefit: Reduces kernel launch and memory access overhead.
- Interaction with Tiling: Often performed before tiling to create a larger, fused iteration space that is then partitioned into tiles.
Loop Nest Optimization (LNO)
A class of compiler transformations applied to nested loops to maximize data locality, parallelism, and hardware utilization. Kernel tiling is a core LNO technique. Others include:
- Loop interchange: Swaps loop order to improve access patterns.
- Loop unrolling: Replicates loop body to reduce control overhead.
- Loop fission: Splits a loop to reduce register pressure.
LNO uses a polyhedral model to mathematically analyze and legally apply these transformations in combination for accelerators like NPUs.
Memory Coalescing
An optimization on parallel architectures where concurrent memory accesses from multiple threads (within a warp or wavefront) are combined into a single, wider transaction. This maximizes effective memory bandwidth.
- Critical for Tiling: The tile size and thread mapping must be chosen to ensure threads within a block access contiguous, aligned memory addresses.
- Performance Impact: Poor coalescing can reduce effective bandwidth by 10x or more, negating the benefits of tiling.
Arithmetic Intensity
A key performance metric defined as the number of arithmetic operations performed per byte of data transferred between the processor and main memory (DRAM). It classifies kernels as:
- Compute-Bound: High arithmetic intensity. Performance limited by peak FLOPS.
- Memory-Bound: Low arithmetic intensity. Performance limited by memory bandwidth.
Tiling's Goal: To transform memory-bound kernels into compute-bound ones by reusing data within a tile (in registers/shared memory), thereby increasing the effective arithmetic intensity for the data fetched from global memory.
Register Spilling
Occurs when a compiler's register allocator is forced to move values from fast, on-chip registers to slower memory (like the stack or local memory) because the live variables exceed the available physical registers.
- Tiling Trade-off: Larger tile sizes increase data reuse but also raise register pressure. Excessive spilling can destroy performance gains from tiling.
- Compiler Role: The compiler must balance tile size against the fixed register file size of the target hardware (e.g., NPU streaming processor).
Auto-Tuning
An automated process that empirically searches a parameter space—such as tile sizes, loop unroll factors, or thread block dimensions—to find the configuration yielding the best performance for a specific kernel on target hardware.
- Why it's needed: The optimal tile size is a complex function of problem shape, memory hierarchy sizes, and hardware quirks.
- Methodology: Uses techniques like grid search, genetic algorithms, or machine learning to evaluate thousands of configurations, often leveraging a Roofline Model to guide the search.

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.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us