Skip to main content

User Mode Driver for tenstorrent

Project description

TT-UMD

User Mode Driver

ttnn logo

Quickstart

Software Dependencies

UMD requires Tenstorrent's kernel-mode driver

Required Ubuntu dependencies:

sudo apt install -y libhwloc-dev cmake ninja-build

UMD currently supports gcc-11 and newer gcc versions, and clang-13 and newer clang versions.

IOMMU and Hugepage requirements

To determine whether your system requires hugepage configuration, run the provided script:

./scripts/iommu_detect.sh

Wormhole and Blackhole

If your system IOMMU is enabled, no hugepage setup is required. If you don't have IOMMU enabled, than hugepages might be required for some of the driver functionality. 1G hugepages are required for shared device/host memory. Techniques for setup:

  • Recommended: the tt-system-tools repository contains a .deb package which will configure your system
    • sudo dpkg -i tenstorrent-tools_1.1-5_all.deb
  • Alternative: Metal project provides instructions and a script.
  • For experts:
    • Put system IOMMU in passthrough mode or disable it
    • Allocate 1 or more 1G hugepages
    • Mount the hugetlbfs at /dev/hugepages-1G (e.g. mount -t hugetlbfs hugetlbfs /dev/hugepages-1G -o mode=777,pagesize=1024M)

Install and use UMD

Python bindings

You can just run the following command, and you'll have tt_umd python package available in your environment:

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

Or if you have UMD downloaded locally you can install from local source:

pip install .

Build flow for C++ lib

To build libtt-umd.so:

cmake -B build -G Ninja
cmake --build build

To build all components (some are turned off by default, like tests), you can run these commands:

cmake -B build -G Ninja -DTT_UMD_BUILD_ALL=ON
cmake --build build

To build with GCC, set these environment variables before invoking cmake:

export CC=gcc
export CXX=g++

Disabling -Werror

By default, all warnings are treated as errors. This is controlled via the standard CMake variable CMAKE_COMPILE_WARNING_AS_ERROR.

Systems with recent libc may cause the python package building to fail due python redefining some *_SOURCES macros to higher versions and GCC has no mean to disable the macro redefinition diagnostic.

# Plain CMake
cmake -B build -G Ninja -DCMAKE_COMPILE_WARNING_AS_ERROR=OFF

# Python build (scikit-build-core passes CMAKE_ARGS through to CMake)
CMAKE_ARGS="-DCMAKE_COMPILE_WARNING_AS_ERROR=OFF" pip install .

Build debian dev package

cmake --build build --target package

# Generates umd-dev-x.y.z-Linux.deb

Enabling Logging

UMD uses a two-level logging system with compile-time and runtime controls.

Compile-Time Logging Control

By default, log_debug and log_trace statements are compiled out of release builds for performance. To include them in the binary:

Option 1: Enable logging explicitly

cmake -B build -G Ninja -DTT_UMD_ENABLE_LOGGING=ON
cmake --build build

Option 2: Use Debug build type (enables logging automatically)

cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug
cmake --build build

Runtime Logging Control

At runtime, control the logging level using the TT_LOGGER_LEVEL environment variable:

export TT_LOGGER_LEVEL=debug  # Show debug and above
export TT_LOGGER_LEVEL=trace  # Show all log messages (most verbose)
export TT_LOGGER_LEVEL=info   # Default level

Available log levels (from most to least verbose):

  • trace - Most detailed logging, traces program execution
  • debug - Debugging information useful during development
  • info - General informational messages (default)
  • warn - Warning messages for potentially harmful situations
  • error - Error messages for serious problems
  • critical - Critical errors that may lead to program termination
  • off - Disables all logging

Example: Running with debug logging

# Build with logging enabled
cmake -B build -G Ninja -DTT_UMD_ENABLE_LOGGING=ON
cmake --build build

# Run with debug level
TT_LOGGER_LEVEL=debug ./build/bin/your_program

Tracy Profiling

UMD supports Tracy profiling via the TT_UMD_ENABLE_TRACY build option. When disabled (the default), Tracy has zero footprint — no binary overhead, no runtime cost.

Building with Tracy

cmake -B build -G Ninja -DTT_UMD_ENABLE_TRACY=ON
cmake --build build

Capturing a trace

Launch the Tracy GUI locally, then on remote configure Port forwarding in VS Code for port 8086, start the application you want to profile on remote, then click Connect from GUI started locally. Alternatively, use tracy-capture -o trace.tracy to capture trace from the command line, then open the resulting file in the Tracy GUI.

Integration

UMD can be consumed by downstream projects in multiple ways.

From Source (Python)

You can use tt_umd module by installing it in your current python environment

From Source (CMake)

You can link libtt-umd.so by linking against the umd::tt-umd target.

Using CPM Package Manager

CPMAddPackage(
  NAME umd
  GITHUB_REPOSITORY tenstorrent/tt-umd
  GIT_TAG v0.1.0
  VERSION 0.1.0
)

As a submodule/external project

add_subdirectory(<path to umd>)

From Prebuilt Binaries

Ubuntu

apt install ./umd-dev-x.y.z-Linux.deb

Simulator Integration

You can run UMD tests without silicon by following setup instructions here.

Development workflow

For developing tt-umd, you can see the full set of dependencies in docker_install_common.sh

After that you can look at the section defined above Install and use UMD

Pre-commit Hook Integration for Formatting and Linting

As part of maintaining consistent code formatting across the project, we have integrated the pre-commit framework into our workflow. The pre-commit hooks will help automatically check and format code before commits are made, ensuring that we adhere to the project's coding standards.

What is Pre-commit?

Pre-commit is a framework for managing and maintaining multi-language pre-commit hooks. It helps catch common issues early by running a set of hooks before code is committed, automating tasks like:

  • Formatting code (e.g., fixing trailing whitespace, enforcing end-of-file newlines)
  • Running linters (e.g., clang-format, black, flake8)
  • Checking for merge conflicts or other common issues.

For more details on pre-commit, you can visit the official documentation.

How to Set Up Pre-commit Locally

To set up pre-commit on your local machine, follow these steps:

  1. Install Pre-commit: Ensure you have Python installed, then run:
    pip install pre-commit
    
  2. Install the Git Hook Scripts: In your local repository, run the following command to install the pre-commit hooks:
    pre-commit install
    
    This command will configure your local Git to run the defined hooks automatically before each commit.
  3. Run Pre-commit Hooks Manually: You can also run the hooks manually against all files at any time with:
    pre-commit run --all-files
    

Why You Should Use Pre-commit

By setting up pre-commit locally, you can help maintain the quality of the codebase and ensure that commits consistently meet the project's formatting standards. This saves time during code reviews and reduces the likelihood of code formatting issues slipping into the repository.

Since the hooks run automatically before each commit, you don't need to remember to manually format or check your code, making it easier to maintain consistency.

We strongly encourage all developers to integrate pre-commit into their workflow.

Formatting C++ code

Installing clang-format

If you're using an IRD docker, clang-format should be already available. If you don't have clang-format in your working environment, follow the instructions on llvm website for installing it.

Formatting files

If working with VSCode, you can copy the provided default settings:

cp .vscode/default.settings.json .vscode/settings.json

From now on, c++ files will be formatted on save (given that clang-format is available).

Note that if you setup pre-commit hook, the files will be automatically formatted when you commit changes. You can also manually auto format the whole repo using mentioned pre-commit:

   pre-commit run --all-files

Bumping the UMD version

There is an automated workflow for creating releases. It is triggered by merging a PR to main which changes the VERSION file.

You can change the VERSION as part of another PR or as an isolated PR. Please also update the CHANGELOG with the exact version you are changeing to.

Once the PR is merged, a draft Release will be created with the generated changelog and artifacts. Please review it and publish it using the tag which exactly matches the version of the release.

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 Distributions

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

tt_umd-0.9.6-cp313-cp313-manylinux_2_28_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

tt_umd-0.9.6-cp313-cp313-manylinux_2_28_aarch64.whl (2.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ ARM64

tt_umd-0.9.6-cp312-cp312-manylinux_2_28_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

tt_umd-0.9.6-cp312-cp312-manylinux_2_28_aarch64.whl (2.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

tt_umd-0.9.6-cp311-cp311-manylinux_2_28_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

tt_umd-0.9.6-cp311-cp311-manylinux_2_28_aarch64.whl (2.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

tt_umd-0.9.6-cp310-cp310-manylinux_2_28_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

tt_umd-0.9.6-cp310-cp310-manylinux_2_28_aarch64.whl (2.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ ARM64

tt_umd-0.9.6-cp39-cp39-manylinux_2_28_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.28+ x86-64

tt_umd-0.9.6-cp39-cp39-manylinux_2_28_aarch64.whl (2.0 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.28+ ARM64

File details

Details for the file tt_umd-0.9.6-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for tt_umd-0.9.6-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 528e797acfe8e65b0b39bd9bc14fa19a1ee85dcc32456444f7ac1139209c4bba
MD5 c435a5d81dbc0b8bd0452facc94fd2ee
BLAKE2b-256 e28f75c894355f543ed2fced1db471c657e3da969aa64ffa13a12a8ec6db4f03

See more details on using hashes here.

Provenance

The following attestation bundles were made for tt_umd-0.9.6-cp313-cp313-manylinux_2_28_x86_64.whl:

Publisher: release.yml on tenstorrent/tt-umd

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

File details

Details for the file tt_umd-0.9.6-cp313-cp313-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for tt_umd-0.9.6-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 aab13a6bbd96244b41fefb6abddc85c0361b0c46fca34b8389eeec3614fd86d3
MD5 ac92b714c3df5945513e3092f4dc460e
BLAKE2b-256 85765c408d53d1127835ed26392432554f4aa9a6c9d7a775a6e2cd6b42437b11

See more details on using hashes here.

Provenance

The following attestation bundles were made for tt_umd-0.9.6-cp313-cp313-manylinux_2_28_aarch64.whl:

Publisher: release.yml on tenstorrent/tt-umd

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

File details

Details for the file tt_umd-0.9.6-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for tt_umd-0.9.6-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 cc7575b69e3286cd3b4386b7f41dadc67452c597e1fec00de58f6245fc8df480
MD5 4e7575ebc2af8dea0d9dd78bd2623f2a
BLAKE2b-256 4e5fde9ec1f5c7f8a6ff70f1d41f1ec0987411ed64333c2dcb198e3de3e93c69

See more details on using hashes here.

Provenance

The following attestation bundles were made for tt_umd-0.9.6-cp312-cp312-manylinux_2_28_x86_64.whl:

Publisher: release.yml on tenstorrent/tt-umd

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

File details

Details for the file tt_umd-0.9.6-cp312-cp312-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for tt_umd-0.9.6-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 6d8f007eeb655348844e57f1ab22f89fb6cc73f81d59870cb92dd7ca15a39593
MD5 573fcede61bac5c897067d9447ea37d0
BLAKE2b-256 fec6dd727fb8fdc7cfd3053dcb3ae34d2908880cc04c504ceb61c61baafebc33

See more details on using hashes here.

Provenance

The following attestation bundles were made for tt_umd-0.9.6-cp312-cp312-manylinux_2_28_aarch64.whl:

Publisher: release.yml on tenstorrent/tt-umd

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

File details

Details for the file tt_umd-0.9.6-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for tt_umd-0.9.6-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a8cfe2962ff472708a93f093703cc144941bcfd4a1fa74245d945d506cbb5209
MD5 7377be8fcdb7e404ad597e697668992d
BLAKE2b-256 45f3ca41ba97d7b4bb6643a9ae07694cfe8e447e19f55f5396e4d2cf51e2e4ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for tt_umd-0.9.6-cp311-cp311-manylinux_2_28_x86_64.whl:

Publisher: release.yml on tenstorrent/tt-umd

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

File details

Details for the file tt_umd-0.9.6-cp311-cp311-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for tt_umd-0.9.6-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 49abbc5db121e5cc58c83eed8ad0c71709c8bcf5a5112b0a583a61373b158718
MD5 97322a9e8d11fbe6df438612c9920b53
BLAKE2b-256 fcdfe65697a7fbd55d5d14318233fc553fa4a48d235c101a91e04de265931217

See more details on using hashes here.

Provenance

The following attestation bundles were made for tt_umd-0.9.6-cp311-cp311-manylinux_2_28_aarch64.whl:

Publisher: release.yml on tenstorrent/tt-umd

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

File details

Details for the file tt_umd-0.9.6-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for tt_umd-0.9.6-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f689c85c39c70a99f91e7e78ebe6e213e9b42df478bcddf8358b5e48ac95ab5f
MD5 4c2d3f993ccf6c3ceef8343f47e79fbc
BLAKE2b-256 4b1f026e9ed74564175f3fe31fc7b826fc52ac0d97ad169e4afd6481e158a15a

See more details on using hashes here.

Provenance

The following attestation bundles were made for tt_umd-0.9.6-cp310-cp310-manylinux_2_28_x86_64.whl:

Publisher: release.yml on tenstorrent/tt-umd

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

File details

Details for the file tt_umd-0.9.6-cp310-cp310-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for tt_umd-0.9.6-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 21231823e6db626df105548e2c482848c702f3a8be4e065723baf1cad42f824d
MD5 ea729facc6883246753d8993e907d9b8
BLAKE2b-256 f83df2e7aecf9214170f1855c21ea48a1db6852886469dc9c1dda0ee56b42c5e

See more details on using hashes here.

Provenance

The following attestation bundles were made for tt_umd-0.9.6-cp310-cp310-manylinux_2_28_aarch64.whl:

Publisher: release.yml on tenstorrent/tt-umd

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

File details

Details for the file tt_umd-0.9.6-cp39-cp39-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for tt_umd-0.9.6-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ec04f8b3107c6a0bb03da6071074aa48a6faddad787702e55b18e76f4f6cf604
MD5 1047537ec774ccc1bf7366f167a831c3
BLAKE2b-256 17c9eb2940034f53b17614ac484a129de378a2e125cbe74dfbab8d0ff74adca3

See more details on using hashes here.

Provenance

The following attestation bundles were made for tt_umd-0.9.6-cp39-cp39-manylinux_2_28_x86_64.whl:

Publisher: release.yml on tenstorrent/tt-umd

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

File details

Details for the file tt_umd-0.9.6-cp39-cp39-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for tt_umd-0.9.6-cp39-cp39-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 92d784a8b5946c0e0a692fb3b3c0e3e454adfba0e332544b6b559d8b7e514f4d
MD5 abc9c946a599c5341434b147dd30bb73
BLAKE2b-256 ba7813c16466ea84dad2862d4edff76aa3bc7b5d0e8f7b2d106f3809b4b66c8c

See more details on using hashes here.

Provenance

The following attestation bundles were made for tt_umd-0.9.6-cp39-cp39-manylinux_2_28_aarch64.whl:

Publisher: release.yml on tenstorrent/tt-umd

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