Skip to content

Commit 76ae47c

Browse files
committedApr 6, 2017
[AMDGPU] Temporarily change constant address space from 4 to 2
Our final address space mapping is to let constant address space to be 4 to match nvptx. However for now we will make it 2 to avoid unnecessary work in FE/BE/devlib about intrinsics returning constant pointers. Differential Revision: https://reviews.llvm.org/D31770 llvm-svn: 299690
1 parent 5e7059b commit 76ae47c

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed
 

‎llvm/lib/Target/AMDGPU/AMDGPU.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,14 @@ enum TargetIndex {
154154
struct AMDGPUAS {
155155
// The following address space values depend on the triple environment.
156156
unsigned PRIVATE_ADDRESS; ///< Address space for private memory.
157-
unsigned CONSTANT_ADDRESS; ///< Address space for constant memory (VTX2)
158157
unsigned FLAT_ADDRESS; ///< Address space for flat memory.
159158
unsigned REGION_ADDRESS; ///< Address space for region memory.
160159

161160
// The maximum value for flat, generic, local, private, constant and region.
162161
const static unsigned MAX_COMMON_ADDRESS = 5;
163162

164163
const static unsigned GLOBAL_ADDRESS = 1; ///< Address space for global memory (RAT0, VTX0).
164+
const static unsigned CONSTANT_ADDRESS = 2; ///< Address space for constant memory (VTX2)
165165
const static unsigned LOCAL_ADDRESS = 3; ///< Address space for local memory.
166166
const static unsigned PARAM_D_ADDRESS = 6; ///< Address space for direct addressible parameter memory (CONST0)
167167
const static unsigned PARAM_I_ADDRESS = 7; ///< Address space for indirect addressible parameter memory (VTX1)

‎llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,20 @@ AMDGPUAAResult::ASAliasRulesTy::ASAliasRulesTy(AMDGPUAS AS_, Triple::ArchType Ar
5252
/* Region */ {NoAlias , NoAlias , NoAlias , NoAlias , MayAlias, MayAlias}
5353
};
5454
static const AliasResult ASAliasRulesGenIsZero[6][6] = {
55-
/* Flat Global Region Group Constant Private */
55+
/* Flat Global Constant Group Region Private */
5656
/* Flat */ {MayAlias, MayAlias, MayAlias, MayAlias, MayAlias, MayAlias},
5757
/* Global */ {MayAlias, MayAlias, NoAlias , NoAlias , NoAlias , NoAlias},
58-
/* Region */ {NoAlias , NoAlias , MayAlias, NoAlias, NoAlias , MayAlias},
58+
/* Constant */ {MayAlias, NoAlias , MayAlias, NoAlias , NoAlias, NoAlias},
5959
/* Group */ {MayAlias, NoAlias , NoAlias , MayAlias, NoAlias , NoAlias},
60-
/* Constant */ {MayAlias, NoAlias , NoAlias , NoAlias , MayAlias, NoAlias},
60+
/* Region */ {MayAlias, NoAlias , NoAlias , NoAlias, MayAlias, NoAlias},
6161
/* Private */ {MayAlias, NoAlias , NoAlias , NoAlias , NoAlias , MayAlias}
6262
};
6363
assert(AS.MAX_COMMON_ADDRESS <= 5);
6464
if (AS.FLAT_ADDRESS == 0) {
6565
assert(AS.GLOBAL_ADDRESS == 1 &&
66-
AS.REGION_ADDRESS == 2 &&
66+
AS.REGION_ADDRESS == 4 &&
6767
AS.LOCAL_ADDRESS == 3 &&
68-
AS.CONSTANT_ADDRESS == 4 &&
68+
AS.CONSTANT_ADDRESS == 2 &&
6969
AS.PRIVATE_ADDRESS == 5);
7070
ASAliasRules = &ASAliasRulesGenIsZero;
7171
} else {

‎llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ static StringRef computeDataLayout(const Triple &TT) {
212212
// flat.
213213
if (TT.getEnvironmentName() == "amdgiz" ||
214214
TT.getEnvironmentName() == "amdgizcl")
215-
return "e-p:64:64-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32"
215+
return "e-p:64:64-p1:64:64-p2:64:64-p3:32:32-p4:32:32-p5:32:32"
216216
"-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128"
217217
"-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64";
218218
return "e-p:32:32-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32"

‎llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -772,13 +772,11 @@ AMDGPUAS getAMDGPUAS(Triple T) {
772772
AMDGPUAS AS;
773773
if (Env == "amdgiz" || Env == "amdgizcl") {
774774
AS.FLAT_ADDRESS = 0;
775-
AS.CONSTANT_ADDRESS = 4;
776775
AS.PRIVATE_ADDRESS = 5;
777-
AS.REGION_ADDRESS = 2;
776+
AS.REGION_ADDRESS = 4;
778777
}
779778
else {
780779
AS.FLAT_ADDRESS = 4;
781-
AS.CONSTANT_ADDRESS = 2;
782780
AS.PRIVATE_ADDRESS = 0;
783781
AS.REGION_ADDRESS = 5;
784782
}

0 commit comments

Comments
 (0)
Please sign in to comment.