[llvm] [MCA] New option -scheduling-info (PR #130574)

Min-Yih Hsu via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 17 10:42:26 PDT 2025


================
@@ -29,82 +61,152 @@ void InstructionInfoView::printView(raw_ostream &OS) const {
   IIVDVec IIVD(Source.size());
   collectData(IIVD);
 
-  TempStream << "\n\nInstruction Info:\n";
-  TempStream << "[1]: #uOps\n[2]: Latency\n[3]: RThroughput\n"
-             << "[4]: MayLoad\n[5]: MayStore\n[6]: HasSideEffects (U)\n";
+  if (PrintFullInfo) {
+    FOS << "\n\nResources:\n";
+    const MCSchedModel &SM = getSubTargetInfo().getSchedModel();
+    for (unsigned I = 1, ResourceIndex = 0, E = SM.getNumProcResourceKinds();
+         I < E; ++I) {
+      const MCProcResourceDesc &ProcResource = *SM.getProcResource(I);
+      unsigned NumUnits = ProcResource.NumUnits;
+      // Skip invalid resources with zero units.
+      if (!NumUnits)
+        continue;
+
+      FOS << '[' << ResourceIndex << ']';
+      FOS.PadToColumn(6);
+      FOS << "- " << ProcResource.Name << ':' << NumUnits;
+      if (ProcResource.SubUnitsIdxBegin) {
+        FOS.PadToColumn(20);
+        for (unsigned U = 0; U < NumUnits; ++U) {
+          FOS << SM.getProcResource(ProcResource.SubUnitsIdxBegin[U])->Name;
+          if ((U + 1) < NumUnits) {
+            FOS << ", ";
+          }
+        }
+      }
+      FOS << '\n';
+      ResourceIndex++;
+    }
+  }
+
+  std::vector<unsigned> paddings = {0, 7, 14, 21, 28, 35};
+  std::vector<std::string> fields = {"#uOps",       "Latency",
+                                     "RThroughput", "MayLoad",
+                                     "MayStore",    "HasSideEffects (U)"};
+  std::vector<std::string> end_fields;
----------------
mshockwave wrote:

ditto variable names

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


More information about the llvm-commits mailing list