Skip to content

Commit 7d508eb

Browse files
committed
Revert "[AMDGPU] Add pal metadata 3.0 support to callable pal funcs (#67104)"
This reverts commit d6c7253. Change causing CTS failures due to incomplete metadata.
1 parent 2ad6fd6 commit 7d508eb

File tree

4 files changed

+22
-347
lines changed

4 files changed

+22
-347
lines changed

llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp

Lines changed: 22 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,27 +1025,6 @@ void AMDGPUAsmPrinter::EmitProgramInfoSI(const MachineFunction &MF,
10251025
OutStreamer->emitInt32(MFI->getNumSpilledVGPRs());
10261026
}
10271027

1028-
// Helper function to add common PAL Metadata 3.0+
1029-
static void EmitPALMetadataCommon(AMDGPUPALMetadata *MD,
1030-
const SIProgramInfo &CurrentProgramInfo,
1031-
CallingConv::ID CC, const GCNSubtarget &ST) {
1032-
if (ST.hasIEEEMode())
1033-
MD->setHwStage(CC, ".ieee_mode", (bool)CurrentProgramInfo.IEEEMode);
1034-
1035-
MD->setHwStage(CC, ".wgp_mode", (bool)CurrentProgramInfo.WgpMode);
1036-
MD->setHwStage(CC, ".mem_ordered", (bool)CurrentProgramInfo.MemOrdered);
1037-
1038-
if (AMDGPU::isCompute(CC)) {
1039-
MD->setHwStage(CC, ".trap_present",
1040-
(bool)CurrentProgramInfo.TrapHandlerEnable);
1041-
MD->setHwStage(CC, ".excp_en", CurrentProgramInfo.EXCPEnable);
1042-
1043-
MD->setHwStage(CC, ".lds_size",
1044-
(unsigned)(CurrentProgramInfo.LdsSize *
1045-
getLdsDwGranularity(ST) * sizeof(uint32_t)));
1046-
}
1047-
}
1048-
10491028
// This is the equivalent of EmitProgramInfoSI above, but for when the OS type
10501029
// is AMDPAL. It stores each compute/SPI register setting and other PAL
10511030
// metadata items into the PALMD::Metadata, combining with any provided by the
@@ -1077,8 +1056,24 @@ void AMDGPUAsmPrinter::EmitPALMetadata(const MachineFunction &MF,
10771056
}
10781057
} else {
10791058
MD->setHwStage(CC, ".debug_mode", (bool)CurrentProgramInfo.DebugMode);
1080-
MD->setHwStage(CC, ".scratch_en", (bool)CurrentProgramInfo.ScratchEnable);
1081-
EmitPALMetadataCommon(MD, CurrentProgramInfo, CC, STM);
1059+
MD->setHwStage(CC, ".ieee_mode", (bool)CurrentProgramInfo.IEEEMode);
1060+
MD->setHwStage(CC, ".wgp_mode", (bool)CurrentProgramInfo.WgpMode);
1061+
MD->setHwStage(CC, ".mem_ordered", (bool)CurrentProgramInfo.MemOrdered);
1062+
1063+
if (AMDGPU::isCompute(CC)) {
1064+
MD->setHwStage(CC, ".scratch_en", (bool)CurrentProgramInfo.ScratchEnable);
1065+
MD->setHwStage(CC, ".trap_present",
1066+
(bool)CurrentProgramInfo.TrapHandlerEnable);
1067+
1068+
// EXCPEnMSB?
1069+
const unsigned LdsDwGranularity = 128;
1070+
MD->setHwStage(CC, ".lds_size",
1071+
(unsigned)(CurrentProgramInfo.LdsSize * LdsDwGranularity *
1072+
sizeof(uint32_t)));
1073+
MD->setHwStage(CC, ".excp_en", CurrentProgramInfo.EXCPEnable);
1074+
} else {
1075+
MD->setHwStage(CC, ".scratch_en", (bool)CurrentProgramInfo.ScratchEnable);
1076+
}
10821077
}
10831078

10841079
// ScratchSize is in bytes, 16 aligned.
@@ -1132,15 +1127,10 @@ void AMDGPUAsmPrinter::emitPALFunctionMetadata(const MachineFunction &MF) {
11321127
MD->setFunctionScratchSize(FnName, MFI.getStackSize());
11331128
const GCNSubtarget &ST = MF.getSubtarget<GCNSubtarget>();
11341129

1135-
if (MD->getPALMajorVersion() < 3) {
1136-
// Set compute registers
1137-
MD->setRsrc1(CallingConv::AMDGPU_CS,
1138-
CurrentProgramInfo.getPGMRSrc1(CallingConv::AMDGPU_CS, ST));
1139-
MD->setRsrc2(CallingConv::AMDGPU_CS,
1140-
CurrentProgramInfo.getComputePGMRSrc2());
1141-
} else {
1142-
EmitPALMetadataCommon(MD, CurrentProgramInfo, CallingConv::AMDGPU_CS, ST);
1143-
}
1130+
// Set compute registers
1131+
MD->setRsrc1(CallingConv::AMDGPU_CS,
1132+
CurrentProgramInfo.getPGMRSrc1(CallingConv::AMDGPU_CS, ST));
1133+
MD->setRsrc2(CallingConv::AMDGPU_CS, CurrentProgramInfo.getComputePGMRSrc2());
11441134

11451135
// Set optional info
11461136
MD->setFunctionLdsSize(FnName, CurrentProgramInfo.LDSSize);

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2958,11 +2958,6 @@ bool isDPALU_DPP(const MCInstrDesc &OpDesc) {
29582958
return hasAny64BitVGPROperands(OpDesc);
29592959
}
29602960

2961-
unsigned getLdsDwGranularity(const MCSubtargetInfo &ST) {
2962-
// Currently this is 128 for all subtargets
2963-
return 128;
2964-
}
2965-
29662961
} // namespace AMDGPU
29672962

29682963
raw_ostream &operator<<(raw_ostream &OS,

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,11 +1439,6 @@ bool isIntrinsicSourceOfDivergence(unsigned IntrID);
14391439
/// \returns true if the intrinsic is uniform
14401440
bool isIntrinsicAlwaysUniform(unsigned IntrID);
14411441

1442-
/// \returns lds block size in terms of dwords. \p
1443-
/// This is used to calculate the lds size encoded for PAL metadata 3.0+ which
1444-
/// must be defined in terms of bytes.
1445-
unsigned getLdsDwGranularity(const MCSubtargetInfo &ST);
1446-
14471442
} // end namespace AMDGPU
14481443

14491444
raw_ostream &operator<<(raw_ostream &OS,

0 commit comments

Comments
 (0)