[Mlir-commits] [mlir] [MLIR][LLVM] Add ProfileSummary module flag support (PR #138070)

Tobias Gysi llvmlistbot at llvm.org
Thu May 1 01:15:42 PDT 2025


================
@@ -2883,6 +2883,33 @@ llvm.func @to()
 
 // -----
 
+llvm.module_flags [#llvm.mlir.module_flag<error, "ProfileSummary",
+                       #llvm.profile_summary<format = "InstrProf", total_count = 263646, max_count = 86427,
+                         max_internal_count = 86427, max_function_count = 4691,
+                         num_counts = 3712, num_functions = 796,
+                         is_partial_profile = 0 : i64,
+                         partial_profile_ratio = 0.000000e+00 : f64,
+                         detailed_summary = [
+                           #llvm.profile_summary_detailed<cut_off = 10000, min_count = 86427, num_counts = 1>,
+                           #llvm.profile_summary_detailed<cut_off = 100000, min_count = 86427, num_counts = 1>
+                  ]>>]
+
+// CHECK: !llvm.module.flags = !{!0, !15}
+
+// CHECK: !0 = !{i32 1, !"ProfileSummary", !1}
+// CHECK: !1 = !{!2, !3, !4, !5, !6, !7, !8, !9, !10, !11}
----------------
gysit wrote:

I guess it could make sense to at least partially check the detailed summery !11?

Also should we match the the matadata variable names using variables? E.g. 
`![[PROF_FORMAT:.*]] = ...` 
Relying on the numbers is a bit fragile.

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


More information about the Mlir-commits mailing list