|
3 | 3 | #include "nbl/application_templates/MonoAssetManagerAndBuiltinResourceApplication.hpp" |
4 | 4 | #include "app_resources/common.hlsl" |
5 | 5 | #include "nbl/builtin/hlsl/workgroup2/arithmetic_config.hlsl" |
| 6 | +#include "nbl/builtin/hlsl/subgroup2/arithmetic_params.hlsl" |
6 | 7 |
|
7 | 8 | using namespace nbl; |
8 | 9 | using namespace core; |
@@ -549,55 +550,50 @@ class ArithmeticBenchApp final : public examples::SimpleWindowedApplication, pub |
549 | 550 | smart_refctd_ptr<ICPUShader> overriddenUnspecialized; |
550 | 551 | if constexpr (WorkgroupBench) |
551 | 552 | { |
552 | | - const std::string definitions[7] = { |
| 553 | + const std::string definitions[4] = { |
553 | 554 | "workgroup2::" + arith_name, |
554 | | - std::to_string(workgroupSizeLog2), |
555 | | - std::to_string(itemsPerWG), |
556 | | - std::to_string(itemsPerInvoc), |
557 | | - std::to_string(subgroupSizeLog2), |
| 555 | + wgConfig.getConfigTemplateStructString(), |
558 | 556 | std::to_string(numLoops), |
559 | 557 | std::to_string(arith_name=="reduction") |
560 | 558 | }; |
561 | 559 |
|
562 | | - const IShaderCompiler::SMacroDefinition defines[8] = { |
| 560 | + const IShaderCompiler::SMacroDefinition defines[5] = { |
563 | 561 | { "OPERATION", definitions[0] }, |
564 | | - { "WORKGROUP_SIZE_LOG2", definitions[1] }, |
565 | | - { "ITEMS_PER_WG", definitions[2] }, |
566 | | - { "ITEMS_PER_INVOCATION", definitions[3] }, |
567 | | - { "SUBGROUP_SIZE_LOG2", definitions[4] }, |
568 | | - { "NUM_LOOPS", definitions[5] }, |
569 | | - { "IS_REDUCTION", definitions[6] }, |
| 562 | + { "WORKGROUP_CONFIG_T", definitions[1] }, |
| 563 | + { "NUM_LOOPS", definitions[2] }, |
| 564 | + { "IS_REDUCTION", definitions[3] }, |
570 | 565 | { "TEST_NATIVE", "1" } |
571 | 566 | }; |
572 | 567 | if (UseNativeArithmetic) |
573 | | - options.preprocessorOptions.extraDefines = { defines, defines + 8 }; |
| 568 | + options.preprocessorOptions.extraDefines = { defines, defines + 5 }; |
574 | 569 | else |
575 | | - options.preprocessorOptions.extraDefines = { defines, defines + 7 }; |
| 570 | + options.preprocessorOptions.extraDefines = { defines, defines + 4 }; |
576 | 571 |
|
577 | 572 | overriddenUnspecialized = compiler->compileToSPIRV((const char*)source->getContent()->getPointer(), options); |
578 | 573 | } |
579 | 574 | else |
580 | 575 | { |
581 | | - const std::string definitions[5] = { |
| 576 | + hlsl::subgroup2::SArithmeticParams sgParams; |
| 577 | + sgParams.init(subgroupSizeLog2, itemsPerInvoc); |
| 578 | + |
| 579 | + const std::string definitions[4] = { |
582 | 580 | "subgroup2::" + arith_name, |
583 | 581 | std::to_string(workgroupSize), |
584 | | - std::to_string(itemsPerInvoc), |
585 | | - std::to_string(subgroupSizeLog2), |
| 582 | + sgParams.getParamTemplateStructString(), |
586 | 583 | std::to_string(numLoops) |
587 | 584 | }; |
588 | 585 |
|
589 | | - const IShaderCompiler::SMacroDefinition defines[6] = { |
| 586 | + const IShaderCompiler::SMacroDefinition defines[5] = { |
590 | 587 | { "OPERATION", definitions[0] }, |
591 | 588 | { "WORKGROUP_SIZE", definitions[1] }, |
592 | | - { "ITEMS_PER_INVOCATION", definitions[2] }, |
593 | | - { "SUBGROUP_SIZE_LOG2", definitions[3] }, |
594 | | - { "NUM_LOOPS", definitions[4] }, |
| 589 | + { "SUBGROUP_CONFIG_T", definitions[2] }, |
| 590 | + { "NUM_LOOPS", definitions[3] }, |
595 | 591 | { "TEST_NATIVE", "1" } |
596 | 592 | }; |
597 | 593 | if (UseNativeArithmetic) |
598 | | - options.preprocessorOptions.extraDefines = { defines, defines + 6 }; |
599 | | - else |
600 | 594 | options.preprocessorOptions.extraDefines = { defines, defines + 5 }; |
| 595 | + else |
| 596 | + options.preprocessorOptions.extraDefines = { defines, defines + 4 }; |
601 | 597 |
|
602 | 598 | overriddenUnspecialized = compiler->compileToSPIRV((const char*)source->getContent()->getPointer(), options); |
603 | 599 | } |
|
0 commit comments