[llvm-branch-commits] [llvm] [AMDGPU] Add `.amdgpu.info` section for per-function metadata (PR #192384)
Shilei Tian via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Apr 17 07:27:28 PDT 2026
================
@@ -729,6 +879,26 @@ bool AMDGPUAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
RI.gatherResourceInfo(MF, *ResourceUsage, OutContext);
+ if (AMDGPUTargetMachine::EnableObjectLinking) {
+ PerFunctionResourceInfo PFRI = {&MF.getFunction(), *ResourceUsage};
+ if (AMDGPU::isKernel(MF.getFunction().getCallingConv())) {
+ unsigned TotalLDS = STM.getLocalMemorySize();
+ const auto [MinWEU, MaxWEU] = AMDGPU::getIntegerPairAttribute(
+ MF.getFunction(), "amdgpu-waves-per-eu", {0, 0}, true);
+ if (MinWEU > 0) {
+ const SIMachineFunctionInfo &SIMFI =
+ *MF.getInfo<SIMachineFunctionInfo>();
+ unsigned FlatWGSizeMax = SIMFI.getFlatWorkGroupSizes().second;
+ unsigned WavesPerWG = divideCeil(FlatWGSizeMax, STM.getWavefrontSize());
+ unsigned MinWGs = divideCeil(MinWEU * STM.getEUsPerCU(), WavesPerWG);
+ PFRI.Occupancy = MinWGs > 0 ? TotalLDS / MinWGs : TotalLDS;
----------------
shiltian wrote:
This is some leftover from the previous design. I should have cleaned it up. Nice catch.
The number here doesn't really matter at this moment, because there will be a separate PR to propose ABI occupancy and refactor the occupancy computation when object linking is enabled.
https://github.com/llvm/llvm-project/pull/192384
More information about the llvm-branch-commits
mailing list