Skip to content

Commit bb029fb

Browse files
[TVMRT] Document missing dependency for tvm python package on 11.2 SDK
11.2 SDK is missing psutil and typing_extensions python package which is a dependency for tvm python wheel. Signed-off-by: Abhay-Chirania <a-chirania@ti.com>
1 parent 3d78320 commit bb029fb

File tree

3 files changed

+35
-3
lines changed

3 files changed

+35
-3
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,11 @@ You have two options for setting up the EdgeAI TIDL Tools repository on your TI
401401
python3 basic_example.py --config ./config.yaml -r tflitert --infer
402402
403403
# Running tvmrt examples
404-
python3 basic_example.py --config ./config.yaml -r tvmrt --infer
404+
# Note: The TVM python wheel requires additional dependencies that are
405+
# currently not provided in SDK 11.2. Please run
406+
# `pip install psutil typing_extensions` on SoC to enable tvm inference
407+
#
408+
#python3 basic_example.py --config ./config.yaml -r tvmrt --infer
405409
406410
cd -
407411
```

runtimes/tidl_wrapper/python/tvmrt/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ This module is designed to simplify the process of using TVM Runtime with TIDL a
2323
- NumPy
2424
- TIDL Tools (for model compilation)
2525

26+
## Note
27+
28+
For inference on target machine, user needs to manually install additional dependencies using the below command:
29+
``` python
30+
pip3 install psutil typing_extensions
31+
```
32+
2633
## API Documentation
2734

2835
### TVMRT Class
@@ -126,6 +133,7 @@ def get_performance(self):
126133
'subgraph_time': (value, "ms") - Total TIDL Subgraphs processing time
127134
'read_total': (value, "bytes") - Total DDR Read bytes [X for x86 runs]
128135
'write_total': (value, "bytes") - Total DDR Write bytes [X for x86 runs]
136+
'num_subgraphs': (value, "") - Total Detected subgraphs
129137
"""
130138
```
131139

@@ -270,6 +278,7 @@ The `get_performance()` method returns a dictionary with the following metrics,
270278
| `subgraph_time` | Time spent in all TIDL subgraph execution | milliseconds (ms) |
271279
| `read_total` | Total DDR read bytes | bytes |
272280
| `write_total` | Total DDR write bytes | bytes |
281+
| `num_subgraphs` | Total Subgraphs detected | |
273282

274283
## Model Information
275284

runtimes/tidl_wrapper/python/tvmrt/tvmrt_wrapper.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,28 @@
22
import sys
33
import numpy as np
44
import platform
5+
import platform
56

67
# set the environment variable before importing TVM so that
78
# it takes effect while loading and initializing the c++ library.
89
os.environ["TIDL_RT_PERFSTATS"] = "1"
9-
import tvm
10+
11+
try:
12+
import tvm
13+
except ModuleNotFoundError as e:
14+
print("\n" + "="*80)
15+
print("ERROR: TVMRT Dependencies Missing")
16+
print("="*80)
17+
if platform.machine() != "aarch64":
18+
print("Please follow the setup steps before running the application.")
19+
else:
20+
print(f"Failed to import required module: {e.name if hasattr(e, 'name') else 'tvm dependencies'}")
21+
print("\nTVMRT requires additional Python packages to function properly.")
22+
print("Please install the missing dependencies using the following command:")
23+
print("\n pip3 install psutil typing_extensions")
24+
print("\nAfter installation, please re-run your application.")
25+
print("="*80 + "\n")
26+
sys.exit(1)
1027

1128
class TVMRT:
1229
"""
@@ -131,6 +148,7 @@ def get_performance(self):
131148
'subgraph_time': Total TIDL Subgraphs processing time (ms)
132149
'read_total': Total DDR Read bytes [X for x86 runs]
133150
'write_total': Total DDR Write bytes [X for x86 runs]
151+
'num_subgraphs': Total Detected subgraphs
134152
135153
Returns:
136154
dict: performance_name : (performance_value, unit)
@@ -169,7 +187,8 @@ def get_performance(self):
169187
'core_time': (core_time,"ms"),
170188
'subgraph_time': (subgraph_time,"ms"),
171189
'read_total': (read_total, "bytes"),
172-
'write_total': (write_total, "bytes")
190+
'write_total': (write_total, "bytes"),
191+
'num_subgraphs': (len(subgraphIds), "")
173192
}
174193

175194
return stats

0 commit comments

Comments
 (0)