[llvm] [BOLT] Add NamedRegionTimer to inferStaleProfile (PR #92621)
shaw young via llvm-commits
llvm-commits at lists.llvm.org
Mon May 20 10:21:40 PDT 2024
https://github.com/shawbyoung updated https://github.com/llvm/llvm-project/pull/92621
>From 30ffe5202bbc2ebbe78518c5d9a8fd00dc03fb6f Mon Sep 17 00:00:00 2001
From: shawy <shawy at meta.com>
Date: Fri, 17 May 2024 16:19:31 -0700
Subject: [PATCH 1/4] [BOLT] Add NamedRegionTimer to inferStaleProfile
Summary: Add a NamedRegionTimer to measure the time spent in inferStaleProfile.
---
bolt/lib/Profile/StaleProfileMatching.cpp | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/bolt/lib/Profile/StaleProfileMatching.cpp b/bolt/lib/Profile/StaleProfileMatching.cpp
index 016962ff34d8d..02b78197e8286 100644
--- a/bolt/lib/Profile/StaleProfileMatching.cpp
+++ b/bolt/lib/Profile/StaleProfileMatching.cpp
@@ -31,6 +31,7 @@
#include "llvm/ADT/Hashing.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/xxhash.h"
+#include "llvm/Support/Timer.h"
#include "llvm/Transforms/Utils/SampleProfileInference.h"
#include <queue>
@@ -705,6 +706,10 @@ void assignProfile(BinaryFunction &BF,
bool YAMLProfileReader::inferStaleProfile(
BinaryFunction &BF, const yaml::bolt::BinaryFunctionProfile &YamlBF) {
+
+ NamedRegionTimer T( "inferStaleProfile", "inferring from stale profile", "rewrite",
+ "Rewrite passes", opts::InferStaleProfile);
+
if (!BF.hasCFG())
return false;
>From f18d852af7ace3ce1eda1b246aba435bcdde5011 Mon Sep 17 00:00:00 2001
From: shawy <shawy at meta.com>
Date: Mon, 20 May 2024 09:17:26 -0700
Subject: [PATCH 2/4] [BOLT] [NFC] C++ formatting
---
bolt/lib/Profile/StaleProfileMatching.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/bolt/lib/Profile/StaleProfileMatching.cpp b/bolt/lib/Profile/StaleProfileMatching.cpp
index 02b78197e8286..33182d83449a2 100644
--- a/bolt/lib/Profile/StaleProfileMatching.cpp
+++ b/bolt/lib/Profile/StaleProfileMatching.cpp
@@ -30,8 +30,8 @@
#include "llvm/ADT/Bitfields.h"
#include "llvm/ADT/Hashing.h"
#include "llvm/Support/CommandLine.h"
-#include "llvm/Support/xxhash.h"
#include "llvm/Support/Timer.h"
+#include "llvm/Support/xxhash.h"
#include "llvm/Transforms/Utils/SampleProfileInference.h"
#include <queue>
@@ -707,8 +707,8 @@ void assignProfile(BinaryFunction &BF,
bool YAMLProfileReader::inferStaleProfile(
BinaryFunction &BF, const yaml::bolt::BinaryFunctionProfile &YamlBF) {
- NamedRegionTimer T( "inferStaleProfile", "inferring from stale profile", "rewrite",
- "Rewrite passes", opts::InferStaleProfile);
+ NamedRegionTimer T("inferStaleProfile", "inferring from stale profile",
+ "rewrite", "Rewrite passes", opts::InferStaleProfile);
if (!BF.hasCFG())
return false;
>From dd55c7d8479c6a6984df9911a7235898c46b65cc Mon Sep 17 00:00:00 2001
From: shawy <shawy at meta.com>
Date: Mon, 20 May 2024 10:11:56 -0700
Subject: [PATCH 3/4] [BOLT] Set InferStaleProfile timer to TimeRewrite
---
bolt/lib/Profile/StaleProfileMatching.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/bolt/lib/Profile/StaleProfileMatching.cpp b/bolt/lib/Profile/StaleProfileMatching.cpp
index 33182d83449a2..55d3f710f9f59 100644
--- a/bolt/lib/Profile/StaleProfileMatching.cpp
+++ b/bolt/lib/Profile/StaleProfileMatching.cpp
@@ -707,8 +707,8 @@ void assignProfile(BinaryFunction &BF,
bool YAMLProfileReader::inferStaleProfile(
BinaryFunction &BF, const yaml::bolt::BinaryFunctionProfile &YamlBF) {
- NamedRegionTimer T("inferStaleProfile", "inferring from stale profile",
- "rewrite", "Rewrite passes", opts::InferStaleProfile);
+ NamedRegionTimer T("inferStaleProfile", "stale profile inference",
+ "rewrite", "Rewrite passes", opts::TimeRewrite);
if (!BF.hasCFG())
return false;
>From e496030182eb2a59003db17f1ee56f2f19b86f70 Mon Sep 17 00:00:00 2001
From: shawbyoung <shawbyoung at gmail.com>
Date: Mon, 20 May 2024 10:21:26 -0700
Subject: [PATCH 4/4] [BOLT] [NFC] Formatting
---
bolt/lib/Profile/StaleProfileMatching.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/bolt/lib/Profile/StaleProfileMatching.cpp b/bolt/lib/Profile/StaleProfileMatching.cpp
index 55d3f710f9f59..5420c683afc51 100644
--- a/bolt/lib/Profile/StaleProfileMatching.cpp
+++ b/bolt/lib/Profile/StaleProfileMatching.cpp
@@ -707,8 +707,8 @@ void assignProfile(BinaryFunction &BF,
bool YAMLProfileReader::inferStaleProfile(
BinaryFunction &BF, const yaml::bolt::BinaryFunctionProfile &YamlBF) {
- NamedRegionTimer T("inferStaleProfile", "stale profile inference",
- "rewrite", "Rewrite passes", opts::TimeRewrite);
+ NamedRegionTimer T("inferStaleProfile", "stale profile inference", "rewrite",
+ "Rewrite passes", opts::TimeRewrite);
if (!BF.hasCFG())
return false;
More information about the llvm-commits
mailing list