Skip to content

Commit 807ecc3

Browse files
author
Tim Renouf
committedFeb 6, 2018
[AMDGPU] do not generate .AMDGPU.config for amdpal os type
Summary: Now we generate PAL metadata for the amdpal os type, there is no need to generate the .AMDGPU.config section. Reviewers: arsenm, nhaehnle, dstuttard Subscribers: kzhuravl, wdng, yaxunl, t-tye, llvm-commits Differential Revision: https://reviews.llvm.org/D37760 Change-Id: I303c5fad66656ce97293da60621afac6595b4c18 llvm-svn: 324346
1 parent 33c86f8 commit 807ecc3

File tree

2 files changed

+14
-18
lines changed

2 files changed

+14
-18
lines changed
 

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

+12-16
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,8 @@ bool AMDGPUAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
303303

304304
const AMDGPUSubtarget &STM = MF.getSubtarget<AMDGPUSubtarget>();
305305
MCContext &Context = getObjFileLowering().getContext();
306-
if (!STM.isAmdHsaOS()) {
306+
// FIXME: This should be an explicit check for Mesa.
307+
if (!STM.isAmdHsaOS() && !STM.isAmdPalOS()) {
307308
MCSectionELF *ConfigSection =
308309
Context.getELFSection(".AMDGPU.config", ELF::SHT_PROGBITS, 0);
309310
OutStreamer->SwitchSection(ConfigSection);
@@ -322,7 +323,7 @@ bool AMDGPUAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
322323

323324
if (STM.isAmdPalOS())
324325
EmitPALMetadata(MF, CurrentProgramInfo);
325-
if (!STM.isAmdHsaOS()) {
326+
else if (!STM.isAmdHsaOS()) {
326327
EmitProgramInfoSI(MF, CurrentProgramInfo);
327328
}
328329
} else {
@@ -1007,26 +1008,21 @@ void AMDGPUAsmPrinter::EmitProgramInfoSI(const MachineFunction &MF,
10071008
OutStreamer->EmitIntValue(RsrcReg, 4);
10081009
OutStreamer->EmitIntValue(S_00B028_VGPRS(CurrentProgramInfo.VGPRBlocks) |
10091010
S_00B028_SGPRS(CurrentProgramInfo.SGPRBlocks), 4);
1010-
unsigned Rsrc2Val = 0;
10111011
if (STM.isVGPRSpillingEnabled(MF.getFunction())) {
10121012
OutStreamer->EmitIntValue(R_0286E8_SPI_TMPRING_SIZE, 4);
10131013
OutStreamer->EmitIntValue(S_0286E8_WAVESIZE(CurrentProgramInfo.ScratchBlocks), 4);
1014-
if (TM.getTargetTriple().getOS() == Triple::AMDPAL)
1015-
Rsrc2Val = S_00B84C_SCRATCH_EN(CurrentProgramInfo.ScratchBlocks > 0);
1016-
}
1017-
if (MF.getFunction().getCallingConv() == CallingConv::AMDGPU_PS) {
1018-
OutStreamer->EmitIntValue(R_0286CC_SPI_PS_INPUT_ENA, 4);
1019-
OutStreamer->EmitIntValue(MFI->getPSInputEnable(), 4);
1020-
OutStreamer->EmitIntValue(R_0286D0_SPI_PS_INPUT_ADDR, 4);
1021-
OutStreamer->EmitIntValue(MFI->getPSInputAddr(), 4);
1022-
Rsrc2Val |= S_00B02C_EXTRA_LDS_SIZE(CurrentProgramInfo.LDSBlocks);
1023-
}
1024-
if (Rsrc2Val) {
1025-
OutStreamer->EmitIntValue(RsrcReg + 4 /*rsrc2*/, 4);
1026-
OutStreamer->EmitIntValue(Rsrc2Val, 4);
10271014
}
10281015
}
10291016

1017+
if (MF.getFunction().getCallingConv() == CallingConv::AMDGPU_PS) {
1018+
OutStreamer->EmitIntValue(R_00B02C_SPI_SHADER_PGM_RSRC2_PS, 4);
1019+
OutStreamer->EmitIntValue(S_00B02C_EXTRA_LDS_SIZE(CurrentProgramInfo.LDSBlocks), 4);
1020+
OutStreamer->EmitIntValue(R_0286CC_SPI_PS_INPUT_ENA, 4);
1021+
OutStreamer->EmitIntValue(MFI->getPSInputEnable(), 4);
1022+
OutStreamer->EmitIntValue(R_0286D0_SPI_PS_INPUT_ADDR, 4);
1023+
OutStreamer->EmitIntValue(MFI->getPSInputAddr(), 4);
1024+
}
1025+
10301026
OutStreamer->EmitIntValue(R_SPILLED_SGPRS, 4);
10311027
OutStreamer->EmitIntValue(MFI->getNumSpilledSGPRs(), 4);
10321028
OutStreamer->EmitIntValue(R_SPILLED_VGPRS, 4);

‎llvm/test/CodeGen/AMDGPU/amdpal.ll

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
; RUN: llc < %s -mtriple=amdgcn--amdpal -mcpu=tahiti | FileCheck --check-prefix=PAL --enable-var-scope %s
22

3-
; PAL: .AMDGPU.config
4-
3+
; PAL-NOT: .AMDGPU.config
4+
; PAL-LABEL: {{^}}simple:
55
define amdgpu_kernel void @simple(i32 addrspace(1)* %out) {
66
entry:
77
store i32 0, i32 addrspace(1)* %out

0 commit comments

Comments
 (0)
Please sign in to comment.