Ilia Mirkin
2016-Mar-16 14:55 UTC
[Nouveau] [PATCH mesa 4/6] nouveau: codegen: s/FILE_MEMORY_GLOBAL/FILE_MEMORY_BUFFER/
This approach leads to the emitters needing to know about both global and buffer, even though at that point, they are identical. I was thinking that in the lowering logic, buffer would just get rewritten as global (with the offset added), thus not needing any change to the emitters. What do you think about such an approach? On Mar 16, 2016 2:24 AM, "Hans de Goede" <hdegoede at redhat.com> wrote:> FILE_MEMORY_GLOBAL is currently only used for buffer handling, as we > do not yet have (opencl) global memory support. Global memory support > actually requires some different handling during lowering, so rename > FILE_MEMORY_GLOBAL to FILE_MEMORY_BUFFER to reflect that the current > code is for buffer handling, this will allow the later (re-)addition > of FILE_MEMORY_GLOBAL for regular global memory. > > Signed-off-by: Hans de Goede <hdegoede at redhat.com> > --- > src/gallium/drivers/nouveau/codegen/nv50_ir.h | 2 +- > src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp | 10 > +++++----- > src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp | 6 +++--- > src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nv50.cpp | 10 > +++++----- > src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nvc0.cpp | 12 > ++++++------ > src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp | 8 ++++---- > .../drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp | 10 > +++++----- > src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 8 ++++---- > src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp | 2 +- > src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp | 6 +++--- > src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp | 2 +- > 11 files changed, 38 insertions(+), 38 deletions(-) > > diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir.h > b/src/gallium/drivers/nouveau/codegen/nv50_ir.h > index 7b0eb2f..fdc2195 100644 > --- a/src/gallium/drivers/nouveau/codegen/nv50_ir.h > +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir.h > @@ -332,7 +332,7 @@ enum DataFile > FILE_MEMORY_CONST, > FILE_SHADER_INPUT, > FILE_SHADER_OUTPUT, > - FILE_MEMORY_GLOBAL, > + FILE_MEMORY_BUFFER, > FILE_MEMORY_SHARED, > FILE_MEMORY_LOCAL, > FILE_SYSTEM_VALUE, > 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 70f3c3f..02a1101 100644 > --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp > +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp > @@ -1641,7 +1641,7 @@ CodeEmitterGK110::emitSTORE(const Instruction *i) > int32_t offset = SDATA(i->src(0)).offset; > > switch (i->src(0).getFile()) { > - case FILE_MEMORY_GLOBAL: code[1] = 0xe0000000; code[0] = 0x00000000; > break; > + case FILE_MEMORY_BUFFER: code[1] = 0xe0000000; code[0] = 0x00000000; > break; > case FILE_MEMORY_LOCAL: code[1] = 0x7a800000; code[0] = 0x00000002; > break; > case FILE_MEMORY_SHARED: > code[0] = 0x00000002; > @@ -1678,7 +1678,7 @@ CodeEmitterGK110::emitSTORE(const Instruction *i) > > srcId(i->src(1), 2); > srcId(i->src(0).getIndirect(0), 10); > - if (i->src(0).getFile() == FILE_MEMORY_GLOBAL && > + if (i->src(0).getFile() == FILE_MEMORY_BUFFER && > i->src(0).isIndirect(0) && > i->getIndirect(0, 0)->reg.size == 8) > code[1] |= 1 << 23; > @@ -1690,7 +1690,7 @@ CodeEmitterGK110::emitLOAD(const Instruction *i) > int32_t offset = SDATA(i->src(0)).offset; > > switch (i->src(0).getFile()) { > - case FILE_MEMORY_GLOBAL: code[1] = 0xc0000000; code[0] = 0x00000000; > break; > + case FILE_MEMORY_BUFFER: code[1] = 0xc0000000; code[0] = 0x00000000; > break; > case FILE_MEMORY_LOCAL: code[1] = 0x7a000000; code[0] = 0x00000002; > break; > case FILE_MEMORY_SHARED: > code[0] = 0x00000002; > @@ -1800,7 +1800,7 @@ CodeEmitterGK110::emitMOV(const Instruction *i) > static inline bool > uses64bitAddress(const Instruction *ldst) > { > - return ldst->src(0).getFile() == FILE_MEMORY_GLOBAL && > + return ldst->src(0).getFile() == FILE_MEMORY_BUFFER && > ldst->src(0).isIndirect(0) && > ldst->getIndirect(0, 0)->reg.size == 8; > } > @@ -1862,7 +1862,7 @@ CodeEmitterGK110::emitCCTL(const Instruction *i) > > code[0] = 0x00000002 | (i->subOp << 2); > > - if (i->src(0).getFile() == FILE_MEMORY_GLOBAL) { > + if (i->src(0).getFile() == FILE_MEMORY_BUFFER) { > code[1] = 0x7b000000; > } else { > code[1] = 0x7c000000; > diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp > b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp > index e079a57..27f287f 100644 > --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp > +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp > @@ -2417,7 +2417,7 @@ void > CodeEmitterGM107::emitCCTL() > { > unsigned width; > - if (insn->src(0).getFile() == FILE_MEMORY_GLOBAL) { > + if (insn->src(0).getFile() == FILE_MEMORY_BUFFER) { > emitInsn(0xef600000); > width = 30; > } else { > @@ -2988,7 +2988,7 @@ CodeEmitterGM107::emitInstruction(Instruction *i) > case FILE_MEMORY_CONST : emitLDC(); break; > case FILE_MEMORY_LOCAL : emitLDL(); break; > case FILE_MEMORY_SHARED: emitLDS(); break; > - case FILE_MEMORY_GLOBAL: emitLD(); break; > + case FILE_MEMORY_BUFFER: emitLD(); break; > default: > assert(!"invalid load"); > emitNOP(); > @@ -2999,7 +2999,7 @@ CodeEmitterGM107::emitInstruction(Instruction *i) > switch (insn->src(0).getFile()) { > case FILE_MEMORY_LOCAL : emitSTL(); break; > case FILE_MEMORY_SHARED: emitSTS(); break; > - case FILE_MEMORY_GLOBAL: emitST(); break; > + case FILE_MEMORY_BUFFER: emitST(); break; > default: > assert(!"invalid load"); > emitNOP(); > diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nv50.cpp > b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nv50.cpp > index 682a19d..7476e21 100644 > --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nv50.cpp > +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nv50.cpp > @@ -662,7 +662,7 @@ CodeEmitterNV50::emitLOAD(const Instruction *i) > code[0] = 0xd0000001; > code[1] = 0x40000000; > break; > - case FILE_MEMORY_GLOBAL: > + case FILE_MEMORY_BUFFER: > code[0] = 0xd0000001 | (i->getSrc(0)->reg.fileIndex << 16); > code[1] = 0x80000000; > break; > @@ -671,7 +671,7 @@ CodeEmitterNV50::emitLOAD(const Instruction *i) > break; > } > if (sf == FILE_MEMORY_LOCAL || > - sf == FILE_MEMORY_GLOBAL) > + sf == FILE_MEMORY_BUFFER) > emitLoadStoreSizeLG(i->sType, 21 + 32); > > setDst(i, 0); > @@ -679,7 +679,7 @@ CodeEmitterNV50::emitLOAD(const Instruction *i) > emitFlagsRd(i); > emitFlagsWr(i); > > - if (i->src(0).getFile() == FILE_MEMORY_GLOBAL) { > + if (i->src(0).getFile() == FILE_MEMORY_BUFFER) { > srcId(*i->src(0).getIndirect(0), 9); > } else { > setAReg16(i, 0); > @@ -699,7 +699,7 @@ CodeEmitterNV50::emitSTORE(const Instruction *i) > code[1] = 0x80c00000; > srcId(i->src(1), 32 + 14); > break; > - case FILE_MEMORY_GLOBAL: > + case FILE_MEMORY_BUFFER: > code[0] = 0xd0000001 | (i->getSrc(0)->reg.fileIndex << 16); > code[1] = 0xa0000000; > emitLoadStoreSizeLG(i->dType, 21 + 32); > @@ -737,7 +737,7 @@ CodeEmitterNV50::emitSTORE(const Instruction *i) > break; > } > > - if (f == FILE_MEMORY_GLOBAL) > + if (f == FILE_MEMORY_BUFFER) > srcId(*i->src(0).getIndirect(0), 9); > else > setAReg16(i, 0); > 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 8b9328b..6236659 100644 > --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nvc0.cpp > +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nvc0.cpp > @@ -280,7 +280,7 @@ void > CodeEmitterNVC0::setAddressByFile(const ValueRef& src) > { > switch (src.getFile()) { > - case FILE_MEMORY_GLOBAL: > + case FILE_MEMORY_BUFFER: > srcAddr32(src, 26, 0); > break; > case FILE_MEMORY_LOCAL: > @@ -1768,7 +1768,7 @@ CodeEmitterNVC0::emitCachingMode(CacheMode c) > static inline bool > uses64bitAddress(const Instruction *ldst) > { > - return ldst->src(0).getFile() == FILE_MEMORY_GLOBAL && > + return ldst->src(0).getFile() == FILE_MEMORY_BUFFER && > ldst->src(0).isIndirect(0) && > ldst->getIndirect(0, 0)->reg.size == 8; > } > @@ -1779,7 +1779,7 @@ CodeEmitterNVC0::emitSTORE(const Instruction *i) > uint32_t opc; > > switch (i->src(0).getFile()) { > - case FILE_MEMORY_GLOBAL: opc = 0x90000000; break; > + case FILE_MEMORY_BUFFER: opc = 0x90000000; break; > case FILE_MEMORY_LOCAL: opc = 0xc8000000; break; > case FILE_MEMORY_SHARED: > if (i->subOp == NV50_IR_SUBOP_STORE_UNLOCKED) { > @@ -1828,7 +1828,7 @@ CodeEmitterNVC0::emitLOAD(const Instruction *i) > code[0] = 0x00000005; > > switch (i->src(0).getFile()) { > - case FILE_MEMORY_GLOBAL: opc = 0x80000000; break; > + case FILE_MEMORY_BUFFER: opc = 0x80000000; break; > case FILE_MEMORY_LOCAL: opc = 0xc0000000; break; > case FILE_MEMORY_SHARED: > if (i->subOp == NV50_IR_SUBOP_LOAD_LOCKED) { > @@ -2090,7 +2090,7 @@ CodeEmitterNVC0::emitCCTL(const Instruction *i) > { > code[0] = 0x00000005 | (i->subOp << 5); > > - if (i->src(0).getFile() == FILE_MEMORY_GLOBAL) { > + if (i->src(0).getFile() == FILE_MEMORY_BUFFER) { > code[1] = 0x98000000; > srcAddr32(i->src(0), 28, 2); > } else { > @@ -3121,7 +3121,7 @@ SchedDataCalculator::checkRd(const Value *v, int > cycle, int& delay) const > case FILE_MEMORY_LOCAL: > case FILE_MEMORY_CONST: > case FILE_MEMORY_SHARED: > - case FILE_MEMORY_GLOBAL: > + case FILE_MEMORY_BUFFER: > case FILE_SYSTEM_VALUE: > // TODO: any restrictions here ? > break; > diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp > b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp > index 1e91ad3..91879e4 100644 > --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp > +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp > @@ -373,8 +373,8 @@ static nv50_ir::DataFile translateFile(uint file) > case TGSI_FILE_PREDICATE: return nv50_ir::FILE_PREDICATE; > case TGSI_FILE_IMMEDIATE: return nv50_ir::FILE_IMMEDIATE; > case TGSI_FILE_SYSTEM_VALUE: return nv50_ir::FILE_SYSTEM_VALUE; > - case TGSI_FILE_BUFFER: return nv50_ir::FILE_MEMORY_GLOBAL; > - case TGSI_FILE_MEMORY: return nv50_ir::FILE_MEMORY_GLOBAL; > + case TGSI_FILE_BUFFER: return nv50_ir::FILE_MEMORY_BUFFER; > + case TGSI_FILE_MEMORY: return nv50_ir::FILE_MEMORY_BUFFER; > case TGSI_FILE_SAMPLER: > case TGSI_FILE_NULL: > default: > @@ -2191,7 +2191,7 @@ Converter::getResourceBase(const int r) > > switch (r) { > case TGSI_RESOURCE_GLOBAL: > - sym = new_Symbol(prog, nv50_ir::FILE_MEMORY_GLOBAL, 15); > + sym = new_Symbol(prog, nv50_ir::FILE_MEMORY_BUFFER, 15); > break; > case TGSI_RESOURCE_LOCAL: > assert(prog->getType() == Program::TYPE_COMPUTE); > @@ -2209,7 +2209,7 @@ Converter::getResourceBase(const int r) > break; > default: > sym = new_Symbol(prog, > - nv50_ir::FILE_MEMORY_GLOBAL, code->resources.at > (r).slot); > + nv50_ir::FILE_MEMORY_BUFFER, code->resources.at > (r).slot); > break; > } > return sym; > diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp > b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp > index d0936d8..563d7c2 100644 > --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp > +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp > @@ -1141,7 +1141,7 @@ NVC0LoweringPass::handleATOM(Instruction *atom) > handleSharedATOM(atom); > return true; > default: > - assert(atom->src(0).getFile() == FILE_MEMORY_GLOBAL); > + assert(atom->src(0).getFile() == FILE_MEMORY_BUFFER); > base = loadResInfo64(ind, atom->getSrc(0)->reg.fileIndex * 16); > assert(base->reg.size == 8); > if (ptr) > @@ -1154,7 +1154,7 @@ NVC0LoweringPass::handleATOM(Instruction *atom) > bld.mkOp1v(OP_RDSV, TYPE_U32, bld.getScratch(), bld.mkSysVal(sv, > 0)); > > atom->setSrc(0, cloneShallow(func, atom->getSrc(0))); > - atom->getSrc(0)->reg.file = FILE_MEMORY_GLOBAL; > + atom->getSrc(0)->reg.file = FILE_MEMORY_BUFFER; > if (ptr) > base = bld.mkOp2v(OP_ADD, TYPE_U32, base, base, ptr); > atom->setIndirect(0, 1, NULL); > @@ -1571,7 +1571,7 @@ NVC0LoweringPass::handleSurfaceOpNVE4(TexInstruction > *su) > Instruction *red = bld.mkOp(OP_ATOM, su->dType, su->getDef(0)); > red->subOp = su->subOp; > if (!gMemBase) > - gMemBase = bld.mkSymbol(FILE_MEMORY_GLOBAL, 0, TYPE_U32, 0); > + gMemBase = bld.mkSymbol(FILE_MEMORY_BUFFER, 0, TYPE_U32, 0); > red->setSrc(0, gMemBase); > red->setSrc(1, su->getSrc(3)); > if (su->subOp == NV50_IR_SUBOP_ATOM_CAS) > @@ -1963,7 +1963,7 @@ NVC0LoweringPass::visit(Instruction *i) > } else if (i->src(0).getFile() == FILE_SHADER_OUTPUT) { > assert(prog->getType() == Program::TYPE_TESSELLATION_CONTROL); > i->op = OP_VFETCH; > - } else if (i->src(0).getFile() == FILE_MEMORY_GLOBAL) { > + } else if (i->src(0).getFile() == FILE_MEMORY_BUFFER) { > Value *ind = i->getIndirect(0, 1); > Value *ptr = loadResInfo64(ind, i->getSrc(0)->reg.fileIndex * > 16); > // XXX come up with a way not to do this for EVERY little access > but > @@ -1987,7 +1987,7 @@ NVC0LoweringPass::visit(Instruction *i) > break; > case OP_ATOM: > { > - const bool cctl = i->src(0).getFile() == FILE_MEMORY_GLOBAL; > + const bool cctl = i->src(0).getFile() == FILE_MEMORY_BUFFER; > handleATOM(i); > handleCasExch(i, cctl); > } > diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp > b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp > index 66e7b2e..4a96d04 100644 > --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp > +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp > @@ -2580,14 +2580,14 @@ MemoryOpt::runOpt(BasicBlock *bb) > ldst->op == OP_BAR || > ldst->op == OP_MEMBAR) { > purgeRecords(NULL, FILE_MEMORY_LOCAL); > - purgeRecords(NULL, FILE_MEMORY_GLOBAL); > + purgeRecords(NULL, FILE_MEMORY_BUFFER); > purgeRecords(NULL, FILE_MEMORY_SHARED); > purgeRecords(NULL, FILE_SHADER_OUTPUT); > } else > if (ldst->op == OP_ATOM || ldst->op == OP_CCTL) { > - if (ldst->src(0).getFile() == FILE_MEMORY_GLOBAL) { > + if (ldst->src(0).getFile() == FILE_MEMORY_BUFFER) { > purgeRecords(NULL, FILE_MEMORY_LOCAL); > - purgeRecords(NULL, FILE_MEMORY_GLOBAL); > + purgeRecords(NULL, FILE_MEMORY_BUFFER); > purgeRecords(NULL, FILE_MEMORY_SHARED); > } else { > purgeRecords(NULL, ldst->src(0).getFile()); > @@ -2607,7 +2607,7 @@ MemoryOpt::runOpt(BasicBlock *bb) > DataFile file = ldst->src(0).getFile(); > > // if ld l[]/g[] look for previous store to eliminate the reload > - if (file == FILE_MEMORY_GLOBAL || file == FILE_MEMORY_LOCAL) { > + if (file == FILE_MEMORY_BUFFER || file == FILE_MEMORY_LOCAL) { > // TODO: shared memory ? > rec = findRecord(ldst, false, isAdjacent); > if (rec && !isAdjacent) > diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp > b/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp > index cfa85ec..73ed753 100644 > --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp > +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp > @@ -455,7 +455,7 @@ int Symbol::print(char *buf, size_t size, > case FILE_MEMORY_CONST: c = 'c'; break; > case FILE_SHADER_INPUT: c = 'a'; break; > case FILE_SHADER_OUTPUT: c = 'o'; break; > - case FILE_MEMORY_GLOBAL: c = 'g'; break; > + case FILE_MEMORY_BUFFER: c = 'g'; break; > case FILE_MEMORY_SHARED: c = 's'; break; > case FILE_MEMORY_LOCAL: c = 'l'; break; > default: > diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp > b/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp > index 2c4d7f5..1cd45a2 100644 > --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp > +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp > @@ -207,7 +207,7 @@ TargetNV50::getFileSize(DataFile file) const > case FILE_MEMORY_CONST: return 65536; > case FILE_SHADER_INPUT: return 0x200; > case FILE_SHADER_OUTPUT: return 0x200; > - case FILE_MEMORY_GLOBAL: return 0xffffffff; > + case FILE_MEMORY_BUFFER: return 0xffffffff; > case FILE_MEMORY_SHARED: return 16 << 10; > case FILE_MEMORY_LOCAL: return 48 << 10; > case FILE_SYSTEM_VALUE: return 16; > @@ -406,7 +406,7 @@ TargetNV50::isAccessSupported(DataFile file, DataType > ty) const > if (ty == TYPE_B96 || ty == TYPE_NONE) > return false; > if (typeSizeof(ty) > 4) > - return (file == FILE_MEMORY_LOCAL) || (file == FILE_MEMORY_GLOBAL); > + return (file == FILE_MEMORY_LOCAL) || (file == FILE_MEMORY_BUFFER); > return true; > } > > @@ -508,7 +508,7 @@ int TargetNV50::getLatency(const Instruction *i) const > if (i->op == OP_LOAD) { > switch (i->src(0).getFile()) { > case FILE_MEMORY_LOCAL: > - case FILE_MEMORY_GLOBAL: > + case FILE_MEMORY_BUFFER: > return 100; // really 400 to 800 > default: > return 22; > diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp > b/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp > index a03afa8..bda59a5 100644 > --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp > +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp > @@ -248,7 +248,7 @@ TargetNVC0::getFileSize(DataFile file) const > case FILE_MEMORY_CONST: return 65536; > case FILE_SHADER_INPUT: return 0x400; > case FILE_SHADER_OUTPUT: return 0x400; > - case FILE_MEMORY_GLOBAL: return 0xffffffff; > + case FILE_MEMORY_BUFFER: return 0xffffffff; > case FILE_MEMORY_SHARED: return 16 << 10; > case FILE_MEMORY_LOCAL: return 48 << 10; > case FILE_SYSTEM_VALUE: return 32; > -- > 2.7.2 > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <https://lists.freedesktop.org/archives/nouveau/attachments/20160316/74fd6591/attachment-0001.html>
Hans de Goede
2016-Mar-16 18:14 UTC
[Nouveau] [PATCH mesa 4/6] nouveau: codegen: s/FILE_MEMORY_GLOBAL/FILE_MEMORY_BUFFER/
Hi, On 16-03-16 15:55, Ilia Mirkin wrote:> This approach leads to the emitters needing to know about both global and > buffer, even though at that point, they are identical. I was thinking that > in the lowering logic, buffer would just get rewritten as global (with the > offset added), thus not needing any change to the emitters. What do you > think about such an approach?I was actually thinking the same, but I was a bit afraid I might break something by doing that. I'm willing to try though, but the result is going to need some extra testing by others I believe. Questions: 1) Any tests I can run to test the buffer paths ? 2) So the resulting patch, which would replace this one, and make most of the "nouveau: codegen: Add support for OpenCL global memory buffers" unnecessary would look something like this: 2a) Add FILE_MEMORY_BUFFER as nv50_ir::FILE_* type 2b) Use it in nv50_ir_from_tgsi.cpp instead of GLOBAL 2c) Use it in nv50_ir_lowering_ to check for buffer accesses, and when adding the offset change the file_type to GLOBAL Right ? Regards, Hans> On Mar 16, 2016 2:24 AM, "Hans de Goede" <hdegoede at redhat.com> wrote: > >> FILE_MEMORY_GLOBAL is currently only used for buffer handling, as we >> do not yet have (opencl) global memory support. Global memory support >> actually requires some different handling during lowering, so rename >> FILE_MEMORY_GLOBAL to FILE_MEMORY_BUFFER to reflect that the current >> code is for buffer handling, this will allow the later (re-)addition >> of FILE_MEMORY_GLOBAL for regular global memory. >> >> Signed-off-by: Hans de Goede <hdegoede at redhat.com> >> --- >> src/gallium/drivers/nouveau/codegen/nv50_ir.h | 2 +- >> src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp | 10 >> +++++----- >> src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp | 6 +++--- >> src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nv50.cpp | 10 >> +++++----- >> src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nvc0.cpp | 12 >> ++++++------ >> src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp | 8 ++++---- >> .../drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp | 10 >> +++++----- >> src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 8 ++++---- >> src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp | 2 +- >> src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp | 6 +++--- >> src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp | 2 +- >> 11 files changed, 38 insertions(+), 38 deletions(-) >> >> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir.h >> b/src/gallium/drivers/nouveau/codegen/nv50_ir.h >> index 7b0eb2f..fdc2195 100644 >> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir.h >> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir.h >> @@ -332,7 +332,7 @@ enum DataFile >> FILE_MEMORY_CONST, >> FILE_SHADER_INPUT, >> FILE_SHADER_OUTPUT, >> - FILE_MEMORY_GLOBAL, >> + FILE_MEMORY_BUFFER, >> FILE_MEMORY_SHARED, >> FILE_MEMORY_LOCAL, >> FILE_SYSTEM_VALUE, >> 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 70f3c3f..02a1101 100644 >> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp >> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp >> @@ -1641,7 +1641,7 @@ CodeEmitterGK110::emitSTORE(const Instruction *i) >> int32_t offset = SDATA(i->src(0)).offset; >> >> switch (i->src(0).getFile()) { >> - case FILE_MEMORY_GLOBAL: code[1] = 0xe0000000; code[0] = 0x00000000; >> break; >> + case FILE_MEMORY_BUFFER: code[1] = 0xe0000000; code[0] = 0x00000000; >> break; >> case FILE_MEMORY_LOCAL: code[1] = 0x7a800000; code[0] = 0x00000002; >> break; >> case FILE_MEMORY_SHARED: >> code[0] = 0x00000002; >> @@ -1678,7 +1678,7 @@ CodeEmitterGK110::emitSTORE(const Instruction *i) >> >> srcId(i->src(1), 2); >> srcId(i->src(0).getIndirect(0), 10); >> - if (i->src(0).getFile() == FILE_MEMORY_GLOBAL && >> + if (i->src(0).getFile() == FILE_MEMORY_BUFFER && >> i->src(0).isIndirect(0) && >> i->getIndirect(0, 0)->reg.size == 8) >> code[1] |= 1 << 23; >> @@ -1690,7 +1690,7 @@ CodeEmitterGK110::emitLOAD(const Instruction *i) >> int32_t offset = SDATA(i->src(0)).offset; >> >> switch (i->src(0).getFile()) { >> - case FILE_MEMORY_GLOBAL: code[1] = 0xc0000000; code[0] = 0x00000000; >> break; >> + case FILE_MEMORY_BUFFER: code[1] = 0xc0000000; code[0] = 0x00000000; >> break; >> case FILE_MEMORY_LOCAL: code[1] = 0x7a000000; code[0] = 0x00000002; >> break; >> case FILE_MEMORY_SHARED: >> code[0] = 0x00000002; >> @@ -1800,7 +1800,7 @@ CodeEmitterGK110::emitMOV(const Instruction *i) >> static inline bool >> uses64bitAddress(const Instruction *ldst) >> { >> - return ldst->src(0).getFile() == FILE_MEMORY_GLOBAL && >> + return ldst->src(0).getFile() == FILE_MEMORY_BUFFER && >> ldst->src(0).isIndirect(0) && >> ldst->getIndirect(0, 0)->reg.size == 8; >> } >> @@ -1862,7 +1862,7 @@ CodeEmitterGK110::emitCCTL(const Instruction *i) >> >> code[0] = 0x00000002 | (i->subOp << 2); >> >> - if (i->src(0).getFile() == FILE_MEMORY_GLOBAL) { >> + if (i->src(0).getFile() == FILE_MEMORY_BUFFER) { >> code[1] = 0x7b000000; >> } else { >> code[1] = 0x7c000000; >> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp >> b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp >> index e079a57..27f287f 100644 >> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp >> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp >> @@ -2417,7 +2417,7 @@ void >> CodeEmitterGM107::emitCCTL() >> { >> unsigned width; >> - if (insn->src(0).getFile() == FILE_MEMORY_GLOBAL) { >> + if (insn->src(0).getFile() == FILE_MEMORY_BUFFER) { >> emitInsn(0xef600000); >> width = 30; >> } else { >> @@ -2988,7 +2988,7 @@ CodeEmitterGM107::emitInstruction(Instruction *i) >> case FILE_MEMORY_CONST : emitLDC(); break; >> case FILE_MEMORY_LOCAL : emitLDL(); break; >> case FILE_MEMORY_SHARED: emitLDS(); break; >> - case FILE_MEMORY_GLOBAL: emitLD(); break; >> + case FILE_MEMORY_BUFFER: emitLD(); break; >> default: >> assert(!"invalid load"); >> emitNOP(); >> @@ -2999,7 +2999,7 @@ CodeEmitterGM107::emitInstruction(Instruction *i) >> switch (insn->src(0).getFile()) { >> case FILE_MEMORY_LOCAL : emitSTL(); break; >> case FILE_MEMORY_SHARED: emitSTS(); break; >> - case FILE_MEMORY_GLOBAL: emitST(); break; >> + case FILE_MEMORY_BUFFER: emitST(); break; >> default: >> assert(!"invalid load"); >> emitNOP(); >> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nv50.cpp >> b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nv50.cpp >> index 682a19d..7476e21 100644 >> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nv50.cpp >> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nv50.cpp >> @@ -662,7 +662,7 @@ CodeEmitterNV50::emitLOAD(const Instruction *i) >> code[0] = 0xd0000001; >> code[1] = 0x40000000; >> break; >> - case FILE_MEMORY_GLOBAL: >> + case FILE_MEMORY_BUFFER: >> code[0] = 0xd0000001 | (i->getSrc(0)->reg.fileIndex << 16); >> code[1] = 0x80000000; >> break; >> @@ -671,7 +671,7 @@ CodeEmitterNV50::emitLOAD(const Instruction *i) >> break; >> } >> if (sf == FILE_MEMORY_LOCAL || >> - sf == FILE_MEMORY_GLOBAL) >> + sf == FILE_MEMORY_BUFFER) >> emitLoadStoreSizeLG(i->sType, 21 + 32); >> >> setDst(i, 0); >> @@ -679,7 +679,7 @@ CodeEmitterNV50::emitLOAD(const Instruction *i) >> emitFlagsRd(i); >> emitFlagsWr(i); >> >> - if (i->src(0).getFile() == FILE_MEMORY_GLOBAL) { >> + if (i->src(0).getFile() == FILE_MEMORY_BUFFER) { >> srcId(*i->src(0).getIndirect(0), 9); >> } else { >> setAReg16(i, 0); >> @@ -699,7 +699,7 @@ CodeEmitterNV50::emitSTORE(const Instruction *i) >> code[1] = 0x80c00000; >> srcId(i->src(1), 32 + 14); >> break; >> - case FILE_MEMORY_GLOBAL: >> + case FILE_MEMORY_BUFFER: >> code[0] = 0xd0000001 | (i->getSrc(0)->reg.fileIndex << 16); >> code[1] = 0xa0000000; >> emitLoadStoreSizeLG(i->dType, 21 + 32); >> @@ -737,7 +737,7 @@ CodeEmitterNV50::emitSTORE(const Instruction *i) >> break; >> } >> >> - if (f == FILE_MEMORY_GLOBAL) >> + if (f == FILE_MEMORY_BUFFER) >> srcId(*i->src(0).getIndirect(0), 9); >> else >> setAReg16(i, 0); >> 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 8b9328b..6236659 100644 >> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nvc0.cpp >> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nvc0.cpp >> @@ -280,7 +280,7 @@ void >> CodeEmitterNVC0::setAddressByFile(const ValueRef& src) >> { >> switch (src.getFile()) { >> - case FILE_MEMORY_GLOBAL: >> + case FILE_MEMORY_BUFFER: >> srcAddr32(src, 26, 0); >> break; >> case FILE_MEMORY_LOCAL: >> @@ -1768,7 +1768,7 @@ CodeEmitterNVC0::emitCachingMode(CacheMode c) >> static inline bool >> uses64bitAddress(const Instruction *ldst) >> { >> - return ldst->src(0).getFile() == FILE_MEMORY_GLOBAL && >> + return ldst->src(0).getFile() == FILE_MEMORY_BUFFER && >> ldst->src(0).isIndirect(0) && >> ldst->getIndirect(0, 0)->reg.size == 8; >> } >> @@ -1779,7 +1779,7 @@ CodeEmitterNVC0::emitSTORE(const Instruction *i) >> uint32_t opc; >> >> switch (i->src(0).getFile()) { >> - case FILE_MEMORY_GLOBAL: opc = 0x90000000; break; >> + case FILE_MEMORY_BUFFER: opc = 0x90000000; break; >> case FILE_MEMORY_LOCAL: opc = 0xc8000000; break; >> case FILE_MEMORY_SHARED: >> if (i->subOp == NV50_IR_SUBOP_STORE_UNLOCKED) { >> @@ -1828,7 +1828,7 @@ CodeEmitterNVC0::emitLOAD(const Instruction *i) >> code[0] = 0x00000005; >> >> switch (i->src(0).getFile()) { >> - case FILE_MEMORY_GLOBAL: opc = 0x80000000; break; >> + case FILE_MEMORY_BUFFER: opc = 0x80000000; break; >> case FILE_MEMORY_LOCAL: opc = 0xc0000000; break; >> case FILE_MEMORY_SHARED: >> if (i->subOp == NV50_IR_SUBOP_LOAD_LOCKED) { >> @@ -2090,7 +2090,7 @@ CodeEmitterNVC0::emitCCTL(const Instruction *i) >> { >> code[0] = 0x00000005 | (i->subOp << 5); >> >> - if (i->src(0).getFile() == FILE_MEMORY_GLOBAL) { >> + if (i->src(0).getFile() == FILE_MEMORY_BUFFER) { >> code[1] = 0x98000000; >> srcAddr32(i->src(0), 28, 2); >> } else { >> @@ -3121,7 +3121,7 @@ SchedDataCalculator::checkRd(const Value *v, int >> cycle, int& delay) const >> case FILE_MEMORY_LOCAL: >> case FILE_MEMORY_CONST: >> case FILE_MEMORY_SHARED: >> - case FILE_MEMORY_GLOBAL: >> + case FILE_MEMORY_BUFFER: >> case FILE_SYSTEM_VALUE: >> // TODO: any restrictions here ? >> break; >> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp >> b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp >> index 1e91ad3..91879e4 100644 >> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp >> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp >> @@ -373,8 +373,8 @@ static nv50_ir::DataFile translateFile(uint file) >> case TGSI_FILE_PREDICATE: return nv50_ir::FILE_PREDICATE; >> case TGSI_FILE_IMMEDIATE: return nv50_ir::FILE_IMMEDIATE; >> case TGSI_FILE_SYSTEM_VALUE: return nv50_ir::FILE_SYSTEM_VALUE; >> - case TGSI_FILE_BUFFER: return nv50_ir::FILE_MEMORY_GLOBAL; >> - case TGSI_FILE_MEMORY: return nv50_ir::FILE_MEMORY_GLOBAL; >> + case TGSI_FILE_BUFFER: return nv50_ir::FILE_MEMORY_BUFFER; >> + case TGSI_FILE_MEMORY: return nv50_ir::FILE_MEMORY_BUFFER; >> case TGSI_FILE_SAMPLER: >> case TGSI_FILE_NULL: >> default: >> @@ -2191,7 +2191,7 @@ Converter::getResourceBase(const int r) >> >> switch (r) { >> case TGSI_RESOURCE_GLOBAL: >> - sym = new_Symbol(prog, nv50_ir::FILE_MEMORY_GLOBAL, 15); >> + sym = new_Symbol(prog, nv50_ir::FILE_MEMORY_BUFFER, 15); >> break; >> case TGSI_RESOURCE_LOCAL: >> assert(prog->getType() == Program::TYPE_COMPUTE); >> @@ -2209,7 +2209,7 @@ Converter::getResourceBase(const int r) >> break; >> default: >> sym = new_Symbol(prog, >> - nv50_ir::FILE_MEMORY_GLOBAL, code->resources.at >> (r).slot); >> + nv50_ir::FILE_MEMORY_BUFFER, code->resources.at >> (r).slot); >> break; >> } >> return sym; >> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp >> b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp >> index d0936d8..563d7c2 100644 >> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp >> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp >> @@ -1141,7 +1141,7 @@ NVC0LoweringPass::handleATOM(Instruction *atom) >> handleSharedATOM(atom); >> return true; >> default: >> - assert(atom->src(0).getFile() == FILE_MEMORY_GLOBAL); >> + assert(atom->src(0).getFile() == FILE_MEMORY_BUFFER); >> base = loadResInfo64(ind, atom->getSrc(0)->reg.fileIndex * 16); >> assert(base->reg.size == 8); >> if (ptr) >> @@ -1154,7 +1154,7 @@ NVC0LoweringPass::handleATOM(Instruction *atom) >> bld.mkOp1v(OP_RDSV, TYPE_U32, bld.getScratch(), bld.mkSysVal(sv, >> 0)); >> >> atom->setSrc(0, cloneShallow(func, atom->getSrc(0))); >> - atom->getSrc(0)->reg.file = FILE_MEMORY_GLOBAL; >> + atom->getSrc(0)->reg.file = FILE_MEMORY_BUFFER; >> if (ptr) >> base = bld.mkOp2v(OP_ADD, TYPE_U32, base, base, ptr); >> atom->setIndirect(0, 1, NULL); >> @@ -1571,7 +1571,7 @@ NVC0LoweringPass::handleSurfaceOpNVE4(TexInstruction >> *su) >> Instruction *red = bld.mkOp(OP_ATOM, su->dType, su->getDef(0)); >> red->subOp = su->subOp; >> if (!gMemBase) >> - gMemBase = bld.mkSymbol(FILE_MEMORY_GLOBAL, 0, TYPE_U32, 0); >> + gMemBase = bld.mkSymbol(FILE_MEMORY_BUFFER, 0, TYPE_U32, 0); >> red->setSrc(0, gMemBase); >> red->setSrc(1, su->getSrc(3)); >> if (su->subOp == NV50_IR_SUBOP_ATOM_CAS) >> @@ -1963,7 +1963,7 @@ NVC0LoweringPass::visit(Instruction *i) >> } else if (i->src(0).getFile() == FILE_SHADER_OUTPUT) { >> assert(prog->getType() == Program::TYPE_TESSELLATION_CONTROL); >> i->op = OP_VFETCH; >> - } else if (i->src(0).getFile() == FILE_MEMORY_GLOBAL) { >> + } else if (i->src(0).getFile() == FILE_MEMORY_BUFFER) { >> Value *ind = i->getIndirect(0, 1); >> Value *ptr = loadResInfo64(ind, i->getSrc(0)->reg.fileIndex * >> 16); >> // XXX come up with a way not to do this for EVERY little access >> but >> @@ -1987,7 +1987,7 @@ NVC0LoweringPass::visit(Instruction *i) >> break; >> case OP_ATOM: >> { >> - const bool cctl = i->src(0).getFile() == FILE_MEMORY_GLOBAL; >> + const bool cctl = i->src(0).getFile() == FILE_MEMORY_BUFFER; >> handleATOM(i); >> handleCasExch(i, cctl); >> } >> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp >> b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp >> index 66e7b2e..4a96d04 100644 >> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp >> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp >> @@ -2580,14 +2580,14 @@ MemoryOpt::runOpt(BasicBlock *bb) >> ldst->op == OP_BAR || >> ldst->op == OP_MEMBAR) { >> purgeRecords(NULL, FILE_MEMORY_LOCAL); >> - purgeRecords(NULL, FILE_MEMORY_GLOBAL); >> + purgeRecords(NULL, FILE_MEMORY_BUFFER); >> purgeRecords(NULL, FILE_MEMORY_SHARED); >> purgeRecords(NULL, FILE_SHADER_OUTPUT); >> } else >> if (ldst->op == OP_ATOM || ldst->op == OP_CCTL) { >> - if (ldst->src(0).getFile() == FILE_MEMORY_GLOBAL) { >> + if (ldst->src(0).getFile() == FILE_MEMORY_BUFFER) { >> purgeRecords(NULL, FILE_MEMORY_LOCAL); >> - purgeRecords(NULL, FILE_MEMORY_GLOBAL); >> + purgeRecords(NULL, FILE_MEMORY_BUFFER); >> purgeRecords(NULL, FILE_MEMORY_SHARED); >> } else { >> purgeRecords(NULL, ldst->src(0).getFile()); >> @@ -2607,7 +2607,7 @@ MemoryOpt::runOpt(BasicBlock *bb) >> DataFile file = ldst->src(0).getFile(); >> >> // if ld l[]/g[] look for previous store to eliminate the reload >> - if (file == FILE_MEMORY_GLOBAL || file == FILE_MEMORY_LOCAL) { >> + if (file == FILE_MEMORY_BUFFER || file == FILE_MEMORY_LOCAL) { >> // TODO: shared memory ? >> rec = findRecord(ldst, false, isAdjacent); >> if (rec && !isAdjacent) >> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp >> b/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp >> index cfa85ec..73ed753 100644 >> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp >> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp >> @@ -455,7 +455,7 @@ int Symbol::print(char *buf, size_t size, >> case FILE_MEMORY_CONST: c = 'c'; break; >> case FILE_SHADER_INPUT: c = 'a'; break; >> case FILE_SHADER_OUTPUT: c = 'o'; break; >> - case FILE_MEMORY_GLOBAL: c = 'g'; break; >> + case FILE_MEMORY_BUFFER: c = 'g'; break; >> case FILE_MEMORY_SHARED: c = 's'; break; >> case FILE_MEMORY_LOCAL: c = 'l'; break; >> default: >> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp >> b/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp >> index 2c4d7f5..1cd45a2 100644 >> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp >> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp >> @@ -207,7 +207,7 @@ TargetNV50::getFileSize(DataFile file) const >> case FILE_MEMORY_CONST: return 65536; >> case FILE_SHADER_INPUT: return 0x200; >> case FILE_SHADER_OUTPUT: return 0x200; >> - case FILE_MEMORY_GLOBAL: return 0xffffffff; >> + case FILE_MEMORY_BUFFER: return 0xffffffff; >> case FILE_MEMORY_SHARED: return 16 << 10; >> case FILE_MEMORY_LOCAL: return 48 << 10; >> case FILE_SYSTEM_VALUE: return 16; >> @@ -406,7 +406,7 @@ TargetNV50::isAccessSupported(DataFile file, DataType >> ty) const >> if (ty == TYPE_B96 || ty == TYPE_NONE) >> return false; >> if (typeSizeof(ty) > 4) >> - return (file == FILE_MEMORY_LOCAL) || (file == FILE_MEMORY_GLOBAL); >> + return (file == FILE_MEMORY_LOCAL) || (file == FILE_MEMORY_BUFFER); >> return true; >> } >> >> @@ -508,7 +508,7 @@ int TargetNV50::getLatency(const Instruction *i) const >> if (i->op == OP_LOAD) { >> switch (i->src(0).getFile()) { >> case FILE_MEMORY_LOCAL: >> - case FILE_MEMORY_GLOBAL: >> + case FILE_MEMORY_BUFFER: >> return 100; // really 400 to 800 >> default: >> return 22; >> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp >> b/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp >> index a03afa8..bda59a5 100644 >> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp >> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp >> @@ -248,7 +248,7 @@ TargetNVC0::getFileSize(DataFile file) const >> case FILE_MEMORY_CONST: return 65536; >> case FILE_SHADER_INPUT: return 0x400; >> case FILE_SHADER_OUTPUT: return 0x400; >> - case FILE_MEMORY_GLOBAL: return 0xffffffff; >> + case FILE_MEMORY_BUFFER: return 0xffffffff; >> case FILE_MEMORY_SHARED: return 16 << 10; >> case FILE_MEMORY_LOCAL: return 48 << 10; >> case FILE_SYSTEM_VALUE: return 32; >> -- >> 2.7.2 >> >> >
Ilia Mirkin
2016-Mar-16 18:24 UTC
[Nouveau] [PATCH mesa 4/6] nouveau: codegen: s/FILE_MEMORY_GLOBAL/FILE_MEMORY_BUFFER/
On Wed, Mar 16, 2016 at 2:14 PM, Hans de Goede <hdegoede at redhat.com> wrote:> Hi, > > On 16-03-16 15:55, Ilia Mirkin wrote: >> >> This approach leads to the emitters needing to know about both global and >> buffer, even though at that point, they are identical. I was thinking that >> in the lowering logic, buffer would just get rewritten as global (with the >> offset added), thus not needing any change to the emitters. What do you >> think about such an approach? > > > I was actually thinking the same, but I was a bit afraid I might break > something by doing that. I'm willing to try though, but the result is > going to need some extra testing by others I believe. > > Questions: > > 1) Any tests I can run to test the buffer paths ?bin/arb_shader_storage_buffer_object-* (in piglit) Also a ton of stuff in dEQP, although some of it fails. (--deqp-case='*ssbo*')> > 2) So the resulting patch, which would replace this one, and make most > of the "nouveau: codegen: Add support for OpenCL global memory buffers" > unnecessary would look something like this: > 2a) Add FILE_MEMORY_BUFFER as nv50_ir::FILE_* type > 2b) Use it in nv50_ir_from_tgsi.cpp instead of GLOBAL > 2c) Use it in nv50_ir_lowering_ to check for buffer accesses, > and when adding the offset change the file_type to GLOBAL > > Right ?Sounds good to me! -ilia
Reasonably Related Threads
- [PATCH mesa 4/6] nouveau: codegen: s/FILE_MEMORY_GLOBAL/FILE_MEMORY_BUFFER/
- [PATCH mesa 4/6] nouveau: codegen: s/FILE_MEMORY_GLOBAL/FILE_MEMORY_BUFFER/
- [PATCH mesa 5/6] nouveau: codegen: Add support for OpenCL global memory buffers
- [PATCH mesa 5/6] nouveau: codegen: Add support for OpenCL global memory buffers
- [PATCH mesa 5/6] nouveau: codegen: Add support for OpenCL global memory buffers