22#include " nbl/application_templates/MonoAssetManagerAndBuiltinResourceApplication.hpp"
33#include " app_resources/common.hlsl"
44#include " nbl/builtin/hlsl/workgroup2/arithmetic_config.hlsl"
5+ #include " nbl/builtin/hlsl/subgroup2/arithmetic_params.hlsl"
56
67using namespace nbl ;
78using namespace core ;
@@ -186,7 +187,7 @@ class Workgroup2ScanTestApp final : public application_templates::BasicMultiQueu
186187 for (auto subgroupSize = MinSubgroupSize; subgroupSize <= MaxSubgroupSize; subgroupSize *= 2u )
187188 {
188189 const uint8_t subgroupSizeLog2 = hlsl::findMSB (subgroupSize);
189- for (uint32_t workgroupSize = 64 ; workgroupSize <= MaxWorkgroupSize; workgroupSize *= 2u )
190+ for (uint32_t workgroupSize = subgroupSize ; workgroupSize <= MaxWorkgroupSize; workgroupSize *= 2u )
190191 {
191192 // make sure renderdoc captures everything for debugging
192193 m_api->startCapture ();
@@ -198,12 +199,12 @@ class Workgroup2ScanTestApp final : public application_templates::BasicMultiQueu
198199 uint32_t itemsPerWG = workgroupSize * itemsPerInvocation;
199200 m_logger->log (" Testing Items per Invocation %u" , ILogger::ELL_INFO, itemsPerInvocation);
200201 bool passed = true ;
201- // passed = runTest<emulatedReduction, false>(subgroupTestSource, elementCount, subgroupSizeLog2, workgroupSize, bool(useNative), itemsPerWG, itemsPerInvocation) && passed;
202- // logTestOutcome(passed, itemsPerWG);
203- // passed = runTest<emulatedScanInclusive, false>(subgroupTestSource, elementCount, subgroupSizeLog2, workgroupSize, bool(useNative), itemsPerWG, itemsPerInvocation) && passed;
204- // logTestOutcome(passed, itemsPerWG);
205- // passed = runTest<emulatedScanExclusive, false>(subgroupTestSource, elementCount, subgroupSizeLog2, workgroupSize, bool(useNative), itemsPerWG, itemsPerInvocation) && passed;
206- // logTestOutcome(passed, itemsPerWG);
202+ passed = runTest<emulatedReduction, false >(subgroupTestSource, elementCount, subgroupSizeLog2, workgroupSize, bool (useNative), itemsPerWG, itemsPerInvocation) && passed;
203+ logTestOutcome (passed, itemsPerWG);
204+ passed = runTest<emulatedScanInclusive, false >(subgroupTestSource, elementCount, subgroupSizeLog2, workgroupSize, bool (useNative), itemsPerWG, itemsPerInvocation) && passed;
205+ logTestOutcome (passed, itemsPerWG);
206+ passed = runTest<emulatedScanExclusive, false >(subgroupTestSource, elementCount, subgroupSizeLog2, workgroupSize, bool (useNative), itemsPerWG, itemsPerInvocation) && passed;
207+ logTestOutcome (passed, itemsPerWG);
207208
208209 hlsl::workgroup2::SArithmeticConfiguration wgConfig;
209210 wgConfig.init (hlsl::findMSB (workgroupSize), subgroupSizeLog2, itemsPerInvocation);
@@ -331,24 +332,25 @@ class Workgroup2ScanTestApp final : public application_templates::BasicMultiQueu
331332 }
332333 else
333334 {
334- const std::string definitions[4 ] = {
335+ hlsl::subgroup2::SArithmeticParams sgParams;
336+ sgParams.init (subgroupSizeLog2, itemsPerInvoc);
337+
338+ const std::string definitions[3 ] = {
335339 " subgroup2::" + arith_name,
336340 std::to_string (workgroupSize),
337- std::to_string (itemsPerInvoc),
338- std::to_string (subgroupSizeLog2)
341+ sgParams.getParamTemplateStructString ()
339342 };
340343
341- const IShaderCompiler::SMacroDefinition defines[5 ] = {
344+ const IShaderCompiler::SMacroDefinition defines[4 ] = {
342345 { " OPERATION" , definitions[0 ] },
343346 { " WORKGROUP_SIZE" , definitions[1 ] },
344- { " ITEMS_PER_INVOCATION" , definitions[2 ] },
345- { " SUBGROUP_SIZE_LOG2" , definitions[3 ] },
347+ { " SUBGROUP_CONFIG_T" , definitions[2 ] },
346348 { " TEST_NATIVE" , " 1" }
347349 };
348350 if (useNative)
349- options.preprocessorOptions .extraDefines = { defines, defines + 5 };
350- else
351351 options.preprocessorOptions .extraDefines = { defines, defines + 4 };
352+ else
353+ options.preprocessorOptions .extraDefines = { defines, defines + 3 };
352354
353355 overriddenUnspecialized = compiler->compileToSPIRV ((const char *)source->getContent ()->getPointer (), options);
354356 }
0 commit comments