Skip to content

Commit

Permalink
#0: Improve test_pgm_dispatch
Browse files Browse the repository at this point in the history
Add the current clock frequency to the output so we can detect throttling more easily.

Also do CloseDevice on some early returns, so later tests that attempt to use the same device don't run into problems.
  • Loading branch information
jbaumanTT committed Mar 6, 2025
1 parent 5b95f51 commit 860ae4b
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <tt-metalium/device.hpp>
#include <tt-metalium/rtoptions.hpp>
#include <benchmark/benchmark.h>
#include "tt_metal/tt_metal/perf_microbenchmark/common/util.hpp"

constexpr uint32_t DEFAULT_ITERATIONS = 10000;
constexpr uint32_t DEFAULT_WARMUP_ITERATIONS = 100;
Expand Down Expand Up @@ -344,12 +345,14 @@ static int pgm_dispatch(T& state, TestInfo info) {
if constexpr (std::is_same_v<T, benchmark::State>) {
state.SkipWithError("Program creation failed");
}
tt_metal::CloseDevice(device);
return 1;
}
if (!initialize_program(info, device, program[1], info.fast_kernel_cycles)) {
if constexpr (std::is_same_v<T, benchmark::State>) {
state.SkipWithError("Program creation failed");
}
tt_metal::CloseDevice(device);
return 1;
}

Expand Down Expand Up @@ -403,6 +406,7 @@ static int pgm_dispatch(T& state, TestInfo info) {
if constexpr (std::is_same_v<T, benchmark::State>) {
state.counters["IterationTime"] = benchmark::Counter(
info.iterations, benchmark::Counter::kIsIterationInvariantRate | benchmark::Counter::kInvert);
state.counters["Clock"] = benchmark::Counter(get_tt_npu_clock(device), benchmark::Counter::kDefaults);
}

pass &= tt_metal::CloseDevice(device);
Expand Down

0 comments on commit 860ae4b

Please sign in to comment.