Skip to content

Commit cc32e24

Browse files
committed
Add D3D12_Workgroup_Zoo unit tests for Wave Reduction ops
WaveActiveMax() WaveActiveMin() WaveActiveProduct() WaveActiveSum() WaveActiveAllEqual() WaveActiveBitAnd() WaveActiveBitOr() WaveActiveBitXor() WaveActiveCountBits()
1 parent ebd0648 commit cc32e24

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

util/test/demos/d3d12/d3d12_subgroup_zoo.cpp

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,44 @@ void main(uint3 inTid : SV_DispatchThreadID)
319319
data.w = WavePrefixProduct(1 + data.y);
320320
}
321321
}
322+
else if(IsTest(13))
323+
{
324+
// Reduction functions : unit tests
325+
if (id >= 2 && id <= 20)
326+
{
327+
data.x = float(WaveActiveMax(id));
328+
data.y = float(WaveActiveMin(id));
329+
data.z = float(WaveActiveProduct(id));
330+
data.w = float(WaveActiveSum(id));
331+
}
332+
}
333+
else if(IsTest(14))
334+
{
335+
// Reduction functions : unit tests
336+
if (id >= 2 && id <= 20)
337+
{
338+
data.x = float(WaveActiveCountBits(id > 23));
339+
data.y = float(WaveActiveBitAnd(id));
340+
data.z = float(WaveActiveBitOr(id));
341+
data.w = float(WaveActiveBitXor(id));
342+
}
343+
}
344+
else if(IsTest(15))
345+
{
346+
// Reduction functions : unit tests
347+
if (id > 13)
348+
{
349+
bool test1 = (id > 15).x;
350+
bool2 test2 = bool2(test1, (id < 23));
351+
bool3 test3 = bool3(test1, (id < 23), (id >= 25));
352+
bool4 test4 = bool4(test1, (id < 23), (id >= 25), (id >= 28));
353+
354+
data.x = float(WaveActiveAllEqual(test1).x);
355+
data.y = float(WaveActiveAllEqual(test2).y);
356+
data.z = float(WaveActiveAllEqual(test3).z);
357+
data.w = float(WaveActiveAllEqual(test4).w);
358+
}
359+
}
322360
SetOuput(data);
323361
}
324362

0 commit comments

Comments
 (0)