<div dir="auto">I wanted to flip things over and use smxx notation...</div><div class="gmail_extra"><br><div class="gmail_quote">On Apr 10, 2017 6:20 PM, "Samuel Pitoiset" <<a href="mailto:samuel.pitoiset@gmail.com">samuel.pitoiset@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Not sure why you get confused here. The chipset names are globally consistent inside the codegen part and we never use SMxx. Maybe add a comment like:<br>
<br>
#define NVISA_GK104_CHIPSET 0xe0 /* SM30 */<br>
<br>
If you really need this?<br>
<br>
On 04/10/2017 11:41 PM, Matthew Mondazzi wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Define references to chipset did not actually use chipset, leading to confusion. More relevant ISA constants put in place of chipset compares.<br>
<br>
Signed-off-by: Matthew Mondazzi <<a href="mailto:msmondazzi@gmail.com" target="_blank">msmondazzi@gmail.com</a>><br>
---<br>
.../drivers/nouveau/codegen/nv<wbr>50_ir_driver.h | 7 ++--<br>
.../drivers/nouveau/codegen/nv<wbr>50_ir_emit_nvc0.cpp | 24 +++++------<br>
.../nouveau/codegen/nv50_ir_lo<wbr>wering_nvc0.cpp | 46 +++++++++++-----------<br>
.../nouveau/codegen/nv50_ir_ta<wbr>rget_nvc0.cpp | 6 +--<br>
4 files changed, 42 insertions(+), 41 deletions(-)<br>
<br>
diff --git a/src/gallium/drivers/nouveau/<wbr>codegen/nv50_ir_driver.h b/src/gallium/drivers/nouveau/<wbr>codegen/nv50_ir_driver.h<br>
index e7d840d..76c815e 100644<br>
--- a/src/gallium/drivers/nouveau/<wbr>codegen/nv50_ir_driver.h<br>
+++ b/src/gallium/drivers/nouveau/<wbr>codegen/nv50_ir_driver.h<br>
@@ -75,9 +75,10 @@ struct nv50_ir_prog_symbol<br>
uint32_t offset;<br>
};<br>
-#define NVISA_GK104_CHIPSET 0xe0<br>
-#define NVISA_GK20A_CHIPSET 0xea<br>
-#define NVISA_GM107_CHIPSET 0x110<br>
+#define NVISA_SM30 0xe0<br>
+#define NVISA_SM35 0xea<br>
+#define NVISA_SM50 0x110<br>
+<br>
struct nv50_ir_prog_info<br>
{<br>
diff --git a/src/gallium/drivers/nouveau/<wbr>codegen/nv50_ir_emit_nvc0.cpp b/src/gallium/drivers/nouveau/<wbr>codegen/nv50_ir_emit_nvc0.cpp<br>
index 5467447..ed29661 100644<br>
--- a/src/gallium/drivers/nouveau/<wbr>codegen/nv50_ir_emit_nvc0.cpp<br>
+++ b/src/gallium/drivers/nouveau/<wbr>codegen/nv50_ir_emit_nvc0.cpp<br>
@@ -806,7 +806,7 @@ CodeEmitterNVC0::emitSHLADD(co<wbr>nst Instruction *i)<br>
void<br>
CodeEmitterNVC0::emitMADSP(con<wbr>st Instruction *i)<br>
{<br>
- assert(targ->getChipset() >= NVISA_GK104_CHIPSET);<br>
+ assert(targ->getChipset() >= NVISA_SM30);<br>
emitForm_A(i, HEX64(00000000, 00000003));<br>
@@ -1852,7 +1852,7 @@ CodeEmitterNVC0::emitSTORE(con<wbr>st Instruction *i)<br>
case FILE_MEMORY_LOCAL: opc = 0xc8000000; break;<br>
case FILE_MEMORY_SHARED:<br>
if (i->subOp == NV50_IR_SUBOP_STORE_UNLOCKED) {<br>
- if (targ->getChipset() >= NVISA_GK104_CHIPSET)<br>
+ if (targ->getChipset() >= NVISA_SM30)<br>
opc = 0xb8000000;<br>
else<br>
opc = 0xcc000000;<br>
@@ -1868,7 +1868,7 @@ CodeEmitterNVC0::emitSTORE(con<wbr>st Instruction *i)<br>
code[0] = 0x00000005;<br>
code[1] = opc;<br>
- if (targ->getChipset() >= NVISA_GK104_CHIPSET) {<br>
+ if (targ->getChipset() >= NVISA_SM30) {<br>
// Unlocked store on shared memory can fail.<br>
if (i->src(0).getFile() == FILE_MEMORY_SHARED &&<br>
i->subOp == NV50_IR_SUBOP_STORE_UNLOCKED) {<br>
@@ -1901,7 +1901,7 @@ CodeEmitterNVC0::emitLOAD(cons<wbr>t Instruction *i)<br>
case FILE_MEMORY_LOCAL: opc = 0xc0000000; break;<br>
case FILE_MEMORY_SHARED:<br>
if (i->subOp == NV50_IR_SUBOP_LOAD_LOCKED) {<br>
- if (targ->getChipset() >= NVISA_GK104_CHIPSET)<br>
+ if (targ->getChipset() >= NVISA_SM30)<br>
opc = 0xa8000000;<br>
else<br>
opc = 0xc4000000;<br>
@@ -1944,7 +1944,7 @@ CodeEmitterNVC0::emitLOAD(cons<wbr>t Instruction *i)<br>
code[0] |= 63 << 14;<br>
if (p >= 0) {<br>
- if (targ->getChipset() >= NVISA_GK104_CHIPSET)<br>
+ if (targ->getChipset() >= NVISA_SM30)<br>
defId(i->def(p), 8);<br>
else<br>
defId(i->def(p), 32 + 18);<br>
@@ -2362,7 +2362,7 @@ CodeEmitterNVC0::emitSUSTGx(co<wbr>nst TexInstruction *i)<br>
void<br>
CodeEmitterNVC0::emitSUAddr(co<wbr>nst TexInstruction *i)<br>
{<br>
- assert(targ->getChipset() < NVISA_GK104_CHIPSET);<br>
+ assert(targ->getChipset() < NVISA_SM30);<br>
if (i->tex.rIndirectSrc < 0) {<br>
code[1] |= 0x00004000;<br>
@@ -2375,7 +2375,7 @@ CodeEmitterNVC0::emitSUAddr(co<wbr>nst TexInstruction *i)<br>
void<br>
CodeEmitterNVC0::emitSUDim(con<wbr>st TexInstruction *i)<br>
{<br>
- assert(targ->getChipset() < NVISA_GK104_CHIPSET);<br>
+ assert(targ->getChipset() < NVISA_SM30);<br>
code[1] |= (i->tex.target.getDim() - 1) << 12;<br>
if (i->tex.target.isArray() || i->tex.target.isCube() ||<br>
@@ -2390,7 +2390,7 @@ CodeEmitterNVC0::emitSUDim(con<wbr>st TexInstruction *i)<br>
void<br>
CodeEmitterNVC0::emitSULEA(con<wbr>st TexInstruction *i)<br>
{<br>
- assert(targ->getChipset() < NVISA_GK104_CHIPSET);<br>
+ assert(targ->getChipset() < NVISA_SM30);<br>
code[0] = 0x5;<br>
code[1] = 0xf0000000;<br>
@@ -2413,7 +2413,7 @@ CodeEmitterNVC0::emitSULEA(con<wbr>st TexInstruction *i)<br>
void<br>
CodeEmitterNVC0::emitSULDB(con<wbr>st TexInstruction *i)<br>
{<br>
- assert(targ->getChipset() < NVISA_GK104_CHIPSET);<br>
+ assert(targ->getChipset() < NVISA_SM30);<br>
code[0] = 0x5;<br>
code[1] = 0xd4000000 | (i->subOp << 15);<br>
@@ -2431,7 +2431,7 @@ CodeEmitterNVC0::emitSULDB(con<wbr>st TexInstruction *i)<br>
void<br>
CodeEmitterNVC0::emitSUSTx(con<wbr>st TexInstruction *i)<br>
{<br>
- assert(targ->getChipset() < NVISA_GK104_CHIPSET);<br>
+ assert(targ->getChipset() < NVISA_SM30);<br>
code[0] = 0x5;<br>
code[1] = 0xdc000000 | (i->subOp << 15);<br>
@@ -2751,14 +2751,14 @@ CodeEmitterNVC0::emitInstructi<wbr>on(Instruction *insn)<br>
emitMADSP(insn);<br>
break;<br>
case OP_SULDB:<br>
- if (targ->getChipset() >= NVISA_GK104_CHIPSET)<br>
+ if (targ->getChipset() >= NVISA_SM30)<br>
emitSULDGB(insn->asTex());<br>
else<br>
emitSULDB(insn->asTex());<br>
break;<br>
case OP_SUSTB:<br>
case OP_SUSTP:<br>
- if (targ->getChipset() >= NVISA_GK104_CHIPSET)<br>
+ if (targ->getChipset() >= NVISA_SM30)<br>
emitSUSTGx(insn->asTex());<br>
else<br>
emitSUSTx(insn->asTex());<br>
diff --git a/src/gallium/drivers/nouveau/<wbr>codegen/nv50_ir_lowering_nvc0.<wbr>cpp b/src/gallium/drivers/nouveau/<wbr>codegen/nv50_ir_lowering_nvc0.<wbr>cpp<br>
index 732e1a9..a887436 100644<br>
--- a/src/gallium/drivers/nouveau/<wbr>codegen/nv50_ir_lowering_nvc0.<wbr>cpp<br>
+++ b/src/gallium/drivers/nouveau/<wbr>codegen/nv50_ir_lowering_nvc0.<wbr>cpp<br>
@@ -129,11 +129,11 @@ NVC0LegalizeSSA::handleTEXLOD(<wbr>TexInstruction *i)<br>
// SM30+ stores the indirect handle as a separate arg, which comes before<br>
// the LOD.<br>
- if (prog->getTarget()->getChipset<wbr>() >= NVISA_GK104_CHIPSET &&<br>
+ if (prog->getTarget()->getChipset<wbr>() >= NVISA_SM30 &&<br>
i->tex.rIndirectSrc >= 0)<br>
arg++;<br>
// SM20 stores indirect handle combined with array coordinate<br>
- if (prog->getTarget()->getChipset<wbr>() < NVISA_GK104_CHIPSET &&<br>
+ if (prog->getTarget()->getChipset<wbr>() < NVISA_SM30 &&<br>
!i->tex.target.isArray() &&<br>
i->tex.rIndirectSrc >= 0)<br>
arg++;<br>
@@ -162,7 +162,7 @@ NVC0LegalizeSSA::handleShift(I<wbr>nstruction *lo)<br>
// SM30 and prior don't have the fancy new SHF.L/R ops. So the logic has to<br>
// be completely emulated. For SM35+, we can use the more directed SHF<br>
// operations.<br>
- if (prog->getTarget()->getChipset<wbr>() < NVISA_GK20A_CHIPSET) {<br>
+ if (prog->getTarget()->getChipset<wbr>() < NVISA_SM35) {<br>
// The strategy here is to handle shifts >= 32 and less than 32 as<br>
// separate parts.<br>
//<br>
@@ -629,7 +629,7 @@ NVC0LegalizePostRA::visit(Func<wbr>tion *fn)<br>
pOne = new_LValue(fn, FILE_PREDICATE);<br>
carry = new_LValue(fn, FILE_FLAGS);<br>
- rZero-><a href="http://reg.data.id" rel="noreferrer" target="_blank">reg.data.id</a> = (prog->getTarget()->getChipset<wbr>() >= NVISA_GK20A_CHIPSET) ? 255 : 63;<br>
+ rZero-><a href="http://reg.data.id" rel="noreferrer" target="_blank">reg.data.id</a> = (prog->getTarget()->getChipset<wbr>() >= NVISA_SM35) ? 255 : 63;<br>
carry-><a href="http://reg.data.id" rel="noreferrer" target="_blank">reg.data.id</a> = 0;<br>
pOne-><a href="http://reg.data.id" rel="noreferrer" target="_blank">reg.data.id</a> = 7;<br>
@@ -860,7 +860,7 @@ NVC0LoweringPass::handleTEX(Te<wbr>xInstruction *i)<br>
// array + offsets<br>
// derivatives<br>
- if (chipset >= NVISA_GK104_CHIPSET) {<br>
+ if (chipset >= NVISA_SM30) {<br>
if (i->tex.rIndirectSrc >= 0 || i->tex.sIndirectSrc >= 0) {<br>
// XXX this ignores tsc, and assumes a 1:1 mapping<br>
assert(i->tex.rIndirectSrc >= 0);<br>
@@ -976,14 +976,14 @@ NVC0LoweringPass::handleTEX(Te<wbr>xInstruction *i)<br>
// does. Right now we don't know how to pass both in, and this case can't<br>
// happen with OpenGL. On nve0, the sample id is part of the texture<br>
// coordinate argument.<br>
- assert(chipset >= NVISA_GK104_CHIPSET ||<br>
+ assert(chipset >= NVISA_SM30 ||<br>
!i->tex.useOffsets || !i->tex.target.isMS());<br>
// offset is between lod and dc<br>
if (i->tex.useOffsets) {<br>
int n, c;<br>
int s = i->srcCount(0xff, true);<br>
- if (i->op != OP_TXD || chipset < NVISA_GK104_CHIPSET) {<br>
+ if (i->op != OP_TXD || chipset < NVISA_SM30) {<br>
if (i->tex.target.isShadow())<br>
s--;<br>
if (i->srcExists(s)) // move potential predicate out of the way<br>
@@ -1020,7 +1020,7 @@ NVC0LoweringPass::handleTEX(Te<wbr>xInstruction *i)<br>
assert(!"non-immediate offset passed to non-TXG");<br>
imm |= (val.reg.data.u32 & 0xf) << (c * 4);<br>
}<br>
- if (i->op == OP_TXD && chipset >= NVISA_GK104_CHIPSET) {<br>
+ if (i->op == OP_TXD && chipset >= NVISA_SM30) {<br>
// The offset goes into the upper 16 bits of the array index. So<br>
// create it if it's not already there, and INSBF it if it already<br>
// is.<br>
@@ -1041,7 +1041,7 @@ NVC0LoweringPass::handleTEX(Te<wbr>xInstruction *i)<br>
}<br>
}<br>
- if (chipset >= NVISA_GK104_CHIPSET) {<br>
+ if (chipset >= NVISA_SM30) {<br>
//<br>
// If TEX requires more than 4 sources, the 2nd register tuple must be<br>
// aligned to 4, even if it consists of just a single 4-byte register.<br>
@@ -1083,7 +1083,7 @@ NVC0LoweringPass::handleManual<wbr>TXD(TexInstruction *i)<br>
// indirect are separate (and both precede the coordinates). Maxwell is<br>
// handled in a separate function.<br>
unsigned array;<br>
- if (targ->getChipset() < NVISA_GK104_CHIPSET)<br>
+ if (targ->getChipset() < NVISA_SM30)<br>
array = i->tex.target.isArray() || i->tex.rIndirectSrc >= 0;<br>
else<br>
array = i->tex.target.isArray() + (i->tex.rIndirectSrc >= 0);<br>
@@ -1152,7 +1152,7 @@ NVC0LoweringPass::handleTXD(Te<wbr>xInstruction *txd)<br>
unsigned expected_args = arg;<br>
const int chipset = prog->getTarget()->getChipset(<wbr>);<br>
- if (chipset >= NVISA_GK104_CHIPSET) {<br>
+ if (chipset >= NVISA_SM30) {<br>
if (!txd->tex.target.isArray() && txd->tex.useOffsets)<br>
expected_args++;<br>
if (txd->tex.rIndirectSrc >= 0 || txd->tex.sIndirectSrc >= 0)<br>
@@ -1189,7 +1189,7 @@ NVC0LoweringPass::handleTXD(Te<wbr>xInstruction *txd)<br>
// In this case we have fewer than 4 "real" arguments, which means that<br>
// handleTEX didn't apply any padding. However we have to make sure that<br>
// the second "group" of arguments still gets padded up to 4.<br>
- if (chipset >= NVISA_GK104_CHIPSET) {<br>
+ if (chipset >= NVISA_SM30) {<br>
int s = arg + 2 * dim;<br>
if (s >= 4 && s < 7) {<br>
if (txd->srcExists(s)) // move potential predicate out of the way<br>
@@ -1206,7 +1206,7 @@ bool<br>
NVC0LoweringPass::handleTXQ(Te<wbr>xInstruction *txq)<br>
{<br>
const int chipset = prog->getTarget()->getChipset(<wbr>);<br>
- if (chipset >= NVISA_GK104_CHIPSET && txq->tex.rIndirectSrc < 0)<br>
+ if (chipset >= NVISA_SM30 && txq->tex.rIndirectSrc < 0)<br>
txq->tex.r += prog->driver->io.texBindBase / 4;<br>
if (txq->tex.rIndirectSrc < 0)<br>
@@ -1219,7 +1219,7 @@ NVC0LoweringPass::handleTXQ(Te<wbr>xInstruction *txq)<br>
assert(ticRel);<br>
- if (chipset < NVISA_GK104_CHIPSET) {<br>
+ if (chipset < NVISA_SM30) {<br>
LValue *src = new_LValue(func, FILE_GPR); // 0xttxsaaaa<br>
txq->setSrc(txq->tex.rIndirect<wbr>Src, NULL);<br>
@@ -1501,9 +1501,9 @@ NVC0LoweringPass::handleATOM(I<wbr>nstruction *atom)<br>
case FILE_MEMORY_SHARED:<br>
// For Fermi/Kepler, we have to use ld lock/st unlock to perform atomic<br>
// operations on shared memory. For Maxwell, ATOMS is enough.<br>
- if (targ->getChipset() < NVISA_GK104_CHIPSET)<br>
+ if (targ->getChipset() < NVISA_SM30)<br>
handleSharedATOM(atom);<br>
- else if (targ->getChipset() < NVISA_GM107_CHIPSET)<br>
+ else if (targ->getChipset() < NVISA_SM50)<br>
handleSharedATOMNVE4(atom);<br>
return true;<br>
default:<br>
@@ -1552,7 +1552,7 @@ NVC0LoweringPass::handleATOM(I<wbr>nstruction *atom)<br>
bool<br>
NVC0LoweringPass::handleCasExc<wbr>h(Instruction *cas, bool needCctl)<br>
{<br>
- if (targ->getChipset() < NVISA_GM107_CHIPSET) {<br>
+ if (targ->getChipset() < NVISA_SM50) {<br>
if (cas->src(0).getFile() == FILE_MEMORY_SHARED) {<br>
// ATOM_CAS and ATOM_EXCH are handled in handleSharedATOM().<br>
return false;<br>
@@ -2391,7 +2391,7 @@ NVC0LoweringPass::handleLDST(I<wbr>nstruction *i)<br>
assert(prog->getType() != Program::TYPE_FRAGMENT); // INTERP<br>
}<br>
} else if (i->src(0).getFile() == FILE_MEMORY_CONST) {<br>
- if (targ->getChipset() >= NVISA_GK104_CHIPSET &&<br>
+ if (targ->getChipset() >= NVISA_SM30 &&<br>
prog->getType() == Program::TYPE_COMPUTE) {<br>
// The launch descriptor only allows to set up 8 CBs, but OpenGL<br>
// requires at least 12 UBOs. To bypass this limitation, we store the<br>
@@ -2568,7 +2568,7 @@ NVC0LoweringPass::handleRDSV(I<wbr>nstruction *i)<br>
case SV_NTID:<br>
case SV_NCTAID:<br>
case SV_GRIDID:<br>
- assert(targ->getChipset() >= NVISA_GK104_CHIPSET); // mov $sreg otherwise<br>
+ assert(targ->getChipset() >= NVISA_SM30); // mov $sreg otherwise<br>
if (sym->reg.data.sv.index == 3) {<br>
i->op = OP_MOV;<br>
i->setSrc(0, bld.mkImm(sv == SV_GRIDID ? 0 : 1));<br>
@@ -2845,9 +2845,9 @@ NVC0LoweringPass::visit(Instru<wbr>ction *i)<br>
case OP_SUSTP:<br>
case OP_SUREDB:<br>
case OP_SUREDP:<br>
- if (targ->getChipset() >= NVISA_GM107_CHIPSET)<br>
+ if (targ->getChipset() >= NVISA_SM50)<br>
handleSurfaceOpGM107(i-><wbr>asTex());<br>
- else if (targ->getChipset() >= NVISA_GK104_CHIPSET)<br>
+ else if (targ->getChipset() >= NVISA_SM30)<br>
handleSurfaceOpNVE4(i->asTex(<wbr>));<br>
else<br>
handleSurfaceOpNVC0(i->asTex(<wbr>));<br>
@@ -2869,13 +2869,13 @@ NVC0LoweringPass::visit(Instru<wbr>ction *i)<br>
* interpolation ops in frag shaders.<br>
*/<br>
bool doAfetch = false;<br>
- if (targ->getChipset() >= NVISA_GK104_CHIPSET &&<br>
+ if (targ->getChipset() >= NVISA_SM30 &&<br>
!i->perPatch &&<br>
(i->op == OP_VFETCH || i->op == OP_EXPORT) &&<br>
i->src(0).isIndirect(0)) {<br>
doAfetch = true;<br>
}<br>
- if (targ->getChipset() >= NVISA_GM107_CHIPSET &&<br>
+ if (targ->getChipset() >= NVISA_SM50 &&<br>
(i->op == OP_LINTERP || i->op == OP_PINTERP) &&<br>
i->src(0).isIndirect(0)) {<br>
doAfetch = true;<br>
diff --git a/src/gallium/drivers/nouveau/<wbr>codegen/nv50_ir_target_nvc0.cp<wbr>p b/src/gallium/drivers/nouveau/<wbr>codegen/nv50_ir_target_nvc0.cp<wbr>p<br>
index 0df528f..62c3740 100644<br>
--- a/src/gallium/drivers/nouveau/<wbr>codegen/nv50_ir_target_nvc0.cp<wbr>p<br>
+++ b/src/gallium/drivers/nouveau/<wbr>codegen/nv50_ir_target_nvc0.cp<wbr>p<br>
@@ -279,7 +279,7 @@ TargetNVC0::getSVAddress(DataF<wbr>ile shaderFile, const Symbol *sym) const<br>
const SVSemantic sv = sym-><a href="http://reg.data.sv.sv" rel="noreferrer" target="_blank">reg.data.sv.sv</a>;<br>
const bool isInput = shaderFile == FILE_SHADER_INPUT;<br>
- const bool kepler = getChipset() >= NVISA_GK104_CHIPSET;<br>
+ const bool kepler = getChipset() >= NVISA_SM30;<br>
switch (sv) {<br>
case SV_POSITION: return 0x070 + idx * 4;<br>
@@ -407,10 +407,10 @@ TargetNVC0::isAccessSupported(<wbr>DataFile file, DataType ty) const<br>
if (ty == TYPE_NONE)<br>
return false;<br>
if (file == FILE_MEMORY_CONST) {<br>
- if (getChipset() >= NVISA_GM107_CHIPSET)<br>
+ if (getChipset() >= NVISA_SM50)<br>
return typeSizeof(ty) <= 4;<br>
else<br>
- if (getChipset() >= NVISA_GK104_CHIPSET) // wrong encoding ?<br>
+ if (getChipset() >= NVISA_SM30) // wrong encoding ?<br>
return typeSizeof(ty) <= 8;<br>
}<br>
if (ty == TYPE_B96)<br>
<br>
</blockquote>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</blockquote></div></div>