| // Copyright 2025 The Dawn & Tint Authors |
| // |
| // Redistribution and use in source and binary forms, with or without |
| // modification, are permitted provided that the following conditions are met: |
| // |
| // 1. Redistributions of source code must retain the above copyright notice, this |
| // list of conditions and the following disclaimer. |
| // |
| // 2. Redistributions in binary form must reproduce the above copyright notice, |
| // this list of conditions and the following disclaimer in the documentation |
| // and/or other materials provided with the distribution. |
| // |
| // 3. Neither the name of the copyright holder nor the names of its |
| // contributors may be used to endorse or promote products derived from |
| // this software without specific prior written permission. |
| // |
| // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
| // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| |
| //////////////////////////////////////////////////////////////////////////////// |
| // File generated by 'tools/src/cmd/gen' using the template: |
| // src/tint/cmd/bench/enums_wgsl_bench.cc.tmpl |
| // |
| // To regenerate run: './tools/run gen' |
| // |
| // Do not modify this file directly |
| //////////////////////////////////////////////////////////////////////////////// |
| |
| // clang-format off |
| |
| #include <array> |
| |
| #include "benchmark/benchmark.h" |
| #include "src/tint/lang/wgsl/enums.h" |
| |
| namespace tint::wgsl { |
| namespace { |
| |
| void CoreDiagnosticRuleParser(::benchmark::State& state) { |
| const char* kStrings[] = { |
| "deriative_unccformity", |
| "dlivative_3iformiy", |
| "derivative_uniforVity", |
| "derivative_uniformity", |
| "derivative_uniform1ty", |
| "derivativeJunifqrmity", |
| "derivative_unifllrmit77", |
| "subgopppqquniformitHH", |
| "subgrou_cformity", |
| "subgGoup_unifombty", |
| "subgroup_uniformity", |
| "suvgroup_uniformiiiy", |
| "subgroWWp8uniformity", |
| "subgroup_uifoxxmiMy", |
| }; |
| for (auto _ : state) { |
| for (auto* str : kStrings) { |
| auto result = ParseCoreDiagnosticRule(str); |
| benchmark::DoNotOptimize(result); |
| } |
| } |
| } // NOLINT(readability/fn_size) |
| |
| BENCHMARK(CoreDiagnosticRuleParser); |
| void ChromiumDiagnosticRuleParser(::benchmark::State& state) { |
| const char* kStrings[] = { |
| "sbgroup_ggatrix_uniformXty", |
| "suVroup_matrx_uniforXitu", |
| "subgroup_ma3rix_uniformity", |
| "subgroup_matrix_uniformity", |
| "subgroup_matrix_uniformitE", |
| "subgroup_atrix_uniTTPormity", |
| "suxxdgroup_matri_uniformity", |
| "44nreachable_code", |
| "unreaVVhabSSe_code", |
| "unre22chabR_Rode", |
| "unreachable_code", |
| "nFeachable_9ode", |
| "unrachable_code", |
| "VnreacaRRlH_OOode", |
| }; |
| for (auto _ : state) { |
| for (auto* str : kStrings) { |
| auto result = ParseChromiumDiagnosticRule(str); |
| benchmark::DoNotOptimize(result); |
| } |
| } |
| } // NOLINT(readability/fn_size) |
| |
| BENCHMARK(ChromiumDiagnosticRuleParser); |
| void DiagnosticSeverityParser(::benchmark::State& state) { |
| const char* kStrings[] = { |
| "rryr", |
| "n77rrlrGr", |
| "erro40", |
| "error", |
| "oor", |
| "erzz", |
| "1ippor", |
| "XXnfo", |
| "55nII9nn", |
| "iSSfHHaa", |
| "info", |
| "kk", |
| "gRR", |
| "ib", |
| "ojf", |
| "of", |
| "q", |
| "off", |
| "oNN", |
| "ov", |
| "Qff", |
| "waffir", |
| "warnijg", |
| "wNNwnin8", |
| "warning", |
| "waring", |
| "wrrrning", |
| "Garning", |
| }; |
| for (auto _ : state) { |
| for (auto* str : kStrings) { |
| auto result = ParseDiagnosticSeverity(str); |
| benchmark::DoNotOptimize(result); |
| } |
| } |
| } // NOLINT(readability/fn_size) |
| |
| BENCHMARK(DiagnosticSeverityParser); |
| void ExtensionParser(::benchmark::State& state) { |
| const char* kStrings[] = { |
| "atomic_vec2u_min_FFax", |
| "aEmicvec2u_in_max", |
| "arroic_vec2u_min_max", |
| "atomic_vec2u_min_max", |
| "atomicvc2u_min_max", |
| "atmiD_XecJJu_min_max", |
| "atmic_vec2uminmax", |
| "chromkm_is11ble_unifrmity_analysis", |
| "chrmium_disable_uniformity_analysis", |
| "chromium_disabe_uniformity_analyJis", |
| "chromium_disable_uniformity_analysis", |
| "chromium_disable_uniformcty_analysis", |
| "chromium_disable_uniformity_analysOs", |
| "chromium_disttble_un__formitvv_KKnalysis", |
| "chromium_epxxrimenta8_barycentric_co5rd", |
| "chromim_experimental_baryc__ntric_qqorF", |
| "chromium_exerimental_bqqrycentric_coord", |
| "chromium_experimental_barycentric_coord", |
| "h66omiu33_experimenOal_barycentric_coord", |
| "ch6ottiumooexperQQmental_baryce9tric_coord", |
| "chomium_experimen66al_barycentric_coord", |
| "hromxum_experimental_zzr66mebufferOfetch", |
| "chromium_experimental_framebyyffer_fetch", |
| "chrmium_experimental_fraeHHuffer_feZch", |
| "chromium_experimental_framebuffer_fetch", |
| "chromium_expeimeWWtal_framebuq4fer_fetch", |
| "chromium_experimental_fOOamebuffer_etch", |
| "chroomium_experimntalhframebuffr_fetcY", |
| "chomium_experiental_pixel_loca", |
| "chromum_experimental_pixel_lFcal", |
| "chromium_expewimentalpixel_local", |
| "chromium_experimental_pixel_local", |
| "chromffum_expeKmentG_pixel_local", |
| "chromiuq_KKxperimental_pixel_local", |
| "chromium_eFpe3imental_mmixel_local", |
| "chromium_experimental_reource_table", |
| "chromium_experimentalresourcq_table", |
| "chromium_ebbprimental_resource_table", |
| "chromium_experimental_resource_table", |
| "chromium_expirimental_resource_tabe", |
| "chromium_experimentl_resoOOrce_tablq", |
| "chromium_experimental_TTvvsource_table", |
| "chromium_experimental_subgrouFF_matrix", |
| "chromifm_experimenta00PsubgroQp_mtrix", |
| "chromium_experPmental_subgroup_matrix", |
| "chromium_experimental_subgroup_matrix", |
| "cssomium_experimental_subgroup_mat77ix", |
| "chromium_exbberimenCal_subgroup_mRRtrix", |
| "chromium_experimental_subgroup_mXXtrix", |
| "chOOomOCCum_interna_iqput_attachments", |
| "chosium_iuternal_input_attachmentL", |
| "chromium_internXl_input_attachments", |
| "chromium_internal_input_attachments", |
| "chromium_internal_input_attachmets", |
| "chomium_interna_input_tOachmenqqs", |
| "chromium_internal_i22put_attachments", |
| "clip_is0yzzceXX", |
| "clip_ditaVPies", |
| "clp_distnnnCes", |
| "clip_distances", |
| "clip_disqanceHA", |
| "clip_dstances", |
| "flidistKKnces", |
| "dul_sourceggbPnding", |
| "dua_source_blending", |
| "duNl_sourcec4lenTTing", |
| "dual_source_blending", |
| "dual_sppurce_blendin7", |
| "dul_zzgurce_NNlendig", |
| "bXXual_suuurce_bnding", |
| "f6", |
| "88", |
| "9q", |
| "f16", |
| "f116", |
| "f122", |
| "776", |
| "primitNN2e_indx", |
| "primitVVve_index", |
| "FrimiWWive_inw11x", |
| "primitive_index", |
| "primitvewwindex", |
| "pDimitive_index", |
| "primitiv_indeK", |
| "subgrhup_sife_crnPP11ol", |
| "subgroup_sie_control", |
| "subgroupYYsize_control", |
| "subgroup_size_control", |
| "stbgroVp_size_contoHkk", |
| "subgroup_size_contrrol", |
| "subgoupWWsize_cosstrol", |
| "suYroups", |
| "sbgroqpL", |
| "sfbv22rouus", |
| "subgroups", |
| "subgous", |
| "suYgrous", |
| "subyr77upEY", |
| }; |
| for (auto _ : state) { |
| for (auto* str : kStrings) { |
| auto result = ParseExtension(str); |
| benchmark::DoNotOptimize(result); |
| } |
| } |
| } // NOLINT(readability/fn_size) |
| |
| BENCHMARK(ExtensionParser); |
| |
| } // namespace |
| } // namespace tint::wgsl |
| |
| // clang-format on |