CLRX  1
An unofficial OpenCL extensions designed for Radeon GPUs
GPUId.h
Go to the documentation of this file.
1 /*
2  * CLRadeonExtender - Unofficial OpenCL Radeon Extensions Library
3  * Copyright (C) 2014-2016 Mateusz Szpakowski
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
23 #ifndef __CLRX_GPUID_H__
24 #define __CLRX_GPUID_H__
25 
26 #include <CLRX/Config.h>
27 #include <CLRX/utils/Utilities.h>
28 #include <string>
29 
31 namespace CLRX
32 {
33 /*
34  * GPU identification utilities
35  */
36 
38 enum class GPUDeviceType: cxbyte
39 {
40  CAPE_VERDE = 0,
41  PITCAIRN,
42  TAHITI,
43  OLAND,
44  BONAIRE,
45  SPECTRE,
46  SPOOKY,
47  KALINDI,
48  HAINAN,
49  HAWAII,
50  ICELAND,
51  TONGA,
52  MULLINS,
53  FIJI,
54  CARRIZO,
55  DUMMY,
56  GOOSE,
57  HORSE,
58  STONEY,
59  ELLESMERE,
60  BAFFIN,
61  GPUDEVICE_MAX = BAFFIN,
62 
68  RADEON_R9_290 = HAWAII
69 };
70 
72 enum class GPUArchitecture: cxbyte
73 {
74  GCN1_0 = 0,
75  GCN1_1,
76  GCN1_2,
77  GPUARCH_MAX = GCN1_2
78 };
79 
81 extern GPUDeviceType getGPUDeviceTypeFromName(const char* name);
82 
84 extern const char* getGPUDeviceTypeName(GPUDeviceType deviceType);
85 
87 extern GPUArchitecture getGPUArchitectureFromName(const char* name);
88 
91 
94 
96 extern const char* getGPUArchitectureName(GPUArchitecture architecture);
97 
98 enum: Flags {
99  REGCOUNT_NO_VCC = 1,
100  REGCOUNT_NO_FLAT = 2,
101  REGCOUNT_NO_XNACK = 4,
102  REGCOUNT_NO_EXTRA = 0xffff
103 };
104 
105 enum: cxuint {
106  REGTYPE_SGPR = 0,
107  REGTYPE_VGPR
108 };
109 
110 enum : Flags
111 {
112  GCN_VCC = 1,
113  GCN_FLAT = 2,
114  GCN_XNACK = 4
115 };
116 
117 enum: Flags {
118  GPUSETUP_TGSIZE_EN = 1,
119  GPUSETUP_SCRATCH_EN = 2
120 };
121 
123 extern cxuint getGPUMaxRegistersNum(GPUArchitecture architecture, cxuint regType,
124  Flags flags = 0);
125 
127 extern void getGPUSetupMinRegistersNum(GPUArchitecture architecture, cxuint dimMask,
128  cxuint userDataNum, Flags flags, cxuint* gprsOut);
129 
131 extern size_t getGPUMaxLocalSize(GPUArchitecture architecture);
132 
134 extern cxuint getGPUExtraRegsNum(GPUArchitecture architecture, cxuint regType,
135  Flags flags);
136 
138 {
139  uint32_t major;
140  uint32_t minor;
141  uint32_t stepping;
142 };
143 
144 };
145 
146 #endif
uint32_t Flags
type for declaring various flags
Definition: Utilities.h:97
first iteration (Radeon HD7000 series)
GPUArchitecture getGPUArchitectureFromDeviceType(GPUDeviceType deviceType)
get GPUArchitecture from GPU device type
GPUArchitecture getGPUArchitectureFromName(const char *name)
get GPU architecture from name
GPUArchitecture
GPU architecture.
Definition: GPUId.h:72
GPUDeviceType getLowestGPUDeviceTypeFromArchitecture(GPUArchitecture arch)
get lowest GPU device for architecture
void getGPUSetupMinRegistersNum(GPUArchitecture architecture, cxuint dimMask, cxuint userDataNum, Flags flags, cxuint *gprsOut)
get minimal number of required registers
const char * getGPUDeviceTypeName(GPUDeviceType deviceType)
get GPU device type name
size_t getGPUMaxLocalSize(GPUArchitecture architecture)
get maximum local size for GPU architecture
cxuint getGPUMaxRegistersNum(GPUArchitecture architecture, cxuint regType, Flags flags=0)
get maximum available registers for GPU (type: 0 - scalar, 1 - vector)
main namespace
Definition: AsmFormats.h:41
Definition: GPUId.h:137
GPUDeviceType
type of GPU device
Definition: GPUId.h:38
third iteration (Radeon Rx 300 series and Tonga)
utilities for other libraries and programs
const char * getGPUArchitectureName(GPUArchitecture architecture)
get GPU architecture name
GPUDeviceType getGPUDeviceTypeFromName(const char *name)
get GPU device type from name
cxuint getGPUExtraRegsNum(GPUArchitecture architecture, cxuint regType, Flags flags)
get extra registers (like VCC,FLAT_SCRATCH)
second iteration (Radeon Rx 200 series)