Home | History | Annotate | Download | only in core
      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 USE_8x2_TILE_BACKEND    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 
     80 #define KNOB_SIMD16_WIDTH 16
     81 #define KNOB_SIMD16_BYTES 64
     82 
     83 #if (KNOB_ARCH == KNOB_ARCH_AVX512)
     84 #define ENABLE_AVX512_EMULATION 0
     85 #else
     86 #define ENABLE_AVX512_EMULATION 1
     87 #endif
     88 
     89 #endif
     90 
     91 #define MAX_KNOB_ARCH_STR_LEN sizeof("AVX512_PLUS_PADDING")
     92 
     93 ///////////////////////////////////////////////////////////////////////////////
     94 // Configuration knobs
     95 ///////////////////////////////////////////////////////////////////////////////
     96 // Maximum supported number of active vertex buffer streams
     97 #define KNOB_NUM_STREAMS                    32
     98 
     99 // Maximum supported number of attributes per vertex
    100 #define KNOB_NUM_ATTRIBUTES                 39
    101 
    102 // Maximum supported active viewports and scissors
    103 #define KNOB_NUM_VIEWPORTS_SCISSORS         16
    104 
    105 // Guardband range used by the clipper
    106 #define KNOB_GUARDBAND_WIDTH                32768.0f
    107 #define KNOB_GUARDBAND_HEIGHT               32768.0f
    108 
    109 ///////////////////////////////
    110 // Macro tile configuration
    111 ///////////////////////////////
    112 
    113 // raster tile dimensions
    114 #define KNOB_TILE_X_DIM                      8
    115 #define KNOB_TILE_X_DIM_SHIFT                3
    116 #define KNOB_TILE_Y_DIM                      8
    117 #define KNOB_TILE_Y_DIM_SHIFT                3
    118 
    119 // fixed macrotile pixel dimension for now, eventually will be
    120 // dynamically set based on tile format and pixel size
    121 #define KNOB_MACROTILE_X_DIM                32
    122 #define KNOB_MACROTILE_Y_DIM                32
    123 #define KNOB_MACROTILE_X_DIM_FIXED_SHIFT    13
    124 #define KNOB_MACROTILE_Y_DIM_FIXED_SHIFT    13
    125 #define KNOB_MACROTILE_X_DIM_FIXED          (KNOB_MACROTILE_X_DIM << 8)
    126 #define KNOB_MACROTILE_Y_DIM_FIXED          (KNOB_MACROTILE_Y_DIM << 8)
    127 #define KNOB_MACROTILE_X_DIM_IN_TILES       (KNOB_MACROTILE_X_DIM >> KNOB_TILE_X_DIM_SHIFT)
    128 #define KNOB_MACROTILE_Y_DIM_IN_TILES       (KNOB_MACROTILE_Y_DIM >> KNOB_TILE_Y_DIM_SHIFT)
    129 
    130 // total # of hot tiles available. This should be enough to
    131 // fully render a 16kx16k 128bpp render target
    132 #define KNOB_NUM_HOT_TILES_X                 256
    133 #define KNOB_NUM_HOT_TILES_Y                 256
    134 #define KNOB_COLOR_HOT_TILE_FORMAT           R32G32B32A32_FLOAT
    135 #define KNOB_DEPTH_HOT_TILE_FORMAT           R32_FLOAT
    136 #define KNOB_STENCIL_HOT_TILE_FORMAT         R8_UINT
    137 
    138 // Max scissor rectangle
    139 #define KNOB_MAX_SCISSOR_X                  KNOB_NUM_HOT_TILES_X * KNOB_MACROTILE_X_DIM
    140 #define KNOB_MAX_SCISSOR_Y                  KNOB_NUM_HOT_TILES_Y * KNOB_MACROTILE_Y_DIM
    141 
    142 #if KNOB_SIMD_WIDTH==8 && KNOB_TILE_X_DIM < 4
    143 #error "incompatible width/tile dimensions"
    144 #endif
    145 
    146 #if ENABLE_AVX512_SIMD16
    147 #if KNOB_SIMD16_WIDTH == 16 && KNOB_TILE_X_DIM < 8
    148 #error "incompatible width/tile dimensions"
    149 #endif
    150 #endif
    151 
    152 #if KNOB_SIMD_WIDTH == 8
    153 #define SIMD_TILE_X_DIM 4
    154 #define SIMD_TILE_Y_DIM 2
    155 #else
    156 #error "Invalid simd width"
    157 #endif
    158 
    159 #if ENABLE_AVX512_SIMD16
    160 #if KNOB_SIMD16_WIDTH == 16
    161 #define SIMD16_TILE_X_DIM 8
    162 #define SIMD16_TILE_Y_DIM 2
    163 #else
    164 #error "Invalid simd width"
    165 #endif
    166 #endif
    167 
    168 ///////////////////////////////////////////////////////////////////////////////
    169 // Optimization knobs
    170 ///////////////////////////////////////////////////////////////////////////////
    171 #define KNOB_USE_FAST_SRGB                     TRUE
    172 
    173 // enables cut-aware primitive assembler
    174 #define KNOB_ENABLE_CUT_AWARE_PA               TRUE
    175 
    176 ///////////////////////////////////////////////////////////////////////////////
    177 // Debug knobs
    178 ///////////////////////////////////////////////////////////////////////////////
    179 //#define KNOB_ENABLE_RDTSC
    180 
    181 // Set to 1 to use the dynamic KNOB_TOSS_XXXX knobs.
    182 #if !defined(KNOB_ENABLE_TOSS_POINTS)
    183 #define KNOB_ENABLE_TOSS_POINTS                 0
    184 #endif
    185 
    186