ttperf 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ttperf-0.1.0/LICENSE +21 -0
- ttperf-0.1.0/PKG-INFO +170 -0
- ttperf-0.1.0/README.md +142 -0
- ttperf-0.1.0/pyproject.toml +36 -0
- ttperf-0.1.0/setup.cfg +4 -0
- ttperf-0.1.0/ttperf.egg-info/PKG-INFO +170 -0
- ttperf-0.1.0/ttperf.egg-info/SOURCES.txt +10 -0
- ttperf-0.1.0/ttperf.egg-info/dependency_links.txt +1 -0
- ttperf-0.1.0/ttperf.egg-info/entry_points.txt +2 -0
- ttperf-0.1.0/ttperf.egg-info/requires.txt +1 -0
- ttperf-0.1.0/ttperf.egg-info/top_level.txt +1 -0
- ttperf-0.1.0/ttperf.py +94 -0
ttperf-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Aswin Z
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
ttperf-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ttperf
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A streamlined CLI tool for profiling Tenstorrent's TT-Metal tests and extracting device kernel performance metrics
|
|
5
|
+
Author-email: Aswin Z <aswintechie@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Aswintechie/ttperf
|
|
8
|
+
Project-URL: Repository, https://github.com/Aswintechie/ttperf
|
|
9
|
+
Project-URL: Issues, https://github.com/Aswintechie/ttperf/issues
|
|
10
|
+
Project-URL: Documentation, https://github.com/Aswintechie/ttperf/blob/master/README.md
|
|
11
|
+
Keywords: tenstorrent,tt-metal,profiling,performance,cli
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Topic :: Software Development :: Testing
|
|
22
|
+
Classifier: Topic :: System :: Benchmark
|
|
23
|
+
Requires-Python: >=3.7
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: pandas>=1.3.0
|
|
27
|
+
Dynamic: license-file
|
|
28
|
+
|
|
29
|
+
# š ttperf - TT-Metal Performance Profiler
|
|
30
|
+
|
|
31
|
+
<div align="center">
|
|
32
|
+
|
|
33
|
+

|
|
34
|
+

|
|
35
|
+

|
|
36
|
+
[](https://github.com/Aswintechie/ttperf/issues)
|
|
37
|
+
[](https://github.com/Aswintechie/ttperf/stargazers)
|
|
38
|
+
|
|
39
|
+
**A streamlined CLI tool for profiling Tenstorrent's TT-Metal tests and extracting device kernel performance metrics**
|
|
40
|
+
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
## ⨠Features
|
|
44
|
+
|
|
45
|
+
- š **Automated Profiling**: Seamlessly runs Tenstorrent's TT-Metal profiler with pytest
|
|
46
|
+
- š **CSV Analysis**: Automatically extracts and parses performance CSV files
|
|
47
|
+
- ā” **Real-time Output**: Shows profiling progress in real-time
|
|
48
|
+
- š **Performance Metrics**: Calculates total DEVICE KERNEL DURATION
|
|
49
|
+
- šÆ **Simple CLI**: Easy-to-use command-line interface
|
|
50
|
+
- š ļø **Flexible**: Supports named profiles and various test paths
|
|
51
|
+
|
|
52
|
+
## š Quick Start
|
|
53
|
+
|
|
54
|
+
### Installation
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# Clone the repository
|
|
58
|
+
git clone https://github.com/Aswintechie/ttperf.git
|
|
59
|
+
cd ttperf
|
|
60
|
+
|
|
61
|
+
# Install the package
|
|
62
|
+
pip install -e .
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Basic Usage
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# Run profiling on a specific test
|
|
69
|
+
ttperf test_performance.py
|
|
70
|
+
|
|
71
|
+
# Run with a custom profile name
|
|
72
|
+
ttperf my_profile pytest test_performance.py
|
|
73
|
+
|
|
74
|
+
# Run on a specific test method
|
|
75
|
+
ttperf tests/test_ops.py::test_matmul
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## š Usage Examples
|
|
79
|
+
|
|
80
|
+
### Simple Test Profiling
|
|
81
|
+
```bash
|
|
82
|
+
ttperf test_conv.py
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Named Profile
|
|
86
|
+
```bash
|
|
87
|
+
ttperf conv_benchmark pytest test_conv.py
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Specific Test Method
|
|
91
|
+
```bash
|
|
92
|
+
ttperf tests/ops/test_matmul.py::test_basic_matmul
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Output Example
|
|
96
|
+
```
|
|
97
|
+
ā¶ļø Running: ./tt_metal/tools/profiler/profile_this.py -n conv_benchmark -c "pytest test_conv.py"
|
|
98
|
+
|
|
99
|
+
... (profiling output) ...
|
|
100
|
+
|
|
101
|
+
š Found CSV path: /path/to/profile_results.csv
|
|
102
|
+
ā±ļø DEVICE KERNEL DURATION [ns] total: 1234567.89 ns
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## š ļø How It Works
|
|
106
|
+
|
|
107
|
+
1. **Command Parsing**: Analyzes input arguments to determine profile name and test path
|
|
108
|
+
2. **Profile Execution**: Runs the Tenstorrent's TT-Metal profiler with the specified test
|
|
109
|
+
3. **Output Monitoring**: Streams profiling output in real-time
|
|
110
|
+
4. **CSV Extraction**: Parses the output to find the generated CSV file path
|
|
111
|
+
5. **Performance Analysis**: Reads the CSV and calculates total device kernel duration
|
|
112
|
+
|
|
113
|
+
## š Performance Metrics
|
|
114
|
+
|
|
115
|
+
The tool extracts the following key metrics:
|
|
116
|
+
|
|
117
|
+
- **DEVICE KERNEL DURATION [ns]**: Total time spent in device kernels
|
|
118
|
+
- **CSV Path**: Location of the detailed profiling results
|
|
119
|
+
- **Real-time Progress**: Live output during profiling
|
|
120
|
+
|
|
121
|
+
## š§ Requirements
|
|
122
|
+
|
|
123
|
+
- Python 3.7+
|
|
124
|
+
- pandas
|
|
125
|
+
- Tenstorrent's TT-Metal development environment
|
|
126
|
+
- pytest
|
|
127
|
+
|
|
128
|
+
## š Project Structure
|
|
129
|
+
|
|
130
|
+
```
|
|
131
|
+
ttperf/
|
|
132
|
+
āāā ttperf.py # Main CLI implementation
|
|
133
|
+
āāā pyproject.toml # Project configuration
|
|
134
|
+
āāā README.md # This file
|
|
135
|
+
āāā .gitignore # Git ignore rules
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## š¤ Contributing
|
|
139
|
+
|
|
140
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
141
|
+
|
|
142
|
+
1. Fork the repository
|
|
143
|
+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
144
|
+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
145
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
146
|
+
5. Open a Pull Request
|
|
147
|
+
|
|
148
|
+
## š License
|
|
149
|
+
|
|
150
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
151
|
+
|
|
152
|
+
## š Issues
|
|
153
|
+
|
|
154
|
+
If you encounter any issues, please [create an issue](https://github.com/Aswintechie/ttperf/issues) on GitHub.
|
|
155
|
+
|
|
156
|
+
## šØāš» Author
|
|
157
|
+
|
|
158
|
+
**Aswin Z**
|
|
159
|
+
- GitHub: [@Aswintechie](https://github.com/Aswintechie)
|
|
160
|
+
|
|
161
|
+
## š Acknowledgments
|
|
162
|
+
|
|
163
|
+
- Tenstorrent's TT-Metal development team for the profiling tools
|
|
164
|
+
- Python community for excellent libraries like pandas
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
<div align="center">
|
|
169
|
+
Made with ā¤ļø for the Tenstorrent TT-Metal community
|
|
170
|
+
</div>
|
ttperf-0.1.0/README.md
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# š ttperf - TT-Metal Performance Profiler
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+

|
|
7
|
+

|
|
8
|
+
[](https://github.com/Aswintechie/ttperf/issues)
|
|
9
|
+
[](https://github.com/Aswintechie/ttperf/stargazers)
|
|
10
|
+
|
|
11
|
+
**A streamlined CLI tool for profiling Tenstorrent's TT-Metal tests and extracting device kernel performance metrics**
|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
## ⨠Features
|
|
16
|
+
|
|
17
|
+
- š **Automated Profiling**: Seamlessly runs Tenstorrent's TT-Metal profiler with pytest
|
|
18
|
+
- š **CSV Analysis**: Automatically extracts and parses performance CSV files
|
|
19
|
+
- ā” **Real-time Output**: Shows profiling progress in real-time
|
|
20
|
+
- š **Performance Metrics**: Calculates total DEVICE KERNEL DURATION
|
|
21
|
+
- šÆ **Simple CLI**: Easy-to-use command-line interface
|
|
22
|
+
- š ļø **Flexible**: Supports named profiles and various test paths
|
|
23
|
+
|
|
24
|
+
## š Quick Start
|
|
25
|
+
|
|
26
|
+
### Installation
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# Clone the repository
|
|
30
|
+
git clone https://github.com/Aswintechie/ttperf.git
|
|
31
|
+
cd ttperf
|
|
32
|
+
|
|
33
|
+
# Install the package
|
|
34
|
+
pip install -e .
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Basic Usage
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# Run profiling on a specific test
|
|
41
|
+
ttperf test_performance.py
|
|
42
|
+
|
|
43
|
+
# Run with a custom profile name
|
|
44
|
+
ttperf my_profile pytest test_performance.py
|
|
45
|
+
|
|
46
|
+
# Run on a specific test method
|
|
47
|
+
ttperf tests/test_ops.py::test_matmul
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## š Usage Examples
|
|
51
|
+
|
|
52
|
+
### Simple Test Profiling
|
|
53
|
+
```bash
|
|
54
|
+
ttperf test_conv.py
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Named Profile
|
|
58
|
+
```bash
|
|
59
|
+
ttperf conv_benchmark pytest test_conv.py
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Specific Test Method
|
|
63
|
+
```bash
|
|
64
|
+
ttperf tests/ops/test_matmul.py::test_basic_matmul
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Output Example
|
|
68
|
+
```
|
|
69
|
+
ā¶ļø Running: ./tt_metal/tools/profiler/profile_this.py -n conv_benchmark -c "pytest test_conv.py"
|
|
70
|
+
|
|
71
|
+
... (profiling output) ...
|
|
72
|
+
|
|
73
|
+
š Found CSV path: /path/to/profile_results.csv
|
|
74
|
+
ā±ļø DEVICE KERNEL DURATION [ns] total: 1234567.89 ns
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## š ļø How It Works
|
|
78
|
+
|
|
79
|
+
1. **Command Parsing**: Analyzes input arguments to determine profile name and test path
|
|
80
|
+
2. **Profile Execution**: Runs the Tenstorrent's TT-Metal profiler with the specified test
|
|
81
|
+
3. **Output Monitoring**: Streams profiling output in real-time
|
|
82
|
+
4. **CSV Extraction**: Parses the output to find the generated CSV file path
|
|
83
|
+
5. **Performance Analysis**: Reads the CSV and calculates total device kernel duration
|
|
84
|
+
|
|
85
|
+
## š Performance Metrics
|
|
86
|
+
|
|
87
|
+
The tool extracts the following key metrics:
|
|
88
|
+
|
|
89
|
+
- **DEVICE KERNEL DURATION [ns]**: Total time spent in device kernels
|
|
90
|
+
- **CSV Path**: Location of the detailed profiling results
|
|
91
|
+
- **Real-time Progress**: Live output during profiling
|
|
92
|
+
|
|
93
|
+
## š§ Requirements
|
|
94
|
+
|
|
95
|
+
- Python 3.7+
|
|
96
|
+
- pandas
|
|
97
|
+
- Tenstorrent's TT-Metal development environment
|
|
98
|
+
- pytest
|
|
99
|
+
|
|
100
|
+
## š Project Structure
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
ttperf/
|
|
104
|
+
āāā ttperf.py # Main CLI implementation
|
|
105
|
+
āāā pyproject.toml # Project configuration
|
|
106
|
+
āāā README.md # This file
|
|
107
|
+
āāā .gitignore # Git ignore rules
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## š¤ Contributing
|
|
111
|
+
|
|
112
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
113
|
+
|
|
114
|
+
1. Fork the repository
|
|
115
|
+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
116
|
+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
117
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
118
|
+
5. Open a Pull Request
|
|
119
|
+
|
|
120
|
+
## š License
|
|
121
|
+
|
|
122
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
123
|
+
|
|
124
|
+
## š Issues
|
|
125
|
+
|
|
126
|
+
If you encounter any issues, please [create an issue](https://github.com/Aswintechie/ttperf/issues) on GitHub.
|
|
127
|
+
|
|
128
|
+
## šØāš» Author
|
|
129
|
+
|
|
130
|
+
**Aswin Z**
|
|
131
|
+
- GitHub: [@Aswintechie](https://github.com/Aswintechie)
|
|
132
|
+
|
|
133
|
+
## š Acknowledgments
|
|
134
|
+
|
|
135
|
+
- Tenstorrent's TT-Metal development team for the profiling tools
|
|
136
|
+
- Python community for excellent libraries like pandas
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
<div align="center">
|
|
141
|
+
Made with ā¤ļø for the Tenstorrent TT-Metal community
|
|
142
|
+
</div>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "ttperf"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "A streamlined CLI tool for profiling Tenstorrent's TT-Metal tests and extracting device kernel performance metrics"
|
|
5
|
+
authors = [{name = "Aswin Z", email = "aswintechie@gmail.com"}]
|
|
6
|
+
license = {text = "MIT"}
|
|
7
|
+
readme = "README.md"
|
|
8
|
+
requires-python = ">=3.7"
|
|
9
|
+
dependencies = ["pandas>=1.3.0"]
|
|
10
|
+
keywords = ["tenstorrent", "tt-metal", "profiling", "performance", "cli"]
|
|
11
|
+
classifiers = [
|
|
12
|
+
"Development Status :: 4 - Beta",
|
|
13
|
+
"Intended Audience :: Developers",
|
|
14
|
+
"License :: OSI Approved :: MIT License",
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Programming Language :: Python :: 3.7",
|
|
17
|
+
"Programming Language :: Python :: 3.8",
|
|
18
|
+
"Programming Language :: Python :: 3.9",
|
|
19
|
+
"Programming Language :: Python :: 3.10",
|
|
20
|
+
"Programming Language :: Python :: 3.11",
|
|
21
|
+
"Topic :: Software Development :: Testing",
|
|
22
|
+
"Topic :: System :: Benchmark",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[project.urls]
|
|
26
|
+
Homepage = "https://github.com/Aswintechie/ttperf"
|
|
27
|
+
Repository = "https://github.com/Aswintechie/ttperf"
|
|
28
|
+
Issues = "https://github.com/Aswintechie/ttperf/issues"
|
|
29
|
+
Documentation = "https://github.com/Aswintechie/ttperf/blob/master/README.md"
|
|
30
|
+
|
|
31
|
+
[project.scripts]
|
|
32
|
+
ttperf = "ttperf:main"
|
|
33
|
+
|
|
34
|
+
[build-system]
|
|
35
|
+
requires = ["setuptools", "wheel"]
|
|
36
|
+
build-backend = "setuptools.build_meta"
|
ttperf-0.1.0/setup.cfg
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ttperf
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A streamlined CLI tool for profiling Tenstorrent's TT-Metal tests and extracting device kernel performance metrics
|
|
5
|
+
Author-email: Aswin Z <aswintechie@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Aswintechie/ttperf
|
|
8
|
+
Project-URL: Repository, https://github.com/Aswintechie/ttperf
|
|
9
|
+
Project-URL: Issues, https://github.com/Aswintechie/ttperf/issues
|
|
10
|
+
Project-URL: Documentation, https://github.com/Aswintechie/ttperf/blob/master/README.md
|
|
11
|
+
Keywords: tenstorrent,tt-metal,profiling,performance,cli
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Topic :: Software Development :: Testing
|
|
22
|
+
Classifier: Topic :: System :: Benchmark
|
|
23
|
+
Requires-Python: >=3.7
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: pandas>=1.3.0
|
|
27
|
+
Dynamic: license-file
|
|
28
|
+
|
|
29
|
+
# š ttperf - TT-Metal Performance Profiler
|
|
30
|
+
|
|
31
|
+
<div align="center">
|
|
32
|
+
|
|
33
|
+

|
|
34
|
+

|
|
35
|
+

|
|
36
|
+
[](https://github.com/Aswintechie/ttperf/issues)
|
|
37
|
+
[](https://github.com/Aswintechie/ttperf/stargazers)
|
|
38
|
+
|
|
39
|
+
**A streamlined CLI tool for profiling Tenstorrent's TT-Metal tests and extracting device kernel performance metrics**
|
|
40
|
+
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
## ⨠Features
|
|
44
|
+
|
|
45
|
+
- š **Automated Profiling**: Seamlessly runs Tenstorrent's TT-Metal profiler with pytest
|
|
46
|
+
- š **CSV Analysis**: Automatically extracts and parses performance CSV files
|
|
47
|
+
- ā” **Real-time Output**: Shows profiling progress in real-time
|
|
48
|
+
- š **Performance Metrics**: Calculates total DEVICE KERNEL DURATION
|
|
49
|
+
- šÆ **Simple CLI**: Easy-to-use command-line interface
|
|
50
|
+
- š ļø **Flexible**: Supports named profiles and various test paths
|
|
51
|
+
|
|
52
|
+
## š Quick Start
|
|
53
|
+
|
|
54
|
+
### Installation
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# Clone the repository
|
|
58
|
+
git clone https://github.com/Aswintechie/ttperf.git
|
|
59
|
+
cd ttperf
|
|
60
|
+
|
|
61
|
+
# Install the package
|
|
62
|
+
pip install -e .
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Basic Usage
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# Run profiling on a specific test
|
|
69
|
+
ttperf test_performance.py
|
|
70
|
+
|
|
71
|
+
# Run with a custom profile name
|
|
72
|
+
ttperf my_profile pytest test_performance.py
|
|
73
|
+
|
|
74
|
+
# Run on a specific test method
|
|
75
|
+
ttperf tests/test_ops.py::test_matmul
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## š Usage Examples
|
|
79
|
+
|
|
80
|
+
### Simple Test Profiling
|
|
81
|
+
```bash
|
|
82
|
+
ttperf test_conv.py
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Named Profile
|
|
86
|
+
```bash
|
|
87
|
+
ttperf conv_benchmark pytest test_conv.py
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Specific Test Method
|
|
91
|
+
```bash
|
|
92
|
+
ttperf tests/ops/test_matmul.py::test_basic_matmul
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Output Example
|
|
96
|
+
```
|
|
97
|
+
ā¶ļø Running: ./tt_metal/tools/profiler/profile_this.py -n conv_benchmark -c "pytest test_conv.py"
|
|
98
|
+
|
|
99
|
+
... (profiling output) ...
|
|
100
|
+
|
|
101
|
+
š Found CSV path: /path/to/profile_results.csv
|
|
102
|
+
ā±ļø DEVICE KERNEL DURATION [ns] total: 1234567.89 ns
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## š ļø How It Works
|
|
106
|
+
|
|
107
|
+
1. **Command Parsing**: Analyzes input arguments to determine profile name and test path
|
|
108
|
+
2. **Profile Execution**: Runs the Tenstorrent's TT-Metal profiler with the specified test
|
|
109
|
+
3. **Output Monitoring**: Streams profiling output in real-time
|
|
110
|
+
4. **CSV Extraction**: Parses the output to find the generated CSV file path
|
|
111
|
+
5. **Performance Analysis**: Reads the CSV and calculates total device kernel duration
|
|
112
|
+
|
|
113
|
+
## š Performance Metrics
|
|
114
|
+
|
|
115
|
+
The tool extracts the following key metrics:
|
|
116
|
+
|
|
117
|
+
- **DEVICE KERNEL DURATION [ns]**: Total time spent in device kernels
|
|
118
|
+
- **CSV Path**: Location of the detailed profiling results
|
|
119
|
+
- **Real-time Progress**: Live output during profiling
|
|
120
|
+
|
|
121
|
+
## š§ Requirements
|
|
122
|
+
|
|
123
|
+
- Python 3.7+
|
|
124
|
+
- pandas
|
|
125
|
+
- Tenstorrent's TT-Metal development environment
|
|
126
|
+
- pytest
|
|
127
|
+
|
|
128
|
+
## š Project Structure
|
|
129
|
+
|
|
130
|
+
```
|
|
131
|
+
ttperf/
|
|
132
|
+
āāā ttperf.py # Main CLI implementation
|
|
133
|
+
āāā pyproject.toml # Project configuration
|
|
134
|
+
āāā README.md # This file
|
|
135
|
+
āāā .gitignore # Git ignore rules
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## š¤ Contributing
|
|
139
|
+
|
|
140
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
141
|
+
|
|
142
|
+
1. Fork the repository
|
|
143
|
+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
144
|
+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
145
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
146
|
+
5. Open a Pull Request
|
|
147
|
+
|
|
148
|
+
## š License
|
|
149
|
+
|
|
150
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
151
|
+
|
|
152
|
+
## š Issues
|
|
153
|
+
|
|
154
|
+
If you encounter any issues, please [create an issue](https://github.com/Aswintechie/ttperf/issues) on GitHub.
|
|
155
|
+
|
|
156
|
+
## šØāš» Author
|
|
157
|
+
|
|
158
|
+
**Aswin Z**
|
|
159
|
+
- GitHub: [@Aswintechie](https://github.com/Aswintechie)
|
|
160
|
+
|
|
161
|
+
## š Acknowledgments
|
|
162
|
+
|
|
163
|
+
- Tenstorrent's TT-Metal development team for the profiling tools
|
|
164
|
+
- Python community for excellent libraries like pandas
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
<div align="center">
|
|
169
|
+
Made with ā¤ļø for the Tenstorrent TT-Metal community
|
|
170
|
+
</div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pandas>=1.3.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ttperf
|
ttperf-0.1.0/ttperf.py
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# ttperf/cli.py
|
|
2
|
+
|
|
3
|
+
import sys
|
|
4
|
+
import subprocess
|
|
5
|
+
import re
|
|
6
|
+
import pandas as pd
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def extract_csv_path(output: str) -> str:
|
|
11
|
+
match = re.search(r"OPs csv generated at: (.+?\.csv)", output)
|
|
12
|
+
if not match:
|
|
13
|
+
print("ā CSV path not found in output.")
|
|
14
|
+
sys.exit(1)
|
|
15
|
+
return match.group(1)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def get_device_kernel_duration(csv_path: str) -> float:
|
|
19
|
+
df = pd.read_csv(csv_path)
|
|
20
|
+
if "DEVICE KERNEL DURATION [ns]" not in df.columns:
|
|
21
|
+
print("ā 'DEVICE KERNEL DURATION [ns]' column not found.")
|
|
22
|
+
sys.exit(1)
|
|
23
|
+
return df["DEVICE KERNEL DURATION [ns]"].sum()
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def parse_args(argv):
|
|
27
|
+
# Default values
|
|
28
|
+
name = None
|
|
29
|
+
test_cmd = None
|
|
30
|
+
|
|
31
|
+
for arg in argv:
|
|
32
|
+
if arg.endswith(".py") or "::" in arg or Path(arg).exists():
|
|
33
|
+
test_cmd = arg
|
|
34
|
+
elif arg.lower() == "pytest":
|
|
35
|
+
continue
|
|
36
|
+
else:
|
|
37
|
+
name = arg
|
|
38
|
+
|
|
39
|
+
if not test_cmd:
|
|
40
|
+
print("ā Test file/path not found in arguments.")
|
|
41
|
+
sys.exit(1)
|
|
42
|
+
|
|
43
|
+
return name, test_cmd
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def build_profile_command(name, test_cmd):
|
|
47
|
+
name_arg = f"-n {name}" if name else ""
|
|
48
|
+
return f"./tt_metal/tools/profiler/profile_this.py {name_arg} -c \"pytest {test_cmd}\""
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def main():
|
|
52
|
+
if len(sys.argv) < 2:
|
|
53
|
+
print("Usage: ttperf [name] [pytest] <test_path>")
|
|
54
|
+
sys.exit(1)
|
|
55
|
+
|
|
56
|
+
name, test_cmd = parse_args(sys.argv[1:])
|
|
57
|
+
profile_cmd = build_profile_command(name, test_cmd)
|
|
58
|
+
|
|
59
|
+
print(f"ā¶ļø Running: {profile_cmd}\n")
|
|
60
|
+
|
|
61
|
+
process = subprocess.Popen(
|
|
62
|
+
profile_cmd,
|
|
63
|
+
shell=True,
|
|
64
|
+
stdout=subprocess.PIPE,
|
|
65
|
+
stderr=subprocess.STDOUT,
|
|
66
|
+
universal_newlines=True,
|
|
67
|
+
bufsize=1,
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
output_lines = []
|
|
71
|
+
try:
|
|
72
|
+
for line in process.stdout:
|
|
73
|
+
print(line, end="") # Real-time output
|
|
74
|
+
output_lines.append(line)
|
|
75
|
+
except KeyboardInterrupt:
|
|
76
|
+
process.terminate()
|
|
77
|
+
print("ā Aborted.")
|
|
78
|
+
sys.exit(1)
|
|
79
|
+
|
|
80
|
+
process.wait()
|
|
81
|
+
|
|
82
|
+
# Combine all output for post-analysis
|
|
83
|
+
full_output = "".join(output_lines)
|
|
84
|
+
|
|
85
|
+
# Extract CSV path and duration
|
|
86
|
+
csv_path = extract_csv_path(full_output)
|
|
87
|
+
print(f"\nš Found CSV path: {csv_path}")
|
|
88
|
+
|
|
89
|
+
duration = get_device_kernel_duration(csv_path)
|
|
90
|
+
print(f"\nā±ļø DEVICE KERNEL DURATION [ns] total: {duration:.2f} ns")
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
if __name__ == "__main__":
|
|
94
|
+
main()
|