[clang] [llvm] [AMDGPU] Convert AMDGPUResourceUsageAnalysis pass from Module to MF pass (PR #102913)

Janek van Oirschot via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 17 05:44:48 PDT 2024


================
@@ -40,12 +42,19 @@ class AMDGPUAsmPrinter final : public AsmPrinter {
 
   AMDGPUResourceUsageAnalysis *ResourceUsage;
 
+  MCResourceInfo RI;
+
   SIProgramInfo CurrentProgramInfo;
 
   std::unique_ptr<AMDGPU::HSAMD::MetadataStreamer> HSAMetadataStream;
 
   MCCodeEmitter *DumpCodeInstEmitter = nullptr;
 
+  // validateMCResourceInfo cannot recompute parts of the occupancy as it does
+  // for other metadata to validate (e.g., NumSGPRs) so a map is necessary if we
+  // really want to track and validate the occupancy.
----------------
JanekvO wrote:

Yeah, I thought I needed access to the `MachineFunction` for `SIMachineFunctionInfo` but I can reconstruct it using just the `Function` and `GCNSubTarget`. It now recomputes the occupancy instead of this caching.

https://github.com/llvm/llvm-project/pull/102913


More information about the cfe-commits mailing list