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