1# Copyright (C) 2014-2018 Intel Corporation. All Rights Reserved. 2# 3# Permission is hereby granted, free of charge, to any person obtaining a 4# copy of this software and associated documentation files (the "Software"), 5# to deal in the Software without restriction, including without limitation 6# the rights to use, copy, modify, merge, publish, distribute, sublicense, 7# and/or sell copies of the Software, and to permit persons to whom the 8# Software is furnished to do so, subject to the following conditions: 9# 10# The above copyright notice and this permission notice (including the next 11# paragraph) shall be included in all copies or substantial portions of the 12# Software. 13# 14# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20# IN THE SOFTWARE. 21import sys 22 23# Python source 24KNOBS = [ 25 26 ['ENABLE_ASSERT_DIALOGS', { 27 'type' : 'bool', 28 'default' : 'true', 29 'desc' : ['Use dialogs when asserts fire.', 30 'Asserts are only enabled in debug builds'], 31 'category' : 'debug', 32 }], 33 34 ['SINGLE_THREADED', { 35 'type' : 'bool', 36 'default' : 'false', 37 'desc' : ['If enabled will perform all rendering on the API thread.', 38 'This is useful mainly for debugging purposes.'], 39 'category' : 'debug', 40 }], 41 42 ['DUMP_SHADER_IR', { 43 'type' : 'bool', 44 'default' : 'false', 45 'desc' : ['Dumps shader LLVM IR at various stages of jit compilation.'], 46 'category' : 'debug', 47 }], 48 49 ['USE_GENERIC_STORETILE', { 50 'type' : 'bool', 51 'default' : 'false', 52 'desc' : ['Always use generic function for performing StoreTile.', 53 'Will be slightly slower than using optimized (jitted) path'], 54 'category' : 'debug_adv', 55 }], 56 57 ['FAST_CLEAR', { 58 'type' : 'bool', 59 'default' : 'true', 60 'desc' : ['Replace 3D primitive execute with a SWRClearRT operation and', 61 'defer clear execution to first backend op on hottile, or hottile store'], 62 'category' : 'perf_adv', 63 }], 64 65 ['MAX_NUMA_NODES', { 66 'type' : 'uint32_t', 67 'default' : '1' if sys.platform == 'win32' else '0', 68 'desc' : ['Maximum # of NUMA-nodes per system used for worker threads', 69 ' 0 == ALL NUMA-nodes in the system', 70 ' N == Use at most N NUMA-nodes for rendering'], 71 'category' : 'perf', 72 }], 73 74 ['MAX_CORES_PER_NUMA_NODE', { 75 'type' : 'uint32_t', 76 'default' : '0', 77 'desc' : ['Maximum # of cores per NUMA-node used for worker threads.', 78 ' 0 == ALL non-API thread cores per NUMA-node', 79 ' N == Use at most N cores per NUMA-node'], 80 'category' : 'perf', 81 }], 82 83 ['MAX_THREADS_PER_CORE', { 84 'type' : 'uint32_t', 85 'default' : '1', 86 'desc' : ['Maximum # of (hyper)threads per physical core used for worker threads.', 87 ' 0 == ALL hyper-threads per core', 88 ' N == Use at most N hyper-threads per physical core'], 89 'category' : 'perf', 90 }], 91 92 ['MAX_WORKER_THREADS', { 93 'type' : 'uint32_t', 94 'default' : '0', 95 'desc' : ['Maximum worker threads to spawn.', 96 '', 97 'IMPORTANT: If this is non-zero, no worker threads will be bound to', 98 'specific HW threads. They will all be "floating" SW threads.', 99 'In this case, the above 3 KNOBS will be ignored.'], 100 'category' : 'perf', 101 }], 102 103 ['BASE_NUMA_NODE', { 104 'type' : 'uint32_t', 105 'default' : '0', 106 'desc' : ['Starting NUMA node index to use when allocating compute resources.', 107 'Setting this to a non-zero value will reduce the maximum # of NUMA nodes used.'], 108 'category' : 'perf', 109 }], 110 111 ['BASE_CORE', { 112 'type' : 'uint32_t', 113 'default' : '0', 114 'desc' : ['Starting core index to use when allocating compute resources.', 115 'Setting this to a non-zero value will reduce the maximum # of cores used.'], 116 'category' : 'perf', 117 }], 118 119 ['BASE_THREAD', { 120 'type' : 'uint32_t', 121 'default' : '0', 122 'desc' : ['Starting thread index to use when allocating compute resources.', 123 'Setting this to a non-zero value will reduce the maximum # of threads used.'], 124 'category' : 'perf', 125 }], 126 127 ['BUCKETS_START_FRAME', { 128 'type' : 'uint32_t', 129 'default' : '1200', 130 'desc' : ['Frame from when to start saving buckets data.', 131 '', 132 'NOTE: KNOB_ENABLE_RDTSC must be enabled in core/knobs.h', 133 'for this to have an effect.'], 134 'category' : 'perf_adv', 135 }], 136 137 ['BUCKETS_END_FRAME', { 138 'type' : 'uint32_t', 139 'default' : '1400', 140 'desc' : ['Frame at which to stop saving buckets data.', 141 '', 142 'NOTE: KNOB_ENABLE_RDTSC must be enabled in core/knobs.h', 143 'for this to have an effect.'], 144 'category' : 'perf_adv', 145 }], 146 147 ['WORKER_SPIN_LOOP_COUNT', { 148 'type' : 'uint32_t', 149 'default' : '5000', 150 'desc' : ['Number of spin-loop iterations worker threads will perform', 151 'before going to sleep when waiting for work'], 152 'category' : 'perf_adv', 153 }], 154 155 ['MAX_DRAWS_IN_FLIGHT', { 156 'type' : 'uint32_t', 157 'default' : '256', 158 'desc' : ['Maximum number of draws outstanding before API thread blocks.', 159 'This value MUST be evenly divisible into 2^32'], 160 'category' : 'perf_adv', 161 }], 162 163 ['MAX_PRIMS_PER_DRAW', { 164 'type' : 'uint32_t', 165 'default' : '49152', 166 'desc' : ['Maximum primitives in a single Draw().', 167 'Larger primitives are split into smaller Draw calls.', 168 'Should be a multiple of (3 * vectorWidth).'], 169 'category' : 'perf_adv', 170 }], 171 172 ['MAX_TESS_PRIMS_PER_DRAW', { 173 'type' : 'uint32_t', 174 'default' : '16', 175 'desc' : ['Maximum primitives in a single Draw() with tessellation enabled.', 176 'Larger primitives are split into smaller Draw calls.', 177 'Should be a multiple of (vectorWidth).'], 178 'category' : 'perf_adv', 179 }], 180 181 182 ['DEBUG_OUTPUT_DIR', { 183 'type' : 'std::string', 184 'default' : r'%TEMP%\Rast\DebugOutput' if sys.platform == 'win32' else '/tmp/Rast/DebugOutput', 185 'desc' : ['Output directory for debug data.'], 186 'category' : 'debug', 187 }], 188 189 ['JIT_ENABLE_CACHE', { 190 'type' : 'bool', 191 'default' : 'false', 192 'desc' : ['Enables caching of compiled shaders'], 193 'category' : 'debug_adv', 194 }], 195 196 ['JIT_OPTIMIZATION_LEVEL', { 197 'type' : 'int', 198 'default' : '-1', 199 'desc' : ['JIT compile optimization level:',], 200 'category' : 'debug', 201 'control' : 'dropdown', 202 'choices' : [ 203 { 204 'name' : 'Automatic', 205 'desc' : 'Automatic based on other KNOB and build settings', 206 'value' : -1, 207 }, 208 { 209 'name' : 'Debug', 210 'desc' : 'No optimization: -O0', 211 'value' : 0, 212 }, 213 { 214 'name' : 'Less', 215 'desc' : 'Some optimization: -O1', 216 'value' : 1, 217 }, 218 { 219 'name' : 'Optimize', 220 'desc' : 'Default Clang / LLVM optimizations: -O2', 221 'value' : 2, 222 }, 223 { 224 'name' : 'Aggressive', 225 'desc' : 'Maximum optimization: -O3', 226 'value' : 3, 227 }, 228 ], 229 }], 230 231 ['JIT_CACHE_DIR', { 232 'type' : 'std::string', 233 'default' : r'%TEMP%\SWR\JitCache' if sys.platform == 'win32' else '${HOME}/.swr/jitcache', 234 'desc' : ['Cache directory for compiled shaders.'], 235 'category' : 'debug', 236 }], 237 238 ['TOSS_DRAW', { 239 'type' : 'bool', 240 'default' : 'false', 241 'desc' : ['Disable per-draw/dispatch execution'], 242 'category' : 'perf', 243 }], 244 245 ['TOSS_QUEUE_FE', { 246 'type' : 'bool', 247 'default' : 'false', 248 'desc' : ['Stop per-draw execution at worker FE', 249 '', 250 'NOTE: Requires KNOB_ENABLE_TOSS_POINTS to be enabled in core/knobs.h'], 251 'category' : 'perf_adv', 252 }], 253 254 ['TOSS_FETCH', { 255 'type' : 'bool', 256 'default' : 'false', 257 'desc' : ['Stop per-draw execution at vertex fetch', 258 '', 259 'NOTE: Requires KNOB_ENABLE_TOSS_POINTS to be enabled in core/knobs.h'], 260 'category' : 'perf_adv', 261 }], 262 263 ['TOSS_IA', { 264 'type' : 'bool', 265 'default' : 'false', 266 'desc' : ['Stop per-draw execution at input assembler', 267 '', 268 'NOTE: Requires KNOB_ENABLE_TOSS_POINTS to be enabled in core/knobs.h'], 269 'category' : 'perf_adv', 270 }], 271 272 ['TOSS_VS', { 273 'type' : 'bool', 274 'default' : 'false', 275 'desc' : ['Stop per-draw execution at vertex shader', 276 '', 277 'NOTE: Requires KNOB_ENABLE_TOSS_POINTS to be enabled in core/knobs.h'], 278 'category' : 'perf_adv', 279 }], 280 281 ['TOSS_SETUP_TRIS', { 282 'type' : 'bool', 283 'default' : 'false', 284 'desc' : ['Stop per-draw execution at primitive setup', 285 '', 286 'NOTE: Requires KNOB_ENABLE_TOSS_POINTS to be enabled in core/knobs.h'], 287 'category' : 'perf_adv', 288 }], 289 290 ['TOSS_BIN_TRIS', { 291 'type' : 'bool', 292 'default' : 'false', 293 'desc' : ['Stop per-draw execution at primitive binning', 294 '', 295 'NOTE: Requires KNOB_ENABLE_TOSS_POINTS to be enabled in core/knobs.h'], 296 'category' : 'perf_adv', 297 }], 298 299 ['TOSS_RS', { 300 'type' : 'bool', 301 'default' : 'false', 302 'desc' : ['Stop per-draw execution at rasterizer', 303 '', 304 'NOTE: Requires KNOB_ENABLE_TOSS_POINTS to be enabled in core/knobs.h'], 305 'category' : 'perf_adv', 306 }], 307 308 ['DISABLE_SPLIT_DRAW', { 309 'type' : 'bool', 310 'default' : 'false', 311 'desc' : ['Don\'t split large draws into smaller draws.,', 312 'MAX_PRIMS_PER_DRAW and MAX_TESS_PRIMS_PER_DRAW can be used to control split size.', 313 '', 314 'Useful to disable split draws for gathering archrast stats.'], 315 'category' : 'perf_adv', 316 }], 317 318 ['AR_ENABLE_PIPELINE_STATS', { 319 'type' : 'bool', 320 'default' : 'true', 321 'desc' : ['Enable pipeline stats when using Archrast'], 322 'category' : 'archrast', 323 }], 324 325 ['AR_ENABLE_SHADER_STATS', { 326 'type' : 'bool', 327 'default' : 'true', 328 'desc' : ['Enable shader stats when using Archrast'], 329 'category' : 'archrast', 330 }], 331 332 ['AR_ENABLE_SWTAG_DATA', { 333 'type' : 'bool', 334 'default' : 'false', 335 'desc' : ['Enable SWTag data when using Archrast'], 336 'category' : 'archrast', 337 }], 338 339 ['AR_ENABLE_SWR_EVENTS', { 340 'type' : 'bool', 341 'default' : 'true', 342 'desc' : ['Enable internal SWR events when using Archrast'], 343 'category' : 'archrast', 344 }], 345 346 ['AR_ENABLE_PIPELINE_EVENTS', { 347 'type' : 'bool', 348 'default' : 'true', 349 'desc' : ['Enable pipeline events when using Archrast'], 350 'category' : 'archrast', 351 }], 352 353 ['AR_ENABLE_SHADER_EVENTS', { 354 'type' : 'bool', 355 'default' : 'true', 356 'desc' : ['Enable shader events when using Archrast'], 357 'category' : 'archrast', 358 }], 359 360 ['AR_ENABLE_SWTAG_EVENTS', { 361 'type' : 'bool', 362 'default' : 'false', 363 'desc' : ['Enable SWTag events when using Archrast'], 364 'category' : 'archrast', 365 }], 366 367 ['AR_ENABLE_MEMORY_EVENTS', { 368 'type' : 'bool', 369 'default' : 'false', 370 'desc' : ['Enable memory events when using Archrast'], 371 'category' : 'archrast', 372 }], 373 374 ['AR_MEM_SET_BYTE_GRANULARITY', { 375 'type' : 'uint32_t', 376 'default' : '64', 377 'desc' : ['Granularity and alignment of tracking of memory accesses', 378 'ONLY ACTIVE UNDER ArchRast.'], 379 'category' : 'archrast', 380 }], 381 382 383 ] 384