Mesa (master): nvc0/ir: add ld lock/st unlock emission on GK104

Samuel Pitoiset hakzsam at kemper.freedesktop.org
Mon Feb 22 20:30:43 UTC 2016


Module: Mesa
Branch: master
Commit: 9f0d059d4bab97e334fb3fecc24a1421b562d9e5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9f0d059d4bab97e334fb3fecc24a1421b562d9e5

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Sun Feb 21 15:28:16 2016 +0100

nvc0/ir: add ld lock/st unlock emission on GK104

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>

---

 .../drivers/nouveau/codegen/nv50_ir_emit_nvc0.cpp  | 35 +++++++++++++++-------
 1 file changed, 25 insertions(+), 10 deletions(-)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nvc0.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nvc0.cpp
index 65fcd64..e89b129 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nvc0.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nvc0.cpp
@@ -1779,11 +1779,14 @@ CodeEmitterNVC0::emitSTORE(const Instruction *i)
    case FILE_MEMORY_GLOBAL: opc = 0x90000000; break;
    case FILE_MEMORY_LOCAL:  opc = 0xc8000000; break;
    case FILE_MEMORY_SHARED:
-      opc = 0xc8000000;
-      if (i->subOp == NV50_IR_SUBOP_STORE_UNLOCKED)
-         opc |= (1 << 26);
-      else
-         opc |= (1 << 24);
+      if (i->subOp == NV50_IR_SUBOP_STORE_UNLOCKED) {
+         if (targ->getChipset() >= NVISA_GK104_CHIPSET)
+            opc = 0xb8000000;
+         else
+            opc = 0xcc000000;
+      } else {
+         opc = 0xc9000000;
+      }
       break;
    default:
       assert(!"invalid memory file");
@@ -1793,6 +1796,15 @@ CodeEmitterNVC0::emitSTORE(const Instruction *i)
    code[0] = 0x00000005;
    code[1] = opc;
 
+   if (targ->getChipset() >= NVISA_GK104_CHIPSET) {
+      // Unlocked store on shared memory can fail.
+      if (i->src(0).getFile() == FILE_MEMORY_SHARED &&
+          i->subOp == NV50_IR_SUBOP_STORE_UNLOCKED) {
+         assert(i->defExists(0));
+         defId(i->def(0), 8);
+      }
+   }
+
    setAddressByFile(i->src(0));
    srcId(i->src(1), 14);
    srcId(i->src(0).getIndirect(0), 20);
@@ -1816,11 +1828,14 @@ CodeEmitterNVC0::emitLOAD(const Instruction *i)
    case FILE_MEMORY_GLOBAL: opc = 0x80000000; break;
    case FILE_MEMORY_LOCAL:  opc = 0xc0000000; break;
    case FILE_MEMORY_SHARED:
-      opc = 0xc0000000;
-      if (i->subOp == NV50_IR_SUBOP_LOAD_LOCKED)
-         opc |= (1 << 26);
-      else
-         opc |= (1 << 24);
+      if (i->subOp == NV50_IR_SUBOP_LOAD_LOCKED) {
+         if (targ->getChipset() >= NVISA_GK104_CHIPSET)
+            opc = 0xa8000000;
+         else
+            opc = 0xc4000000;
+      } else {
+         opc = 0xc1000000;
+      }
       break;
    case FILE_MEMORY_CONST:
       if (!i->src(0).isIndirect(0) && typeSizeof(i->dType) == 4) {




More information about the mesa-commit mailing list