[Mesa-dev] [PATCH v2] nv50/ir: add memory barriers support for GK110
Ilia Mirkin
imirkin at alum.mit.edu
Wed Dec 2 13:33:40 PST 2015
On Wed, Dec 2, 2015 at 4:27 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 | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
> 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 053df8b..72cfed4 100644
> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp
> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp
> @@ -75,6 +75,7 @@ private:
> void emitLOAD(const Instruction *);
> void emitSTORE(const Instruction *);
> void emitMOV(const Instruction *);
> + void emitMEMBAR(const Instruction *);
>
> void emitINTERP(const Instruction *);
> void emitAFETCH(const Instruction *);
> @@ -1687,6 +1688,22 @@ CodeEmitterGK110::emitMOV(const Instruction *i)
> }
> }
>
> +void CodeEmitterGK110::emitMEMBAR(const Instruction *i)
> +{
> + code[0] = 0x001c0002;
s/1c/00/
emitPredicate() takes care of sticking the 1c in there if this barrier
isn't predicated.
> + code[1] = 0x7cc00000;
> +
> + switch (NV50_IR_SUBOP_MEMBAR_SCOPE(i->subOp)) {
> + case NV50_IR_SUBOP_MEMBAR_GL: code[0] |= 0x400; break;
> + case NV50_IR_SUBOP_MEMBAR_SYS: code[0] |= 0x800; break;
> + default:
> + assert(NV50_IR_SUBOP_MEMBAR_SCOPE(i->subOp) == NV50_IR_SUBOP_MEMBAR_CTA);
> + break;
> + }
A slightly cleverer way of doing this would be
code[0] = 0x00000002 | NV50_IR_SUBOP_MEMBAR_SCOPE(i->subOp) << 8;
code[1] = 0x7cc00000;
But either way, this change is
Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>
> +
> + emitPredicate(i);
> +}
> +
> bool
> CodeEmitterGK110::emitInstruction(Instruction *insn)
> {
> @@ -1918,6 +1935,9 @@ CodeEmitterGK110::emitInstruction(Instruction *insn)
> case OP_BAR:
> emitBAR(insn);
> break;
> + case OP_MEMBAR:
> + emitMEMBAR(insn);
> + break;
> case OP_PHI:
> case OP_UNION:
> case OP_CONSTRAINT:
> --
> 2.6.2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list