[llvm] [AMDGPU] Handle amdgpu.last.use metadata (PR #83816)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 4 08:38:41 PST 2024


================
@@ -2415,6 +2442,16 @@ bool SIGfx12CacheControl::enableVolatileAndOrNonTemporal(
   return Changed;
 }
 
+bool SIGfx12CacheControl::enableLastUse(MachineInstr &MI,
+                                        bool IsLastUse) const {
+  assert(MI.mayLoad() && !MI.mayStore());
+
+  if (IsLastUse && !isScope(MI, AMDGPU::CPol::SCOPE_SYS))
----------------
jayfoad wrote:

For simplicity I think we should probably set th=3 regardless of scope.

If I understand correctly "last use" does not really mean anything useful for a system scope load. Normally "last use" means you can discard dirty data from any cache at the same or higher level than the scope. But for system scope, there _is_ no cache at that scope, so there is nothing to do. But it is harmless to set th=3 anyway. @Pierre-vh 

https://github.com/llvm/llvm-project/pull/83816


More information about the llvm-commits mailing list