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 roughly by a factor of the tile width. 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.