Skip to content

Commit 237e0fb

Browse files
Add comments for some magic numbers
1 parent 1275bd1 commit 237e0fb

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

tools/clang/unittests/HLSLExec/CoopVec.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,9 @@ class TestVector {
508508
std::is_same_v<T, float>) {
509509
float Elt = 0.0f;
510510

511+
// Generate random input in the following ranges:
512+
// - Integral types: [-3, 4] by 1
513+
// - FP types: [-0.5, 1] by 0.5
511514
if (IsIntegralDataType(MatrixInterpretation))
512515
Elt = static_cast<float>(Rnd() & 0x7) - 3.0f;
513516
else
@@ -518,6 +521,9 @@ class TestVector {
518521
else
519522
Vec[J] = static_cast<T>(Elt);
520523
} else {
524+
// Generate random input in the following ranges:
525+
// - Signed types: [-8, 7] by 1
526+
// - Unsigned types: [0, 15] by 1
521527
if constexpr (std::is_signed_v<T>)
522528
Vec[J] = static_cast<T>((int32_t)(Rnd() & 0xf) - 8);
523529
else
@@ -676,10 +682,12 @@ class TestVector {
676682
ConvertInfo.DestInfo.NumColumns = static_cast<UINT>(getVectorSize());
677683

678684
if (MatrixLayout == D3D12_LINEAR_ALGEBRA_MATRIX_LAYOUT_ROW_MAJOR) {
685+
// Align to 16 bytes
679686
ConvertInfo.DestInfo.DestStride =
680687
(static_cast<UINT>(getVectorSize()) * DestEltSize + 15) & ~15;
681688
} else if (MatrixLayout ==
682689
D3D12_LINEAR_ALGEBRA_MATRIX_LAYOUT_COLUMN_MAJOR) {
690+
// Align to 16 bytes
683691
ConvertInfo.DestInfo.DestStride =
684692
(static_cast<UINT>(getNumVectors()) * DestEltSize + 15) & ~15;
685693
}

0 commit comments

Comments
 (0)