Debian Codegraph @

gcc/config/gcn/gcn-opts.h

raw
1 /* Copyright (C) 2016-2025 Free Software Foundation, Inc.
2
3 This file is free software; you can redistribute it and/or modify it under
4 the terms of the GNU General Public License as published by the Free
5 Software Foundation; either version 3 of the License, or (at your option)
6 any later version.
7
8 This file is distributed in the hope that it will be useful, but WITHOUT
9 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11 for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with GCC; see the file COPYING3. If not see
15 <http://www.gnu.org/licenses/>. */
16
17 #ifndef GCN_OPTS_H
18 #define GCN_OPTS_H
19
20 /* Create constants for PROCESSOR_GFX???. */
21 enum processor_type
22 {
23 #define GCN_DEVICE(name, NAME, ...) \
24 PROCESSOR_ ## NAME,
25 #include "gcn-devices.def"
26 PROCESSOR_COUNT
27 };
28
29 /* Set in gcn_option_override. */
30 extern enum gcn_isa {
31 ISA_UNKNOWN,
32 ISA_GCN5,
33 ISA_RDNA2,
34 ISA_RDNA3,
35 ISA_CDNA1,
36 ISA_CDNA2
37 } gcn_isa;
38
39 #define TARGET_GCN5 (gcn_isa == ISA_GCN5)
40 #define TARGET_CDNA1 (gcn_isa == ISA_CDNA1)
41 #define TARGET_CDNA1_PLUS (gcn_isa >= ISA_CDNA1)
42 #define TARGET_CDNA2 (gcn_isa == ISA_CDNA2)
43 #define TARGET_CDNA2_PLUS (gcn_isa >= ISA_CDNA2)
44 #define TARGET_RDNA2 (gcn_isa == ISA_RDNA2)
45 #define TARGET_RDNA2_PLUS (gcn_isa >= ISA_RDNA2 && gcn_isa < ISA_CDNA1)
46 #define TARGET_RDNA3 (gcn_isa == ISA_RDNA3)
47
48
49 #define TARGET_PACKED_WORK_ITEMS (TARGET_CDNA2_PLUS || TARGET_RDNA3)
50
51 #define TARGET_XNACK (flag_xnack == HSACO_ATTR_ON \
52 || flag_xnack == HSACO_ATTR_ANY)
53
54 enum hsaco_attr_type
55 {
56 HSACO_ATTR_UNSUPPORTED,
57 HSACO_ATTR_OFF,
58 HSACO_ATTR_ON,
59 HSACO_ATTR_ANY,
60 HSACO_ATTR_DEFAULT
61 };
62
63 /* Device has an AVGPR register file. */
64 #define TARGET_AVGPRS TARGET_CDNA1_PLUS
65 /* There are load/store instructions for AVGPRS. */
66 #define TARGET_AVGPR_MEMOPS TARGET_CDNA2_PLUS
67 /* AVGPRS may have their own register file, or be combined with VGPRS. */
68 #define TARGET_AVGPR_COMBINED TARGET_CDNA2_PLUS
69 /* global_load/store has reduced offset. */
70 #define TARGET_11BIT_GLOBAL_OFFSET TARGET_RDNA2_PLUS
71 /* The work item details are all encoded into v0. */
72 //#define TARGET_PACKED_WORK_ITEMS TARGET_PACKED_WORK_ITEMS
73 /* CDNA2 load/store costs are reduced.
74 * TODO: what does this mean? */
75 #define TARGET_CDNA2_MEM_COSTS TARGET_CDNA2_PLUS
76 /* Wave32 devices running in wave64 compatibility mode. */
77 #define TARGET_WAVE64_COMPAT TARGET_RDNA2_PLUS
78 /* RDNA devices have different DPP with reduced capabilities. */
79 #define TARGET_DPP_FULL !TARGET_RDNA2_PLUS
80 #define TARGET_DPP16 TARGET_RDNA2_PLUS
81 #define TARGET_DPP8 TARGET_RDNA2_PLUS
82 /* Device requires CDNA1-style manually inserted wait states for AVGPRs. */
83 #define TARGET_AVGPR_CDNA1_NOPS TARGET_CDNA1
84 /* The metadata on different devices need different granularity. */
85 #define TARGET_VGPR_GRANULARITY \
86 (TARGET_RDNA3 ? 12 \
87 : TARGET_RDNA2_PLUS || TARGET_CDNA2_PLUS ? 8 \
88 : 4)
89 /* This mostly affects the metadata. */
90 #define TARGET_ARCHITECTED_FLAT_SCRATCH TARGET_RDNA3
91 /* Device has Sub-DWord Addressing instrucions. */
92 #define TARGET_SDWA (!TARGET_RDNA3)
93 /* Different devices uses different cache control instructions. */
94 #define TARGET_WBINVL1_CACHE (!TARGET_RDNA2_PLUS)
95 #define TARGET_GLn_CACHE TARGET_RDNA2_PLUS
96 /* Some devices have TGSPLIT, which needs at least metadata. */
97 #define TARGET_TGSPLIT TARGET_CDNA2_PLUS
98
99 #endif