Inferensys

Glossary

Bank Conflict

A bank conflict is a GPU performance bottleneck where multiple threads in a warp attempt to access different data within the same memory bank simultaneously, forcing serialized access and reducing memory bandwidth.
Cinematic overhead of a WeWork creative suite room with multiple curved monitors showing AI decision dashboards, executives in casual attire reviewing data, dramatic pendant lighting.
GPU MEMORY OPTIMIZATION

What is Bank Conflict?

A performance-limiting condition in GPU parallel computing that serializes memory access.

A bank conflict is a hardware-level contention that occurs in GPU shared memory when two or more threads within the same warp attempt to access different data words stored in the same memory bank during a single clock cycle, forcing those accesses to be serialized. This serialization drastically reduces the effective memory bandwidth for that warp, creating a performance bottleneck in parallel algorithms that rely on fast, inter-thread communication. Avoiding bank conflicts is a critical optimization for kernels performing reductions, matrix transpositions, or any operation requiring frequent shared memory access.

Shared memory is organized into independent, equally sized memory banks (typically 32 banks on modern NVIDIA GPUs) that can service one access per bank per cycle. Conflict-free, coalesced access is achieved when all 32 threads in a warp access 32 distinct banks or the same address within a bank (broadcast). A conflict arises from strided access patterns where the stride and the number of banks share a common factor. Techniques to mitigate conflicts include memory padding, altering data layouts, or using warp-shuffle instructions to avoid shared memory altogether for certain operations.

GPU MEMORY OPTIMIZATION

Key Characteristics of Bank Conflicts

Bank conflicts are a critical performance bottleneck in GPU programming, occurring within shared memory. Understanding their characteristics is essential for writing high-performance CUDA kernels.

01

Definition and Root Cause

A bank conflict occurs when two or more threads within the same GPU warp attempt to access different data words stored in the same memory bank of shared memory during a single instruction cycle. This forces the hardware to serialize the accesses, turning a parallel operation into a sequential one. The root cause is the interleaved bank addressing scheme used to maximize bandwidth, where consecutive 32-bit words are assigned to consecutive banks in a round-robin fashion (e.g., 32 banks for 32-bit words).

02

Performance Impact

The primary impact is a drastic reduction in effective memory bandwidth and increased latency. A single conflict can cause a 2x slowdown; a worst-case scenario where all 32 threads in a warp access the same bank serializes all accesses, resulting in a 32x slowdown. This stalls the warp scheduler, reducing instruction-level parallelism (ILP) and overall GPU occupancy. The performance penalty is multiplicative, making it a critical optimization target for kernels heavy on shared memory operations like matrix transposes or reductions.

03

Access Patterns That Cause Conflicts

Conflicts arise from specific, predictable stride patterns in thread memory access:

  • Strided Access with a stride that is a multiple of the bank count: The most common cause. For 32 banks, a stride of 32, 64, 96, etc., will cause all threads to map to the same bank.
  • Random or Irregular Access: If thread IDs map unpredictably to addresses, collisions are likely.
  • Diagonal Access in 2D Arrays: Accessing elements like array[threadIdx.x][threadIdx.x] often leads to bank conflicts.
  • Broadcast Access (a special case): When all threads read the same address, it is optimized by hardware into a broadcast and does not cause a conflict.
04

Conflict Resolution and Hardware Behavior

The GPU hardware resolves conflicts by splitting the simultaneous access request into multiple, sequential transaction cycles. The number of cycles equals the number of threads that collided on a single bank (the degree of conflict). Modern GPUs (Compute Capability 2.0+) have 32-bit and 64-bit bank modes. In 64-bit mode, successive 64-bit words are assigned to successive banks, effectively halving the bank count to 16 for 64-bit accesses, which changes the conflict dynamics for double precision data.

05

Common Mitigation Techniques

Developers use several strategies to avoid or eliminate bank conflicts:

  • Memory Padding: Adding an extra column (a "pad") to shared memory arrays changes the base address stride, shifting threads into different banks. For a 2D array tile[32][32], declaring it as tile[32][33] can eliminate stride-32 conflicts.
  • Data Layout Transformation: Reorganizing data in shared memory (e.g., using a different indexing scheme) to ensure coalesced or conflict-free access patterns.
  • Using Alternate Algorithms: Choosing parallel algorithms designed for conflict-free shared memory access, such as certain parallel reduction or scan implementations that use sequential addressing.
  • Bank Size Awareness: Writing code that is aware of the bank width (32-bit vs. 64-bit) for the target architecture.
06

Distinction from Coalescing

It is crucial to distinguish bank conflicts from memory coalescing. They are complementary optimizations for different memory hierarchies:

  • Bank Conflicts: Occur in shared memory (on-chip, software-managed cache). Optimization focuses on access stride relative to the 32-bank structure.
  • Coalescing: Concerns global memory (off-chip DRAM). Optimization focuses on having consecutive threads access consecutive 128-byte aligned segments to minimize transactions. A kernel can be perfectly coalesced for global memory access yet suffer severe bank conflicts in shared memory, and vice-versa. Both must be optimized for peak performance.
GPU MEMORY OPTIMIZATION

Frequently Asked Questions

Bank conflicts are a critical performance bottleneck in GPU programming, directly impacting the throughput of parallel algorithms. These questions address their definition, detection, and resolution for systems engineers and ML Ops professionals.

A bank conflict is a performance degradation event in GPU shared memory that occurs when two or more threads within the same warp attempt to access different data words stored in the same memory bank simultaneously. This forces the memory accesses to be serialized, drastically reducing the available memory bandwidth for that warp. Shared memory is organized into independent banks (typically 32 banks on modern NVIDIA GPUs) that can service one access per bank per clock cycle. Optimal performance is achieved when all 32 threads in a warp access 32 distinct banks, allowing all accesses to proceed in parallel.

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.