Debian Codegraph @

src/panfrost/compiler/bifrost/bi_quirks.h

raw
1 /*
2 * Copyright (C) 2019-2020 Collabora, Ltd.
3 * SPDX-License-Identifier: MIT
4 */
5
6 #ifndef __BI_QUIRKS_H
7 #define __BI_QUIRKS_H
8
9 #include "panfrost/model/pan_model.h"
10
11 /* Model-specific quirks requiring compiler workarounds/etc. Quirks
12 * may be errata requiring a workaround, or features. We're trying to be
13 * quirk-positive here; quirky is the best! */
14
15 /* Whether this GPU lacks support for fp32 transcendentals, requiring backend
16 * lowering to low-precision lookup tables and polynomial approximation */
17
18 #define BIFROST_NO_FP32_TRANSCENDENTALS (1 << 0)
19
20 /* Whether this GPU lacks support for the full form of the CLPER instruction.
21 * These GPUs use a simple encoding of CLPER that does not support
22 * inactive_result, subgroup_size, or lane_op. Using those features requires
23 * lowering to additional ALU instructions. The encoding forces inactive_result
24 * = zero, subgroup_size = subgroup4, and lane_op = none. */
25
26 #define BIFROST_LIMITED_CLPER (1 << 1)
27
28 static inline unsigned
29 bifrost_get_quirks(uint64_t gpu_id)
30 {
31 unsigned arch_maj_min =
32 (PAN_ARCH_MAJOR(gpu_id) << 4) | PAN_ARCH_MINOR(gpu_id);
33 switch (arch_maj_min) {
34 case 0x60: /* G71 */
35 return BIFROST_NO_FP32_TRANSCENDENTALS | BIFROST_LIMITED_CLPER;
36 case 0x62: /* G72 */
37 case 0x70: /* G31 */
38 return BIFROST_LIMITED_CLPER;
39 default:
40 return 0;
41 }
42 }
43
44 #endif