xref: /aosp_15_r20/external/mesa3d/src/intel/compiler/intel_gfx_ver_enum.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 /*
2  * Copyright © 2015 Intel Corporation
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
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21  * IN THE SOFTWARE.
22  */
23 
24 #ifndef INTEL_GFX_VER_ENUM_H
25 #define INTEL_GFX_VER_ENUM_H
26 
27 #include "util/macros.h"
28 #include "dev/intel_device_info.h"
29 
30 enum gfx_ver {
31    GFX4    = (1 << 0),
32    GFX45   = (1 << 1),
33    GFX5    = (1 << 2),
34    GFX6    = (1 << 3),
35    GFX7    = (1 << 4),
36    GFX75   = (1 << 5),
37    GFX8    = (1 << 6),
38    GFX9    = (1 << 7),
39    GFX10   = (1 << 8),
40    GFX11   = (1 << 9),
41    GFX12   = (1 << 10),
42    GFX125  = (1 << 11),
43    XE2     = (1 << 12),
44    GFX_ALL = ~0
45 };
46 
47 #define GFX_LT(ver) ((ver) - 1)
48 #define GFX_GE(ver) (~GFX_LT(ver))
49 #define GFX_LE(ver) (GFX_LT(ver) | (ver))
50 
51 static inline enum gfx_ver
gfx_ver_from_devinfo(const struct intel_device_info * devinfo)52 gfx_ver_from_devinfo(const struct intel_device_info *devinfo)
53 {
54    switch (devinfo->verx10) {
55    case 40: return GFX4;
56    case 45: return GFX45;
57    case 50: return GFX5;
58    case 60: return GFX6;
59    case 70: return GFX7;
60    case 75: return GFX75;
61    case 80: return GFX8;
62    case 90: return GFX9;
63    case 110: return GFX11;
64    case 120: return GFX12;
65    case 125: return GFX125;
66    case 200: return XE2;
67    default:
68       unreachable("not reached");
69    }
70 }
71 
72 #endif
73