LLVM 20.0.0git
AMDGPUAddrSpace.h
Go to the documentation of this file.
1//===---------------- AMDGPUAddrSpace.h -------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9/// \file
10/// AMDGPU address space definition
11///
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_SUPPORT_AMDGPUADDRSPACE_H
16#define LLVM_SUPPORT_AMDGPUADDRSPACE_H
17
18namespace llvm {
19/// OpenCL uses address spaces to differentiate between
20/// various memory regions on the hardware. On the CPU
21/// all of the address spaces point to the same memory,
22/// however on the GPU, each address space points to
23/// a separate piece of memory that is unique from other
24/// memory locations.
25namespace AMDGPUAS {
26enum : unsigned {
27 // The maximum value for flat, generic, local, private, constant and region.
29
30 FLAT_ADDRESS = 0, ///< Address space for flat memory.
31 GLOBAL_ADDRESS = 1, ///< Address space for global memory (RAT0, VTX0).
32 REGION_ADDRESS = 2, ///< Address space for region memory. (GDS)
33
34 CONSTANT_ADDRESS = 4, ///< Address space for constant memory (VTX2).
35 LOCAL_ADDRESS = 3, ///< Address space for local memory.
36 PRIVATE_ADDRESS = 5, ///< Address space for private memory.
37
38 CONSTANT_ADDRESS_32BIT = 6, ///< Address space for 32-bit constant memory.
39
40 BUFFER_FAT_POINTER = 7, ///< Address space for 160-bit buffer fat pointers.
41 ///< Not used in backend.
42
43 BUFFER_RESOURCE = 8, ///< Address space for 128-bit buffer resources.
44
45 BUFFER_STRIDED_POINTER = 9, ///< Address space for 192-bit fat buffer
46 ///< pointers with an additional index.
47
48 /// Internal address spaces. Can be freely renumbered.
49 STREAMOUT_REGISTER = 128, ///< Address space for GS NGG Streamout registers.
50 /// end Internal address spaces.
51
52 /// Address space for direct addressable parameter memory (CONST0).
54 /// Address space for indirect addressable parameter memory (VTX1).
56
57 // Do not re-order the CONSTANT_BUFFER_* enums. Several places depend on
58 // this order to be able to dynamically index a constant buffer, for
59 // example:
60 //
61 // ConstantBufferAS = CONSTANT_BUFFER_0 + CBIdx
62
79
80 // Some places use this if the address space can't be determined.
82};
83} // end namespace AMDGPUAS
84
85namespace AMDGPU {
86inline bool isFlatGlobalAddrSpace(unsigned AS) {
89}
90
91inline bool isExtendedGlobalAddrSpace(unsigned AS) {
95}
96
97inline bool isConstantAddressSpace(unsigned AS) {
98 switch (AS) {
99 using namespace AMDGPUAS;
100 case CONSTANT_ADDRESS:
101 case CONSTANT_ADDRESS_32BIT:
102 case CONSTANT_BUFFER_0:
103 case CONSTANT_BUFFER_1:
104 case CONSTANT_BUFFER_2:
105 case CONSTANT_BUFFER_3:
106 case CONSTANT_BUFFER_4:
107 case CONSTANT_BUFFER_5:
108 case CONSTANT_BUFFER_6:
109 case CONSTANT_BUFFER_7:
110 case CONSTANT_BUFFER_8:
111 case CONSTANT_BUFFER_9:
112 case CONSTANT_BUFFER_10:
113 case CONSTANT_BUFFER_11:
114 case CONSTANT_BUFFER_12:
115 case CONSTANT_BUFFER_13:
116 case CONSTANT_BUFFER_14:
117 case CONSTANT_BUFFER_15:
118 return true;
119 default:
120 return false;
121 }
122}
123} // end namespace AMDGPU
124
125} // end namespace llvm
126
127#endif // LLVM_SUPPORT_AMDGPUADDRSPACE_H
@ CONSTANT_ADDRESS_32BIT
Address space for 32-bit constant memory.
@ BUFFER_STRIDED_POINTER
Address space for 192-bit fat buffer pointers with an additional index.
@ PARAM_D_ADDRESS
end Internal address spaces.
@ REGION_ADDRESS
Address space for region memory. (GDS)
@ LOCAL_ADDRESS
Address space for local memory.
@ STREAMOUT_REGISTER
Internal address spaces. Can be freely renumbered.
@ PARAM_I_ADDRESS
Address space for indirect addressable parameter memory (VTX1).
@ CONSTANT_ADDRESS
Address space for constant memory (VTX2).
@ FLAT_ADDRESS
Address space for flat memory.
@ GLOBAL_ADDRESS
Address space for global memory (RAT0, VTX0).
@ BUFFER_FAT_POINTER
Address space for 160-bit buffer fat pointers.
@ PRIVATE_ADDRESS
Address space for private memory.
@ BUFFER_RESOURCE
Address space for 128-bit buffer resources.
bool isFlatGlobalAddrSpace(unsigned AS)
bool isExtendedGlobalAddrSpace(unsigned AS)
bool isConstantAddressSpace(unsigned AS)
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18