Skip to main content

A low level hardware debugger

Project description

TT-Lensium :tm:

A low level hardware debugger

ttnn logo

Ask DeepWiki

This is a low-level debugging tool for Tenstorrent hardware. It enables access to and communication with the device. It supports Wormhole and Blackhole devices.


Quickstart

You can install latest published version with:

pip install tt-exalens

Or specific version with:

pip install tt-exalens=="x.y.z"

Alternatively, the wheel can be installed directly from GitHub with:

pip install git+https://github.com/tenstorrent/tt-exalens.git

The CLI application can be run by invoking tt-exalens command after installing the wheel.

Building

Cloning repository and setting up the environment

Clone the tt-exalens repository.

Requirements

Project has been tested on Ubuntu 22.04.

To build it, you need the following dependencies:

  • ninja-build,
  • cmake

Install them with:

sudo apt install ninja-build cmake

Python 3.10 is the only supported version. Install it with:

sudo apt install python3.10-venv

Additional Python dependencies are listed in ttexalens/requirements.txt and can be installed with:

pip install -r ttexalens/requirements.txt

Building the library and the application

Once the dependencies are installed, building the project is straightforward and can be done by running:

make build

from the project's root directory.

To verify that the build was successful, try running:

python tt-exalens.py

or

./tt-exalens.py

from the root directory.

Building and Installing Wheel

The wheel can be installed from the GitHub release, built from source, or installed directly from GitHub with

pip install git+https://github.com/tenstorrent/tt-exalens.git

Alternatively, you can install latest published version with:

pip install tt-exalens

Or specific version with:

pip install tt-exalens=="x.y.z"

Or you can simply run following in root directory:

pip install .

Another option is to build the wheel from local source, run:

make wheel

in the root directory. Then install it using:

pip install build/ttexalens_wheel/<ttexalens_wheel>.whl

where <ttexalens_wheel> is an automatically generated filename for the build.

Running the CLI application

The CLI application can be run via the tt-exalens.py script or by invoking tt-exalens command after installing the wheel. It currently operates in Limited mode by default, with plans to support additional modes in the future. Limited mode allows basic communication with the device, such as reading/writing registers and memory, and running .elf files on RISC cores.

The CLI application can target local or remote devices. For remote runs, a server instance is required and can be started using the same application.

It’s also possible to cache session results and replay commands on a machine without Tenstorrent hardware.

A GDB server can be launched, enabling stepping, breakpoints, and other debugging features via a GDB client.

For more usage information, refer to the tutorial or the documentation.

Using library

The application functionalities can also be accessed through the ttexalens Python library to create scripts that interact with Tenstorrent hardware.

For a quick start with the library, check out the tutorial. Full documentation is also available here.

Development

Testing

Test dependencies

Apart from the base dependencies, running tests requires additional Python packages:

  • pytest
  • coverage
  • parameterized

and system libraries:

  • libgtest-dev
  • libgmock-dev

Install the Python packages with:

pip install -r test/test_requirements.txt

Running tests

It is currently possible to run tests locally, by running

make test

from the project root directory.

Updating documentation

In order to update documentation virtual environment has to be created first by running the following command:

./scripts/create-venv.sh

To activate created environment use

.venv/bin/activate

Library documentation is automatically generated from source code docstrings. To update the library docs, you need to run (while in created environment):

make docs

in the project root. For more advanced use cases, refer to the source code of the documentation generation scripts, located in docs/bin.

Static checks

Pre-commit

We have defined various pre-commit hooks that check the code for formatting, licensing issues, etc.

To install pre-commit , run the following command:

pip install pre-commit

After installing pre-commit, you can install the hooks by running:

pre-commit install

Now, each time you run git commit the pre-commit hooks (checks) will be executed.

If you have already committed before installing the pre-commit hooks, you can run on all files to "catch up":

pre-commit run --all-files

For more information visit pre-commit

Updating docker images

To update docker images used on CI and in development, you need to update Dockerfiles in .github directory and then run release-docker-images workflow. This can be done through GitHub CLI (see here how to install it) by using command

gh workflow run 116548537 --ref <your-branch-name>

This will automatically generate new image releases and tag them as latest.


Troubleshooting

python: command not found

test/wheel-test/wheel-test.sh: line 11: python: command not found
make: *** [Makefile:182: test] Error 127

Fix:

alias python=python3

ModuleNotFoundError: No module named 'ttexalens_pybind_unit_tests'

This error might occur when trying to run unit tests:

Failed to import test module: test.ttexalens.pybind.test_bindings
Traceback (most recent call last):
  File "/usr/lib/python3.10/unittest/loader.py", line 436, in _find_test_path
    module = self._get_module_from_name(name)
  File "/usr/lib/python3.10/unittest/loader.py", line 377, in _get_module_from_name
    __import__(name)
  File "./test/ttexalens/pybind/test_bindings.py", line 17, in <module>
    from ttexalens_pybind_unit_tests import set_ttexalens_test_implementation
ModuleNotFoundError: No module named 'ttexalens_pybind_unit_tests'

To fix, just build the neccessary test library:

make build

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

tt_exalens-0.3.0-py3-none-any.whl (4.7 MB view details)

Uploaded Python 3

File details

Details for the file tt_exalens-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: tt_exalens-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 4.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tt_exalens-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b0f21a48e924c42ae7b0c84e9a3d60ff58ee48ff8ca8c7586ead65283dd571a9
MD5 232919c8be19b95e686c327ecdfb5f30
BLAKE2b-256 86b2de38a7d83d5712de4625767cd8a8ea54839b74382b819653efafc39c3e65

See more details on using hashes here.

Provenance

The following attestation bundles were made for tt_exalens-0.3.0-py3-none-any.whl:

Publisher: release-version.yml on tenstorrent/tt-exalens

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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