@@ -10622,18 +10622,54 @@ void ExecutionTest::WaveSizeRangeTest() {
1062210622 m_support);
1062310623}
1062410624
10625+ // Helper: run a GroupSharedLimit shader op test, read back UAV, and verify
10626+ // that the output buffer contains sequential uint values [0, GsmDwords).
10627+ static void RunGSMLimitShaderAndVerify (
10628+ ID3D12Device *Device, dxc::DxcDllSupport &Support, LPCSTR OpName,
10629+ const char *ShaderText, UINT GsmDwords, UINT ShaderIndex,
10630+ std::shared_ptr<st::ShaderOpSet> ShaderOpSet) {
10631+ std::shared_ptr<st::ShaderOpTestResult> Test =
10632+ st::RunShaderOpTestAfterParse (
10633+ Device, Support, OpName,
10634+ [&](LPCSTR Name, std::vector<BYTE> &Data, st::ShaderOp *Op) {
10635+ VERIFY_IS_TRUE ((0 == strncmp (Name, " UAVBuffer0" , 10 )));
10636+ Op->Shaders .at (ShaderIndex).Text = ShaderText;
10637+ Data.resize (sizeof (uint32_t ) * GsmDwords);
10638+ memset (Data.data (), 0 , Data.size ());
10639+ },
10640+ ShaderOpSet);
10641+
10642+ MappedData DataUav;
10643+ Test->Test ->GetReadBackData (" UAVBuffer0" , &DataUav);
10644+ const uint32_t *OutData = (const uint32_t *)DataUav.data ();
10645+
10646+ for (UINT I = 0 ; I < GsmDwords; I++) {
10647+ VERIFY_ARE_EQUAL (OutData[I], I);
10648+ }
10649+ }
10650+
1062510651void ExecutionTest::GroupSharedLimitTest () {
1062610652 WEX::TestExecution::SetVerifyOutput VerifySettings (
1062710653 WEX::TestExecution::VerifyOutputSettings::LogOnlyFailures);
1062810654
10655+ bool FailIfRequirementsNotMet = false ;
10656+ #ifdef _HLK_CONF
10657+ FailIfRequirementsNotMet = true ;
10658+ #endif
10659+ WEX::TestExecution::RuntimeParameters::TryGetValue (
10660+ L" FailIfRequirementsNotMet" , FailIfRequirementsNotMet);
10661+
1062910662 CComPtr<ID3D12Device> Device;
1063010663 // GroupSharedLimit requires SM 6.10 (DXIL 1.10).
10631- if (!createDevice (&Device, D3D_SHADER_MODEL_6_10,
10632- /* skipUnsupported*/ false )) {
10664+ const bool SkipUnsupported = !FailIfRequirementsNotMet;
10665+ if (!createDevice (&Device, D3D_SHADER_MODEL_6_10, SkipUnsupported)) {
10666+ if (FailIfRequirementsNotMet)
10667+ LogErrorFmt (L" Device creation failed, resulting in test failure, since "
10668+ L" FailIfRequirementsNotMet is set." );
1063310669 return ;
1063410670 }
1063510671
10636- UINT MaxGSMCS = getMaxGroupSharedMemoryCS (Device);
10672+ const UINT MaxGSMCS = getMaxGroupSharedMemoryCS (Device);
1063710673 LogCommentFmt (L" Device MaxGroupSharedMemoryPerGroupCS: %u bytes" , MaxGSMCS);
1063810674
1063910675 // Read shader config
@@ -10647,13 +10683,10 @@ void ExecutionTest::GroupSharedLimitTest() {
1064710683 // Use 4096 DWORDs (16384 bytes) of TGSM with a limit of 16384 bytes.
1064810684 {
1064910685 static const UINT GSM_DWORDS = 4096 ;
10650- static const UINT NUM_THREADS = 64 ;
1065110686
1065210687 LogCommentFmt (L" Test 1: GroupSharedLimit == usage (16384 bytes). "
1065310688 L" Shader should compile and execute successfully." );
1065410689
10655- // All threads cooperatively fill g_shared, then thread 0 copies
10656- // the entire contents to the output buffer for verification.
1065710690 static const char Shader[] =
1065810691 R"(
1065910692 #define GSM_DWORDS 4096
@@ -10664,35 +10697,17 @@ void ExecutionTest::GroupSharedLimitTest() {
1066410697 [GroupSharedLimit(16384)]
1066510698 [numthreads(NUM_THREADS, 1, 1)]
1066610699 void main(uint GI : SV_GroupIndex) {
10667- // Each thread writes multiple elements to fill the array.
1066810700 for (uint i = GI; i < GSM_DWORDS; i += NUM_THREADS)
1066910701 g_shared[i] = i;
1067010702 GroupMemoryBarrierWithGroupSync();
10671- // Thread 0 copies all of groupshared memory to the output.
1067210703 if (GI == 0) {
1067310704 for (uint j = 0; j < GSM_DWORDS; j++)
1067410705 g_output[j] = g_shared[j];
1067510706 }
1067610707 })" ;
1067710708
10678- std::shared_ptr<st::ShaderOpTestResult> Test =
10679- st::RunShaderOpTestAfterParse (
10680- Device, m_support, " GroupSharedLimitTest" ,
10681- [&](LPCSTR Name, std::vector<BYTE> &Data, st::ShaderOp *Op) {
10682- VERIFY_IS_TRUE ((0 == strncmp (Name, " UAVBuffer0" , 10 )));
10683- Op->Shaders .at (0 ).Text = Shader;
10684- Data.resize (sizeof (uint32_t ) * GSM_DWORDS);
10685- memset (Data.data (), 0 , Data.size ());
10686- },
10687- ShaderOpSet);
10688-
10689- MappedData DataUav;
10690- Test->Test ->GetReadBackData (" UAVBuffer0" , &DataUav);
10691- uint32_t *OutData = (uint32_t *)DataUav.data ();
10692-
10693- for (UINT I = 0 ; I < GSM_DWORDS; I++) {
10694- VERIFY_ARE_EQUAL (OutData[I], I);
10695- }
10709+ RunGSMLimitShaderAndVerify (Device, m_support, " GroupSharedLimitTest" ,
10710+ Shader, GSM_DWORDS, 0 , ShaderOpSet);
1069610711 LogCommentFmt (L" Test 1 passed: GroupSharedLimit == usage succeeded." );
1069710712 }
1069810713
@@ -10704,7 +10719,6 @@ void ExecutionTest::GroupSharedLimitTest() {
1070410719 MaxGSMCS);
1070510720 } else {
1070610721 static const UINT GSM_DWORDS = 9216 ;
10707- static const UINT NUM_THREADS = 64 ;
1070810722
1070910723 LogCommentFmt (L" Test 2: GroupSharedLimit (36864) > usage (36864 bytes), "
1071010724 L" both above default (32768). "
@@ -10729,32 +10743,15 @@ void ExecutionTest::GroupSharedLimitTest() {
1072910743 }
1073010744 })" ;
1073110745
10732- std::shared_ptr<st::ShaderOpTestResult> Test =
10733- st::RunShaderOpTestAfterParse (
10734- Device, m_support, " GroupSharedLimitTest" ,
10735- [&](LPCSTR Name, std::vector<BYTE> &Data, st::ShaderOp *Op) {
10736- VERIFY_IS_TRUE ((0 == strncmp (Name, " UAVBuffer0" , 10 )));
10737- Op->Shaders .at (0 ).Text = Shader;
10738- Data.resize (sizeof (uint32_t ) * GSM_DWORDS);
10739- memset (Data.data (), 0 , Data.size ());
10740- },
10741- ShaderOpSet);
10742-
10743- MappedData DataUav;
10744- Test->Test ->GetReadBackData (" UAVBuffer0" , &DataUav);
10745- uint32_t *OutData = (uint32_t *)DataUav.data ();
10746-
10747- for (UINT I = 0 ; I < GSM_DWORDS; I++) {
10748- VERIFY_ARE_EQUAL (OutData[I], I);
10749- }
10746+ RunGSMLimitShaderAndVerify (Device, m_support, " GroupSharedLimitTest" ,
10747+ Shader, GSM_DWORDS, 0 , ShaderOpSet);
1075010748 LogCommentFmt (L" Test 2 passed: GroupSharedLimit > default succeeded." );
1075110749 }
1075210750
1075310751 // Test 3: No GroupSharedLimit attribute, usage within default (32768 bytes).
1075410752 // The shader should use default limit and succeed.
1075510753 {
1075610754 static const UINT GSM_DWORDS = 8192 ;
10757- static const UINT NUM_THREADS = 64 ;
1075810755
1075910756 LogCommentFmt (L" Test 3: No GroupSharedLimit, usage (32768 bytes) <= "
1076010757 L" default limit. Shader should succeed." );
@@ -10777,24 +10774,8 @@ void ExecutionTest::GroupSharedLimitTest() {
1077710774 }
1077810775 })" ;
1077910776
10780- std::shared_ptr<st::ShaderOpTestResult> Test =
10781- st::RunShaderOpTestAfterParse (
10782- Device, m_support, " GroupSharedLimitTest" ,
10783- [&](LPCSTR Name, std::vector<BYTE> &Data, st::ShaderOp *Op) {
10784- VERIFY_IS_TRUE ((0 == strncmp (Name, " UAVBuffer0" , 10 )));
10785- Op->Shaders .at (0 ).Text = Shader;
10786- Data.resize (sizeof (uint32_t ) * GSM_DWORDS);
10787- memset (Data.data (), 0 , Data.size ());
10788- },
10789- ShaderOpSet);
10790-
10791- MappedData DataUav;
10792- Test->Test ->GetReadBackData (" UAVBuffer0" , &DataUav);
10793- uint32_t *OutData = (uint32_t *)DataUav.data ();
10794-
10795- for (UINT I = 0 ; I < GSM_DWORDS; I++) {
10796- VERIFY_ARE_EQUAL (OutData[I], I);
10797- }
10777+ RunGSMLimitShaderAndVerify (Device, m_support, " GroupSharedLimitTest" ,
10778+ Shader, GSM_DWORDS, 0 , ShaderOpSet);
1079810779 LogCommentFmt (L" Test 3 passed: No attribute with default usage succeeded." );
1079910780 }
1080010781}
@@ -10803,9 +10784,19 @@ void ExecutionTest::GroupSharedLimitASTest() {
1080310784 WEX::TestExecution::SetVerifyOutput VerifySettings (
1080410785 WEX::TestExecution::VerifyOutputSettings::LogOnlyFailures);
1080510786
10787+ bool FailIfRequirementsNotMet = false ;
10788+ #ifdef _HLK_CONF
10789+ FailIfRequirementsNotMet = true ;
10790+ #endif
10791+ WEX::TestExecution::RuntimeParameters::TryGetValue (
10792+ L" FailIfRequirementsNotMet" , FailIfRequirementsNotMet);
10793+
1080610794 CComPtr<ID3D12Device> Device;
10807- if (!createDevice (&Device, D3D_SHADER_MODEL_6_10,
10808- /* skipUnsupported*/ false )) {
10795+ const bool SkipUnsupported = !FailIfRequirementsNotMet;
10796+ if (!createDevice (&Device, D3D_SHADER_MODEL_6_10, SkipUnsupported)) {
10797+ if (FailIfRequirementsNotMet)
10798+ LogErrorFmt (L" Device creation failed, resulting in test failure, since "
10799+ L" FailIfRequirementsNotMet is set." );
1080910800 return ;
1081010801 }
1081110802
@@ -10815,7 +10806,7 @@ void ExecutionTest::GroupSharedLimitASTest() {
1081510806 return ;
1081610807 }
1081710808
10818- UINT MaxGSMAS = getMaxGroupSharedMemoryAS (Device);
10809+ const UINT MaxGSMAS = getMaxGroupSharedMemoryAS (Device);
1081910810 LogCommentFmt (L" Device MaxGroupSharedMemoryPerGroupAS: %u bytes" , MaxGSMAS);
1082010811
1082110812 CComPtr<IStream> Stream;
@@ -10869,24 +10860,8 @@ void ExecutionTest::GroupSharedLimitASTest() {
1086910860 float4 PSMain() : SV_Target { return float4(0,0,0,0); }
1087010861 )" ;
1087110862
10872- std::shared_ptr<st::ShaderOpTestResult> Test =
10873- st::RunShaderOpTestAfterParse (
10874- Device, m_support, " GroupSharedLimitASTest" ,
10875- [&](LPCSTR Name, std::vector<BYTE> &Data, st::ShaderOp *Op) {
10876- VERIFY_IS_TRUE ((0 == strncmp (Name, " UAVBuffer0" , 10 )));
10877- Op->Shaders .at (0 ).Text = Shader;
10878- Data.resize (sizeof (uint32_t ) * GSM_DWORDS);
10879- memset (Data.data (), 0 , Data.size ());
10880- },
10881- ShaderOpSet);
10882-
10883- MappedData DataUav;
10884- Test->Test ->GetReadBackData (" UAVBuffer0" , &DataUav);
10885- uint32_t *OutData = (uint32_t *)DataUav.data ();
10886-
10887- for (UINT I = 0 ; I < GSM_DWORDS; I++) {
10888- VERIFY_ARE_EQUAL (OutData[I], I);
10889- }
10863+ RunGSMLimitShaderAndVerify (Device, m_support, " GroupSharedLimitASTest" ,
10864+ Shader, GSM_DWORDS, 0 , ShaderOpSet);
1089010865 LogCommentFmt (
1089110866 L" AS Test passed: GroupSharedLimit in amplification shader succeeded." );
1089210867 }
@@ -10896,9 +10871,19 @@ void ExecutionTest::GroupSharedLimitMSTest() {
1089610871 WEX::TestExecution::SetVerifyOutput VerifySettings (
1089710872 WEX::TestExecution::VerifyOutputSettings::LogOnlyFailures);
1089810873
10874+ bool FailIfRequirementsNotMet = false ;
10875+ #ifdef _HLK_CONF
10876+ FailIfRequirementsNotMet = true ;
10877+ #endif
10878+ WEX::TestExecution::RuntimeParameters::TryGetValue (
10879+ L" FailIfRequirementsNotMet" , FailIfRequirementsNotMet);
10880+
1089910881 CComPtr<ID3D12Device> Device;
10900- if (!createDevice (&Device, D3D_SHADER_MODEL_6_10,
10901- /* skipUnsupported*/ false )) {
10882+ const bool SkipUnsupported = !FailIfRequirementsNotMet;
10883+ if (!createDevice (&Device, D3D_SHADER_MODEL_6_10, SkipUnsupported)) {
10884+ if (FailIfRequirementsNotMet)
10885+ LogErrorFmt (L" Device creation failed, resulting in test failure, since "
10886+ L" FailIfRequirementsNotMet is set." );
1090210887 return ;
1090310888 }
1090410889
@@ -10908,7 +10893,7 @@ void ExecutionTest::GroupSharedLimitMSTest() {
1090810893 return ;
1090910894 }
1091010895
10911- UINT MaxGSMMS = getMaxGroupSharedMemoryMS (Device);
10896+ const UINT MaxGSMMS = getMaxGroupSharedMemoryMS (Device);
1091210897 LogCommentFmt (L" Device MaxGroupSharedMemoryPerGroupMS: %u bytes" , MaxGSMMS);
1091310898
1091410899 CComPtr<IStream> Stream;
@@ -10953,24 +10938,8 @@ void ExecutionTest::GroupSharedLimitMSTest() {
1095310938 float4 PSMain() : SV_Target { return float4(0,0,0,0); }
1095410939 )" ;
1095510940
10956- std::shared_ptr<st::ShaderOpTestResult> Test =
10957- st::RunShaderOpTestAfterParse (
10958- Device, m_support, " GroupSharedLimitMSTest" ,
10959- [&](LPCSTR Name, std::vector<BYTE> &Data, st::ShaderOp *Op) {
10960- VERIFY_IS_TRUE ((0 == strncmp (Name, " UAVBuffer0" , 10 )));
10961- Op->Shaders .at (0 ).Text = Shader;
10962- Data.resize (sizeof (uint32_t ) * GSM_DWORDS);
10963- memset (Data.data (), 0 , Data.size ());
10964- },
10965- ShaderOpSet);
10966-
10967- MappedData DataUav;
10968- Test->Test ->GetReadBackData (" UAVBuffer0" , &DataUav);
10969- uint32_t *OutData = (uint32_t *)DataUav.data ();
10970-
10971- for (UINT I = 0 ; I < GSM_DWORDS; I++) {
10972- VERIFY_ARE_EQUAL (OutData[I], I);
10973- }
10941+ RunGSMLimitShaderAndVerify (Device, m_support, " GroupSharedLimitMSTest" ,
10942+ Shader, GSM_DWORDS, 0 , ShaderOpSet);
1097410943 LogCommentFmt (
1097510944 L" MS Test passed: GroupSharedLimit in mesh shader succeeded." );
1097610945 }
0 commit comments