Skip to main content

tilelang-devkit

Developer tooling for TileLang.

The package currently ships lower_trace, a pass-by-pass IR tracing tool built on TVM PassInstrument and TileLang's compilation instrumentation interfaces. It records raw before/after IR, prints terminal diffs, and generates a self-contained HTML report without patching TVM globals.

Install

pip install tilelang-devkit

The package has no hard dependencies. Install it into the Python environment that already provides the compatible TileLang/TVM build you want to inspect. Python 3.10 or newer is required.

For development:

git clone https://github.com/easy-tilelang/tilelang-devkit.git
cd tilelang-devkit
pip install -e '.[dev]'

Trace a complete TileLang compilation

Compatible TileLang versions discover the package through the tilelang.instrumentation_tools entry point:

TL_LOWER_TRACE=both python kernel.py

Supported values are terminal, html, and both. The truthy shorthand values 1, true, yes, and on select html; 0, false, no, and off disable tracing.

Reports are written below ./tmp/lower_trace_dir/<script-name>/ by default. Select another base directory with:

TL_LOWER_TRACE=both \
TL_LOWER_TRACE_DIR="$PWD/tmp/lower_trace_dir" \
python kernel.py

The latest report is available as <script-name>/report.html; immutable run data lives under <script-name>/.run_records/run_<timestamp>_<pid>_<id>/. If TileLang serves a cached compilation result, no lowering passes execute and there is nothing new to trace; disable the TileLang kernel cache when you need a fresh compilation trace.

Tracing can also be controlled from Python:

import tilelang_devkit.lower_trace as lt

lt.enable(mode="both", trace_dir="./traces")
# tilelang.compile(...)
lt.disable()

The v0.1 context-manager API remains available and selects terminal mode:

from tilelang_devkit.lower_trace import trace

with trace(trace_dir="./traces"):
    # compile a TileLang kernel
    ...

Trace selected TVM passes

Apply and compare a fixed pass chain:

import tilelang_devkit.lower_trace as lt

results = lt.lower_trace(
    mod,
    [("Simplify", simplify_pass)],
    mode="both",
    html_path="lower-trace.html",
)

Or instrument an existing PassContext:

from tvm.ir.transform import PassContext
import tilelang_devkit.lower_trace as lt

instrument = lt.create_pass_instrument(mode="html", trace_dir="./traces")
with PassContext(instruments=[instrument]):
    with lt.phase("optimization"):
        # run TVM passes
        ...
instrument.finish()

The full manual covers the HTML viewer, raw IR files, host/device source output, and the edit-and-recompile workflow.

Public API

  • lower_trace(...): run and compare selected passes.
  • create_pass_instrument(...): create a standalone TVM pass instrument.
  • phase(name): label records produced by the standalone instrument.
  • enable(...), disable(), reset(): control future TileLang sessions.
  • trace(trace_dir=None): compatibility context manager.
  • LowerRecord: one pass or code-generation record.

Importing tilelang_devkit.lower_trace does not eagerly import TileLang. The TileLang-specific adapter is loaded only when its API or plugin entry point is used.

Releasing (maintainers)

Versions come from Git tags through setuptools-scm; do not edit _version.py. Use v followed by a Python package version; prerelease versions are also supported. Replace <version> below with the actual version number, then run from a clean checkout of the intended release commit:

git tag -a "v<version>" -m "Release <version>"
git push origin "v<version>"

Pushing the tag starts Publish to PyPI. It calls the reusable test workflow on the tagged commit and builds the sdist and wheel in parallel. The build job builds both distributions directly from the Git checkout to retain commit metadata in the wheel. It checks distribution metadata, installs the wheel in an isolated environment, verifies its version, commit metadata, plugin entry point and py.typed, and runs framework-neutral smoke/import tests. Publishing requires both the build checks and the complete test suite (including TileLang integration) to pass. The publish job uploads the same validated artifacts without rebuilding them. Branch pushes and pull requests run tests independently; tag pushes do not start a second standalone test workflow.

Publishing uses PyPI Trusted Publishing with this repository, .github/workflows/workflow.yml, and the GitHub environment pypi. Keep the workflow filename and environment name aligned with the PyPI publisher configuration. Only the publish job receives OIDC token permission.

Inspect Actions → Publish to PyPI for the failing job and logs. A failed or cancelled test/build prevents publishing. For a transient failure before any upload, rerun the failed jobs. If an upload failed, check which files reached PyPI before retrying: an already uploaded file cannot be overwritten, and a partial upload may require manual recovery. For a code or packaging fix, create a new version and tag; do not move a published tag or reuse its version. On each release, confirm tests finished before the upload and verify the resulting PyPI version page. This workflow does not create a GitHub Release.

License

Apache-2.0

Metadata

Release files for tilelang-devkit 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tilelang-devkit 0.2.1
File Size Uploaded Provenance Actions
tilelang_devkit-0.2.1.tar.gz 722.4 kB With provenance Details for tilelang_devkit-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tilelang-devkit 0.2.1
File Interpreter ABI Platform Actions
tilelang_devkit-0.2.1-py3-none-any.whl Python 3 none any Details for tilelang_devkit-0.2.1-py3-none-any.whl

Total release size: 766.4 kB

Release files / tilelang_devkit-0.2.1.tar.gz

Download URL tilelang_devkit-0.2.1.tar.gz
Size 722.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b513f5341fe377b24e3ad801c08775a07ebb5c5107551a5d3f572738c8ad789b
BLAKE2b-256 checksum
How to use checksums
9222e9a50e09a5d5e715c06ad43ec8a4dd5a518c0feed15ce4734b02b27f5328
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Release files / tilelang_devkit-0.2.1-py3-none-any.whl

Download URL tilelang_devkit-0.2.1-py3-none-any.whl
Size 44.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fe1c021ce22fbd58c5af53fac88cd52641aceffff7e56c1df8e84b9c1a877b42
BLAKE2b-256 checksum
How to use checksums
27f1f6b61b29494e7360747b7af7bb32ab5bada40bfdb2e88287d532b5694a15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Security for tilelang-devkit 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for tilelang_devkit-0.2.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page