-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Kernel profiler based NoC event tracing (#16541)
### Problem Description This PR adds support for recording detailed traces of all NoC activity initiated by Tensix worker cores. This data is then written to a JSON format file. These JSON traces can be either analyzed directly or consumed by tt-npe (noc performance estimator). ### What's Changed NoC tracing builds on top of the timestamped data packets (`PacketType::TS_DATA`) feature in the kernel profiler. NoC tracing can be enabled on top of normal kernel profiling by setting the ENV variable `TT_METAL_DEVICE_PROFILER_NOC_EVENTS=1`. The directory path where noc traces are written can be set using ENV variable `TT_METAL_DEVICE_PROFILER_NOC_EVENTS_RPT_PATH`. A timestamped packet is recorded on each worker core for each call to `dataflow_api.h:noc_async_*` functions. All arguments to the `dataflow_api.h` function are bit-packed into the `TS_DATA` payload. This is done by adding new stripped-by-default macros to each noc_async* call of interest in `dataflow_api.h`. ```cpp // example of RECORD macro within dataflow_api.h inline void noc_async_read(...) { // if TT_METAL_DEVICE_PROFILER_NOC_EVENTS != 1, the following macro is stripped out RECORD_NOC_EVENT_WITH_ADDR(...); // noc_async_read continues unmodified here ... } ``` ### Checklist - [X] Post commit CI passes - [X] Device Perf Regression Tests Pass - [X] uBenchmark Regression Tests Pass - [X] multi-device (T3K) Regression Tests Pass
- Loading branch information
Showing
19 changed files
with
955 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// SPDX-FileCopyrightText: © 2025 Tenstorrent Inc. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#pragma once | ||
|
||
#include "map" | ||
|
||
class ProfilerOptionalMetadata { | ||
using RuntimeID = uint32_t; | ||
|
||
public: | ||
ProfilerOptionalMetadata(std::map<std::pair<chip_id_t, RuntimeID>, std::string>&& runtime_map) : | ||
runtime_id_to_opname_(std::move(runtime_map)) {} | ||
|
||
const std::string& get_op_name(chip_id_t device_id, RuntimeID runtime_id) const { | ||
static const std::string empty_string; | ||
auto key = std::make_pair(device_id, runtime_id); | ||
auto it = runtime_id_to_opname_.find(key); | ||
if (it != runtime_id_to_opname_.end()) { | ||
return it->second; | ||
} | ||
return empty_string; | ||
} | ||
|
||
private: | ||
std::map<std::pair<chip_id_t, RuntimeID>, std::string> runtime_id_to_opname_; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.