AI Hardware & Software Stack
Why do element-wise operations such as ReLU or layer normalization tend to take a lot of time relative to their operation count in AI workloads?
- AReLU involves more operations than matrix multiplication
- BThey do little computation relative to the data read and written per element, so memory bandwidth sets their speed
- CGPUs cannot execute element-wise operations
Show answer and explanation
Answer: B. They do little computation relative to the data read and written per element, so memory bandwidth sets their speed
ReLU just reads each element, compares it with 0 and writes it back, very little computation per element. With such low arithmetic intensity, time is set by memory bandwidth rather than compute. They can be a small share of operations yet a noticeable share of time. Fusing them right after matrix products, or combining normalization steps into one kernel, reduces memory traffic.
- A. They need far fewer operations than matrix products.
- B. Correct. They are prime candidates for fusion.
- C. GPUs execute them fine.