From f4847077c7fa6a576f4f5eee405363a223827c61 Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Tue, 14 Jul 2020 22:36:47 +0200 Subject: [PATCH] gm107/ir: emit barrier sources for quadon/pop We drop them later on, but it's actually how that needs to be done on Volta. Signed-off-by: Karol Herbst Reviewed-by: Ilia Mirkin Part-of: --- .../codegen/nv50_ir_lowering_gm107.cpp | 23 +++++++++++++++++-- .../nouveau/codegen/nv50_ir_lowering_gm107.h | 2 ++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_gm107.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_gm107.cpp index 9fad1dcfe89..64b47bb2da0 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_gm107.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_gm107.cpp @@ -76,10 +76,28 @@ GM107LegalizeSSA::handleLOAD(Instruction *i) i->op = OP_MOV; } +void +GM107LegalizeSSA::handleQUADON(Instruction *i) +{ + i->setDef(0, NULL); +} + +void +GM107LegalizeSSA::handleQUADPOP(Instruction *i) +{ + i->setSrc(0, NULL); +} + bool GM107LegalizeSSA::visit(Instruction *i) { switch (i->op) { + case OP_QUADON: + handleQUADON(i); + break; + case OP_QUADPOP: + handleQUADPOP(i); + break; case OP_PFETCH: handlePFETCH(i); break; @@ -118,9 +136,10 @@ GM107LoweringPass::handleManualTXD(TexInstruction *i) tmp = bld.getScratch(); for (l = 0; l < 4; ++l) { + Value *bar = bld.getSSA(4, FILE_BARRIER); Value *src[3], *val; Value *lane = bld.mkImm(l); - bld.mkOp(OP_QUADON, TYPE_NONE, NULL); + bld.mkOp(OP_QUADON, TYPE_U32, bar); // Make sure lane 0 has the appropriate array/depth compare values if (l != 0) { if (array) @@ -179,7 +198,7 @@ GM107LoweringPass::handleManualTXD(TexInstruction *i) if (l != 0) for (c = 0; i->defExists(c); ++c) bld.mkOp3(OP_SHFL, TYPE_F32, tex->getDef(c), tex->getDef(c), bld.mkImm(0), quad); - bld.mkOp(OP_QUADPOP, TYPE_NONE, NULL); + bld.mkOp1(OP_QUADPOP, TYPE_U32, NULL, bar)->fixed = 1; // save results for (c = 0; i->defExists(c); ++c) { diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_gm107.h b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_gm107.h index dfa1d035dac..3e70bfc2d32 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_gm107.h +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_gm107.h @@ -24,6 +24,8 @@ private: protected: void handlePFETCH(Instruction *); void handleLOAD(Instruction *); + void handleQUADON(Instruction *); + void handleQUADPOP(Instruction *); }; } // namespace nv50_ir