• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_8x2_TILE_BACKEND    1
43 #define USE_SIMD16_FRONTEND     1
44 #define USE_SIMD16_SHADERS      1   // requires USE_SIMD16_FRONTEND
45 #define USE_SIMD16_VS           1   // requires USE_SIMD16_SHADERS
46 
47 ///////////////////////////////////////////////////////////////////////////////
48 // Architecture validation
49 ///////////////////////////////////////////////////////////////////////////////
50 #if !defined(KNOB_ARCH)
51 #define KNOB_ARCH KNOB_ARCH_AVX
52 #endif
53 
54 #if (KNOB_ARCH == KNOB_ARCH_AVX)
55 #define KNOB_ARCH_ISA AVX
56 #define KNOB_ARCH_STR "AVX"
57 #define KNOB_SIMD_WIDTH 8
58 #define KNOB_SIMD_BYTES 32
59 #elif (KNOB_ARCH == KNOB_ARCH_AVX2)
60 #define KNOB_ARCH_ISA AVX2
61 #define KNOB_ARCH_STR "AVX2"
62 #define KNOB_SIMD_WIDTH 8
63 #define KNOB_SIMD_BYTES 32
64 #elif (KNOB_ARCH == KNOB_ARCH_AVX512)
65 #define KNOB_ARCH_ISA AVX512F
66 #define KNOB_ARCH_STR "AVX512"
67 #define KNOB_SIMD_WIDTH 8
68 #define KNOB_SIMD_BYTES 32
69 #else
70 #error "Unknown architecture"
71 #endif
72 
73 #if ENABLE_AVX512_SIMD16
74 
75 #define KNOB_SIMD16_WIDTH 16
76 #define KNOB_SIMD16_BYTES 64
77 
78 #if (KNOB_ARCH == KNOB_ARCH_AVX512)
79 #define ENABLE_AVX512_EMULATION 0
80 #else
81 #define ENABLE_AVX512_EMULATION 1
82 #endif
83 
84 #endif
85 
86 #define MAX_KNOB_ARCH_STR_LEN sizeof("AVX512_PLUS_PADDING")
87 
88 ///////////////////////////////////////////////////////////////////////////////
89 // Configuration knobs
90 ///////////////////////////////////////////////////////////////////////////////
91 // Maximum supported number of active vertex buffer streams
92 #define KNOB_NUM_STREAMS                    32
93 
94 // Maximum supported active viewports and scissors
95 #define KNOB_NUM_VIEWPORTS_SCISSORS         16
96 
97 // Guardband range used by the clipper
98 #define KNOB_GUARDBAND_WIDTH                32768.0f
99 #define KNOB_GUARDBAND_HEIGHT               32768.0f
100 
101 ///////////////////////////////
102 // Macro tile configuration
103 ///////////////////////////////
104 
105 // raster tile dimensions
106 #define KNOB_TILE_X_DIM                      8
107 #define KNOB_TILE_X_DIM_SHIFT                3
108 #define KNOB_TILE_Y_DIM                      8
109 #define KNOB_TILE_Y_DIM_SHIFT                3
110 
111 // fixed macrotile pixel dimension for now, eventually will be
112 // dynamically set based on tile format and pixel size
113 #define KNOB_MACROTILE_X_DIM                32
114 #define KNOB_MACROTILE_Y_DIM                32
115 #define KNOB_MACROTILE_X_DIM_FIXED_SHIFT    13
116 #define KNOB_MACROTILE_Y_DIM_FIXED_SHIFT    13
117 #define KNOB_MACROTILE_X_DIM_FIXED          (KNOB_MACROTILE_X_DIM << 8)
118 #define KNOB_MACROTILE_Y_DIM_FIXED          (KNOB_MACROTILE_Y_DIM << 8)
119 #define KNOB_MACROTILE_X_DIM_IN_TILES       (KNOB_MACROTILE_X_DIM >> KNOB_TILE_X_DIM_SHIFT)
120 #define KNOB_MACROTILE_Y_DIM_IN_TILES       (KNOB_MACROTILE_Y_DIM >> KNOB_TILE_Y_DIM_SHIFT)
121 
122 // total # of hot tiles available. This should be enough to
123 // fully render a 16kx16k 128bpp render target
124 #define KNOB_NUM_HOT_TILES_X                 256
125 #define KNOB_NUM_HOT_TILES_Y                 256
126 #define KNOB_COLOR_HOT_TILE_FORMAT           R32G32B32A32_FLOAT
127 #define KNOB_DEPTH_HOT_TILE_FORMAT           R32_FLOAT
128 #define KNOB_STENCIL_HOT_TILE_FORMAT         R8_UINT
129 
130 // Max scissor rectangle
131 #define KNOB_MAX_SCISSOR_X                  KNOB_NUM_HOT_TILES_X * KNOB_MACROTILE_X_DIM
132 #define KNOB_MAX_SCISSOR_Y                  KNOB_NUM_HOT_TILES_Y * KNOB_MACROTILE_Y_DIM
133 
134 #if KNOB_SIMD_WIDTH==8 && KNOB_TILE_X_DIM < 4
135 #error "incompatible width/tile dimensions"
136 #endif
137 
138 #if ENABLE_AVX512_SIMD16
139 #if KNOB_SIMD16_WIDTH == 16 && KNOB_TILE_X_DIM < 8
140 #error "incompatible width/tile dimensions"
141 #endif
142 #endif
143 
144 #if KNOB_SIMD_WIDTH == 8
145 #define SIMD_TILE_X_DIM 4
146 #define SIMD_TILE_Y_DIM 2
147 #else
148 #error "Invalid simd width"
149 #endif
150 
151 #if ENABLE_AVX512_SIMD16
152 #if KNOB_SIMD16_WIDTH == 16
153 #define SIMD16_TILE_X_DIM 8
154 #define SIMD16_TILE_Y_DIM 2
155 #else
156 #error "Invalid simd width"
157 #endif
158 #endif
159 
160 ///////////////////////////////////////////////////////////////////////////////
161 // Optimization knobs
162 ///////////////////////////////////////////////////////////////////////////////
163 #define KNOB_USE_FAST_SRGB                     TRUE
164 
165 // enables cut-aware primitive assembler
166 #define KNOB_ENABLE_CUT_AWARE_PA               TRUE
167 
168 // enables early rasterization (useful for small triangles)
169 #if !defined(KNOB_ENABLE_EARLY_RAST)
170 #define KNOB_ENABLE_EARLY_RAST                 1
171 #endif
172 
173 #if KNOB_ENABLE_EARLY_RAST
174 #define ER_SIMD_TILE_X_SHIFT 2
175 #define ER_SIMD_TILE_Y_SHIFT 2
176 #endif
177 
178 ///////////////////////////////////////////////////////////////////////////////
179 // Debug knobs
180 ///////////////////////////////////////////////////////////////////////////////
181 //#define KNOB_ENABLE_RDTSC
182 
183 // Set to 1 to use the dynamic KNOB_TOSS_XXXX knobs.
184 #if !defined(KNOB_ENABLE_TOSS_POINTS)
185 #define KNOB_ENABLE_TOSS_POINTS                 0
186 #endif
187 
188