Skip to content

Commit f5afe64

Browse files
authored
Merge pull request #214 from tenstorrent/sbansal/test_new_reset_interfaces
Add updated reset interfaces to tt-smi + UMD 0.9.4 update
2 parents 340f594 + 0fe9e1b commit f5afe64

10 files changed

Lines changed: 600 additions & 141 deletions

File tree

README.md

Lines changed: 86 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ pre-commit install
9494
tt-smi can be used as a GUI (`tt-smi`) or CLI (`tt-smi -s`) to display system information and Tenstorrent device telemetry, and it can be used to reset Tenstorrent devices (`tt-smi -r`).
9595

9696
```
97-
tt-smi [-h] [-l] [-v] [-s] [-ls] [-f [snapshot filename]] [-c] [-r [0,1 ...]] [--snapshot_no_tty] [-glx_reset] [-glx_reset_auto] [-glx_reset_tray {1,2,3,4}] [-glx_list_tray_to_device] [--no_reinit]
97+
tt-smi [-h] [-l] [-v] [-s] [-ls] [-f [snapshot filename]] [-c] [-r [TARGETS ...]] [--snapshot_no_tty] [-glx_reset] [-glx_reset_auto] [-glx_reset_tray {1,2,3,4}] [-glx_list_tray_to_device] [--no_reinit]
9898
```
9999

100100
## Getting Help
@@ -103,7 +103,7 @@ Running tt-smi with the ```-h, --help``` flag displays the help text.
103103

104104
```
105105
$ tt-smi -h
106-
usage: tt-smi [-h] [-l] [-v] [-s] [-ls] [-f [snapshot filename]] [-c] [-r [0,1 ...]] [--snapshot_no_tty] [-glx_reset] [-glx_reset_auto] [-glx_reset_tray {1,2,3,4}] [-glx_list_tray_to_device] [--no_reinit] [--use_luwen]
106+
usage: tt-smi [-h] [-l] [-v] [-s] [-ls] [-f [snapshot filename]] [-c] [-r [TARGETS ...]] [--snapshot_no_tty] [-glx_reset] [-glx_reset_auto] [-glx_reset_tray {1,2,3,4}] [-glx_list_tray_to_device] [--no_reinit] [--use_luwen]
107107
108108
Tenstorrent System Management Interface (TT-SMI) is a command line utility to interact with all Tenstorrent devices on host. The main objective of TT-SMI is to provide a simple and easy-to-use
109109
interface to display devices, device telemetry, and system information. TT-SMI is also used to issue board-level resets.
@@ -113,12 +113,12 @@ options:
113113
-l, --local Run on local chips (Wormhole only)
114114
-v, --version show program's version number and exit
115115
-s, --snapshot Dump snapshot of current tt-smi information to STDOUT
116-
-ls, --list List boards that are available on host and quit
116+
-ls, --list List boards on the host and quit (UMD: UMD Chip ID, PCI BDF, PCI Dev ID, …)
117117
-f [snapshot filename], --filename [snapshot filename]
118118
Write snapshot to a file. Default: ~/tt_smi/<timestamp>_snapshot.json
119119
-c, --compact Run in compact mode, hiding the sidebar and other static elements
120-
-r [0,1 ...], --reset [0,1 ...]
121-
Provide a list of PCI indices. Find PCI index of board using the -ls option. If no indices are provided, all devices will be reset
120+
-r [TARGETS ...], --reset [TARGETS ...]
121+
Reset targets: UMD logical IDs, PCI BDFs (e.g. 0000:0a:00.0), or /dev/tenstorrent/<id>. Use -ls to list devices. Omit targets or use "all" to reset all devices. Do not mix types in one command.
122122
--snapshot_no_tty Force no-tty behavior in the snapshot to stdout
123123
-glx_reset, --galaxy_6u_trays_reset
124124
Reset all the ASICs on the galaxy host
@@ -148,69 +148,105 @@ All GUI keyboard shortcuts can be found in the help menu that user can bring up
148148

149149
![help_menu](images/help.png)
150150

151-
## Resets
151+
## Listing devices
152152

153-
Another feature of tt-smi is performing resets on Blackhole, Wormhole and Grayskull PCIe cards, using the ```-r / --reset``` argument.
153+
Use **`tt-smi -ls`** or **`tt-smi --list`** to print a table of Tenstorrent devices and exit (no GUI). This is the easiest way to see **UMD Chip ID**, **PCI BDF**, and **`/dev/tenstorrent/<n>`** (shown as **PCI Dev ID**) for each board—use these values with `tt-smi -r` as described in [Resets](#resets).
154154

155+
With the **UMD** backend (default), output includes two tables:
155156

156-
```
157-
$ tt-smi -r 0,1 ..., --reset 0,1 ...
158-
```
157+
- **All available boards on host (UMD)** — every device TT-SMI discovered.
158+
- **Boards that can be reset (UMD)** — devices eligible for `tt-smi -r`.
159159

160-
To perform the reset, provide a list of comma-separated PCI indices of the cards on the host. You can find PCI index of board using the -ls option. If no indices are provided, all devices will be reset.
160+
Column meanings:
161161

162-
TT-SMI will perform different types of resets depending on the device:
163-
- Grayskull
164-
- Tensix-level reset that will reset each Tensix cores.
165-
- Wormhole
166-
- A board-level reset will be perfomed. Power will be cut to the board and brought back up.
167-
- After reset, the ethernet connections will be re-trained.
168-
- Blackhole
169-
- An ASIC-level reset will be perfomed.
162+
| Column | Meaning |
163+
|--------|---------|
164+
| **UMD Chip ID** | Logical device index used for `tt-smi -r 0`, `tt-smi -r 1`, … |
165+
| **PCI BDF** | PCI bus/device/function, e.g. `0000:01:00.0` — use with `tt-smi -r 0000:01:00.0` |
166+
| **PCI Dev ID** | Kernel device node path, e.g. `/dev/tenstorrent/19` — use with `tt-smi -r /dev/tenstorrent/19` |
167+
| **Board Type** | e.g. Blackhole, Wormhole |
168+
| **Device Series** | Board SKU / series string |
169+
| **Board Number** | Board serial identifier |
170170

171-
By default, the reset command will re-initialize the boards after reset.
171+
On large hosts (e.g. Galaxy), **UMD Chip ID** and **`/dev/tenstorrent/<n>`** are **not** always the same number—always use `-ls` to pick the correct target.
172172

173-
A successful reset on a system with a Wormhole N300 board looks like the following:
173+
During discovery, **tt-umd** may print log lines (for example Ethernet heartbeat checks on Galaxy). Those messages are from the driver; the tables below still list the boards.
174174

175-
```
176-
$ tt-smi -r
177-
Starting reset on devices at PCI indices: 0
178-
Waiting for 2 seconds for potential hotplug removal.
179-
Waiting for devices to reappear on pci bus...
180-
Reset successfully completed for device at PCI index 0.
181-
Finishing reset on devices at PCI indices: 0
182-
Re-initializing boards after reset....
183-
Detected Chips: 2
184-
```
175+
### Example: Blackhole Galaxy (32 ASICs, UMD)
185176

186-
In order to find the correct device ID to call the reset on, the user can use the tt-smi board list function `tt-smi -ls` or `tt-smi --list`.
187-
The dev id listed is the same as found on `/dev/tenstorrent/<dev pci id>`.
188-
The generated output will include a list of all boards on host as well as the ones that can be reset.
177+
Abbreviated output from a 32-board Galaxy system; your PCI BDFs and `/dev/tenstorrent/<n>` assignments will differ.
189178

190179
```
191180
$ tt-smi -ls
192-
181+
… UMD may log info/warning lines during topology discovery …
193182
Gathering Information ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00
194-
All available boards on host:
195-
┏━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓
196-
┃ PCI Dev ID ┃ Board Type ┃ Device Series ┃ Board Number ┃
197-
┡━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩
198-
│ 0 │ Grayskull │ e75 │ 0100007311523010 │
199-
│ 1 │ Wormhole │ n300 L │ 010001451170801d │
200-
│ N/A │ Wormhole │ n300 R │ 010001451170801d │
201-
└────────────┴────────────┴───────────────┴──────────────────┘
202-
Boards that can be reset:
203-
┏━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓
204-
┃ PCI Dev ID ┃ Board Type ┃ Device Series ┃ Board Number ┃
205-
┡━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩
206-
│ 0 │ Grayskull │ e75 │ 0100007311523010 │
207-
│ 1 │ Wormhole │ n300 L │ 010001451170801d │
208-
└────────────┴────────────┴───────────────┴──────────────────┘
183+
All available boards on host (UMD):
184+
┏━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓
185+
┃ UMD Chip ID ┃ PCI BDF ┃ PCI Dev ID ┃ Board Type ┃ Device Series ┃ Board Number ┃
186+
┡━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩
187+
│ 0 │ 0000:01:00.0 │ /dev/tenstorrent/19 │ Blackhole │ tt-galaxy-bh │ 0000047131831011 │
188+
│ 1 │ 0000:02:00.0 │ /dev/tenstorrent/18 │ Blackhole │ tt-galaxy-bh │ 0000047131831011 │
189+
│ 2 │ 0000:03:00.0 │ /dev/tenstorrent/25 │ Blackhole │ tt-galaxy-bh │ 0000047131831011 │
190+
│ … │ … │ … │ … │ … │ … │
191+
│ 31 │ 0000:c8:00.0 │ /dev/tenstorrent/6 │ Blackhole │ tt-galaxy-bh │ 0000047131831011 │
192+
└─────────────┴──────────────┴─────────────────────┴────────────┴───────────────┴──────────────────┘
193+
Boards that can be reset (UMD):
194+
┏━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓
195+
┃ UMD Chip ID ┃ PCI BDF ┃ PCI Dev ID ┃ Board Type ┃ Device Series ┃ Board Number ┃
196+
┡━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩
197+
│ 0 │ 0000:01:00.0 │ /dev/tenstorrent/19 │ Blackhole │ tt-galaxy-bh │ 0000047131831011 │
198+
│ … │ … │ … │ … │ … │ … │
199+
└─────────────┴──────────────┴─────────────────────┴────────────┴───────────────┴──────────────────┘
200+
```
201+
202+
With **`--use_luwen`**, the table layout differs (no UMD Chip ID column); use **PCI BDF** and **`/dev/tenstorrent/<n>`** for `tt-smi -r` when using Luwen.
203+
204+
## Resets
205+
206+
Another feature of tt-smi is performing resets on Blackhole and Wormhole PCIe cards and galaxy machines, using the `-r` / `--reset` argument.
207+
208+
Reset targets are parsed as **one type per invocation** (do not mix UMD logical IDs, PCI BDFs, and `/dev/tenstorrent/<id>` paths in the same command).
209+
210+
### UMD (default backend)
211+
212+
With the UMD backend (default, no `--use_luwen`), `-r` accepts **four** kinds of input:
213+
214+
- **No arguments** or **`all`** — reset every detected device (`tt-smi -r` or `tt-smi -r all`).
215+
- **UMD logical chip IDs** — comma-separated integers, e.g. `0`, `1`, `2` (same numbering as UMD device enumeration).
216+
- **PCI BDF** — full address, e.g. `0000:0a:00.0` (comma-separated for multiple devices).
217+
- **`/dev/tenstorrent/<id>`** — device node index, e.g. `/dev/tenstorrent/0`.
218+
219+
### Luwen (`--use_luwen`)
220+
221+
With the Luwen backend, `-r` accepts **three** kinds of input:
222+
223+
- **No arguments** or **`all`** — reset all devices discovered via Luwen.
224+
- **PCI BDF** — as above.
225+
- **`/dev/tenstorrent/<id>`** — as above.
226+
227+
**Note:** A bare integer (e.g. `0`) is **not** a valid Luwen reset target. Use the `/dev/tenstorrent/0` form instead.
228+
229+
- **Example (invalid with Luwen):** `tt-smi -r 0 --use_luwen`
230+
- **Example (valid with Luwen):** `tt-smi -r /dev/tenstorrent/0 --use_luwen`
231+
232+
### Examples of valid resets
233+
234+
```bash
235+
tt-smi -r 0000:0a:00.0,0000:0b:00.0
236+
tt-smi -r /dev/tenstorrent/0,/dev/tenstorrent/2,/dev/tenstorrent/3
237+
tt-smi -r 0,1,2 # UMD logical IDs (UMD / default backend only)
238+
tt-smi -r # or: tt-smi -r all
209239
```
210240

241+
Use `tt-smi -ls` (or `tt-smi --list`) to list boards; see [Listing devices](#listing-devices) for UMD Chip ID, PCI BDF, and `/dev/tenstorrent/<id>` columns.
242+
243+
By default, the reset command will re-initialize the boards after reset. Use the `--no_reinit` arg to skip this.
244+
245+
211246
## Galaxy resets
212247

213248
There are several options available for resetting Galaxy 6U trays.
249+
- Use the `-r/--reset` argument and treat it like any other pcie card. Warning - Needs CPLD FW v1.16 or higher.
214250
- glx_reset: resets the galaxy, informs users if an Ethernet failure has been detected
215251
- glx_reset_auto: same as -glx_reset, but resets up to 3 times if an Ethernet failure has been detected
216252
- glx_reset_tray <tray_num>: performs reset on one galaxy tray. Tray number has to be between 1-4

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ dependencies = [
2929
'pydantic>=1.2',
3030
'tt_tools_common~=1.6.0',
3131
'pyluwen~=0.8.0',
32-
'tt-umd==0.9.3',
32+
'tt-umd==0.9.4',
3333
'rich>=13.7.0',
3434
'textual>=0.59.0',
3535
'pre-commit>=3.5.0',

tests/conftest.py

Lines changed: 41 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,58 +6,68 @@
66
from typing import List, Dict, Tuple, Union
77

88
from pyluwen import pci_scan, PciChip
9-
from tt_umd import PCIDevice, TopologyDiscovery, TTDevice
9+
from tt_umd import PCIDevice, TopologyDiscovery, TTDevice, TopologyDiscoveryOptions
1010
from tt_smi.tt_smi_backend import TTSMIBackend
11+
from tt_smi.constants import SMBUS_TELEMETRY_OPTIONS
1112
from tt_tools_common.utils_common.tools_utils import detect_chips_with_callback
1213

1314
# Luwen fixtures
1415

1516

16-
@pytest.fixture(scope="session")
17+
@pytest.fixture(scope="function")
1718
def luwen_reset_test_config() -> Tuple[List[int], bool]:
1819
"""Return a tuple of a list of PCI indices using Luwen backend, and False, which represents the use_umd param."""
1920
return (pci_scan(), False)
2021

2122

22-
@pytest.fixture(scope="session")
23+
@pytest.fixture(scope="function")
2324
def luwen_devices() -> Dict[int, PciChip]:
24-
"""Return a list of Tenstorrent PciChips."""
25-
return dict(enumerate(detect_chips_with_callback()))
25+
"""Return fresh Tenstorrent PciChips for each test."""
26+
chips = dict(enumerate(detect_chips_with_callback()))
27+
try:
28+
yield chips
29+
finally:
30+
# We need to make sure the chips are deleted after the test is done to avoid memory leaks.
31+
del chips
2632

2733

28-
@pytest.fixture(scope="session")
34+
@pytest.fixture(scope="function")
2935
def luwen_backend(luwen_devices) -> TTSMIBackend:
30-
"""Return a TTSMIBackend instance created from devices."""
36+
"""Return a TTSMIBackend instance created from devices (must match luwen_devices scope)."""
3137
return TTSMIBackend(luwen_devices)
3238

3339

3440
# UMD fixtures
3541

3642

37-
@pytest.fixture(scope="session")
43+
@pytest.fixture(scope="function")
3844
def umd_reset_test_config() -> Tuple[List[int], bool]:
3945
"""Return a tuple of a list of PCI indices using UMD backend, and True, which represents the use_umd param."""
4046
return (list(PCIDevice.enumerate_devices_info()), True)
4147

4248

43-
@pytest.fixture(scope="session")
49+
@pytest.fixture(scope="function")
4450
def umd_devices() -> dict[int, TTDevice]:
45-
"""Return a dict of Tenstorrent TTDevices using UMD backend."""
46-
_, devices = TopologyDiscovery.discover()
47-
return devices
51+
"""Return fresh Tenstorrent TTDevices for each test."""
52+
# Ignore eth heartbeat failures for now. Not relevant to tests.
53+
_, devices = TopologyDiscovery.discover(options=SMBUS_TELEMETRY_OPTIONS)
54+
try:
55+
yield devices
56+
finally:
57+
del devices
4858

4959

50-
@pytest.fixture(scope="session")
60+
@pytest.fixture(scope="function")
5161
def umd_backend() -> TTSMIBackend:
5262
"""Return a TTSMIBackend instance using UMD backend."""
53-
cluster_descriptor, devices = TopologyDiscovery.discover()
63+
cluster_descriptor, devices = TopologyDiscovery.discover(options=SMBUS_TELEMETRY_OPTIONS)
5464
return TTSMIBackend(devices=devices, umd_cluster_descriptor=cluster_descriptor)
5565

5666

5767
# Parametrized fixtures to run tests with both backends
5868

5969

60-
@pytest.fixture(scope="session", params=["luwen", "umd"])
70+
@pytest.fixture(scope="function", params=["luwen", "umd"])
6171
def reset_test_config(
6272
request, luwen_reset_test_config, umd_reset_test_config
6373
) -> Tuple[List[int], bool]:
@@ -66,15 +76,29 @@ def reset_test_config(
6676
return umd_reset_test_config
6777

6878

69-
@pytest.fixture(scope="session", params=["luwen", "umd"])
79+
@pytest.fixture(scope="function", params=["luwen", "umd"])
7080
def devices(request, luwen_devices, umd_devices) -> List[Union[PciChip, TTDevice]]:
7181
if request.param == "luwen":
7282
return luwen_devices
7383
return umd_devices
7484

7585

76-
@pytest.fixture(scope="session", params=["luwen", "umd"])
86+
@pytest.fixture(scope="function", params=["luwen", "umd"])
7787
def backend(request, luwen_backend, umd_backend) -> TTSMIBackend:
7888
if request.param == "luwen":
7989
return luwen_backend
8090
return umd_backend
91+
92+
93+
@pytest.fixture(scope="function", params=["luwen", "umd"])
94+
def reset_test_config_with_backend(
95+
request,
96+
luwen_reset_test_config,
97+
umd_reset_test_config,
98+
luwen_backend,
99+
umd_backend,
100+
) -> Tuple[Tuple[List[int], bool], TTSMIBackend]:
101+
"""Same variant as reset_test_config, paired with the matching TTSMIBackend (one param axis)."""
102+
if request.param == "luwen":
103+
return luwen_reset_test_config, luwen_backend
104+
return umd_reset_test_config, umd_backend

0 commit comments

Comments
 (0)