Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions llvm/lib/Target/AMDGPU/Utils/AMDGPUPALMetadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "llvm/MC/MCExpr.h"
#include "llvm/Support/AMDGPUMetadata.h"
#include "llvm/Support/EndianStream.h"
#include "llvm/Support/VersionTuple.h"

using namespace llvm;
using namespace llvm::AMDGPU;
Expand Down Expand Up @@ -259,13 +260,16 @@ void AMDGPUPALMetadata::setEntryPoint(unsigned CC, StringRef Name) {
getHwStage(CC)[".entry_point_symbol"] =
MsgPackDoc.getNode(Name, /*Copy=*/true);

// Set .entry_point which is defined
// to be _amdgpu_<stage> and _amdgpu_cs for non-shader functions
SmallString<16> EPName("_amdgpu_");
raw_svector_ostream EPNameOS(EPName);
EPNameOS << getStageName(CC) + 1;
getHwStage(CC)[".entry_point"] =
MsgPackDoc.getNode(EPNameOS.str(), /*Copy=*/true);
// For PAL version 3.6 and above, entry_point is no longer required.
if (getPALVersion() < VersionTuple(3, 6)) {
// Set .entry_point which is defined to be _amdgpu_<stage>_main and
// _amdgpu_cs_main for non-shader functions.
SmallString<16> EPName("_amdgpu_");
raw_svector_ostream EPNameOS(EPName);
EPNameOS << getStageName(CC) + 1 << "_main";
getHwStage(CC)[".entry_point"] =
MsgPackDoc.getNode(EPNameOS.str(), /*Copy=*/true);
}
}

// Set the number of used vgprs in the metadata. This is an optional
Expand Down Expand Up @@ -1052,6 +1056,10 @@ unsigned AMDGPUPALMetadata::getPALMajorVersion() { return getPALVersion(0); }

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

VersionTuple AMDGPUPALMetadata::getPALVersion() {
return VersionTuple(getPALVersion(0), getPALVersion(1));
}

// Set the field in a given .hardware_stages entry
void AMDGPUPALMetadata::setHwStage(unsigned CC, StringRef field, unsigned Val) {
getHwStage(CC)[field] = Val;
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Target/AMDGPU/Utils/AMDGPUPALMetadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
namespace llvm {

class Module;
class StringRef;

class AMDGPUPALMetadata {
public:
Expand Down Expand Up @@ -155,6 +154,7 @@ class AMDGPUPALMetadata {

unsigned getPALMajorVersion();
unsigned getPALMinorVersion();
VersionTuple getPALVersion();

void setHwStage(unsigned CC, StringRef field, unsigned Val);
void setHwStage(unsigned CC, StringRef field, bool Val);
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/AMDGPU/amdpal-cs.ll
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
; GCN-NEXT: amdpal.pipelines:
; GCN-NEXT: - .hardware_stages:
; GCN-NEXT: .cs:
; GCN-NEXT: .entry_point: _amdgpu_cs
; GCN-NEXT: .entry_point: _amdgpu_cs_main
; GCN-NEXT: .entry_point_symbol: cs_amdpal
; GCN-NEXT: .scratch_memory_size: 0
; GCN: .registers:
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/AMDGPU/amdpal-es.ll
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
; GCN-NEXT: amdpal.pipelines:
; GCN-NEXT: - .hardware_stages:
; GCN-NEXT: .es:
; GCN-NEXT: .entry_point: _amdgpu_es
; GCN-NEXT: .entry_point: _amdgpu_es_main
; GCN-NEXT: .entry_point_symbol: es_amdpal
; GCN-NEXT: .scratch_memory_size: 0
; GCN: .registers:
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/AMDGPU/amdpal-gs.ll
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
; GCN-NEXT: amdpal.pipelines:
; GCN-NEXT: - .hardware_stages:
; GCN-NEXT: .gs:
; GCN-NEXT: .entry_point: _amdgpu_gs
; GCN-NEXT: .entry_point: _amdgpu_gs_main
; GCN-NEXT: .entry_point_symbol: gs_amdpal
; GCN-NEXT: .scratch_memory_size: 0
; GCN: .registers:
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/AMDGPU/amdpal-ls.ll
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
; GCN-NEXT: amdpal.pipelines:
; GCN-NEXT: - .hardware_stages:
; GCN-NEXT: .ls:
; GCN-NEXT: .entry_point: _amdgpu_ls
; GCN-NEXT: .entry_point: _amdgpu_ls_main
; GCN-NEXT: .entry_point_symbol: ls_amdpal
; GCN-NEXT: .scratch_memory_size: 0
; GCN: .registers:
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/AMDGPU/amdpal-psenable.ll
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
; GCN-NEXT: amdpal.pipelines:
; GCN-NEXT: - .hardware_stages:
; GCN-NEXT: .ps:
; GCN-NEXT: .entry_point: _amdgpu_ps
; GCN-NEXT: .entry_point: _amdgpu_ps_main
; GCN-NEXT: .entry_point_symbol: amdpal_psenable
; GCN-NEXT: .scratch_memory_size: 0
; GCN: .registers:
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/AMDGPU/amdpal-vs.ll
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
; GCN-NEXT: amdpal.pipelines:
; GCN-NEXT: - .hardware_stages:
; GCN-NEXT: .vs:
; GCN-NEXT: .entry_point: _amdgpu_vs
; GCN-NEXT: .entry_point: _amdgpu_vs_main
; GCN-NEXT: .entry_point_symbol: vs_amdpal
; GCN-NEXT: .scratch_memory_size: 0
; GCN: .registers:
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/AMDGPU/amdpal.ll
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ declare void @llvm.amdgcn.raw.ptr.buffer.store.f32(float, ptr addrspace(8), i32,
; PAL-NEXT: amdpal.pipelines:
; PAL-NEXT: - .hardware_stages:
; PAL-NEXT: .cs:
; PAL-NEXT: .entry_point: _amdgpu_cs
; PAL-NEXT: .entry_point: _amdgpu_cs_main
; PAL-NEXT: .entry_point_symbol: scratch2_cs
; PAL-NEXT: .scratch_memory_size: 0x10
; PAL-NEXT: .sgpr_count: 0x
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/AMDGPU/elf-notes.ll
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
; OSABI-PAL-ELF: amdpal.pipelines:
; OSABI-PAL-ELF: - .hardware_stages:
; OSABI-PAL-ELF: .cs:
; OSABI-PAL-ELF: .entry_point: _amdgpu_cs
; OSABI-PAL-ELF: .entry_point: _amdgpu_cs_main
; OSABI-PAL-ELF: .entry_point_symbol: elf_notes
; OSABI-PAL-ELF: .scratch_memory_size: 0
; OSABI-PAL-ELF: .sgpr_count: 96
Expand Down
21 changes: 8 additions & 13 deletions llvm/test/CodeGen/AMDGPU/pal-metadata-3.0.ll
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
; CHECK-NEXT: .checksum_value: 0x9444d7d0
; CHECK-NEXT: .debug_mode: false
; DVGPR-NEXT: .dynamic_vgpr_saved_count: 0x70
; CHECK-NEXT: .entry_point: _amdgpu_cs
; CHECK-NEXT: .entry_point: _amdgpu_cs_main
; CHECK-NEXT: .entry_point_symbol: _amdgpu_cs_main
; CHECK-NEXT: .excp_en: 0
; CHECK-NEXT: .float_mode: 0xc0
Expand Down Expand Up @@ -116,7 +116,7 @@
; CHECK-NEXT: .wgp_mode: false
; CHECK-NEXT: .gs:
; CHECK-NEXT: .debug_mode: false
; CHECK-NEXT: .entry_point: _amdgpu_gs
; CHECK-NEXT: .entry_point: _amdgpu_gs_main
; CHECK-NEXT: .entry_point_symbol: gs_shader
; GFX11-NEXT: .ieee_mode: false
; CHECK-NEXT: .lds_size: 0x200
Expand All @@ -128,7 +128,7 @@
; CHECK-NEXT: .wgp_mode: true
; CHECK-NEXT: .hs:
; CHECK-NEXT: .debug_mode: false
; CHECK-NEXT: .entry_point: _amdgpu_hs
; CHECK-NEXT: .entry_point: _amdgpu_hs_main
; CHECK-NEXT: .entry_point_symbol: hs_shader
; GFX11-NEXT: .ieee_mode: false
; CHECK-NEXT: .lds_size: 0x1000
Expand All @@ -140,7 +140,7 @@
; CHECK-NEXT: .wgp_mode: true
; CHECK-NEXT: .ps:
; CHECK-NEXT: .debug_mode: false
; CHECK-NEXT: .entry_point: _amdgpu_ps
; CHECK-NEXT: .entry_point: _amdgpu_ps_main
; CHECK-NEXT: .entry_point_symbol: ps_shader
; GFX11-NEXT: .ieee_mode: false
; CHECK-NEXT: .lds_size: 0
Expand Down Expand Up @@ -180,32 +180,27 @@ define dllexport amdgpu_ps void @ps_shader() #1 {

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

define dllexport amdgpu_gs void @gs_shader() #2 {
define dllexport amdgpu_gs void @gs_shader() {
%ptr = getelementptr i32, ptr addrspace(3) @LDS.GS, i32 0
store i32 0, ptr addrspace(3) %ptr, align 4
ret void
}

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

define dllexport amdgpu_hs void @hs_shader() #2 {
define dllexport amdgpu_hs void @hs_shader() {
%ptr = getelementptr i32, ptr addrspace(3) @LDS.HS, i32 0
store i32 0, ptr addrspace(3) %ptr, align 4
ret void
}

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

; Function Attrs: nounwind willreturn memory(none)
declare ptr addrspace(7) @lgc.buffer.desc.to.ptr(<4 x i32>) #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.amdgcn.s.getpc() #2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(write)
declare i64 @llvm.amdgcn.s.getpc()
declare void @llvm.amdgcn.raw.buffer.store.i32(i32, <4 x i32>, i32, i32, i32 immarg) #3

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" }
attributes #0 = { nounwind memory(readwrite) "target-features"=",+wavefrontsize64,+cumode" }

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

Expand Down
Loading
Loading