Austin Eng | cc2516a | 2023-10-17 20:57:54 +0000 | [diff] [blame] | 1 | // Copyright 2022 The Dawn & Tint Authors |
Ben Clayton | a123b89 | 2022-07-27 16:36:35 +0000 | [diff] [blame] | 2 | // |
Austin Eng | cc2516a | 2023-10-17 20:57:54 +0000 | [diff] [blame] | 3 | // Redistribution and use in source and binary forms, with or without |
| 4 | // modification, are permitted provided that the following conditions are met: |
Ben Clayton | a123b89 | 2022-07-27 16:36:35 +0000 | [diff] [blame] | 5 | // |
Austin Eng | cc2516a | 2023-10-17 20:57:54 +0000 | [diff] [blame] | 6 | // 1. Redistributions of source code must retain the above copyright notice, this |
| 7 | // list of conditions and the following disclaimer. |
Ben Clayton | a123b89 | 2022-07-27 16:36:35 +0000 | [diff] [blame] | 8 | // |
Austin Eng | cc2516a | 2023-10-17 20:57:54 +0000 | [diff] [blame] | 9 | // 2. Redistributions in binary form must reproduce the above copyright notice, |
| 10 | // this list of conditions and the following disclaimer in the documentation |
| 11 | // and/or other materials provided with the distribution. |
| 12 | // |
| 13 | // 3. Neither the name of the copyright holder nor the names of its |
| 14 | // contributors may be used to endorse or promote products derived from |
| 15 | // this software without specific prior written permission. |
| 16 | // |
| 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 19 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 20 | // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
| 21 | // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 22 | // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 23 | // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 24 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 25 | // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Ben Clayton | a123b89 | 2022-07-27 16:36:35 +0000 | [diff] [blame] | 27 | |
| 28 | //////////////////////////////////////////////////////////////////////////////// |
Ben Clayton | 57ded6a | 2023-08-22 13:22:22 +0000 | [diff] [blame] | 29 | // File generated by 'tools/src/cmd/gen' using the template: |
Ben Clayton | cd52f38 | 2023-08-07 13:11:08 +0000 | [diff] [blame] | 30 | // src/tint/lang/core/address_space_bench.cc.tmpl |
Ben Clayton | a123b89 | 2022-07-27 16:36:35 +0000 | [diff] [blame] | 31 | // |
Ben Clayton | 57ded6a | 2023-08-22 13:22:22 +0000 | [diff] [blame] | 32 | // To regenerate run: './tools/run gen' |
| 33 | // |
| 34 | // Do not modify this file directly |
Ben Clayton | a123b89 | 2022-07-27 16:36:35 +0000 | [diff] [blame] | 35 | //////////////////////////////////////////////////////////////////////////////// |
| 36 | |
Ben Clayton | cd52f38 | 2023-08-07 13:11:08 +0000 | [diff] [blame] | 37 | #include "src/tint/lang/core/address_space.h" |
Ben Clayton | a123b89 | 2022-07-27 16:36:35 +0000 | [diff] [blame] | 38 | |
| 39 | #include <array> |
| 40 | |
| 41 | #include "benchmark/benchmark.h" |
| 42 | |
Ben Clayton | cd52f38 | 2023-08-07 13:11:08 +0000 | [diff] [blame] | 43 | namespace tint::core { |
Ben Clayton | a123b89 | 2022-07-27 16:36:35 +0000 | [diff] [blame] | 44 | namespace { |
| 45 | |
dan sinclair | ff7cf21 | 2022-10-03 14:05:23 +0000 | [diff] [blame] | 46 | void AddressSpaceParser(::benchmark::State& state) { |
Ben Clayton | ed3389f | 2023-02-09 23:56:42 +0000 | [diff] [blame] | 47 | const char* kStrings[] = { |
Ben Clayton | 79781f2 | 2023-02-18 17:13:18 +0000 | [diff] [blame] | 48 | "ccin", |
| 49 | "3", |
| 50 | "_Vin", |
| 51 | "__in", |
| 52 | "1_in", |
| 53 | "_qiJ", |
| 54 | "_lli77", |
| 55 | "__qHupp", |
| 56 | "vt", |
| 57 | "G_bt", |
| 58 | "__out", |
| 59 | "__viut", |
| 60 | "__8WWt", |
| 61 | "Mxxou", |
| 62 | "fuXggton", |
| 63 | "fuXtou", |
| 64 | "funct3on", |
| 65 | "function", |
| 66 | "funEtion", |
| 67 | "PPncTTion", |
| 68 | "xxuncddon", |
Ben Clayton | 6cd15d2 | 2023-09-06 10:41:09 +0000 | [diff] [blame] | 69 | "pixe44_local", |
| 70 | "SSVVxel_local", |
| 71 | "pixRR_local", |
| 72 | "pixel_local", |
| 73 | "pixel_lF9a", |
| 74 | "pixel_loca", |
| 75 | "pOOxVRl_locH", |
| 76 | "prvaye", |
| 77 | "llnrrrv77te", |
| 78 | "priv4t00", |
Ben Clayton | 79781f2 | 2023-02-18 17:13:18 +0000 | [diff] [blame] | 79 | "private", |
Ben Clayton | 6cd15d2 | 2023-09-06 10:41:09 +0000 | [diff] [blame] | 80 | "rvooe", |
| 81 | "zzvate", |
| 82 | "piiippa1", |
| 83 | "puXXh_constant", |
| 84 | "pusII9_nn55nstant", |
| 85 | "YusHH_coaastSSrnt", |
Ben Clayton | 79781f2 | 2023-02-18 17:13:18 +0000 | [diff] [blame] | 86 | "push_constant", |
Ben Clayton | 6cd15d2 | 2023-09-06 10:41:09 +0000 | [diff] [blame] | 87 | "pushonkkHan", |
| 88 | "jush_consgRt", |
| 89 | "puh_cobsant", |
| 90 | "storaje", |
| 91 | "torage", |
| 92 | "qrage", |
Ben Clayton | 79781f2 | 2023-02-18 17:13:18 +0000 | [diff] [blame] | 93 | "storage", |
Ben Clayton | 6cd15d2 | 2023-09-06 10:41:09 +0000 | [diff] [blame] | 94 | "stoNNge", |
| 95 | "torgvv", |
| 96 | "QQorage", |
| 97 | "unffor", |
Ben Clayton | 79781f2 | 2023-02-18 17:13:18 +0000 | [diff] [blame] | 98 | "unifojm", |
Ben Clayton | 6cd15d2 | 2023-09-06 10:41:09 +0000 | [diff] [blame] | 99 | "uNNwfor8", |
Ben Clayton | 79781f2 | 2023-02-18 17:13:18 +0000 | [diff] [blame] | 100 | "uniform", |
Ben Clayton | 6cd15d2 | 2023-09-06 10:41:09 +0000 | [diff] [blame] | 101 | "uniorm", |
| 102 | "urriform", |
| 103 | "Gniform", |
| 104 | "workgrFFup", |
| 105 | "Eokgru", |
| 106 | "worrgroup", |
Ben Clayton | 79781f2 | 2023-02-18 17:13:18 +0000 | [diff] [blame] | 107 | "workgroup", |
Ben Clayton | 6cd15d2 | 2023-09-06 10:41:09 +0000 | [diff] [blame] | 108 | "wokgrou", |
| 109 | "woJDkgoup", |
| 110 | "okroup", |
Ben Clayton | a123b89 | 2022-07-27 16:36:35 +0000 | [diff] [blame] | 111 | }; |
| 112 | for (auto _ : state) { |
Ben Clayton | ed3389f | 2023-02-09 23:56:42 +0000 | [diff] [blame] | 113 | for (auto* str : kStrings) { |
dan sinclair | ff7cf21 | 2022-10-03 14:05:23 +0000 | [diff] [blame] | 114 | auto result = ParseAddressSpace(str); |
Ben Clayton | a123b89 | 2022-07-27 16:36:35 +0000 | [diff] [blame] | 115 | benchmark::DoNotOptimize(result); |
| 116 | } |
| 117 | } |
Ben Clayton | 47dd301 | 2023-04-26 18:27:53 +0000 | [diff] [blame] | 118 | } // NOLINT(readability/fn_size) |
Ben Clayton | a123b89 | 2022-07-27 16:36:35 +0000 | [diff] [blame] | 119 | |
dan sinclair | ff7cf21 | 2022-10-03 14:05:23 +0000 | [diff] [blame] | 120 | BENCHMARK(AddressSpaceParser); |
Ben Clayton | a123b89 | 2022-07-27 16:36:35 +0000 | [diff] [blame] | 121 | |
| 122 | } // namespace |
Ben Clayton | cd52f38 | 2023-08-07 13:11:08 +0000 | [diff] [blame] | 123 | } // namespace tint::core |