Skip to content

Commit 6b69ff4

Browse files
alsepkowCopilot
andcommitted
Rename doVectorsMatch to doMatricesMatch with row/col logging
Renamed to better reflect the matrix data being compared. Added M and N parameters so mismatch errors now log (row,col) coordinates instead of flat indices, improving debuggability. Co-authored-by: Copilot <[email protected]>
1 parent e0bb6c5 commit 6b69ff4

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

tools/clang/unittests/HLSLExec/LinearAlgebra.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,15 @@ using HLSLTestDataTypes::ValidationConfig;
9696
using HLSLTestDataTypes::ValidationType;
9797

9898
template <typename T>
99-
bool doVectorsMatch(const std::vector<T> &Actual,
100-
const std::vector<T> &Expected,
101-
const ValidationConfig &Config, bool VerboseLogging) {
99+
bool doMatricesMatch(const std::vector<T> &Actual,
100+
const std::vector<T> &Expected, size_t M, size_t N,
101+
const ValidationConfig &Config, bool VerboseLogging) {
102102
DXASSERT(Actual.size() == Expected.size(),
103103
"Actual and Expected must be the same size");
104104

105105
if (VerboseLogging)
106-
hlsl_test::LogCommentFmt(L"Verifying %zu elements", Actual.size());
106+
hlsl_test::LogCommentFmt(L"Verifying %zux%zu matrix (%zu elements)", M, N,
107+
Actual.size());
107108

108109
std::vector<size_t> MismatchedIndexes;
109110
for (size_t I = 0; I < Actual.size(); I++) {
@@ -117,7 +118,7 @@ bool doVectorsMatch(const std::vector<T> &Actual,
117118
for (size_t Index : MismatchedIndexes) {
118119
std::wstringstream Wss(L"");
119120
Wss << std::setprecision(15);
120-
Wss << L"Mismatch at Index: " << Index;
121+
Wss << L"Mismatch at (" << Index / N << L"," << Index % N << L")";
121122
Wss << L" Actual:" << Actual[Index];
122123
Wss << L" Expected:" << Expected[Index];
123124
hlsl_test::LogErrorFmt(Wss.str().c_str());
@@ -338,7 +339,8 @@ void runAndVerify(ID3D12Device *D3DDevice, bool VerboseLogging,
338339
return;
339340
}
340341

341-
VERIFY_IS_TRUE(doVectorsMatch(*Actual, Expected, Config, VerboseLogging));
342+
VERIFY_IS_TRUE(
343+
doMatricesMatch(*Actual, Expected, Rows, Cols, Config, VerboseLogging));
342344
}
343345

344346
//

0 commit comments

Comments
 (0)