What is Bank conflict?

In GPU shared memory, multiple threads of a warp accessing different addresses in the same bank at once, which serializes the accesses. Padding can avoid it.

Field: GPU Programming

Japanese name: バンク競合

What a bank is

CUDA shared memory is divided into equally sized sections that can be accessed at the same time. These sections are called banks. If the threads of a warp each use an address in a different bank, the whole request is served at once. If several threads use different addresses in the same bank, a conflict occurs. The hardware splits the request into separate conflict-free requests and serves them in turn. Effective bandwidth falls by a factor equal to the number of requests it was split into.

An example and the padding fix

In the example in the CUDA guide, there are 32 banks and successive 4-byte words map to successive banks. Suppose the 32 threads of a warp read a 32 × 32 table of floats down a column. Neighboring threads are 32 words apart, so all of them land in the same bank and the request splits into 32. If each row is widened to 33 elements, the address advances 33 words per row. The remainder of 33 ÷ 32 is 1, so the bank shifts by one each row and the 32 threads spread over different banks.

When there is no conflict, and similar terms

When several threads of a warp read the same address, there is no conflict. The result of one read is delivered to every thread that wants it. Memory coalescing is about combining accesses to global memory. A bank conflict concerns shared memory, so the two apply to different memories. DRAM also uses the word bank, but it refers to something else.

Try it: questions about Bank conflict

Which describes a bank conflict in CUDA shared memory?

  1. ATwo GPUs using the same bank account
  2. BRunning out of shared memory capacity so the program stops
  3. CShared memory is split into 32 banks, and when several threads of a warp access different addresses in the same bank at once, the accesses are serialized
Show answer and explanation

Answer: C. Shared memory is split into 32 banks, and when several threads of a warp access different addresses in the same bank at once, the accesses are serialized

Shared memory consists of 32 banks assigned in rotation every 4 bytes, and each bank can serve only one address per access. If the 32 threads of a warp use different banks, one access suffices, but two threads hitting different addresses in the same bank split it into two. Reading every 32nd 4-byte element, for example, piles all threads onto one bank and splits the access into 32. When all threads read the same address, it is broadcast and there is no conflict.

FAQ

Is it always a conflict when accesses fall in the same bank?

No. A conflict arises when the accesses go to different addresses in the same bank. When several threads read the same address, the value is delivered to all of them together.

Does a bank conflict produce wrong results?

No. The accesses are simply carried out one after another, and what is read or written stays correct. Only the speed is affected.

Books on GPU Programming Ad

As an Amazon Associate I earn from qualifying purchases.

This page was drafted with AI and fact-checked by a separate AI review before publication. Our Editorial policy explains how we write and check content. If you spot an error, please tell us on our Contact page.

Back to the glossary