Skip to content

feat(431): add SI profiling helper scripts for TT-Metal profiling on IRD systems#433

Draft
ssapreTT wants to merge 1 commit into
mainfrom
431-add-si-profiling-helper-scripts-for-tt-metal-profiling-on-ird-systems
Draft

feat(431): add SI profiling helper scripts for TT-Metal profiling on IRD systems#433
ssapreTT wants to merge 1 commit into
mainfrom
431-add-si-profiling-helper-scripts-for-tt-metal-profiling-on-ird-systems

Conversation

@ssapreTT
Copy link
Copy Markdown
Contributor

@ssapreTT ssapreTT commented May 7, 2026

Summary

  • Adds tools/si_profiling_helpers/ with three scripts and a README to standardize TT-Metal profiling workflows on IRD systems
  • setup-step-1-fresh-build.sh: one-time build of tt-metal + tt-npe with profiler support (clang-20)
  • setup-step-2-new-login.sh: per-session env setup (venv, TT_METAL_HOME, PYTHONPATH, NPE tools)
  • run-ttnn-profiler.py: multi-mode tracy profiler runner (raw, NOC traces, perf counters) with pytest integration, dry-run, and optional cleanup

Test plan

  • Copy scripts to IRD system via scp and run setup-step-1-fresh-build.sh from tt-metal directory
  • Source setup-step-2-new-login.sh in a new shell and verify env vars are set
  • Run run-ttnn-profiler.py --dryrun to verify command construction
  • Run run-ttnn-profiler.py against a known TTNN test and verify profiler output directories are created
  • Run with --basic-only, --disable-logging, --cleanup flags and verify each behaves correctly

Closes #431

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings May 7, 2026 14:51
@ssapreTT ssapreTT linked an issue May 7, 2026 that may be closed by this pull request
6 tasks
@ssapreTT ssapreTT marked this pull request as draft May 7, 2026 14:52
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new tools/si_profiling_helpers/ bundle to standardize TT-Metal/TTNN profiling workflows on IRD systems, covering initial build, per-login environment setup, and a multi-pass tracy-based profiler runner.

Changes:

  • Added setup-step-1-fresh-build.sh to build tt-metal with profiler support, create a venv, and build tt-npe with clang-20.
  • Added setup-step-2-new-login.sh to configure per-session environment variables and source tt-npe tooling.
  • Added run-ttnn-profiler.py to run tracy-based profiling in raw/perf/NOC-trace modes with pytest integration, dry-run, and optional cleanup, plus a README.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.

File Description
tools/si_profiling_helpers/setup-step-1-fresh-build.sh One-time build/bootstrap script for tt-metal + venv + tt-npe (clang-20).
tools/si_profiling_helpers/setup-step-2-new-login.sh Per-shell-session environment setup (venv, TT_METAL_HOME, PYTHONPATH, tt-npe ENV_SETUP).
tools/si_profiling_helpers/run-ttnn-profiler.py Tracy wrapper to run TTNN profiling in multiple modes with optional pytest integration/cleanup.
tools/si_profiling_helpers/README.md Documentation and recommended workflow for copying and using the helper scripts on IRD systems.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tools/si_profiling_helpers/setup-step-2-new-login.sh Outdated
Comment thread tools/si_profiling_helpers/setup-step-2-new-login.sh Outdated
Comment on lines +34 to +42
# Build tt-metal with profiler support enabled
./build_metal.sh --enable-profiler

# Create Python virtual environment
./create_venv.sh

# Build tt-npe with clang-20 compiler
cd ../tt-npe
CMAKE_C_COMPILER=clang-20 CMAKE_CXX_COMPILER=clang++-20 CMAKE_MAKE_PROGRAM=make bash build-npe.sh
@@ -0,0 +1,431 @@
#!/usr/bin/env python
Comment thread tools/si_profiling_helpers/run-ttnn-profiler.py
Comment thread tools/si_profiling_helpers/run-ttnn-profiler.py
Comment thread tools/si_profiling_helpers/run-ttnn-profiler.py
Comment thread tools/si_profiling_helpers/run-ttnn-profiler.py
Comment thread tools/si_profiling_helpers/run-ttnn-profiler.py
Comment thread tools/si_profiling_helpers/run-ttnn-profiler.py Outdated
Comment thread tools/si_profiling_helpers/run-ttnn-profiler.py
Comment thread tools/si_profiling_helpers/run-ttnn-profiler.py
# - Required build dependencies must be installed

# Build tt-metal with profiler support enabled
./build_metal.sh --enable-profiler
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no longer an option for enable-profiler in latest build_metal.sh script


# Create Python virtual environment
./create_venv.sh

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After I created the virtual environment I needed to activate it for next step (tt-npe build)

source python_env/bin/activate


# Build tt-npe with clang-20 compiler
cd ../tt-npe
CMAKE_C_COMPILER=clang-20 CMAKE_CXX_COMPILER=clang++-20 CMAKE_MAKE_PROGRAM=make bash build-npe.sh
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't have to include the env overrides because I simply activate the Python venv in tt-metal first and then simply ran build-npe.sh and it worked without problems for me

@ssapreTT ssapreTT force-pushed the 431-add-si-profiling-helper-scripts-for-tt-metal-profiling-on-ird-systems branch from 898f138 to ec62283 Compare May 8, 2026 12:21
Comment thread tools/si_profiling_helpers/run-ttnn-profiler.py
Comment thread tools/si_profiling_helpers/run-ttnn-profiler.py
Comment thread tools/si_profiling_helpers/run-ttnn-profiler.py
Comment thread tools/si_profiling_helpers/run-ttnn-profiler.py
Comment thread tools/si_profiling_helpers/run-ttnn-profiler.py
Comment thread tools/si_profiling_helpers/run-ttnn-profiler.py
Comment thread tools/si_profiling_helpers/run-ttnn-profiler.py
Comment thread tools/si_profiling_helpers/run-ttnn-profiler.py
…IRD systems

Adds tools/si_profiling_helpers/ with setup and profiler runner scripts to
standardize TT-Metal profiling workflows on IRD systems, reducing error-prone
manual setup steps.

- run-ttnn-profiler.py: python3 shebang; argv list + shell=False to avoid
  shell injection; per-mode subdirs (raw/, perf/, trace/) so tracy passes
  don't collide; create output-dir before tracy runs; fix --command help text;
  resolve output_dir with realpath() to prevent path traversal
- setup-step-1-fresh-build.sh: set -euo pipefail for fail-fast behaviour;
  remove obsolete --enable-profiler flag (profiler support always on)
- setup-step-2-new-login.sh: sanity check for tt-metal root; prepend to
  PYTHONPATH instead of overwriting it

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ssapreTT ssapreTT force-pushed the 431-add-si-profiling-helper-scripts-for-tt-metal-profiling-on-ird-systems branch from ec62283 to e937db7 Compare May 8, 2026 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add SI Profiling Helper Scripts for TT-Metal Profiling on IRD Systems

3 participants