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 18 namespace 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. 25 namespace AMDGPUAS { 26 enum : unsigned { 27 // The maximum value for flat, generic, local, private, constant and region. 28 MAX_AMDGPU_ADDRESS = 9, 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). 53 PARAM_D_ADDRESS = 6, 54 /// Address space for indirect addressable parameter memory (VTX1). 55 PARAM_I_ADDRESS = 7, 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 63 CONSTANT_BUFFER_0 = 8, 64 CONSTANT_BUFFER_1 = 9, 65 CONSTANT_BUFFER_2 = 10, 66 CONSTANT_BUFFER_3 = 11, 67 CONSTANT_BUFFER_4 = 12, 68 CONSTANT_BUFFER_5 = 13, 69 CONSTANT_BUFFER_6 = 14, 70 CONSTANT_BUFFER_7 = 15, 71 CONSTANT_BUFFER_8 = 16, 72 CONSTANT_BUFFER_9 = 17, 73 CONSTANT_BUFFER_10 = 18, 74 CONSTANT_BUFFER_11 = 19, 75 CONSTANT_BUFFER_12 = 20, 76 CONSTANT_BUFFER_13 = 21, 77 CONSTANT_BUFFER_14 = 22, 78 CONSTANT_BUFFER_15 = 23, 79 80 // Some places use this if the address space can't be determined. 81 UNKNOWN_ADDRESS_SPACE = ~0u, 82 }; 83 } // end namespace AMDGPUAS 84 } // end namespace llvm 85 86 #endif // LLVM_SUPPORT_AMDGPUADDRSPACE_H 87