Skip to main content

A streamlined CLI tool for profiling Tenstorrent's TT-Metal tests and extracting device kernel performance metrics

Project description

🚀 ttperf - TT-Metal Performance Profiler

Python License Version GitHub issues GitHub stars

A streamlined CLI tool for profiling Tenstorrent's TT-Metal tests and extracting device kernel performance metrics

✨ Features

  • 🔍 Automated Profiling: Seamlessly runs Tenstorrent's TT-Metal profiler with pytest
  • 📊 CSV Analysis: Automatically extracts and parses performance CSV files
  • Real-time Output: Shows profiling progress in real-time
  • 📈 Performance Metrics: Calculates total DEVICE KERNEL DURATION
  • 🎯 Simple CLI: Easy-to-use command-line interface
  • 🛠️ Flexible: Supports named profiles and various test paths

🚀 Quick Start

Installation

# Clone the repository
git clone https://github.com/Aswintechie/ttperf.git
cd ttperf

# Install the package
pip install -e .

Basic Usage

# Run profiling on a specific test
ttperf test_performance.py

# Run with a custom profile name
ttperf my_profile pytest test_performance.py

# Run on a specific test method
ttperf tests/test_ops.py::test_matmul

📋 Usage Examples

Simple Test Profiling

ttperf test_conv.py

Named Profile

ttperf conv_benchmark pytest test_conv.py

Specific Test Method

ttperf tests/ops/test_matmul.py::test_basic_matmul

Output Example

▶️ Running: ./tt_metal/tools/profiler/profile_this.py -n conv_benchmark -c "pytest test_conv.py"

... (profiling output) ...

📁 Found CSV path: /path/to/profile_results.csv
⏱️ DEVICE KERNEL DURATION [ns] total: 1234567.89 ns

🛠️ How It Works

  1. Command Parsing: Analyzes input arguments to determine profile name and test path
  2. Profile Execution: Runs the Tenstorrent's TT-Metal profiler with the specified test
  3. Output Monitoring: Streams profiling output in real-time
  4. CSV Extraction: Parses the output to find the generated CSV file path
  5. Performance Analysis: Reads the CSV and calculates total device kernel duration

📊 Performance Metrics

The tool extracts the following key metrics:

  • DEVICE KERNEL DURATION [ns]: Total time spent in device kernels
  • CSV Path: Location of the detailed profiling results
  • Real-time Progress: Live output during profiling

🔧 Requirements

  • Python 3.7+
  • pandas
  • Tenstorrent's TT-Metal development environment
  • pytest

📁 Project Structure

ttperf/
├── ttperf.py          # Main CLI implementation
├── pyproject.toml     # Project configuration
├── README.md          # This file
└── .gitignore         # Git ignore rules

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

🐛 Issues

If you encounter any issues, please create an issue on GitHub.

👨‍💻 Author

Aswin Z

🌟 Acknowledgments

  • Tenstorrent's TT-Metal development team for the profiling tools
  • Python community for excellent libraries like pandas

Made with ❤️ for the Tenstorrent TT-Metal community

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ttperf-0.1.0.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ttperf-0.1.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file ttperf-0.1.0.tar.gz.

File metadata

  • Download URL: ttperf-0.1.0.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for ttperf-0.1.0.tar.gz
Algorithm Hash digest
SHA256 59bc78f3e6eccb4da23aafb3a681c2e46d74c0edf9625a5218e6be82efbdea8d
MD5 08738437603e16652e38e900f454123a
BLAKE2b-256 fc1dcf19fcb0a35ba722b2b17274d25b1a51a46211111086a55667beb8267d6e

See more details on using hashes here.

File details

Details for the file ttperf-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ttperf-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for ttperf-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ed787ece9c33faaeca866a8477baf4be725e491c3cc6ff3dd6ba50baa8c22288
MD5 9c51a9b7fc1e570bff3d875e738f8d5b
BLAKE2b-256 2b23c543171d9aa98045aabeb6bcc0adfb64e34ce2a6cf48358b836866b2611f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page