GPU Programming

When multiplying large matrices on a GPU, why are the matrices split into small tiles loaded into shared memory?

  1. ATo reuse data read from global memory many times in shared memory, reducing the number of slow memory accesses
  2. BTo make matrix values smaller and prevent overflow
  3. CTo reduce the computation and approximate the result
Show answer and explanation

Answer: A. To reuse data read from global memory many times in shared memory, reducing the number of slow memory accesses

In matrix multiplication the same elements are used many times. Written naively, each thread rereads them from global memory every time, exhausting memory bandwidth. Loading tiles into shared memory lets every thread in the block reuse each tile many times, cutting global-memory traffic in proportion to the tile size. It is the same idea as cache blocking on a CPU.

  • A. Correct. It raises arithmetic intensity.
  • B. The values do not change.
  • C. The computation count and accuracy are unchanged.
Practice this topic Back to topic

More GPU Programming questions

  1. What can happen if a GPU kernel uses too many registers per thread?
  2. Which describes occupancy on a GPU?
  3. What is the main way a GPU hides long memory latency (hundreds of cycles)?
  4. Which statement about GPU occupancy is correct?
  5. In CUDA, what is the relationship between blocks and SMs (streaming multiprocessors)?