Skip to content

Commit 83f642f

Browse files
committed
Address review comments
1 parent 2b30dc7 commit 83f642f

File tree

4 files changed

+16
-20
lines changed

4 files changed

+16
-20
lines changed

llvm/lib/Target/AMDGPU/Utils/AMDGPUPALMetadata.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "llvm/MC/MCExpr.h"
2424
#include "llvm/Support/AMDGPUMetadata.h"
2525
#include "llvm/Support/EndianStream.h"
26+
#include "llvm/Support/VersionTuple.h"
2627

2728
using namespace llvm;
2829
using namespace llvm::AMDGPU;
@@ -260,8 +261,7 @@ void AMDGPUPALMetadata::setEntryPoint(unsigned CC, StringRef Name) {
260261
MsgPackDoc.getNode(Name, /*Copy=*/true);
261262

262263
// For pal version 3.6 and above, entry_point is no longer required
263-
if (getPALMajorVersion() < 3 ||
264-
(getPALMajorVersion() == 3 && getPALMinorVersion() < 6)) {
264+
if (getPALVersion() < VersionTuple(3, 6)) {
265265
// Set .entry_point which is defined
266266
// to be _amdgpu_<stage>_main and _amdgpu_cs_main for non-shader functions
267267
SmallString<16> EPName("_amdgpu_");
@@ -1056,6 +1056,10 @@ unsigned AMDGPUPALMetadata::getPALMajorVersion() { return getPALVersion(0); }
10561056

10571057
unsigned AMDGPUPALMetadata::getPALMinorVersion() { return getPALVersion(1); }
10581058

1059+
VersionTuple AMDGPUPALMetadata::getPALVersion() {
1060+
return VersionTuple(getPALVersion(0), getPALVersion(1));
1061+
}
1062+
10591063
// Set the field in a given .hardware_stages entry
10601064
void AMDGPUPALMetadata::setHwStage(unsigned CC, StringRef field, unsigned Val) {
10611065
getHwStage(CC)[field] = Val;

llvm/lib/Target/AMDGPU/Utils/AMDGPUPALMetadata.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ namespace llvm {
2222

2323
class Module;
2424
class StringRef;
25+
class VersionTuple;
2526

2627
class AMDGPUPALMetadata {
2728
public:
@@ -155,6 +156,7 @@ class AMDGPUPALMetadata {
155156

156157
unsigned getPALMajorVersion();
157158
unsigned getPALMinorVersion();
159+
VersionTuple getPALVersion();
158160

159161
void setHwStage(unsigned CC, StringRef field, unsigned Val);
160162
void setHwStage(unsigned CC, StringRef field, bool Val);

llvm/test/CodeGen/AMDGPU/pal-metadata-3.0.ll

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -180,32 +180,27 @@ define dllexport amdgpu_ps void @ps_shader() #1 {
180180

181181
@LDS.GS = external addrspace(3) global [1 x i32], align 4
182182

183-
define dllexport amdgpu_gs void @gs_shader() #2 {
183+
define dllexport amdgpu_gs void @gs_shader() {
184184
%ptr = getelementptr i32, ptr addrspace(3) @LDS.GS, i32 0
185185
store i32 0, ptr addrspace(3) %ptr, align 4
186186
ret void
187187
}
188188

189189
@LDS.HS = external addrspace(3) global [1024 x i32], align 4
190190

191-
define dllexport amdgpu_hs void @hs_shader() #2 {
191+
define dllexport amdgpu_hs void @hs_shader() {
192192
%ptr = getelementptr i32, ptr addrspace(3) @LDS.HS, i32 0
193193
store i32 0, ptr addrspace(3) %ptr, align 4
194194
ret void
195195
}
196196

197197
!amdgpu.pal.metadata.msgpack = !{!0}
198198

199-
; Function Attrs: nounwind willreturn memory(none)
200199
declare ptr addrspace(7) @lgc.buffer.desc.to.ptr(<4 x i32>) #1
201-
202-
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
203-
declare i64 @llvm.amdgcn.s.getpc() #2
204-
205-
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(write)
200+
declare i64 @llvm.amdgcn.s.getpc()
206201
declare void @llvm.amdgcn.raw.buffer.store.i32(i32, <4 x i32>, i32, i32, i32 immarg) #3
207202

208-
attributes #0 = { nounwind memory(readwrite) "amdgpu-flat-work-group-size"="1024,1024" "amdgpu-memory-bound"="false" "amdgpu-unroll-threshold"="700" "amdgpu-wave-limiter"="false" "amdgpu-work-group-info-arg-no"="4" "denormal-fp-math-f32"="preserve-sign" "target-features"=",+wavefrontsize64,+cumode" }
203+
attributes #0 = { nounwind memory(readwrite) "target-features"=",+wavefrontsize64,+cumode" }
209204

210205
attributes #1 = { nounwind memory(readwrite) "InitialPSInputAddr"="36983" }
211206

llvm/test/CodeGen/AMDGPU/pal-metadata-3.6.ll

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -180,32 +180,27 @@ define dllexport amdgpu_ps void @ps_shader() #1 {
180180

181181
@LDS.GS = external addrspace(3) global [1 x i32], align 4
182182

183-
define dllexport amdgpu_gs void @gs_shader() #2 {
183+
define dllexport amdgpu_gs void @gs_shader() {
184184
%ptr = getelementptr i32, ptr addrspace(3) @LDS.GS, i32 0
185185
store i32 0, ptr addrspace(3) %ptr, align 4
186186
ret void
187187
}
188188

189189
@LDS.HS = external addrspace(3) global [1024 x i32], align 4
190190

191-
define dllexport amdgpu_hs void @hs_shader() #2 {
191+
define dllexport amdgpu_hs void @hs_shader() {
192192
%ptr = getelementptr i32, ptr addrspace(3) @LDS.HS, i32 0
193193
store i32 0, ptr addrspace(3) %ptr, align 4
194194
ret void
195195
}
196196

197197
!amdgpu.pal.metadata.msgpack = !{!0}
198198

199-
; Function Attrs: nounwind willreturn memory(none)
200199
declare ptr addrspace(7) @lgc.buffer.desc.to.ptr(<4 x i32>) #1
201-
202-
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
203-
declare i64 @llvm.amdgcn.s.getpc() #2
204-
205-
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(write)
200+
declare i64 @llvm.amdgcn.s.getpc()
206201
declare void @llvm.amdgcn.raw.buffer.store.i32(i32, <4 x i32>, i32, i32, i32 immarg) #3
207202

208-
attributes #0 = { nounwind memory(readwrite) "amdgpu-flat-work-group-size"="1024,1024" "amdgpu-memory-bound"="false" "amdgpu-unroll-threshold"="700" "amdgpu-wave-limiter"="false" "amdgpu-work-group-info-arg-no"="4" "denormal-fp-math-f32"="preserve-sign" "target-features"=",+wavefrontsize64,+cumode" }
203+
attributes #0 = { nounwind memory(readwrite) "target-features"=",+wavefrontsize64,+cumode" }
209204

210205
attributes #1 = { nounwind memory(readwrite) "InitialPSInputAddr"="36983" }
211206

0 commit comments

Comments
 (0)