-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#753: Syncing device host times for tracy profiler #8101
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,6 +87,7 @@ class RunTimeOptions { | |
|
||
bool profiler_enabled = false; | ||
bool profile_dispatch_cores = false; | ||
bool profiler_sync_enabled = false; | ||
|
||
bool null_kernels = false; | ||
|
||
|
@@ -220,6 +221,7 @@ class RunTimeOptions { | |
|
||
inline bool get_profiler_enabled() { return profiler_enabled; } | ||
inline bool get_profiler_do_dispatch_cores() { return profile_dispatch_cores; } | ||
inline bool get_profiler_sync_enabled() { return profiler_sync_enabled; } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these functions should all be marked with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are return bools by value, does const mean much here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wow this class is a lot bigger than I thought; maybe it isn't worthwhile to stay consistent with rest of class |
||
|
||
inline void set_kernels_nullified(bool v) { null_kernels = v; } | ||
inline bool get_kernels_nullified() { return null_kernels; } | ||
|
+37 −0 | csvexport/src/csvexport.cpp | |
+3 −1 | public/client/TracyProfiler.hpp | |
+64 −23 | public/tracy/TracyTTDevice.hpp |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#include <cstdint> | ||
|
||
void kernel_main() { | ||
DeviceZoneScopedMainN("SYNC-MAIN"); | ||
volatile tt_reg_ptr uint32_t *p_reg = reinterpret_cast<volatile tt_reg_ptr uint32_t *> (RISCV_DEBUG_REG_WALL_CLOCK_L); | ||
volatile tt_l1_ptr uint32_t *profiler_control_buffer = reinterpret_cast<volatile tt_l1_ptr uint32_t*>(PROFILER_L1_BUFFER_CONTROL); | ||
volatile tt_l1_ptr uint32_t *briscBuffer = reinterpret_cast<volatile tt_l1_ptr uint32_t*>(PROFILER_L1_BUFFER_BR + kernel_profiler::CUSTOM_MARKERS * sizeof(uint32_t)); | ||
|
||
uint32_t syncTimeBufferIndex = 0; | ||
|
||
constexpr int FIRST_READ_COUNT = 2; | ||
|
||
|
||
while ( syncTimeBufferIndex < FIRST_READ_COUNT) { | ||
uint32_t deviceTime = p_reg[kernel_profiler::WALL_CLOCK_LOW_INDEX]; | ||
|
||
uint32_t hostTime = profiler_control_buffer[kernel_profiler::FW_RESET_L]; | ||
if (hostTime > 0) | ||
{ | ||
briscBuffer[syncTimeBufferIndex++] = p_reg[kernel_profiler::WALL_CLOCK_HIGH_INDEX]; | ||
briscBuffer[syncTimeBufferIndex++] = deviceTime; | ||
briscBuffer[syncTimeBufferIndex++] = deviceTime; | ||
briscBuffer[syncTimeBufferIndex++] = hostTime; | ||
profiler_control_buffer[kernel_profiler::FW_RESET_L] = 0; | ||
} | ||
} | ||
|
||
{ | ||
DeviceZoneScopedMainChildN("SYNC-LOOP"); | ||
while ( syncTimeBufferIndex < ((SAMPLE_COUNT + 1) * 2) ) { | ||
uint32_t deviceTime = p_reg[kernel_profiler::WALL_CLOCK_LOW_INDEX]; | ||
|
||
uint32_t hostTime = profiler_control_buffer[kernel_profiler::FW_RESET_L]; | ||
if (hostTime > 0) | ||
{ | ||
briscBuffer[syncTimeBufferIndex++] = deviceTime; | ||
briscBuffer[syncTimeBufferIndex++] = hostTime; | ||
profiler_control_buffer[kernel_profiler::FW_RESET_L] = 0; | ||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Man another env var 🥴
@TT-billteng
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These env vars will be hidden behind
tracy.py
cli options pretty soon. User never need to now about them. I need this ticket in before I can add more CLI options.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you pass this via function parameters somehow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a runtime variable. We are deciding at runtime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can pass runtime variables from the top all the way down through the stack?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In tracy.py I can bring tt-lib bindings for this switch and set it through that. That way I can avoid the env_var