From de666cc418737cc937920d40a5f14af0ed4c5dd8 Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Tue, 14 Jul 2020 22:36:02 +0200 Subject: [PATCH] gv100/ir: add support for barrier thread state files for OP_CVT Signed-off-by: Karol Herbst Reviewed-by: Ilia Mirkin Part-of: --- .../nouveau/codegen/nv50_ir_emit_gv100.cpp | 37 ++++++++++++++++++- .../nouveau/codegen/nv50_ir_emit_gv100.h | 17 +++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gv100.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gv100.cpp index f18c116b967..da8f71c6fd0 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gv100.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gv100.cpp @@ -313,6 +313,12 @@ CodeEmitterGV100::emitMOV() emitField(90, 1, 1); emitPRED (87, insn->src(0)); break; + case FILE_BARRIER: + case FILE_THREAD_STATE: + emitInsn (0x355); + emitBTS (24, insn->src(0)); + emitGPR (16, insn->def(0)); + break; default: assert(!"bad src file"); break; @@ -329,6 +335,31 @@ CodeEmitterGV100::emitMOV() emitGPR (24, insn->src(0)); emitGPR (32); break; + case FILE_BARRIER: + case FILE_THREAD_STATE: + switch (insn->src(0).getFile()) { + case FILE_GPR: + emitInsn (0x356); + emitGPR (32, insn->src(0)); + emitBTS (24, insn->def(0)); + break; + case FILE_BARRIER: + emitInsn (0xf56); + emitBTS (24, insn->def(0)); + emitBTS (16, insn->src(0)); + break; + case FILE_THREAD_STATE: + assert(insn->def(0).getFile() == FILE_BARRIER); + emitInsn (0xf55); + emitBTS (24, insn->src(0)); + emitBTS (16, insn->def(0)); + break; + default: + assert(!"bad src file"); + break; + } + emitField(84, 1, insn->getDef(0)->reg.data.ts == TS_PQUAD_MACTIVE ? 1 : 0); + break; default: assert(!"bad dst file"); break; @@ -1753,7 +1784,11 @@ CodeEmitterGV100::emitInstruction(Instruction *i) case OP_FLOOR: case OP_TRUNC: if (insn->op == OP_CVT && (insn->def(0).getFile() == FILE_PREDICATE || - insn->src(0).getFile() == FILE_PREDICATE)) { + insn->def(0).getFile() == FILE_BARRIER || + insn->def(0).getFile() == FILE_THREAD_STATE || + insn->src(0).getFile() == FILE_PREDICATE || + insn->src(0).getFile() == FILE_BARRIER || + insn->src(0).getFile() == FILE_THREAD_STATE)) { emitMOV(); } else if (isFloatType(insn->dType)) { if (isFloatType(insn->sType)) { diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gv100.h b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gv100.h index 15ab717e460..d6a903e762f 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gv100.h +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gv100.h @@ -228,6 +228,23 @@ private: emitSYS(pos, ref.get() ? ref.rep() : (const Value *)NULL); } + inline void emitBTS(int pos, const Value *val) { + if (val->inFile(FILE_THREAD_STATE)) { + TSSemantic ts = val->reg.data.ts == TS_PQUAD_MACTIVE ? TS_MACTIVE : val->reg.data.ts; + emitField(pos, 5, ts | 0x10); + } else { + emitField(pos, 5, val->reg.data.id); + } + } + + inline void emitBTS(int pos, const ValueRef &ref) { + emitBTS(pos, ref.get() ? ref.rep() : (const Value *)NULL); + } + + inline void emitBTS(int pos, const ValueDef &def) { + emitBTS(pos, def.get() ? def.rep() : (const Value *)NULL); + } + inline void emitGPR(int pos, const Value *val, int off) { emitField(pos, 8, val && !val->inFile(FILE_FLAGS) ? val->reg.data.id + off: 255);