Skip to content

Commit 283de2e

Browse files
committed
[Compat] Compat with PaddlePaddle
add dist workflow remove if fix ci skip test after build wheel only trigger when tag skip test in sdist fix artifact name rename project name to tilelang-paddle update README.md update dtype literals release v0.1.7.dev1 [CI] Add unittest workflow for PaddlePaddle (#1)
1 parent 74da369 commit 283de2e

File tree

11 files changed

+466
-20
lines changed

11 files changed

+466
-20
lines changed

.github/workflows/ci-paddle.yml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: CI Paddle
2+
on:
3+
push:
4+
branches: [paddle]
5+
tags: ["v*"]
6+
pull_request:
7+
merge_group:
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
concurrency:
14+
group: "${{ github.workflow }}-${{ github.ref }}"
15+
cancel-in-progress: true
16+
17+
jobs:
18+
test:
19+
name: Test
20+
runs-on:
21+
group: H20
22+
timeout-minutes: 30
23+
env:
24+
container_name: tilelang-paddle-test-${{ github.run_id }}
25+
steps:
26+
- name: Check docker image and run container
27+
env:
28+
FLAGS_fraction_of_gpu_memory_to_use: 0.15
29+
CTEST_PARALLEL_LEVEL: 2
30+
WITH_GPU: "ON"
31+
CUDA_ARCH_NAME: Hopper
32+
WITH_AVX: "ON"
33+
PY_VERSION: "3.10"
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
no_proxy: "bcebos.com,apiin.im.baidu.com,gitee.com,aliyun.com,.baidu.com,.tuna.tsinghua.edu.cn"
36+
run: |
37+
docker_image=ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddle:cuda129-coverage-test
38+
docker run -d -t --gpus all --name ${{ env.container_name }} \
39+
-v "/dev/shm:/dev/shm" \
40+
-v ${{ github.workspace }}/../../..:${{ github.workspace }}/../../.. \
41+
-v ${{ github.workspace }}:/workspace \
42+
-e FLAGS_fraction_of_gpu_memory_to_use \
43+
-e CTEST_PARALLEL_LEVEL \
44+
-e WITH_GPU \
45+
-e CUDA_ARCH_NAME \
46+
-e WITH_AVX \
47+
-e PY_VERSION \
48+
-e GITHUB_TOKEN \
49+
-e no_proxy \
50+
-w /workspace \
51+
--network host \
52+
${docker_image}
53+
54+
- name: Checkout repository
55+
run: |
56+
docker exec -t ${{ env.container_name }} /bin/bash -c '
57+
set -e
58+
source ${{ github.workspace }}/../../../proxy
59+
git config --global --add safe.directory "*"
60+
# Clean workspace
61+
find . -maxdepth 1 ! -name "." -exec rm -rf {} +
62+
# Checkout
63+
git init
64+
git remote add origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
65+
git fetch origin ${{ github.ref }} --depth=1
66+
git checkout FETCH_HEAD
67+
git submodule update --init --recursive
68+
'
69+
70+
- name: Install dependencies
71+
run: |
72+
docker exec -t ${{ env.container_name }} /bin/bash -c '
73+
set -e
74+
source ${{ github.workspace }}/../../../proxy
75+
76+
# Install uv
77+
curl -LsSf https://astral.sh/uv/install.sh | sh
78+
source $HOME/.local/bin/env
79+
80+
# Create and activate virtual environment
81+
uv venv .venv --seed
82+
source .venv/bin/activate
83+
84+
# Install paddle
85+
uv pip install --pre paddlepaddle-gpu -i https://www.paddlepaddle.org.cn/packages/nightly/cu129/
86+
87+
# Install project and minimal test runner
88+
uv pip install pytest
89+
uv pip install -e .
90+
'
91+
92+
- name: Run tests
93+
run: |
94+
docker exec -t ${{ env.container_name }} /bin/bash -c '
95+
set -e
96+
source .venv/bin/activate
97+
pytest tests_paddle/
98+
'
99+
100+
- name: Terminate and delete the container
101+
if: always()
102+
run: |
103+
set +e
104+
docker stop ${{ env.container_name }}
105+
docker rm ${{ env.container_name }}

.github/workflows/dist-paddle.yml

Lines changed: 227 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
1+
name: Dist Paddle
2+
on:
3+
push:
4+
branches: [paddle]
5+
tags: ["v*"]
6+
pull_request:
7+
merge_group:
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
concurrency:
14+
group: "${{ github.workflow }}-${{ github.ref }}"
15+
cancel-in-progress: true
16+
17+
env:
18+
PYTHONDEVMODE: "1"
19+
PYTHONUNBUFFERED: "1"
20+
COLUMNS: "100"
21+
FORCE_COLOR: "1"
22+
CLICOLOR_FORCE: "1"
23+
24+
jobs:
25+
build-sdist:
26+
name: Build SDist
27+
runs-on: macos-latest
28+
timeout-minutes: 30
29+
env:
30+
# `NO_VERSION_LABEL=ON` disables embedding the toolchain / git commit hash in version metadata.
31+
# Otherwise, the version of the SDist has a git hash suffix (e.g., 0.1.0+gitabcdef12),
32+
# but the package built from the SDist has no way to get the git hash (it is not a git repo),
33+
# leading to inconsistent versions between SDist and built packages (+gitabcdef12 vs. +gitunknown).
34+
NO_VERSION_LABEL: "ON"
35+
36+
steps:
37+
- name: Checkout repository
38+
uses: actions/checkout@v5
39+
with:
40+
fetch-depth: 1
41+
submodules: recursive
42+
43+
- name: Setup Python and uv with caching
44+
id: setup-uv
45+
uses: astral-sh/setup-uv@v7
46+
with:
47+
python-version: "3.12"
48+
activate-environment: true
49+
50+
- name: Build SDist
51+
run: |
52+
uv run --no-project --with=build -m -- build --sdist --outdir=dist
53+
54+
- name: Setup ccache
55+
uses: hendrikmuhs/ccache-action@v1
56+
with:
57+
create-symlink: true
58+
evict-old-files: "7d"
59+
append-timestamp: false
60+
key: sdist-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/*.cc') }}
61+
restore-keys: |
62+
sdist-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/*.cc') }}
63+
sdist-${{ runner.os }}-${{ runner.arch }}
64+
${{ runner.os }}-${{ runner.arch }}
65+
66+
- name: Test SDist buildable
67+
run: |
68+
TEMP_DIR="$(mktemp -d -t tilelang-sdist-test)"
69+
cp -r dist "${TEMP_DIR}/dist"
70+
cd "${TEMP_DIR}"
71+
uv pip install -v dist/*.tar.gz
72+
# python3 -c "import tilelang; print(tilelang.__version__)"
73+
74+
- name: Upload SDist
75+
# Not PR to save artifact storage, as SDist is only needed for releases.
76+
uses: actions/upload-artifact@v5
77+
with:
78+
name: sdist
79+
path: dist/*.tar.gz
80+
if-no-files-found: error
81+
82+
build-wheels:
83+
name: Build wheels for Python ${{ matrix.python-version }} on ${{ matrix.target.runner }} with ${{ matrix.target.toolkit }}
84+
strategy:
85+
matrix:
86+
target:
87+
- { runner: ubuntu-latest, toolkit: "CUDA-12.1" }
88+
- { runner: ubuntu-24.04-arm, toolkit: "CUDA-12.8" }
89+
- { runner: macos-latest, toolkit: "Metal" }
90+
python-version:
91+
# Wheels are built with Python 3.8 Limited API, they should work with all Python >= 3.8.
92+
# Only build wheels against Python 3.8 Limited API to save CI resources.
93+
# FIXME: Here we use Python 3.9 because our dependency `apache-tvm-ffi` claims to support
94+
# Python 3.8 but it depends on a version of `ml-dtypes` that requires Python >= 3.9.
95+
- "3.9"
96+
fail-fast: false
97+
timeout-minutes: 120
98+
runs-on: ${{ matrix.target.runner }}
99+
env:
100+
NO_VERSION_LABEL: ${{ github.event_name == 'release' && 'OFF' || 'ON' }}
101+
102+
steps:
103+
- name: Checkout repository
104+
uses: actions/checkout@v5
105+
with:
106+
fetch-depth: 1
107+
submodules: recursive
108+
109+
- name: Setup ccache
110+
uses: hendrikmuhs/ccache-action@v1
111+
with:
112+
create-symlink: true
113+
evict-old-files: "7d"
114+
append-timestamp: false
115+
key: wheel-${{ runner.os }}-${{ runner.arch }}-${{ matrix.target.toolkit }}-${{ hashFiles('**/*.cc') }}
116+
restore-keys: |
117+
wheel-${{ runner.os }}-${{ runner.arch }}-${{ matrix.target.toolkit }}-${{ hashFiles('**/*.cc') }}
118+
wheel-${{ runner.os }}-${{ runner.arch }}-${{ matrix.target.toolkit }}
119+
wheel-${{ runner.os }}-${{ runner.arch }}
120+
${{ runner.os }}-${{ runner.arch }}-${{ matrix.target.toolkit }}
121+
${{ runner.os }}-${{ runner.arch }}
122+
123+
- name: Set CIBW_BUILD
124+
run: |
125+
PYTHON_VERSION="${{ matrix.python-version }}"
126+
PYTHON_VERSION_MAJMIN="$(echo "${PYTHON_VERSION}" | cut -d '.' -f-2)"
127+
PYTHON_VERSION_MAJMIN_NODOT="${PYTHON_VERSION_MAJMIN//./}"
128+
echo "CIBW_BUILD=cp${PYTHON_VERSION_MAJMIN_NODOT}-*" | tee -a "${GITHUB_ENV}"
129+
130+
if [[ "${{ matrix.target.toolkit }}" == *"CUDA"* ]]; then
131+
CUDA_VERSION="${{ matrix.target.toolkit }}"
132+
CUDA_VERSION="${CUDA_VERSION#CUDA-}"
133+
echo "CUDA_VERSION=${CUDA_VERSION}" | tee -a "${GITHUB_ENV}"
134+
fi
135+
136+
if [[ "${{ runner.os }}" == "Linux" ]]; then
137+
HOST_CCACHE_DIR="$(ccache --get-config cache_dir)"
138+
echo "CIBW_BEFORE_BUILD_LINUX=yum install -y ccache && ccache -o cache_dir=/host${HOST_CCACHE_DIR}" | tee -a "${GITHUB_ENV}"
139+
fi
140+
141+
- name: Build wheels
142+
uses: pypa/[email protected]
143+
with:
144+
package-dir: .
145+
output-dir: wheelhouse
146+
config-file: "{package}/pyproject.toml"
147+
148+
- name: Upload wheels
149+
# Not PR to save artifact storage, as wheels are only needed for releases.
150+
uses: actions/upload-artifact@v5
151+
with:
152+
name: wheels-${{ matrix.python-version }}-${{ runner.os }}-${{ runner.arch }}-${{ matrix.target.toolkit }}
153+
path: wheelhouse/*.whl
154+
if-no-files-found: error
155+
156+
list-artifacts:
157+
name: List artifacts
158+
# Not PR to save artifact storage, as artifacts are only needed for releases.
159+
runs-on: ubuntu-latest
160+
needs: [build-sdist, build-wheels]
161+
timeout-minutes: 15
162+
steps:
163+
- name: Download built SDist
164+
uses: actions/download-artifact@v6
165+
with:
166+
# unpacks default artifact into dist/
167+
# if `name: artifact` is omitted, the action will create extra parent dir
168+
name: sdist
169+
path: dist
170+
171+
- name: Download built wheels
172+
uses: actions/download-artifact@v6
173+
with:
174+
pattern: wheels-*
175+
path: dist
176+
merge-multiple: true
177+
178+
- name: List distributions
179+
run: ls -lh dist/*
180+
181+
- name: Upload artifacts
182+
uses: actions/upload-artifact@v5
183+
with:
184+
name: artifacts
185+
path: dist/*
186+
if-no-files-found: error
187+
188+
publish-pypi:
189+
runs-on: ubuntu-latest
190+
name: Publish to PyPI
191+
if: "startsWith(github.ref, 'refs/tags/')"
192+
needs:
193+
- list-artifacts
194+
permissions:
195+
id-token: write
196+
197+
steps:
198+
- name: Retrieve release distributions
199+
uses: actions/download-artifact@v6
200+
with:
201+
name: artifacts
202+
path: dist/
203+
204+
- name: Publish release distributions to PyPI
205+
uses: pypa/gh-action-pypi-publish@release/v1
206+
207+
publish-release:
208+
runs-on: ubuntu-latest
209+
name: Publish to GitHub
210+
if: "startsWith(github.ref, 'refs/tags/')"
211+
needs:
212+
- list-artifacts
213+
permissions:
214+
contents: write
215+
steps:
216+
- uses: actions/download-artifact@v6
217+
with:
218+
name: artifacts
219+
path: dist/
220+
- name: Get tag name
221+
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
222+
- name: Publish to GitHub
223+
uses: softprops/action-gh-release@v2
224+
with:
225+
draft: true
226+
files: dist/*
227+
tag_name: ${{ env.RELEASE_VERSION }}

README.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,36 @@
22

33
<div align="center">
44

5-
# Tile Language
5+
# Tile Language ❤️ PaddlePaddle
6+
67
[![PyPI version](https://badge.fury.io/py/tilelang.svg)](https://badge.fury.io/py/tilelang)
78
[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/tile-ai/tilelang) [![Discord](https://img.shields.io/badge/Discord-%235865F2.svg?logo=discord&logoColor=white)](https://discord.gg/TUrHyJnKPG)
89

910
</div>
1011

12+
> [!NOTE]
13+
>
14+
> This repo is a fork of the original tilelang project, with modifications to enhance compatibility and integration with PaddlePaddle.
15+
>
16+
> **Installation**
17+
>
18+
> ```bash
19+
> pip install tilelang-paddle
20+
> ```
21+
>
22+
> **Usage**
23+
>
24+
> ```python
25+
> import paddle
26+
> paddle.compat.enable_torch_proxy() # Enable torch proxy before importing tilelang
27+
> import tilelang
28+
> # use tilelang
29+
> ```
30+
31+
The original README.md content is as follows:
32+
33+
---
34+
1135
Tile Language (**tile-lang**) is a concise domain-specific language designed to streamline the development of high-performance GPU/CPU kernels (e.g., GEMM, Dequant GEMM, FlashAttention, LinearAttention). By employing a Pythonic syntax with an underlying compiler infrastructure on top of [TVM](https://tvm.apache.org/), tile-lang allows developers to focus on productivity without sacrificing the low-level optimizations necessary for state-of-the-art performance.
1236
1337
<img src=./images/MatmulExample.png />

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.6.post2
1+
0.1.7.dev1

0 commit comments

Comments
 (0)