Skip to content

Commit eb5a56c

Browse files
committed
ongoing test
1 parent ab7707f commit eb5a56c

File tree

3 files changed

+21
-39
lines changed

3 files changed

+21
-39
lines changed

tools/clang/unittests/HLSLExec/LongVectorOps.def

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ INPUT_SET(Positive)
1919
INPUT_SET(Bitwise)
2020
INPUT_SET(SelectCond)
2121
INPUT_SET(FloatSpecial)
22-
INPUT_SET(DynamicIndexes)
2322

2423
#undef INPUT_SET
2524

@@ -66,8 +65,8 @@ OP_DEFAULT_DEFINES(Unary, Initialize, 1, "TestInitialize", "",
6665
OP_DEFAULT_DEFINES(ArrayOperator, ArrayOperator_StaticAccess, 1, "TestArrayOperatorStaticAccess", "",
6766
" -DTEST_ARRAY_OPERATOR_STATIC_ACCESS=1")
6867

69-
OP(ArrayOperator, ArrayOperator_DynamicAccess, 2, "TestArrayOperatorDynamicAccess", "", " -DTEST_ARRAY_OPERATOR_DYNAMIC_ACCESS=1 -DINDEX=1.0", "LongVectorOp", \
70-
Default1, DynamicIndexes, Default3)
68+
OP_DEFAULT_DEFINES(ArrayOperator, ArrayOperator_DynamicAccess, 2, "TestArrayOperatorDynamicAccess", "",
69+
" -DTEST_ARRAY_OPERATOR_DYNAMIC_ACCESS=1")
7170

7271
#define OP_CAST_DEFAULT(GROUP, SYMBOL) \
7372
OP_DEFAULT_DEFINES(GROUP, SYMBOL, 1, "TestCast", "", "-DFUNC_TEST_CAST=1")

tools/clang/unittests/HLSLExec/LongVectorTestData.h

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -240,15 +240,12 @@ enum class InputSet {
240240
#include "LongVectorOps.def"
241241
};
242242

243-
template <typename T>
244-
const std::vector<T> &getInputSet(InputSet InputSet, size_t SizeToTest) {
243+
template <typename T> const std::vector<T> &getInputSet(InputSet InputSet) {
245244
static_assert(false, "No InputSet for this type");
246245
}
247246

248247
#define BEGIN_INPUT_SETS(TYPE) \
249-
template <> \
250-
const std::vector<TYPE> &getInputSet<TYPE>(InputSet InputSet, \
251-
size_t SizeToTest) { \
248+
template <> const std::vector<TYPE> &getInputSet<TYPE>(InputSet InputSet) { \
252249
using T = TYPE; \
253250
switch (InputSet) {
254251

@@ -290,9 +287,6 @@ INPUT_SET(InputSet::Bitwise, std::numeric_limits<int16_t>::min(), -1, 0, 1, 3,
290287
6, 9, 0x5555, static_cast<int16_t>(0xAAAA),
291288
std::numeric_limits<int16_t>::max());
292289
INPUT_SET(InputSet::SelectCond, 0, 1);
293-
INPUT_SET(InputSet::DynamicIndexes, 0, (int16_t)(SizeToTest - 1), 1,
294-
(int16_t)(SizeToTest - 2), (int16_t)(SizeToTest / 2),
295-
(int16_t)(SizeToTest / 2 + 1));
296290
END_INPUT_SETS()
297291

298292
BEGIN_INPUT_SETS(int32_t)
@@ -306,10 +300,6 @@ INPUT_SET(InputSet::Bitwise, std::numeric_limits<int32_t>::min(), -1, 0, 1, 3,
306300
6, 9, 0x55555555, static_cast<int32_t>(0xAAAAAAAA),
307301
std::numeric_limits<int32_t>::max());
308302
INPUT_SET(InputSet::SelectCond, 0, 1);
309-
// {0, VectorSize - 1, 1, VectorSize - 2, VectorSize / 2, VectorSize / 2 + 1};
310-
INPUT_SET(InputSet::DynamicIndexes, 0, (int32_t)(SizeToTest - 1), 1,
311-
(int32_t)(SizeToTest - 2), (int32_t)(SizeToTest / 2),
312-
(int32_t)(SizeToTest / 2 + 1));
313303
END_INPUT_SETS()
314304

315305
BEGIN_INPUT_SETS(int64_t)
@@ -323,9 +313,6 @@ INPUT_SET(InputSet::Bitwise, std::numeric_limits<int64_t>::min(), -1, 0, 1, 3,
323313
6, 9, 0x5555555555555555LL, 0xAAAAAAAAAAAAAAAALL,
324314
std::numeric_limits<int64_t>::max());
325315
INPUT_SET(InputSet::SelectCond, 0, 1);
326-
INPUT_SET(InputSet::DynamicIndexes, 0, (int64_t)(SizeToTest - 1), 1,
327-
(int64_t)(SizeToTest - 2), (int64_t)(SizeToTest / 2),
328-
(int64_t)(SizeToTest / 2 + 1));
329316
END_INPUT_SETS()
330317

331318
BEGIN_INPUT_SETS(uint16_t)
@@ -336,9 +323,6 @@ INPUT_SET(InputSet::BitShiftRhs, 1, 6, 3, 0, 9, 3, 12, 13, 14, 15);
336323
INPUT_SET(InputSet::Bitwise, 0, 1, 3, 6, 9, 0x5555, 0xAAAA, 0x8000, 127,
337324
std::numeric_limits<uint16_t>::max());
338325
INPUT_SET(InputSet::SelectCond, 0, 1);
339-
INPUT_SET(InputSet::DynamicIndexes, 0, (uint16_t)(SizeToTest - 1), 1,
340-
(uint16_t)(SizeToTest - 2), (uint16_t)(SizeToTest / 2),
341-
(uint16_t)(SizeToTest / 2 + 1));
342326
END_INPUT_SETS()
343327

344328
BEGIN_INPUT_SETS(uint32_t)
@@ -349,9 +333,6 @@ INPUT_SET(InputSet::BitShiftRhs, 1, 6, 3, 0, 9, 3, 30, 31, 32);
349333
INPUT_SET(InputSet::Bitwise, 0, 1, 3, 6, 9, 0x55555555, 0xAAAAAAAA, 0x80000000,
350334
127, std::numeric_limits<uint32_t>::max());
351335
INPUT_SET(InputSet::SelectCond, 0, 1);
352-
INPUT_SET(InputSet::DynamicIndexes, 0, (uint32_t)(SizeToTest - 1), 1,
353-
(uint32_t)(SizeToTest - 2), (uint32_t)(SizeToTest / 2),
354-
(uint32_t)(SizeToTest / 2 + 1));
355336
END_INPUT_SETS()
356337

357338
BEGIN_INPUT_SETS(uint64_t)
@@ -363,9 +344,6 @@ INPUT_SET(InputSet::Bitwise, 0, 1, 3, 6, 9, 0x5555555555555555,
363344
0xAAAAAAAAAAAAAAAA, 0x8000000000000000, 127,
364345
std::numeric_limits<uint64_t>::max());
365346
INPUT_SET(InputSet::SelectCond, 0, 1);
366-
INPUT_SET(InputSet::DynamicIndexes, 0, (uint64_t)(SizeToTest - 1), 1,
367-
(uint64_t)(SizeToTest - 2), (uint64_t)(SizeToTest / 2),
368-
(uint64_t)(SizeToTest / 2 + 1));
369347
END_INPUT_SETS()
370348

371349
BEGIN_INPUT_SETS(HLSLHalf_t)
@@ -396,9 +374,6 @@ INPUT_SET(InputSet::FloatSpecial, std::numeric_limits<float>::infinity(),
396374
-std::numeric_limits<float>::max(),
397375
std::numeric_limits<float>::denorm_min(),
398376
std::numeric_limits<float>::denorm_min() * 10.0, 1.0 / 3.0);
399-
INPUT_SET(InputSet::DynamicIndexes, 0.0, (float)(SizeToTest - 1), 1.0,
400-
(float)(SizeToTest - 2), (float)(SizeToTest / 2),
401-
(float)(SizeToTest / 2 + 1));
402377
END_INPUT_SETS()
403378

404379
BEGIN_INPUT_SETS(float)
@@ -426,9 +401,6 @@ INPUT_SET(InputSet::FloatSpecial, std::numeric_limits<float>::infinity(),
426401
-std::numeric_limits<float>::max(),
427402
std::numeric_limits<float>::denorm_min(),
428403
std::numeric_limits<float>::denorm_min() * 10.0f, 1.0f / 3.0f);
429-
INPUT_SET(InputSet::DynamicIndexes, 0.0, (float)(SizeToTest - 1), 1.0,
430-
(float)(SizeToTest - 2), (float)(SizeToTest / 2),
431-
(float)(SizeToTest / 2 + 1));
432404
END_INPUT_SETS()
433405

434406
BEGIN_INPUT_SETS(double)
@@ -447,9 +419,6 @@ INPUT_SET(InputSet::SplitDouble, 0.0, -1.0, 1.0, -1.0, 12345678.87654321, -1.0,
447419
INPUT_SET(InputSet::Positive, 1.0, 1.0, 65535.0, 0.01, 5531.0, 0.01, 1.0, 0.01,
448420
331.2330, 3250.01);
449421
INPUT_SET(InputSet::SelectCond, 0.0, 1.0);
450-
INPUT_SET(InputSet::DynamicIndexes, 0.0, (double)(SizeToTest - 1), 1.0,
451-
(double)(SizeToTest - 2), (double)(SizeToTest / 2),
452-
(double)(SizeToTest / 2 + 1));
453422
END_INPUT_SETS()
454423

455424
#undef BEGIN_INPUT_SETS

tools/clang/unittests/HLSLExec/LongVectors.cpp

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -448,8 +448,22 @@ runTest(ID3D12Device *D3DDevice, bool VerboseLogging,
448448
std::string BufferName = "InputVector";
449449
BufferName += (char)('1' + I);
450450
if (_stricmp(Name, BufferName.c_str()) == 0) {
451-
if (I < Operation.Arity)
452-
fillShaderBufferFromLongVectorData(ShaderData, Inputs[I]);
451+
if (I < Operation.Arity) {
452+
if (Operation.Type == OpType::ArrayOperator_DynamicAccess &&
453+
I == 1) {
454+
// For the dynamic access operator, the second input is the
455+
// index. We need to convert it to a uint32_t.
456+
const size_t NumElements = Inputs[0].size();
457+
std::vector<size_t> IndexData = {0,
458+
NumElements - 1,
459+
1,
460+
NumElements - 2,
461+
NumElements / 2,
462+
NumElements / 2 + 1};
463+
fillShaderBufferFromLongVectorData(ShaderData, IndexData);
464+
} else
465+
fillShaderBufferFromLongVectorData(ShaderData, Inputs[I]);
466+
}
453467
return;
454468
}
455469
}
@@ -535,7 +549,7 @@ void configureLoadAndStoreShaderOp(const Operation &Operation,
535549

536550
template <typename T>
537551
std::vector<T> buildTestInput(InputSet InputSet, size_t SizeToTest) {
538-
const std::vector<T> &RawValueSet = getInputSet<T>(InputSet, SizeToTest);
552+
const std::vector<T> &RawValueSet = getInputSet<T>(InputSet);
539553

540554
std::vector<T> ValueSet;
541555
ValueSet.reserve(SizeToTest);

0 commit comments

Comments
 (0)