[PATCH] D11621: AMDGPU/SI: Mark SMRD instructions as rematerializable

Marek Olšák via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 28 07:24:21 PDT 2016


mareko added a subscriber: mareko.
mareko added a comment.

In http://reviews.llvm.org/D11621#215003, @michel.daenzer wrote:

> Also, is rematerializing SMRD instructions to save SGPR spills really a win? 64 SGPRs can be spilled to a single VGPR, but the rematerialized SMRD instruction is only cheap if the loaded value is still in cache, right?


Yes, it is a win. The SMEM cache is shared by 4 CUs, which means only one out of at least 16 and at most 160 waves will get a cache miss in most cases. That leaves us with cache hits, which take 16-20 clocks (I don't remember exactly), which is the approximate cost of 4 v_read/writelane instructions. By that logic, spilling and restoring is twice as expensive as repeating the load.


http://reviews.llvm.org/D11621





More information about the llvm-commits mailing list