Skip to content

Commit 386419d

Browse files
author
Greg Roth
authored
QuadRead Test fix dependencies and groupIndex (#3825)
Add needed check for wave ops needed for QuadRead* operations. Correct use of GroupIndex to use WaveLaneIndex since that's how quad relationships can be ensured. That required changing some other aspects of the test as well.
1 parent ec7e332 commit 386419d

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

tools/clang/test/HLSL/ShaderOpArith.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@
345345
[NumThreads(MESHDISPATCHX, MESHDISPATCHY, MESHDISPATCHZ)]
346346
void ASMain(uint ix : SV_GroupIndex) {
347347
Payload payload;
348-
g_bufAmp[ix] = QuadReadTest(ix);
348+
g_bufAmp[ix] = QuadReadTest(WaveGetLaneIndex());
349349
payload.nothing = 0;
350350
DispatchMesh(1, 1, 1, payload);
351351
}
@@ -370,7 +370,7 @@
370370
// Assign static fullscreen 2 tri quad
371371
verts[ix%6].position = g_Verts[ix%6];
372372
tris[ix&1] = uint3((ix&1)*3, (ix&1)*3 + 1, (ix&1)*3 + 2);
373-
g_bufMesh[ix] = QuadReadTest(ix);
373+
g_bufMesh[ix] = QuadReadTest(WaveGetLaneIndex());
374374
}
375375
376376
void PSMain(PSInput input) {
@@ -379,7 +379,7 @@
379379
380380
[NumThreads(DISPATCHX, DISPATCHY, DISPATCHZ)]
381381
void CSMain(uint ix : SV_GroupIndex) {
382-
g_bufMain[ix] = QuadReadTest(ix);
382+
g_bufMain[ix] = QuadReadTest(WaveGetLaneIndex());
383383
}
384384
]]>
385385
</Shader>

tools/clang/unittests/HLSL/ExecutionTest.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3253,10 +3253,10 @@ TEST_F(ExecutionTest, DerivativesTest) {
32533253
void VerifyQuadReadResults(const UINT *pPixels, UINT quadIndex) {
32543254
for (UINT i = 0; i < 4; i++) {
32553255
UINT ix = quadIndex + i;
3256-
VERIFY_ARE_EQUAL(pPixels[4*ix + 0], ix); // ReadLaneAt own quad index
3257-
VERIFY_ARE_EQUAL(pPixels[4*ix + 1], (ix^1));// ReadAcrossX
3258-
VERIFY_ARE_EQUAL(pPixels[4*ix + 2], (ix^2));// ReadAcrossY
3259-
VERIFY_ARE_EQUAL(pPixels[4*ix + 3], (ix^3));// ReadAcrossDiagonal
3256+
UINT lix = pPixels[4*ix];
3257+
VERIFY_ARE_EQUAL(pPixels[4*ix + 1], (lix^1));// ReadAcrossX
3258+
VERIFY_ARE_EQUAL(pPixels[4*ix + 2], (lix^2));// ReadAcrossY
3259+
VERIFY_ARE_EQUAL(pPixels[4*ix + 3], (lix^3));// ReadAcrossDiagonal
32603260
}
32613261
}
32623262

@@ -3276,6 +3276,11 @@ TEST_F(ExecutionTest, QuadReadTest) {
32763276
return;
32773277
}
32783278

3279+
if (!DoesDeviceSupportWaveOps(pDevice)) {
3280+
WEX::Logging::Log::Comment(L"Device does not support wave operations.");
3281+
return;
3282+
}
3283+
32793284
std::shared_ptr<st::ShaderOpSet> ShaderOpSet =
32803285
std::make_shared<st::ShaderOpSet>();
32813286
st::ParseShaderOpSetFromStream(pStream, ShaderOpSet.get());
@@ -3292,13 +3297,8 @@ TEST_F(ExecutionTest, QuadReadTest) {
32923297
{
32933298
{32, 32, 1, 8, 8, 1},
32943299
{64, 4, 1, 64, 2, 1},
3295-
{1, 4, 64, 1, 4, 32},
32963300
{64, 1, 1, 64, 1, 1},
3297-
{1, 64, 1, 1, 64, 1},
3298-
{1, 1, 64, 1, 1, 64},
32993301
{16, 16, 3, 4, 4, 3},
3300-
{32, 3, 8, 8, 3, 2},
3301-
{3, 1, 64, 3, 1, 32}
33023302
};
33033303

33043304
for (Dispatch &D : dispatches) {

0 commit comments

Comments
 (0)