Skip to content

Commit

Permalink
Add a few FUSER_PERF_SCOPEs for isResharding. (#3464)
Browse files Browse the repository at this point in the history
This is to help track down the host latency regression found in #3421.
  • Loading branch information
wujingyue authored Nov 24, 2024
1 parent 75bf6af commit ad3aa3f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions csrc/multidevice/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
// clang-format on

#include <device_lower/utils.h>
#include <id_model/id_model.h>
#include <instrumentation.h>
#include <ir/internal_base_nodes.h>
#include <ir/iostream.h>
#include <ir/utils.h>
Expand Down Expand Up @@ -176,6 +178,8 @@ bool haveDifferentShardings(
}

bool isResharding(const Expr* expr) {
FUSER_PERF_SCOPE("isResharding");

if (!ir_utils::isTvOp(expr)) {
return false;
}
Expand Down
5 changes: 5 additions & 0 deletions csrc/preseg_passes/optimization_pass.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#pragma once
#include <debug.h>
#include <exceptions.h>
#include <instrumentation.h>
#include <ir/interface_nodes.h>
#include <ir/utils.h>
#include <options.h>
Expand Down Expand Up @@ -51,13 +52,17 @@ class OptimizationPass {
if (!flag_.load()) {
return;
}

FUSER_PERF_SCOPE(DerivedClass::name().c_str());
DerivedClass::runPass(fusion);

// TODO: skip the logging of the pass where the fusion has not been changed.
if (isDebugDumpEnabled(DebugDumpOption::PreSegmenterLogging)) {
debug() << "Fusion after pass: " << DerivedClass::name() << std::endl;
fusion->printMath();
debug() << "========================================" << std::endl;
}

#ifndef NDEBUG
// cycle detection is only enabled on debug run
NVF_ERROR(
Expand Down

0 comments on commit ad3aa3f

Please sign in to comment.