Chapter 5Shared Memory and Constant Memory

What's in this chapter?

  • Learning how data is arranged in shared memory
  • Mastering index conversion from 2D shared memory to linear global memory
  • Resolving bank conflicts for different access modes
  • Caching data in shared memory to reduce global memory accesses
  • Avoiding non-coalesced global memory access using shared memory
  • Understanding the difference between the constant cache and the read-only cache
  • Programming with the warp shuffle instruction

In the preceding chapter, you examined various global memory access patterns. You learned how to realize good performance and avoid wasting transactions by arranging global memory access patterns so they are and coalesced. Misaligned memory accesses are not as problematic since modern GPU hardware includes an L1 cache, but non-coalesced memory accesses that stride through global memory still cause suboptimal bandwidth utilization. Depending on the nature of your algorithms and the corresponding access patterns, non-coalesced accesses may be unavoidable. However, it is possible to improve global memory coalesced access using shared memory in many cases. Shared memory is a key enabler for many high-performance computing applications.

In this chapter, you will learn ...

Get Professional CUDA C Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.