Check for PackedVectorFormat in SPIRV debugger interger dot products

This commit is contained in:
Jake Turner
2026-02-23 11:02:42 +00:00
parent 1dad34a8ef
commit f9a3cf6193
+38 -5
View File
@@ -4889,6 +4889,8 @@ void ThreadState::StepNext(bool useDebugState, const uint32_t steps,
ShaderVariable acc;
bool leftSigned = true;
bool rightSigned = true;
PackedVectorFormat packedFormat = PackedVectorFormat::Invalid;
bool hasPackedFormat = false;
switch(opdata.op)
{
case Op::SDot:
@@ -4897,6 +4899,8 @@ void ThreadState::StepNext(bool useDebugState, const uint32_t steps,
vector1 = dot.vector1;
vector2 = dot.vector2;
result = dot.result;
packedFormat = dot.packedVectorFormat;
hasPackedFormat = dot.HasPackedVectorFormat();
break;
}
case Op::SDotAccSat:
@@ -4906,6 +4910,8 @@ void ThreadState::StepNext(bool useDebugState, const uint32_t steps,
vector2 = dot.vector2;
acc = GetSrc(dot.accumulator);
result = dot.result;
packedFormat = dot.packedVectorFormat;
hasPackedFormat = dot.HasPackedVectorFormat();
break;
}
case Op::UDot:
@@ -4916,6 +4922,8 @@ void ThreadState::StepNext(bool useDebugState, const uint32_t steps,
result = dot.result;
leftSigned = false;
rightSigned = false;
packedFormat = dot.packedVectorFormat;
hasPackedFormat = dot.HasPackedVectorFormat();
break;
}
case Op::UDotAccSat:
@@ -4927,6 +4935,8 @@ void ThreadState::StepNext(bool useDebugState, const uint32_t steps,
result = dot.result;
leftSigned = false;
rightSigned = false;
packedFormat = dot.packedVectorFormat;
hasPackedFormat = dot.HasPackedVectorFormat();
break;
}
case Op::SUDot:
@@ -4936,6 +4946,8 @@ void ThreadState::StepNext(bool useDebugState, const uint32_t steps,
vector2 = dot.vector2;
result = dot.result;
rightSigned = false;
packedFormat = dot.packedVectorFormat;
hasPackedFormat = dot.HasPackedVectorFormat();
break;
}
case Op::SUDotAccSat:
@@ -4946,6 +4958,8 @@ void ThreadState::StepNext(bool useDebugState, const uint32_t steps,
acc = GetSrc(dot.accumulator);
result = dot.result;
rightSigned = false;
packedFormat = dot.packedVectorFormat;
hasPackedFormat = dot.HasPackedVectorFormat();
break;
}
default: RDCERR("Unexpected opcode %s", ToStr(opdata.op).c_str()); break;
@@ -4956,14 +4970,33 @@ void ThreadState::StepNext(bool useDebugState, const uint32_t steps,
RDCASSERTEQUAL(lhs.columns, rhs.columns);
// 1x32-bit is a 4x-8bit packed vector
bool packed = false;
if((lhs.columns == 1) && (lhs.type == VarType::SInt || lhs.type == VarType::UInt))
{
lhs.columns = 4;
rhs.columns = 4;
lhs.type = (lhs.type == VarType::SInt) ? VarType::SByte : VarType::UByte;
rhs.type = (rhs.type == VarType::SInt) ? VarType::SByte : VarType::UByte;
packed = true;
if(!hasPackedFormat)
{
RDCERR("Inputs are packed but opcode does not specify packed format opcode %s",
ToStr(opdata.op).c_str());
break;
}
if(packedFormat != PackedVectorFormat::PackedVectorFormat4x8Bit)
{
RDCERR("Inputs are packed but opcdode specifies an invalid packed format %u opcode %s",
(uint32_t)packedFormat, ToStr(opdata.op).c_str());
break;
}
}
else
{
if(hasPackedFormat)
{
RDCERR("Inputs are not packed but opcode does specify packed format opcode %s",
ToStr(opdata.op).c_str());
break;
}
}
const DataType &resultType = debugger.GetType(opdata.resultType);
ShaderVariable var;
@@ -5006,7 +5039,7 @@ void ThreadState::StepNext(bool useDebugState, const uint32_t steps,
#undef _IMPL
#define _IMPL(I, S, U) \
int64_t ret(0); \
if(!packed) \
if(!hasPackedFormat) \
{ \
for(uint8_t c = 0; c < lhs.columns; c++) \
ret += comp<S>(lhs, c) * comp<S>(rhs, c); \
@@ -5027,7 +5060,7 @@ void ThreadState::StepNext(bool useDebugState, const uint32_t steps,
#undef _IMPL
#define _IMPL(I, S, U) \
uint64_t ret(0); \
if(!packed) \
if(!hasPackedFormat) \
{ \
for(uint8_t c = 0; c < lhs.columns; c++) \
ret += comp<U>(lhs, c) * comp<U>(rhs, c); \
@@ -5048,7 +5081,7 @@ void ThreadState::StepNext(bool useDebugState, const uint32_t steps,
#undef _IMPL
#define _IMPL(I, S, U) \
int64_t ret(0); \
if(!packed) \
if(!hasPackedFormat) \
{ \
for(uint8_t c = 0; c < lhs.columns; c++) \
ret += comp<S>(lhs, c) * comp<U>(rhs, c); \