• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2019-2020 Collabora, Ltd.
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 FROM,
20  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21  * SOFTWARE.
22  */
23 
24 #ifndef __BI_QUIRKS_H
25 #define __BI_QUIRKS_H
26 
27 /* Model-specific quirks requiring compiler workarounds/etc. Quirks
28  * may be errata requiring a workaround, or features. We're trying to be
29  * quirk-positive here; quirky is the best! */
30 
31 /* Whether this GPU lacks support for fp32 transcendentals, requiring backend
32  * lowering to low-precision lookup tables and polynomial approximation */
33 
34 #define BIFROST_NO_FP32_TRANSCENDENTALS (1 << 0)
35 
36 /* Whether this GPU lacks support for the full form of the CLPER instruction.
37  * These GPUs use a simple encoding of CLPER that does not support
38  * inactive_result, subgroup_size, or lane_op. Using those features requires
39  * lowering to additional ALU instructions. The encoding forces inactive_result
40  * = zero, subgroup_size = subgroup4, and lane_op = none. */
41 
42 #define BIFROST_LIMITED_CLPER (1 << 1)
43 
44 static inline unsigned
bifrost_get_quirks(unsigned product_id)45 bifrost_get_quirks(unsigned product_id)
46 {
47         switch (product_id >> 8) {
48         case 0x60: /* G71 */
49                 return BIFROST_NO_FP32_TRANSCENDENTALS | BIFROST_LIMITED_CLPER;
50         case 0x62: /* G72 */
51         case 0x70: /* G31 */
52                 return BIFROST_LIMITED_CLPER;
53         default:
54                 return 0;
55         }
56 }
57 
58 #endif
59