Skip to content

Commit cb6175a

Browse files
alsepkowCopilot
andcommitted
Extract getWaveSize helper and clarify mirrors comments
Extract duplicated WaveSize computation from runWaveOpTest and runMinPrecisionWaveOpTest into a shared getWaveSize() method. Update section comments to say 'mirrors applicable ops' since not all ops from the 16-bit equivalent types are supported for min precision. Co-authored-by: Copilot <[email protected]>
1 parent 212db31 commit cb6175a

1 file changed

Lines changed: 13 additions & 26 deletions

File tree

tools/clang/unittests/HLSLExec/LongVectors.cpp

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2060,10 +2060,7 @@ class TestClassCommon {
20602060
return true;
20612061
}
20622062

2063-
template <typename T, OpType OP> void runWaveOpTest() {
2064-
WEX::TestExecution::SetVerifyOutput VerifySettings(
2065-
WEX::TestExecution::VerifyOutputSettings::LogOnlyFailures);
2066-
2063+
UINT getWaveSize() {
20672064
UINT WaveSize = 0;
20682065

20692066
if (OverrideWaveLaneCount > 0) {
@@ -2081,8 +2078,15 @@ class TestClassCommon {
20812078
DXASSERT_NOMSG(WaveSize > 0);
20822079
DXASSERT((WaveSize & (WaveSize - 1)) == 0, "must be a power of 2");
20832080

2081+
return WaveSize;
2082+
}
2083+
2084+
template <typename T, OpType OP> void runWaveOpTest() {
2085+
WEX::TestExecution::SetVerifyOutput VerifySettings(
2086+
WEX::TestExecution::VerifyOutputSettings::LogOnlyFailures);
2087+
20842088
dispatchWaveOpTest<T, OP>(D3DDevice, VerboseLogging, OverrideInputSize,
2085-
WaveSize);
2089+
getWaveSize());
20862090
}
20872091

20882092
template <typename T, OpType OP> void runTest() {
@@ -2104,25 +2108,8 @@ class TestClassCommon {
21042108
WEX::TestExecution::SetVerifyOutput VerifySettings(
21052109
WEX::TestExecution::VerifyOutputSettings::LogOnlyFailures);
21062110

2107-
UINT WaveSize = 0;
2108-
2109-
if (OverrideWaveLaneCount > 0) {
2110-
WaveSize = OverrideWaveLaneCount;
2111-
hlsl_test::LogCommentFmt(
2112-
L"Using overridden WaveLaneCount of %d for this test.", WaveSize);
2113-
} else {
2114-
D3D12_FEATURE_DATA_D3D12_OPTIONS1 WaveOpts;
2115-
VERIFY_SUCCEEDED(D3DDevice->CheckFeatureSupport(
2116-
D3D12_FEATURE_D3D12_OPTIONS1, &WaveOpts, sizeof(WaveOpts)));
2117-
2118-
WaveSize = WaveOpts.WaveLaneCountMin;
2119-
}
2120-
2121-
DXASSERT_NOMSG(WaveSize > 0);
2122-
DXASSERT((WaveSize & (WaveSize - 1)) == 0, "must be a power of 2");
2123-
21242111
dispatchMinPrecisionWaveOpTest<T, OP>(D3DDevice, VerboseLogging,
2125-
OverrideInputSize, WaveSize);
2112+
OverrideInputSize, getWaveSize());
21262113
}
21272114

21282115
protected:
@@ -2897,7 +2884,7 @@ class DxilConf_SM69_Vectorized_Core : public TestClassCommon {
28972884
HLK_WAVEOP_TEST(WaveMultiPrefixProduct, float);
28982885
HLK_WAVEOP_TEST(WaveMatch, float);
28992886

2900-
// ---- HLSLMin16Float_t (mirrors HLSLHalf_t) ----
2887+
// ---- HLSLMin16Float_t (mirrors applicable HLSLHalf_t ops) ----
29012888

29022889
// TernaryMath
29032890
HLK_MIN_PRECISION_TEST(Mad, HLSLMin16Float_t);
@@ -3014,7 +3001,7 @@ class DxilConf_SM69_Vectorized_Core : public TestClassCommon {
30143001
HLK_MIN_PRECISION_WAVEOP_TEST(WaveMultiPrefixProduct, HLSLMin16Float_t);
30153002
HLK_MIN_PRECISION_WAVEOP_TEST(WaveMatch, HLSLMin16Float_t);
30163003

3017-
// ---- HLSLMin16Int_t (mirrors int16_t) ----
3004+
// ---- HLSLMin16Int_t (mirrors applicable int16_t ops) ----
30183005

30193006
// TernaryMath
30203007
HLK_MIN_PRECISION_TEST(Mad, HLSLMin16Int_t);
@@ -3110,7 +3097,7 @@ class DxilConf_SM69_Vectorized_Core : public TestClassCommon {
31103097
HLK_MIN_PRECISION_WAVEOP_TEST(WaveMultiPrefixBitXor, HLSLMin16Int_t);
31113098
HLK_MIN_PRECISION_WAVEOP_TEST(WaveMatch, HLSLMin16Int_t);
31123099

3113-
// ---- HLSLMin16Uint_t (mirrors uint16_t) ----
3100+
// ---- HLSLMin16Uint_t (mirrors applicable uint16_t ops) ----
31143101

31153102
// TernaryMath
31163103
HLK_MIN_PRECISION_TEST(Mad, HLSLMin16Uint_t);

0 commit comments

Comments
 (0)