Unverified Commit eb026b79 authored by Lei Wang's avatar Lei Wang Committed by GitHub
Browse files

[CI] Update CI workflow to use Python 3.12 (#679)

* Update CI workflow to use Python 3.12 and enable build isolation for pip installations

- Changed the Python version in the CI configuration from 3.9 to 3.12 to ensure compatibility with the latest features and improvements.
- Updated the `PIP_NO_BUILD_ISOLATION` environment variable from `0` to `1` in the CI configuration, allowing pip to install testing requirements with build isolation enabled, which enhances the installation process during CI runs.

* Update CI workflow to trigger on pull requests instead of pull_request_target

- Changed the event trigger in the CI configuration from `pull_request_target` to `pull_request` to ensure the workflow runs on pull requests, enhancing the integration process.

* Refactor CI workflow to remove unnecessary repository and token settings

- Removed the repository and token parameters from the checkout step in the CI configuration, simplifying the workflow setup and improving security by not exposing sensitive information.

* Remove pip install command from CI workflow to streamline installation process

* Refactor reshape functions and tests for shared memory operations

- Renamed and updated `reshape_test_smem` to `reshape_test_smem_1d_2_2d` and `run_reshape_smem` to `run_reshape_smem_1d_2_2d` for clarity.
- Introduced a new reshape function `reshape_test_smem_2d_2_1d` and its corresponding runner `run_reshape_smem_2d_2_1d`.
- Updated tests to reflect the new function names and added a test for the 2D to 1D reshape functionality, enhancing test coverage and clarity.
parent ca1138c3
name: CI name: CI
on: [pull_request_target] on: [pull_request]
env: env:
PYTHON_VERSION: '3.9' PYTHON_VERSION: '3.12'
VENV_DIR: tilelang_ci VENV_DIR: tilelang_ci
jobs: jobs:
...@@ -17,9 +17,6 @@ jobs: ...@@ -17,9 +17,6 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
token: ${{ secrets.PAT }}
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v2 uses: actions/setup-python@v2
...@@ -42,8 +39,7 @@ jobs: ...@@ -42,8 +39,7 @@ jobs:
source "${{ runner.tool_cache }}/${{ env.VENV_DIR }}/bin/activate" source "${{ runner.tool_cache }}/${{ env.VENV_DIR }}/bin/activate"
python -m pip install --upgrade pip --no-user python -m pip install --upgrade pip --no-user
[[ -f requirements-test.txt ]] && \ [[ -f requirements-test.txt ]] && \
PIP_NO_BUILD_ISOLATION=0 pip install -r requirements-test.txt --no-user PIP_NO_BUILD_ISOLATION=1 pip install -r requirements-test.txt --no-user
pip install . --no-user
touch "$MARKER" touch "$MARKER"
fi fi
...@@ -97,7 +93,7 @@ jobs: ...@@ -97,7 +93,7 @@ jobs:
source "${{ runner.tool_cache }}/${{ env.VENV_DIR }}/bin/activate" source "${{ runner.tool_cache }}/${{ env.VENV_DIR }}/bin/activate"
python -m pip install --upgrade pip --no-user python -m pip install --upgrade pip --no-user
[[ -f requirements-test.txt ]] && \ [[ -f requirements-test.txt ]] && \
PIP_NO_BUILD_ISOLATION=0 pip install -r requirements-test.txt --no-user PIP_NO_BUILD_ISOLATION=1 pip install -r requirements-test.txt --no-user
pip install . --no-user pip install . --no-user
touch "$MARKER" touch "$MARKER"
fi fi
......
...@@ -35,7 +35,7 @@ def test_reshape_smem(): ...@@ -35,7 +35,7 @@ def test_reshape_smem():
run_reshape(2048, 64, "float16") run_reshape(2048, 64, "float16")
def reshape_test_smem(N, M, dtype): def reshape_test_smem_1d_2_2d(N, M, dtype):
import tilelang.language as T import tilelang.language as T
@T.prim_func @T.prim_func
...@@ -45,19 +45,17 @@ def reshape_test_smem(N, M, dtype): ...@@ -45,19 +45,17 @@ def reshape_test_smem(N, M, dtype):
): ):
with T.Kernel(1) as _: with T.Kernel(1) as _:
A_shared = T.alloc_shared((N,), dtype) A_shared = T.alloc_shared((N,), dtype)
for i in range(N): for i in T.Parallel(N):
A_shared[i] = A[i] A_shared[i] = A[i]
A_smem_reshaped = T.reshape(A_shared, [N // M, M]) A_smem_reshaped = T.reshape(A_shared, [N // M, M])
for i in range(N // M): T.copy(A_smem_reshaped, B)
for j in range(M):
B[i, j] = A_smem_reshaped[i, j]
return main return main
def run_reshape_smem(N, M, dtype): def run_reshape_smem_1d_2_2d(N, M, dtype):
program = reshape_test_smem(N, M, dtype) program = reshape_test_smem_1d_2_2d(N, M, dtype)
jit_kernel = tl.compile(program, out_idx=-1) jit_kernel = tl.compile(program, out_idx=-1)
profiler = jit_kernel.get_profiler() profiler = jit_kernel.get_profiler()
...@@ -67,9 +65,43 @@ def run_reshape_smem(N, M, dtype): ...@@ -67,9 +65,43 @@ def run_reshape_smem(N, M, dtype):
profiler.assert_allclose(ref_program, atol=1e-2, rtol=1e-2) profiler.assert_allclose(ref_program, atol=1e-2, rtol=1e-2)
def test_reshape_smem_shared(): def test_reshape_smem_1d_2_2d():
run_reshape_smem(1024, 32, "float32") run_reshape_smem_1d_2_2d(1024, 32, "float32")
run_reshape_smem(2048, 64, "float16") run_reshape_smem_1d_2_2d(2048, 64, "float16")
def reshape_test_smem_2d_2_1d(N, M, dtype):
import tilelang.language as T
@T.prim_func
def main(
A: T.Tensor((N // M, M), dtype),
B: T.Tensor((N,), dtype),
):
with T.Kernel(1) as _:
A_shared = T.alloc_shared((N // M, M), dtype)
for i, j in T.Parallel(N // M, M):
A_shared[i, j] = A[i, j]
A_smem_reshaped = T.reshape(A_shared, [N])
T.copy(A_smem_reshaped, B)
return main
def run_reshape_smem_2d_2_1d(N, M, dtype):
program = reshape_test_smem_2d_2_1d(N, M, dtype)
jit_kernel = tl.compile(program, out_idx=-1)
profiler = jit_kernel.get_profiler()
def ref_program(A):
return A.reshape(N)
profiler.assert_allclose(ref_program, atol=1e-2, rtol=1e-2)
def test_reshape_smem_2d_2_1d():
run_reshape_smem_2d_2_1d(1024, 32, "float32")
run_reshape_smem_2d_2_1d(2048, 64, "float16")
if __name__ == "__main__": if __name__ == "__main__":
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment