-
Notifications
You must be signed in to change notification settings - Fork 450
Add claude md #944
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add claude md #944
Conversation
Add Tenstorrent matmul MVP project plan
Add Workstream 1 ticket docs
This reverts commit 98b342d.
Register Tenstorrent target
- Replace placeholder return with NotImplementedError for clearer intent - Add target validation to ensure Tenstorrent target is used - Add comprehensive docstring with Args, Returns, and Raises sections - Update tests to expect NotImplementedError instead of placeholder artifact - Add new test for target validation This addresses PR feedback to make the stub implementation more robust and prevent runtime errors from invalid placeholder returns. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
- Create dedicated CI workflow for Tenstorrent backend validation - Run on pull requests affecting TT backend code - Build TileLang with CUDA backend using TVM submodule - Execute Tenstorrent target registration tests - Include lint and type checking steps - Use NVIDIA PyTorch container for CUDA dependencies This ensures PR changes to the Tenstorrent backend are validated before merging, catching build and test failures early. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
- Remove unused exception variable in test import - Update docstring to clarify stub behavior (validates then raises) - Add explicit unused parameter assignments with explanatory comment - Clarify that Returns section indicates function never returns successfully This addresses Copilot AI review suggestions for code clarity. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
- Split tilelang.utils.target imports onto separate lines - Move TENSTORRENT_TARGET import after determine_target - Group TT-related imports at the end This improves code clarity and makes diffs cleaner when adding new imports in the future. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
- Remove Returns section from stub docstring, clarify in Raises section - Extract target kind extraction logic to get_target_kind() helper function - Add exception message to pytest.skip for better error reporting - Use helper function in both engine/lower.py and tt/lower.py This reduces code duplication and improves error diagnostics. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Add Tenstorrent engine adapter stub
Black formatter requires long lines to be wrapped. Applied black formatting to test_target_registration.py to fix CI lint failure. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Set DEBIAN_FRONTEND=noninteractive and TZ=Etc/UTC to prevent apt-get from prompting for timezone configuration during package installation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Fix black formatting violations
Run format.sh to apply yapf formatting to modified files. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Cache TVM build artifacts based on the TVM submodule commit hash. This significantly reduces CI build time for subsequent runs as long as the TVM submodule hasn't changed. Cache key includes: - TVM submodule commit hash (primary factor) - Runner OS 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Use the project's standard format.sh script instead of individual black and ruff checks. This ensures CI uses the same formatting rules as local development (yapf, ruff, codespell, clang-format). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
CI improvements: Add TVM caching and yapf formatting
Cache pip and apt packages to speed up CI runs: - Lint job: Cache pip packages from requirements-lint.txt - Static analysis: Cache pip packages for mypy - Build job: Cache apt packages and pip packages This reduces dependency installation time on subsequent CI runs. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Document the CI setup including: - Job descriptions (lint, build-and-test, static-analysis) - Container usage rationale - Comprehensive caching strategy - Local testing instructions - Performance characteristics 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Create a requirements file for mypy to ensure consistent pip caching behavior in the static-analysis CI job. This addresses Copilot feedback about missing cache-dependency-path. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Update documentation to reflect the use of requirements-mypy.txt for consistent pip caching in the static-analysis job. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Install test dependencies from requirements-test.txt instead of directly installing pytest and pytest-xdist. This ensures the cache key correctly references an existing requirements file. Addresses Copilot feedback about missing requirements-test.txt. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Add dependency caching to CI
Switch from NVIDIA PyTorch container to plain Ubuntu runner with LLVM backend. This significantly reduces CI setup time since: - We're only running CPU tests (not GPU tests) - Don't need CUDA toolkit or PyTorch dependencies - LLVM backend is sufficient for testing Tenstorrent integration Changes: - Remove NVIDIA container, use ubuntu-latest runner - Build TVM with LLVM instead of CUDA - Update cache key from cuda to llvm - Use setup-python with built-in pip caching - Update documentation to reflect lighter setup GPU/CUDA testing can be added later when needed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Replace incorrect package names: - llvm-dev → llvm - libpolly-dev → removed (not needed) - Add standard build dependencies: libedit-dev, libxml2-dev, zlib1g-dev These are the same dependencies used in the original NVIDIA container setup. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Replace heavy NVIDIA container with lightweight Ubuntu runner
TileLang's setup.py requires either CUDA_HOME or ROCM_HOME to be set, even when building with LLVM. Set a dummy CUDA_HOME=/usr to satisfy this check in the CI environment. This is a workaround until setup.py is updated to support LLVM-only builds without requiring GPU runtime environments. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Fix CI: Set dummy CUDA_HOME for setup.py
Configure setup.py for LLVM-only build: - USE_LLVM=true: Enables LLVM build path in setup.py - CUDA_HOME=/usr: Dummy value to pass initial validation check - WITH_COMMITID=False: Skips nvcc check during version generation This properly configures the LLVM build without requiring actual CUDA. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Fix CI: Disable WITH_COMMITID to skip nvcc check
Add cache hit logging to Tenstorrent CI workflow
* Update Tenstorrent CI workflow: improve caching, update actions, add concurrency and ccache
* Add copilot-instructions.md to customize Copilot code reviews
* Fix inefficient glob pattern in ccache key
Address Copilot feedback: replace expensive `hashFiles('3rdparty/tvm/**', 'tilelang/**')`
with simpler `hashFiles('CMakeLists.txt')`.
Rationale:
- ccache handles file-level caching internally based on content
- Cache key should represent build config, not all source files
- Hashing entire directories with ** is computationally expensive
- CMakeLists.txt changes indicate build config changes that should invalidate cache
- Added -v1 suffix for manual cache invalidation when needed
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
* Fix TVM cache not being saved on job failure
Split cache into separate restore/save steps to ensure TVM build
artifacts are cached even when the job fails. This prevents rebuilding
TVM from scratch on every run.
Changes:
- Use actions/cache/restore@v4 for restoring TVM cache
- Use actions/cache/save@v4 with if: always() for saving TVM cache
- Only save if cache was not hit (prevents duplicate cache errors)
- Remove redundant full build directory cache
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
* Update CI docs to explain cache save-on-failure strategy
* Fix Install TileLang by adding back required env vars
Restore PYPI_BUILD=true and CUDA_HOME=/usr which were accidentally
removed when adding ccache support. These are needed for pip install
to work in LLVM-only environment without nvcc.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
* Fix nvcc check to handle missing CUDA toolkit gracefully
Address Codex feedback: setup.py now checks if nvcc exists before
attempting to run it, preventing FileNotFoundError when CUDA toolkit
is not installed.
Changes:
- Add os.path.exists() check for nvcc before calling get_nvcc_cuda_version()
- If nvcc is missing, skip CUDA version detection instead of crashing
- Remove workaround env vars (PYPI_BUILD, dummy CUDA_HOME) from CI
- Simplify Install TileLang step to only set USE_LLVM=true
This allows pip install to work in LLVM-only environments without
requiring CUDA toolkit or environment variable workarounds.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
* Update CI docs to explain nvcc check fix
* Address remaining Copilot feedback on PR #13
Fix two remaining issues identified by Copilot code review:
1. Improve ccache error handling:
- Check if ccache is available before running it
- Provide clear message when ccache is not found
- Avoid hiding legitimate errors with || true
2. Fix boolean comparison in cache condition:
- Change != 'true' to != true (without quotes)
- GitHub Actions outputs are boolean values, not strings
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
* Allow LLVM-only builds without CUDA/ROCM validation
Fix setup.py to skip CUDA_HOME validation when USE_LLVM=true.
The early validation at line 68-70 was requiring CUDA_HOME even for
LLVM-only builds, causing pip install to fail in CI.
Changes:
- Wrap CUDA/ROCM validation checks in `if not USE_LLVM:` condition
- Allow setup.py to proceed when only USE_LLVM=true is set
- Maintains strict validation for CUDA/ROCM builds
This allows LLVM-only CI builds to complete without CUDA toolkit.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
* Apply yapf formatting to setup.py
* Use system llvm-config when available instead of downloading LLVM
Fix pip install failure by preferring system llvm-config over downloading
LLVM 10.0.1. The downloaded LLVM requires libtinfo.so.5 which isn't
available on Ubuntu 24.04.
Changes:
- Check for system llvm-config using shutil.which()
- Use system LLVM if llvm-config is found in PATH
- Fall back to downloading LLVM if system version not available
- Prevents "libtinfo.so.5: cannot open shared object file" error
This allows pip install to work with system LLVM packages installed via apt.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
* Fix TVM cache paths to include subdirectories
Cache paths were missing subdirectories where .so files are actually built.
Updated to cache:
- build/tvm/ (contains libtvm*.so files)
- build/libtilelang*.so (tilelang shared libraries)
- build/3rdparty/ (TVM dependencies)
This fixes the "Path(s) specified in the action for caching do(es) not exist"
warning and ensures TVM artifacts are properly cached for subsequent runs.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
* Install TVM Python package before running tests
Tests were skipped because TVM module wasn't importable. The TVM C++
libraries were built but the Python bindings weren't installed.
Changes:
- Install TVM Python package from 3rdparty/tvm/python before installing TileLang
- This makes `import tvm` work in tests
- Fixes "collected 0 items / 1 skipped" test failure
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
* Set TVM_LIBRARY_PATH for TVM Python install
TVM Python setup.py needs to find libtvm.so and libtvm_runtime.so
which are in build/tvm/ directory. Set TVM_LIBRARY_PATH environment
variable to tell TVM where to find these libraries.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
* Set LD_LIBRARY_PATH for test runs to find TVM libraries
Tests were failing to import TVM because libtvm.so was not in the
library search path. Set LD_LIBRARY_PATH to include build/tvm directory
where the TVM libraries are located.
This fixes the RuntimeError: Cannot find libraries error during test collection.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
---------
Co-authored-by: Claude <[email protected]>
* Update CI documentation with implementation details Document all the key implementation decisions and final approach: - ccache integration for faster compilation - System LLVM usage (avoids libtinfo.so.5 issues) - TVM Python package installation with TVM_LIBRARY_PATH - LD_LIBRARY_PATH setup for test runtime - Cache split strategy (restore/save with if: always()) - Updated performance metrics based on actual runs - Added Key Design Decisions section 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * Update docs/tenstorrent/CI.md Co-authored-by: Copilot <[email protected]> * Update docs/tenstorrent/CI.md Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Claude <[email protected]> Co-authored-by: Copilot <[email protected]>
This file provides comprehensive guidance to Claude Code when working with the TileLang repository, including: - Build commands for different backends (CUDA, ROCm, LLVM) - Test execution instructions - Code architecture overview focusing on Tenstorrent backend - Development workflow and CI/CD information - Key technical details about the grid-to-persistent mapping 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
|
👋 Hi! Thank you for contributing to the TileLang project. Please remember to run We appreciate you taking this step! Our team will review your contribution, and we look forward to your awesome work! 🚀 |
|
Caution Review failedThe pull request is closed. WalkthroughAdds Tenstorrent backend scaffolding (target registration, lowering entry, exports, tests), introduces a new CI workflow (lint, build/test, static analysis), updates setup.py for LLVM-first builds, and substantially expands documentation (README and Tenstorrent guides). Includes mypy tooling and a Copilot review guide. No functional TT lowering yet; stub raises NotImplementedError. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant User
participant Engine as tilelang.engine.lower
participant TT as tilelang.engine.tt.lower
Note over User,Engine: Lowering entry
User->>Engine: lower(mod, params, target, ...)
Engine->>Engine: get_target_kind(target)
alt target == "tenstorrent"
Engine->>TT: lower(mod, params, target, ...)
TT-->>Engine: NotImplementedError (stub)
Engine-->>User: Propagate error
else Non-TT targets
Engine->>Engine: Standard lowering pipeline
Engine-->>User: CompiledArtifact
end
sequenceDiagram
autonumber
participant GH as GitHub
participant Lint as Job: lint-and-format
participant Build as Job: build-and-test
participant SA as Job: static-analysis
GH-->>Lint: Trigger (PR/Push paths)
GH-->>Build: Trigger (PR/Push paths)
GH-->>SA: Trigger (PR/Push paths)
Note over Lint: Checkout → Setup Py 3.10 → Install lint reqs → format.sh --check
Note over Build: Checkout → Setup Py + caches → ccache/TVM cache → CMake build (LLVM) → Install → Tests → Save cache
Note over SA: Checkout → Setup Py → Install mypy → Type check (ignore missing imports)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
Poem
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (22)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary by CodeRabbit
New Features
Documentation
CI
Tests
Chores