[PATCH] D123878: [AMDGPU] Add remarks to output some resource usage

Vang Thao via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 29 14:00:04 PDT 2022

vangthao added inline comments.

Comment at: llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp:1178-1266
+void AMDGPUAsmPrinter::emitResourceUsageRemarks(
+    const MachineFunction &MF, const SIProgramInfo &CurrentProgramInfo,
+    bool isModuleEntryFunction, bool hasMAIInsts) {
+  if (!ORE)
+    return;
arsenm wrote:
> scott.linder wrote:
> > 
> I'm sort of surprised the all in one form doesn't come out in something more parsable? It might be worth looking at IR level remarks, since there's probably more usage of them. Are there any existing uses in clang that do something meaningful by parsing out different parts?
We could check if the specific remark is enabled to avoid cluttering YAML output:
  const char *Name = "kernel-resource-usage";
  LLVMContext &Ctx = MF.getFunction().getContext();
  if (!Ctx.getDiagHandlerPtr()->isAnalysisRemarkEnabled(Name))

I do not think using spaces to format the output will work for us. Most of the IR level remarks seems to be related specifically to their pass and/or optimization thus are quite short so readability is not as impacted. We are outputting a decent chunk of information and need some readability for the user.

Parsing out different parts like this is mostly a workaround for clang ignoring newlines. I am not aware of any other uses doing it like this since many of them are short and uses spaces for formatting.

  rG LLVM Github Monorepo



More information about the cfe-commits mailing list