Skip to content

Commit fc86add

Browse files
committed
comments
1 parent 2f2dc98 commit fc86add

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

tools/clang/unittests/HLSLExec/LinAlgTests.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ static void runElementAccess(ID3D12Device *Device,
580580
// Build actual data.
581581
std::vector<float> ActualFloats(NumElements);
582582
std::vector<int32_t> ActualInts(NumElements);
583-
for (size_t I = 0; I < NumElements * 4; I = I + 4) {
583+
for (size_t I = 0; I < NumElements * ElementSize; I = I + ElementSize) {
584584
switch (Params.CompType) {
585585
case ComponentType::F32: {
586586
float Actual;
@@ -615,9 +615,11 @@ static void runElementAccess(ID3D12Device *Device,
615615

616616
// The sum of the values returned by Length across all threads must be
617617
// greater than or equal to the total number of matrix elements
618+
size_t MatrixEndOffset = NumElements * ElementSize;
619+
size_t LengthValuesEnd = MatrixEndOffset + (NumThreads * sizeof(uint32_t));
618620
size_t TotalLength = 0;
619-
for (size_t I = NumElements * 4; I < (NumElements + NumThreads) * 4;
620-
I = I + 4) {
621+
for (size_t I = MatrixEndOffset; I < LengthValuesEnd;
622+
I = I + sizeof(uint32_t)) {
621623
TotalLength += Out[I];
622624
}
623625
VERIFY_IS_TRUE(TotalLength >= NumElements,

0 commit comments

Comments
 (0)