8cccbf416afcdac34f81e8536fc85db9fe47cc1b
1 /****************************************************************************
2 * Copyright (C) 2014-2015 Intel Corporation. All Rights Reserved.
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:
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
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
25 * @brief Static (Compile-Time) Knobs for Core.
27 ******************************************************************************/
31 #include <gen_knobs.h>
33 #define KNOB_ARCH_AVX 0
34 #define KNOB_ARCH_AVX2 1
35 #define KNOB_ARCH_AVX512 2
37 ///////////////////////////////////////////////////////////////////////////////
39 ///////////////////////////////////////////////////////////////////////////////
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
46 ///////////////////////////////////////////////////////////////////////////////
47 // Architecture validation
48 ///////////////////////////////////////////////////////////////////////////////
49 #if !defined(KNOB_ARCH)
50 #define KNOB_ARCH KNOB_ARCH_AVX
53 #if (KNOB_ARCH == KNOB_ARCH_AVX)
54 #define KNOB_ARCH_ISA AVX
55 #define KNOB_ARCH_STR "AVX"
56 #define KNOB_SIMD_WIDTH 8
57 #define KNOB_SIMD_BYTES 32
58 #elif (KNOB_ARCH == KNOB_ARCH_AVX2)
59 #define KNOB_ARCH_ISA AVX2
60 #define KNOB_ARCH_STR "AVX2"
61 #define KNOB_SIMD_WIDTH 8
62 #define KNOB_SIMD_BYTES 32
63 #elif (KNOB_ARCH == KNOB_ARCH_AVX512)
64 #define KNOB_ARCH_ISA AVX512F
65 #define KNOB_ARCH_STR "AVX512"
66 #define KNOB_SIMD_WIDTH 8
67 #define KNOB_SIMD_BYTES 32
69 #error "Unknown architecture"
72 #if ENABLE_AVX512_SIMD16
74 #define KNOB_SIMD16_WIDTH 16
75 #define KNOB_SIMD16_BYTES 64
77 #if (KNOB_ARCH == KNOB_ARCH_AVX512)
78 #define ENABLE_AVX512_EMULATION 0
80 #define ENABLE_AVX512_EMULATION 1
85 #define MAX_KNOB_ARCH_STR_LEN sizeof("AVX512_PLUS_PADDING")
87 ///////////////////////////////////////////////////////////////////////////////
88 // Configuration knobs
89 ///////////////////////////////////////////////////////////////////////////////
90 // Maximum supported number of active vertex buffer streams
91 #define KNOB_NUM_STREAMS 32
93 // Maximum supported active viewports and scissors
94 #define KNOB_NUM_VIEWPORTS_SCISSORS 16
96 // Guardband range used by the clipper
97 #define KNOB_GUARDBAND_WIDTH 32768.0f
98 #define KNOB_GUARDBAND_HEIGHT 32768.0f
100 ///////////////////////////////
101 // Macro tile configuration
102 ///////////////////////////////
104 // raster tile dimensions
105 #define KNOB_TILE_X_DIM 8
106 #define KNOB_TILE_X_DIM_SHIFT 3
107 #define KNOB_TILE_Y_DIM 8
108 #define KNOB_TILE_Y_DIM_SHIFT 3
110 // fixed macrotile pixel dimension for now, eventually will be
111 // dynamically set based on tile format and pixel size
112 #define KNOB_MACROTILE_X_DIM 32
113 #define KNOB_MACROTILE_Y_DIM 32
114 #define KNOB_MACROTILE_X_DIM_FIXED_SHIFT 13
115 #define KNOB_MACROTILE_Y_DIM_FIXED_SHIFT 13
116 #define KNOB_MACROTILE_X_DIM_FIXED (KNOB_MACROTILE_X_DIM << 8)
117 #define KNOB_MACROTILE_Y_DIM_FIXED (KNOB_MACROTILE_Y_DIM << 8)
118 #define KNOB_MACROTILE_X_DIM_IN_TILES (KNOB_MACROTILE_X_DIM >> KNOB_TILE_X_DIM_SHIFT)
119 #define KNOB_MACROTILE_Y_DIM_IN_TILES (KNOB_MACROTILE_Y_DIM >> KNOB_TILE_Y_DIM_SHIFT)
121 // total # of hot tiles available. This should be enough to
122 // fully render a 16kx16k 128bpp render target
123 #define KNOB_NUM_HOT_TILES_X 256
124 #define KNOB_NUM_HOT_TILES_Y 256
125 #define KNOB_COLOR_HOT_TILE_FORMAT R32G32B32A32_FLOAT
126 #define KNOB_DEPTH_HOT_TILE_FORMAT R32_FLOAT
127 #define KNOB_STENCIL_HOT_TILE_FORMAT R8_UINT
129 // Max scissor rectangle
130 #define KNOB_MAX_SCISSOR_X KNOB_NUM_HOT_TILES_X* KNOB_MACROTILE_X_DIM
131 #define KNOB_MAX_SCISSOR_Y KNOB_NUM_HOT_TILES_Y* KNOB_MACROTILE_Y_DIM
133 #if KNOB_SIMD_WIDTH == 8 && KNOB_TILE_X_DIM < 4
134 #error "incompatible width/tile dimensions"
137 #if ENABLE_AVX512_SIMD16
138 #if KNOB_SIMD16_WIDTH == 16 && KNOB_TILE_X_DIM < 8
139 #error "incompatible width/tile dimensions"
143 #if KNOB_SIMD_WIDTH == 8
144 #define SIMD_TILE_X_DIM 4
145 #define SIMD_TILE_Y_DIM 2
147 #error "Invalid simd width"
150 #if ENABLE_AVX512_SIMD16
151 #if KNOB_SIMD16_WIDTH == 16
152 #define SIMD16_TILE_X_DIM 8
153 #define SIMD16_TILE_Y_DIM 2
155 #error "Invalid simd width"
159 ///////////////////////////////////////////////////////////////////////////////
160 // Optimization knobs
161 ///////////////////////////////////////////////////////////////////////////////
162 #define KNOB_USE_FAST_SRGB TRUE
164 // enables cut-aware primitive assembler
165 #define KNOB_ENABLE_CUT_AWARE_PA TRUE
167 // enables early rasterization (useful for small triangles)
168 #if !defined(KNOB_ENABLE_EARLY_RAST)
169 #define KNOB_ENABLE_EARLY_RAST 1
172 #if KNOB_ENABLE_EARLY_RAST
173 #define ER_SIMD_TILE_X_SHIFT 2
174 #define ER_SIMD_TILE_Y_SHIFT 2
177 ///////////////////////////////////////////////////////////////////////////////
179 ///////////////////////////////////////////////////////////////////////////////
180 //#define KNOB_ENABLE_RDTSC
182 // Set to 1 to use the dynamic KNOB_TOSS_XXXX knobs.
183 #if !defined(KNOB_ENABLE_TOSS_POINTS)
184 #define KNOB_ENABLE_TOSS_POINTS 0