GPU Programming
When multiplying large matrices on a GPU, why are the matrices split into small tiles loaded into shared memory?
- ATo reuse data read from global memory many times in shared memory, reducing the number of slow memory accesses
- BTo make matrix values smaller and prevent overflow
- 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.