Newbie: Bank conflicts?

Could someone explain to me the concept of memory bank accesses and how this can heavily reduce performance when you naively access an array with it’s index like nums[i] ? In some of the source code it is done as nums[i + thread.Idx % ARRAY_SIZE]. How does this help?

Thanks :huh:

Check out the Programming Manual’s “Memory Bandwidth - Shared Memory” section (in v1.1, that’s That provides a pretty good explanation of banked memory.

As to whether nums[i] vs. nums[i + thread.idx % ARRAY_SIZE] is preferred, they do different things, so neither one is really “better” than the other…use the one that gives the functionality you need. If you can post more complete code, we can give more exact answers.

Good Luck!