[PATCH] D42079: AMDGPU: Add a function attribute that shrinks buggy s_buffer opcodes on GFX9

Marek Olšák via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 15 10:26:18 PST 2018


mareko added inline comments.


================
Comment at: lib/Target/AMDGPU/SIMachineFunctionInfo.cpp:165-166
 
+  if (F.hasFnAttribute("amdgpu-shrink-buggy-sbuffer-opcodes"))
+    ShrinkBuggySBufferLoadStoreAtomicxN = true;
+
----------------
arsenm wrote:
> I don't understand why the function attribute for a hardware bug. If this happens to help other targets not working around the bug we should add an optimization to do this somewhere.
Can you be more specific? I don't understand. Note that Mesa may set the function attribute differently for each shader, because it depends on whether the shader is trusted on untrusted.


================
Comment at: lib/Target/AMDGPU/SIShrinkInstructions.cpp:310-312
+      if (ST.hasBuggySBufferLoadStoreAtomicxN() &&
+          MFI->shrinkBuggySBufferLoadStoreAtomicxN() &&
+          TII->isSMRD(MI.getOpcode())) {
----------------
arsenm wrote:
> We shouldn't be putting bug workarounds in an optimization pass. This should probably be part of the initial selection
What initial section are you talking about? Note that the placement of this pass is perfect, because the new code needs to run after SILoadStoreOptimizer.


Repository:
  rL LLVM

https://reviews.llvm.org/D42079





More information about the llvm-commits mailing list