[Mlir-commits] [mlir] d1ef9f1 - [mlir:PassTiming] Always use parentInfo for determining pipeline parent scope
River Riddle
llvmlistbot at llvm.org
Wed Sep 7 16:41:31 PDT 2022
Author: River Riddle
Date: 2022-09-07T16:36:47-07:00
New Revision: d1ef9f142e58d39600a7c096e2939250d2ae09bc
URL: https://github.com/llvm/llvm-project/commit/d1ef9f142e58d39600a7c096e2939250d2ae09bc
DIFF: https://github.com/llvm/llvm-project/commit/d1ef9f142e58d39600a7c096e2939250d2ae09bc.diff
LOG: [mlir:PassTiming] Always use parentInfo for determining pipeline parent scope
This fixes a bug where, depending on thread usage, a pipeline may be
misattributed to a timer that wasn't it's parent.
Differential Revision: https://reviews.llvm.org/D132979
Added:
Modified:
mlir/lib/Pass/PassTiming.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Pass/PassTiming.cpp b/mlir/lib/Pass/PassTiming.cpp
index 102cf50a98cef..c0bfb980423ab 100644
--- a/mlir/lib/Pass/PassTiming.cpp
+++ b/mlir/lib/Pass/PassTiming.cpp
@@ -57,17 +57,14 @@ struct PassTiming : public PassInstrumentation {
auto tid = llvm::get_threadid();
auto &activeTimers = activeThreadTimers[tid];
+ // Find the parent scope, either using the parent info or the root scope
+ // (e.g. in the case of the top-level pipeline).
TimingScope *parentScope;
- if (activeTimers.empty()) {
- auto it = parentTimerIndices.find(parentInfo);
- if (it != parentTimerIndices.end())
- parentScope =
- &activeThreadTimers[parentInfo.parentThreadID][it->second];
- else
- parentScope = &rootScope;
- } else {
- parentScope = &activeTimers.back();
- }
+ auto it = parentTimerIndices.find(parentInfo);
+ if (it != parentTimerIndices.end())
+ parentScope = &activeThreadTimers[parentInfo.parentThreadID][it->second];
+ else
+ parentScope = &rootScope;
// Use nullptr to anchor op-agnostic pipelines, otherwise use the name of
// the operation.
More information about the Mlir-commits
mailing list