[Mesa-dev] [PATCH] gk110/ir: add ld lock/st unlock emission

Ilia Mirkin imirkin at alum.mit.edu
Sun Feb 28 17:26:59 UTC 2016


Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>

On Sun, Feb 28, 2016 at 12:22 PM, Samuel Pitoiset
<samuel.pitoiset at gmail.com> wrote:
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
>  .../drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp | 30 ++++++++++++++++++++--
>  1 file changed, 28 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp
> index a78b3f9..90c6a610 100644
> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp
> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp
> @@ -1597,7 +1597,13 @@ CodeEmitterGK110::emitSTORE(const Instruction *i)
>     switch (i->src(0).getFile()) {
>     case FILE_MEMORY_GLOBAL: code[1] = 0xe0000000; code[0] = 0x00000000; break;
>     case FILE_MEMORY_LOCAL:  code[1] = 0x7a800000; code[0] = 0x00000002; break;
> -   case FILE_MEMORY_SHARED: code[1] = 0x7ac00000; code[0] = 0x00000002; break;
> +   case FILE_MEMORY_SHARED:
> +      code[0] = 0x00000002;
> +      if (i->subOp == NV50_IR_SUBOP_STORE_UNLOCKED)
> +         code[1] = 0x78400000;
> +      else
> +         code[1] = 0x7ac00000;
> +      break;
>     default:
>        assert(!"invalid memory file");
>        break;
> @@ -1617,6 +1623,13 @@ CodeEmitterGK110::emitSTORE(const Instruction *i)
>     code[0] |= offset << 23;
>     code[1] |= offset >> 9;
>
> +   // 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), 32 + 16);
> +   }
> +
>     emitPredicate(i);
>
>     srcId(i->src(1), 2);
> @@ -1635,7 +1648,13 @@ CodeEmitterGK110::emitLOAD(const Instruction *i)
>     switch (i->src(0).getFile()) {
>     case FILE_MEMORY_GLOBAL: code[1] = 0xc0000000; code[0] = 0x00000000; break;
>     case FILE_MEMORY_LOCAL:  code[1] = 0x7a000000; code[0] = 0x00000002; break;
> -   case FILE_MEMORY_SHARED: code[1] = 0x7a400000; code[0] = 0x00000002; break;
> +   case FILE_MEMORY_SHARED:
> +      code[0] = 0x00000002;
> +      if (i->subOp == NV50_IR_SUBOP_LOAD_LOCKED)
> +         code[1] = 0x77400000;
> +      else
> +         code[1] = 0x7a400000;
> +      break;
>     case FILE_MEMORY_CONST:
>        if (!i->src(0).isIndirect(0) && typeSizeof(i->dType) == 4) {
>           emitMOV(i);
> @@ -1663,6 +1682,13 @@ CodeEmitterGK110::emitLOAD(const Instruction *i)
>     code[0] |= offset << 23;
>     code[1] |= offset >> 9;
>
> +   // Locked store on shared memory can fail.
> +   if (i->src(0).getFile() == FILE_MEMORY_SHARED &&
> +       i->subOp == NV50_IR_SUBOP_LOAD_LOCKED) {
> +      assert(i->defExists(1));
> +      defId(i->def(1), 32 + 16);
> +   }
> +
>     emitPredicate(i);
>
>     defId(i->def(0), 2);
> --
> 2.7.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list