source: CLRX/CLRadeonExtender/trunk/CLRX/utils/GPUId.h @ 2604

Last change on this file since 2604 was 2604, checked in by matszpk, 3 years ago

CLRadeonExtender: AsmROCm: tentative version of code to setup kernel configuration.
Fixed setting alignments and wavefront size (power of 2). Add extra symbols to output.
GPUId: Add AMDGPUArchValues to GPUId.

File size: 4.0 KB
Line 
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 */
19/*! \file GPUId.h
20 * \brief GPU identification utilities
21 */
22
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
30/// main namespace
31namespace CLRX
32{
33/*
34 * GPU identification utilities
35 */
36
37/// type of GPU device
38enum class GPUDeviceType: cxbyte
39{
40    CAPE_VERDE = 0, ///< Radeon HD7700
41    PITCAIRN, ///< Radeon HD7800
42    TAHITI, ///< Radeon HD7900
43    OLAND, ///< Radeon R7 250
44    BONAIRE, ///< Radeon R7 260
45    SPECTRE, ///< Kaveri
46    SPOOKY, ///< Kaveri
47    KALINDI, ///< ???  GCN1.1
48    HAINAN, ///< ????  GCN1.0
49    HAWAII, ///< Radeon R9 290
50    ICELAND, ///< ???
51    TONGA, ///< Radeon R9 285
52    MULLINS, ///< ???
53    FIJI,  ///< Radeon Fury
54    CARRIZO, ///< APU
55    DUMMY,
56    GOOSE,
57    HORSE,
58    STONEY,
59    ELLESMERE,
60    BAFFIN,
61    GPUDEVICE_MAX = BAFFIN,    ///< last value
62   
63    RADEON_HD7700 = CAPE_VERDE, ///< Radeon HD7700
64    RADEON_HD7800 = PITCAIRN,   ///< Radeon HD7800
65    RADEON_HD7900 = TAHITI,     ///< Radeon HD7900
66    RADEON_R7_250 = OLAND,      ///< Radeon R7 250
67    RADEON_R7_260 = BONAIRE,    ///< Radeon R7 260
68    RADEON_R9_290 = HAWAII      ///< Radeon R7 290
69};
70
71/// GPU architecture
72enum class GPUArchitecture: cxbyte
73{
74    GCN1_0 = 0, ///< first iteration (Radeon HD7000 series)
75    GCN1_1,     ///< second iteration (Radeon Rx 200 series)
76    GCN1_2,     ///< third iteration (Radeon Rx 300 series and Tonga)
77    GPUARCH_MAX = GCN1_2    /// last value
78};
79
80/// get GPU device type from name
81extern GPUDeviceType getGPUDeviceTypeFromName(const char* name);
82
83/// get GPU device type name
84extern const char* getGPUDeviceTypeName(GPUDeviceType deviceType);
85
86/// get GPU architecture from name
87extern GPUArchitecture getGPUArchitectureFromName(const char* name);
88
89/// get GPUArchitecture from GPU device type
90extern GPUArchitecture getGPUArchitectureFromDeviceType(GPUDeviceType deviceType);
91
92/// get lowest GPU device for architecture
93extern GPUDeviceType getLowestGPUDeviceTypeFromArchitecture(GPUArchitecture arch);
94
95/// get GPU architecture name
96extern const char* getGPUArchitectureName(GPUArchitecture architecture);
97
98enum: Flags {
99    REGCOUNT_NO_VCC = 1,
100    REGCOUNT_NO_FLAT = 2,
101    REGCOUNT_NO_XNACK = 4,
102    REGCOUNT_NO_EXTRA = 0xffff
103};
104
105enum: cxuint {
106    REGTYPE_SGPR = 0,
107    REGTYPE_VGPR
108};
109
110enum : Flags
111{
112    GCN_VCC = 1,
113    GCN_FLAT = 2,
114    GCN_XNACK = 4
115};
116
117enum: Flags {
118    GPUSETUP_TGSIZE_EN = 1,
119    GPUSETUP_SCRATCH_EN = 2
120};
121
122/// get maximum available registers for GPU (type: 0 - scalar, 1 - vector)
123extern cxuint getGPUMaxRegistersNum(GPUArchitecture architecture, cxuint regType,
124                         Flags flags = 0);
125
126/// get minimal number of required registers
127extern void getGPUSetupMinRegistersNum(GPUArchitecture architecture, cxuint dimMask,
128               cxuint userDataNum, Flags flags, cxuint* gprsOut);
129
130/// get maximum local size for GPU architecture
131extern size_t getGPUMaxLocalSize(GPUArchitecture architecture);
132
133/// get extra registers (like VCC,FLAT_SCRATCH)
134extern cxuint getGPUExtraRegsNum(GPUArchitecture architecture, cxuint regType,
135              Flags flags);
136
137struct AMDGPUArchValues
138{
139    uint32_t major;
140    uint32_t minor;
141    uint32_t stepping;
142};
143
144};
145
146#endif
Note: See TracBrowser for help on using the repository browser.