1 /**************************************************************************** 2 * Copyright (C) 2014-2015 Intel Corporation. All Rights Reserved. 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 * and/or sell copies of the Software, and to permit persons to whom the 9 * Software is furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice (including the next 12 * paragraph) shall be included in all copies or substantial portions of the 13 * Software. 14 * 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21 * IN THE SOFTWARE. 22 * 23 * @file knobs.h 24 * 25 * @brief Static (Compile-Time) Knobs for Core. 26 * 27 ******************************************************************************/ 28 #pragma once 29 30 #include <stdint.h> 31 #include <gen_knobs.h> 32 33 #define KNOB_ARCH_AVX 0 34 #define KNOB_ARCH_AVX2 1 35 #define KNOB_ARCH_AVX512 2 36 37 /////////////////////////////////////////////////////////////////////////////// 38 // AVX512 Support 39 /////////////////////////////////////////////////////////////////////////////// 40 41 #define ENABLE_AVX512_SIMD16 1 42 #define USE_SIMD16_FRONTEND 1 43 #define USE_SIMD16_SHADERS 1 // requires USE_SIMD16_FRONTEND 44 #define USE_SIMD16_VS 1 // requires USE_SIMD16_SHADERS 45 46 /////////////////////////////////////////////////////////////////////////////// 47 // Architecture validation 48 /////////////////////////////////////////////////////////////////////////////// 49 #if !defined(KNOB_ARCH) 50 #define KNOB_ARCH KNOB_ARCH_AVX 51 #endif 52 53 #if (KNOB_ARCH == KNOB_ARCH_AVX) 54 #define KNOB_ARCH_ISA AVX 55 #define KNOB_ARCH_STR "AVX" 56 #elif (KNOB_ARCH == KNOB_ARCH_AVX2) 57 #define KNOB_ARCH_ISA AVX2 58 #define KNOB_ARCH_STR "AVX2" 59 #elif (KNOB_ARCH == KNOB_ARCH_AVX512) 60 #define KNOB_ARCH_ISA AVX512F 61 #define KNOB_ARCH_STR "AVX512" 62 #else 63 #error "Unknown architecture" 64 #endif 65 66 #define KNOB_SIMD_WIDTH 8 67 #define KNOB_SIMD_BYTES 32 68 69 #define KNOB_SIMD16_WIDTH 16 70 #define KNOB_SIMD16_BYTES 64 71 72 #define MAX_KNOB_ARCH_STR_LEN sizeof("AVX512_PLUS_PADDING") 73 74 /////////////////////////////////////////////////////////////////////////////// 75 // Configuration knobs 76 /////////////////////////////////////////////////////////////////////////////// 77 // Maximum supported number of active vertex buffer streams 78 #define KNOB_NUM_STREAMS 32 79 80 // Maximum supported active viewports and scissors 81 #define KNOB_NUM_VIEWPORTS_SCISSORS 16 82 83 // Guardband range used by the clipper 84 #define KNOB_GUARDBAND_WIDTH 32768.0f 85 #define KNOB_GUARDBAND_HEIGHT 32768.0f 86 87 // Scratch space requirements per worker. Currently only used for TGSM sizing for some stages 88 #define KNOB_WORKER_SCRATCH_SPACE_SIZE (32 * 1024) 89 90 /////////////////////////////// 91 // Macro tile configuration 92 /////////////////////////////// 93 94 // raster tile dimensions 95 #define KNOB_TILE_X_DIM 8 96 #define KNOB_TILE_X_DIM_SHIFT 3 97 #define KNOB_TILE_Y_DIM 8 98 #define KNOB_TILE_Y_DIM_SHIFT 3 99 100 // fixed macrotile pixel dimension for now, eventually will be 101 // dynamically set based on tile format and pixel size 102 #define KNOB_MACROTILE_X_DIM 32 103 #define KNOB_MACROTILE_Y_DIM 32 104 #define KNOB_MACROTILE_X_DIM_FIXED_SHIFT 13 105 #define KNOB_MACROTILE_Y_DIM_FIXED_SHIFT 13 106 #define KNOB_MACROTILE_X_DIM_FIXED (KNOB_MACROTILE_X_DIM << 8) 107 #define KNOB_MACROTILE_Y_DIM_FIXED (KNOB_MACROTILE_Y_DIM << 8) 108 #define KNOB_MACROTILE_X_DIM_IN_TILES (KNOB_MACROTILE_X_DIM >> KNOB_TILE_X_DIM_SHIFT) 109 #define KNOB_MACROTILE_Y_DIM_IN_TILES (KNOB_MACROTILE_Y_DIM >> KNOB_TILE_Y_DIM_SHIFT) 110 111 // total # of hot tiles available. This should be enough to 112 // fully render a 16kx16k 128bpp render target 113 #define KNOB_NUM_HOT_TILES_X 512 114 #define KNOB_NUM_HOT_TILES_Y 512 115 #define KNOB_COLOR_HOT_TILE_FORMAT R32G32B32A32_FLOAT 116 #define KNOB_DEPTH_HOT_TILE_FORMAT R32_FLOAT 117 #define KNOB_STENCIL_HOT_TILE_FORMAT R8_UINT 118 119 // Max scissor rectangle 120 #define KNOB_MAX_SCISSOR_X KNOB_NUM_HOT_TILES_X* KNOB_MACROTILE_X_DIM 121 #define KNOB_MAX_SCISSOR_Y KNOB_NUM_HOT_TILES_Y* KNOB_MACROTILE_Y_DIM 122 123 #if KNOB_SIMD_WIDTH == 8 && KNOB_TILE_X_DIM < 4 124 #error "incompatible width/tile dimensions" 125 #endif 126 127 #if ENABLE_AVX512_SIMD16 128 #if KNOB_SIMD16_WIDTH == 16 && KNOB_TILE_X_DIM < 8 129 #error "incompatible width/tile dimensions" 130 #endif 131 #endif 132 133 #if KNOB_SIMD_WIDTH == 8 134 #define SIMD_TILE_X_DIM 4 135 #define SIMD_TILE_Y_DIM 2 136 #else 137 #error "Invalid simd width" 138 #endif 139 140 #if ENABLE_AVX512_SIMD16 141 #if KNOB_SIMD16_WIDTH == 16 142 #define SIMD16_TILE_X_DIM 8 143 #define SIMD16_TILE_Y_DIM 2 144 #else 145 #error "Invalid simd width" 146 #endif 147 #endif 148 149 /////////////////////////////////////////////////////////////////////////////// 150 // Optimization knobs 151 /////////////////////////////////////////////////////////////////////////////// 152 #define KNOB_USE_FAST_SRGB TRUE 153 154 // enables cut-aware primitive assembler 155 #define KNOB_ENABLE_CUT_AWARE_PA TRUE 156 157 // enables early rasterization (useful for small triangles) 158 #if !defined(KNOB_ENABLE_EARLY_RAST) 159 #define KNOB_ENABLE_EARLY_RAST 1 160 #endif 161 162 #if KNOB_ENABLE_EARLY_RAST 163 #define ER_SIMD_TILE_X_SHIFT 2 164 #define ER_SIMD_TILE_Y_SHIFT 2 165 #endif 166 167 /////////////////////////////////////////////////////////////////////////////// 168 // Debug knobs 169 /////////////////////////////////////////////////////////////////////////////// 170 //#define KNOB_ENABLE_RDTSC 171 172 // Set to 1 to use the dynamic KNOB_TOSS_XXXX knobs. 173 #if !defined(KNOB_ENABLE_TOSS_POINTS) 174 #define KNOB_ENABLE_TOSS_POINTS 0 175 #endif 176