Skip to content

Commit c522461

Browse files
authored
Execution Tests: Long Vector - Loading and storing of buffers (#7829)
This PR adds test cases for loading and storing of Byte Address Buffers and Structured Buffers using Root Descriptors, Descriptor Tables, and Root Descriptor Heaps. Reading is test using both SRV and UAV resources. Writing is only valid on UAV resources. Resolves #7543
1 parent d2f9d80 commit c522461

File tree

3 files changed

+649
-95
lines changed

3 files changed

+649
-95
lines changed

tools/clang/unittests/HLSLExec/LongVectorOps.def

Lines changed: 65 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ INPUT_SET(SelectCond)
2222
#undef INPUT_SET
2323

2424
#ifndef OP
25-
#define OP(GROUP, SYMBOL, ARITY, INTRINSIC, OPERATOR, DEFINES, INPUT_SET_1, \
26-
INPUT_SET_2, INPUT_SET_3)
25+
#define OP(GROUP, SYMBOL, ARITY, INTRINSIC, OPERATOR, DEFINES, SHADER_NAME, \
26+
INPUT_SET_1, INPUT_SET_2, INPUT_SET_3)
2727
#endif
2828

2929
#define OP_DEFAULT_DEFINES(GROUP, SYMBOL, ARITY, INTRINSIC, OPERATOR, DEFINES) \
30-
OP(GROUP, SYMBOL, ARITY, INTRINSIC, OPERATOR, DEFINES, Default1, Default2, \
31-
Default3)
30+
OP(GROUP, SYMBOL, ARITY, INTRINSIC, OPERATOR, DEFINES, "LongVectorOp", \
31+
Default1, Default2, Default3)
3232

3333
#define OP_DEFAULT(GROUP, SYMBOL, ARITY, INTRINSIC, OPERATOR) \
3434
OP_DEFAULT_DEFINES(GROUP, SYMBOL, ARITY, INTRINSIC, OPERATOR, "")
@@ -48,23 +48,24 @@ OP_DEFAULT(BinaryMath, Ldexp, 2, "ldexp", ",")
4848
OP_DEFAULT(Bitwise, And, 2, "", "&")
4949
OP_DEFAULT(Bitwise, Or, 2, "", "|")
5050
OP_DEFAULT(Bitwise, Xor, 2, "", "^")
51-
OP(Bitwise, LeftShift, 2, "", "<<", "", Default1, BitShiftRhs, Default3)
52-
OP(Bitwise, RightShift, 2, "", ">>", "", Default1, BitShiftRhs, Default3)
51+
OP(Bitwise, LeftShift, 2, "", "<<", "", "LongVectorOp",
52+
Default1, BitShiftRhs, Default3)
53+
OP(Bitwise, RightShift, 2, "", ">>", "", "LongVectorOp",
54+
Default1, BitShiftRhs, Default3)
5355
OP_DEFAULT(Bitwise, Saturate, 1, "saturate", "")
5456
OP_DEFAULT(Bitwise, ReverseBits, 1, "reversebits", "")
55-
OP(Bitwise, CountBits, 1, "countbits", "", "", Bitwise, Default2, Default3)
56-
OP(Bitwise, FirstBitHigh, 1, "firstbithigh", "", "", Bitwise, Default2,
57-
Default3)
58-
OP(Bitwise, FirstBitLow, 1, "firstbitlow", "", "", Bitwise, Default2, Default3)
57+
OP(Bitwise, CountBits, 1, "countbits", "", "", "LongVectorOp", Bitwise, Default2, Default3)
58+
OP(Bitwise, FirstBitHigh, 1, "firstbithigh", "", "", "LongVectorOp", Bitwise, Default2, Default3)
59+
OP(Bitwise, FirstBitLow, 1, "firstbitlow", "", "", "LongVectorOp", Bitwise, Default2, Default3)
5960

6061
OP_DEFAULT_DEFINES(Unary, Initialize, 1, "TestInitialize", "",
6162
" -DFUNC_INITIALIZE=1")
6263

6364
#define OP_CAST_DEFAULT(GROUP, SYMBOL) \
6465
OP_DEFAULT_DEFINES(GROUP, SYMBOL, 1, "TestCast", "", "-DFUNC_TEST_CAST=1")
6566
#define OP_CAST(GROUP, SYMBOL, INPUT_SET_1) \
66-
OP(GROUP, SYMBOL, 1, "TestCast", "", "-DFUNC_TEST_CAST=1", INPUT_SET_1, \
67-
Default2, Default3)
67+
OP(GROUP, SYMBOL, 1, "TestCast", "", "-DFUNC_TEST_CAST=1", "LongVectorOP", \
68+
INPUT_SET_1, Default2, Default3)
6869

6970
OP_CAST_DEFAULT(Cast, CastToBool)
7071
OP_CAST_DEFAULT(Cast, CastToInt16)
@@ -83,9 +84,12 @@ OP_CAST_DEFAULT(Cast, CastToFloat64)
8384
#undef OP_CAST_DEFAULT
8485
#undef OP_CAST
8586

86-
OP(Trigonometric, Acos, 1, "acos", "", "", RangeOne, Default2, Default3)
87-
OP(Trigonometric, Asin, 1, "asin", "", "", RangeHalfPi, Default2, Default3)
88-
OP(Trigonometric, Atan, 1, "atan", "", "", RangeHalfPi, Default2, Default3)
87+
OP(Trigonometric, Acos, 1, "acos", "", "", "LongVectorOp",
88+
RangeOne, Default2, Default3)
89+
OP(Trigonometric, Asin, 1, "asin", "", "", "LongVectorOp",
90+
RangeHalfPi, Default2, Default3)
91+
OP(Trigonometric, Atan, 1, "atan", "", "", "LongVectorOp",
92+
RangeHalfPi, Default2, Default3)
8993
OP_DEFAULT(Trigonometric, Cos, 1, "cos", "")
9094
OP_DEFAULT(Trigonometric, Cosh, 1, "cosh", "")
9195
OP_DEFAULT(Trigonometric, Sin, 1, "sin", "")
@@ -101,7 +105,8 @@ OP_DEFAULT(AsType, AsInt, 1, "asint", "")
101105
OP_DEFAULT(AsType, AsUint, 1, "asuint", "")
102106
OP_DEFAULT(AsType, AsDouble, 2, "asdouble", ",")
103107
OP(AsType, AsUint_SplitDouble, 1, "TestAsUintSplitDouble", "",
104-
" -DFUNC_ASUINT_SPLITDOUBLE=1", SplitDouble, SplitDouble, SplitDouble)
108+
" -DFUNC_ASUINT_SPLITDOUBLE=1", "LongVectorOp", SplitDouble, SplitDouble,
109+
SplitDouble)
105110

106111
OP_DEFAULT(UnaryMath, Abs, 1, "abs", "")
107112
OP_DEFAULT(UnaryMath, Sign, 1, "sign", "")
@@ -129,28 +134,58 @@ OP_DEFAULT(BinaryComparison, NotEqual, 2, "", "!=")
129134

130135
OP_DEFAULT(Binary, Logical_And, 2, "and", ",")
131136
OP_DEFAULT(Binary, Logical_Or, 2, "or", ",")
132-
OP(Ternary, Select, 3, "TestSelect", "", " -DFUNC_TEST_SELECT=1", SelectCond, Default2, Default3)
137+
OP(Ternary, Select, 3, "TestSelect", "", " -DFUNC_TEST_SELECT=1",
138+
"LongVectorOp", SelectCond, Default2, Default3)
133139

134140
// For the 'any' and 'all' reduction operation, we test with three different
135141
// input data sets to cover the different cases of the operation. 'Any' returns
136142
// true if any of the inputs are non-zero, false otherwise. This is in
137143
// contrast to other ops where we can get coverage simply with different values
138144
// across the input set.
139-
OP(Reduction, Any_Mixed, 1, "any", "", " -DIS_REDUCTION_OP=1", Default1,
140-
Default2, Default3)
141-
OP(Reduction, Any_Zero, 1, "any", "", " -DIS_REDUCTION_OP=1", Zero,
142-
Default2, Default3)
143-
OP(Reduction, Any_NoZero, 1, "any", "", " -DIS_REDUCTION_OP=1", NoZero,
144-
Default2, Default3)
145-
OP(Reduction, All_Mixed, 1, "all", "", " -DIS_REDUCTION_OP=1", Default1,
146-
Default2, Default3)
147-
OP(Reduction, All_Zero, 1, "all", "", " -DIS_REDUCTION_OP=1", Zero,
148-
Default2, Default3)
149-
OP(Reduction, All_NoZero, 1, "all", "", " -DIS_REDUCTION_OP=1", NoZero,
150-
Default2, Default3)
151-
145+
OP(Reduction, Any_Mixed, 1, "any", "", " -DIS_REDUCTION_OP=1", "LongVectorOp",
146+
Default1, Default2, Default3)
147+
OP(Reduction, Any_Zero, 1, "any", "", " -DIS_REDUCTION_OP=1", "LongVectorOp",
148+
Zero, Default2, Default3)
149+
OP(Reduction, Any_NoZero, 1, "any", "", " -DIS_REDUCTION_OP=1", "LongVectorOp",
150+
NoZero, Default2, Default3)
151+
OP(Reduction, All_Mixed, 1, "all", "", " -DIS_REDUCTION_OP=1", "LongVectorOp",
152+
Default1, Default2, Default3)
153+
OP(Reduction, All_Zero, 1, "all", "", " -DIS_REDUCTION_OP=1", "LongVectorOp",
154+
Zero, Default2, Default3)
155+
OP(Reduction, All_NoZero, 1, "all", "", " -DIS_REDUCTION_OP=1", "LongVectorOp",
156+
NoZero, Default2, Default3)
152157
OP_DEFAULT(Reduction, Dot, 2, "dot", ",")
153158

154159
OP_DEFAULT_DEFINES(Unary, ShuffleVector, 1, "TestShuffleVector", "", " -DFUNC_SHUFFLE_VECTOR=1")
155160

161+
162+
#define OP_LOAD_AND_STORE(SYMBOL, SHADER_NAME) \
163+
OP(UNARY, SYMBOL, 1, "", "", "", "LongVectorOp_" SHADER_NAME, \
164+
Default1, Default2, Default3)
165+
#define OP_LOAD_AND_STORE_SB(SYMBOL, SHADER_NAME) \
166+
OP(UNARY, SYMBOL, 1, "", "", " -DUSE_STRUCTURED_BUFFER=1", \
167+
"LongVectorOp_" SHADER_NAME, Default1, Default2, Default3)
168+
169+
// BAB == Byte Address Buffer
170+
// RDH == Resource Descriptor Heap
171+
// RD == Root Descriptor
172+
// DT == Descriptor Table
173+
// SB == Structured Buffer
174+
OP_LOAD_AND_STORE(LoadAndStore_RDH_BAB_UAV,"ResourceDescriptorHeap_UAV")
175+
OP_LOAD_AND_STORE(LoadAndStore_RDH_BAB_SRV,"ResourceDescriptorHeap_SRV")
176+
OP_LOAD_AND_STORE(LoadAndStore_DT_BAB_UAV,"DescriptorTable_UAV")
177+
OP_LOAD_AND_STORE(LoadAndStore_DT_BAB_SRV, "DescriptorTable_SRV")
178+
OP_LOAD_AND_STORE(LoadAndStore_RD_BAB_UAV, "RootDescriptor_UAV")
179+
OP_LOAD_AND_STORE(LoadAndStore_RD_BAB_SRV, "RootDescriptor_SRV")
180+
181+
OP_LOAD_AND_STORE_SB(LoadAndStore_RDH_SB_UAV, "ResourceDescriptorHeap_UAV")
182+
OP_LOAD_AND_STORE_SB(LoadAndStore_RDH_SB_SRV, "ResourceDescriptorHeap_SRV")
183+
OP_LOAD_AND_STORE_SB(LoadAndStore_DT_SB_UAV, "DescriptorTable_UAV")
184+
OP_LOAD_AND_STORE_SB(LoadAndStore_DT_SB_SRV, "DescriptorTable_SRV")
185+
OP_LOAD_AND_STORE_SB(LoadAndStore_RD_SB_UAV, "RootDescriptor_UAV")
186+
OP_LOAD_AND_STORE_SB(LoadAndStore_RD_SB_SRV, "RootDescriptor_SRV")
187+
188+
#undef OP_LOAD_AND_STORE
189+
#undef OP_LOAD_AND_STORE_DEFINES
190+
156191
#undef OP

0 commit comments

Comments
 (0)