[Mlir-commits] [mlir] [MLIR][LLVM] Add ProfileSummary module flag support (PR #138070)
Bruno Cardoso Lopes
llvmlistbot at llvm.org
Thu May 1 15:15:32 PDT 2025
================
@@ -1378,6 +1378,54 @@ def ModuleFlagCGProfileEntryAttr
let assemblyFormat = "`<` struct(params) `>`";
}
+def ModuleFlagProfileSummaryDetailedAttr
+ : LLVM_Attr<"ModuleFlagProfileSummaryDetailed", "profile_summary_detailed"> {
+ let summary = "ProfileSummary detailed information";
+ let description = [{
+ Contains detailed information pertinent to "ProfileSummary" attribute.
+ A `#llvm.profile_summary` may contain several of it.
+ ```mlir
+ llvm.module_flags [ ...
+ 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>
+ ```
+ }];
+ let parameters = (ins "uint32_t":$cut_off,
+ "uint64_t":$min_count,
+ "uint32_t":$num_counts);
+ let assemblyFormat = "`<` struct(params) `>`";
+}
+
+def ModuleFlagProfileSummaryAttr
+ : LLVM_Attr<"ModuleFlagProfileSummary", "profile_summary"> {
+ let summary = "ProfileSummary module flag";
+ let description = [{
+ Describes ProfileSummary gathered data in a module. Example:
+ ```mlir
+ 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>
+ ]>>]
+ ```
+ }];
+ let parameters = (
+ ins "StringAttr":$format, "uint64_t":$total_count, "uint64_t":$max_count,
+ "uint64_t":$max_internal_count, "uint64_t":$max_function_count,
+ "uint64_t":$num_counts, "uint64_t":$num_functions,
+ OptionalParameter<"IntegerAttr">:$is_partial_profile,
+ OptionalParameter<"FloatAttr">:$partial_profile_ratio,
----------------
bcardosolopes wrote:
Updated for is_partial_profile, but can't handle the double:
```
LLVMOpsAttrDefs.cpp.inc:10698:49: error: implicit instantiation of undefined template 'mlir::FieldParser<std::optional<double>>'
10698 | _result_partial_profile_ratio = ::mlir::FieldParser<std::optional<double>>::parse(odsParser);
```
https://github.com/llvm/llvm-project/pull/138070
More information about the Mlir-commits
mailing list