mirror of
https://github.com/tile-ai/tilelang.git
synced 2026-10-24 07:04:00 +08:00
* [Refactor] Update FFI type handling and simplify argument management * Refactored FFI type definitions in runtime and code generation files to use `TVMFFIAny` instead of `TVMValue`, enhancing type clarity. * Updated function registration in `runtime.cc` to utilize canonical names for better consistency. * Simplified argument handling in the `simplify` transformation, ensuring unused buffer parameters are removed only when simplification is enabled. * Adjusted autotuner and profiler parameters to standardize the execution backend to `tvm_ffi`, improving clarity in backend selection. * Removed obsolete `adapt_torch2tvm` function from tensor utilities to streamline the codebase and reduce complexity. * [Update] Sync TVM submodule and enhance kernel source handling * Updated the TVM submodule to commit cdc2aced, ensuring compatibility with recent changes. * Added functionality to print kernel source in `example_blocksparse_gemm.py` for better debugging. * Commented out the main execution call in test files to prevent unintended execution during testing. * Introduced `tilelang.disable_cache()` in various test files to streamline testing and avoid cache-related issues. * Refactored kernel source retrieval methods to improve clarity and consistency across different execution backends. * [Refactor] Clean up imports and improve code formatting * Removed unused import of `tilelang.testing` in `test_example_blocksparse_gemm.py` to streamline the code. * Reformatted several lines in `arg_binder.cc`, `make_packed_api.cc`, `tvm_ffi.py`, and `adapter.py` for improved readability and consistency. * Updated comments and spacing in `tvm_ffi.py` to enhance clarity without altering functionality. * Update execution backend options and improve resolution logic - Changed default execution backend from "cython" to "auto" in multiple locations to allow automatic selection based on the target. - Expanded the list of supported execution backends to include "torch" and "nvrtc" across various classes and functions. - Enhanced backend resolution logic in `KernelCache` and `AutoTuner` to ensure appropriate backend selection based on the target. - Updated documentation to reflect changes in execution backend options and their defaults. * lint fix * fix * Enhance argument handling in CUDA and HIP runtime modules - Updated `ExtractFuncInfo` in `rt_mod_cuda.cc` and `rt_mod_hip.cc` to map boolean argument types to int32, ensuring compatibility with device runtime. - Refactored `BindDLTensor` in `arg_binder.cc` to improve null handling and validation checks for DLTensor parameters, utilizing expression-level guards to prevent dereferencing null pointers. - Enhanced error checking for buffer shape, strides, and data fields, ensuring robust handling of optional inputs and maintaining consistency across various checks. * lint fix * lint fix * lint fix * lint fix * minor fix * fix * recover check * Refactor argument binding and validation in `arg_binder.cc` - Improved null handling and validation checks in `BindDLTensor`, ensuring safe dereferencing of pointers. - Enhanced consistency checks for buffer shape, strides, and data fields, utilizing expression-level guards. - Updated `MakePackedAPI` to maintain code clarity and consistency in argument handling. - Minor adjustments in test files to streamline kernel execution and improve readability. * lint fix * stride fix * minor fix * fix * lint fix * lint fix * Add CUDA stream access policy window helpers and integrate with L2 persistent cache management - Introduced functions to set and reset the CUDA stream access policy window, allowing for better control over L2 cache usage. - Updated runtime files to include new FFI packed functions for managing stream attributes. - Modified lower_hopper_intrin to incorporate prologue and epilogue statements for L2 cache setup and teardown. - Enhanced tests to verify the inclusion of new FFI calls in the generated kernel source. * check with symbolic * support null ptr * Update CMakeLists and lower.py for code generation and subproject status - Added `codegen_c_host.cc` to the list of source files in CMakeLists.txt for improved code generation support. - Updated the function call in `lower.py` to use `target.build.tilelang_c` for C target host code generation, enhancing compatibility. - Marked the TVM subproject as dirty to indicate local modifications. * lint fix * Update comments for clarity in quickstart.py
262 lines
7.1 KiB
TOML
262 lines
7.1 KiB
TOML
[project]
|
|
name = "tilelang"
|
|
description = "A tile level programming language to generate high performance code."
|
|
readme = "README.md"
|
|
requires-python = ">=3.9"
|
|
authors = [{ name = "TileLang Contributors" }, { name = "Tile-AI" }]
|
|
maintainers = [{ name = "Lei Wang", email = "leiwang1999@outlook.com" }]
|
|
license = "MIT"
|
|
keywords = ["BLAS", "CUDA", "HIP", "Code Generation", "TVM"]
|
|
classifiers = [
|
|
"Development Status :: 4 - Beta",
|
|
"Environment :: GPU",
|
|
"Operating System :: POSIX :: Linux",
|
|
"Operating System :: MacOS",
|
|
"Programming Language :: C++",
|
|
"Programming Language :: Python :: 3",
|
|
"Programming Language :: Python :: 3.9",
|
|
"Programming Language :: Python :: 3.10",
|
|
"Programming Language :: Python :: 3.11",
|
|
"Programming Language :: Python :: 3.12",
|
|
"Programming Language :: Python :: 3.13",
|
|
"Programming Language :: Python :: 3.14",
|
|
"Programming Language :: Python :: Implementation :: CPython",
|
|
"Intended Audience :: Developers",
|
|
"Intended Audience :: Science/Research",
|
|
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
]
|
|
dynamic = ["version"]
|
|
dependencies = [
|
|
"apache-tvm-ffi==0.1.0",
|
|
"cloudpickle",
|
|
"ml-dtypes",
|
|
"numpy>=1.23.5",
|
|
"psutil",
|
|
"torch",
|
|
"torch>=2.7; platform_system == 'Darwin'",
|
|
"tqdm>=4.62.3",
|
|
"typing-extensions>=4.10.0",
|
|
]
|
|
|
|
[project.optional-dependencies]
|
|
# mldtypes should be greater than 0.5.1
|
|
# if you want to enable fp4
|
|
fp4 = ["ml-dtypes>=0.5.1"]
|
|
|
|
[build-system]
|
|
requires = ["cython>=3.0.0", "scikit-build-core"]
|
|
build-backend = "scikit_build_core.build"
|
|
|
|
[tool.scikit-build]
|
|
wheel.py-api = "cp38"
|
|
cmake.version = ">=3.26.1"
|
|
build-dir = "build"
|
|
|
|
# editable.rebuild = true
|
|
|
|
# Include backend and git info in version
|
|
metadata.version.provider = "version_provider"
|
|
metadata.version.provider-path = "."
|
|
experimental = true
|
|
|
|
# build.verbose = true
|
|
# logging.level = "DEBUG"
|
|
|
|
[tool.scikit-build.sdist]
|
|
include = [
|
|
"./VERSION",
|
|
".git_commit.txt",
|
|
"./LICENSE",
|
|
"THIRDPARTYNOTICES.txt",
|
|
"version_provider.py",
|
|
"requirements*.txt",
|
|
"tilelang/jit/adapter/cython/cython_wrapper.pyx",
|
|
"CMakeLists.txt",
|
|
"src/**",
|
|
"cmake/**",
|
|
# The vendored 3rdparty contents in sdist should be same as wheel.
|
|
# Need full TVM to build from source.
|
|
"3rdparty/tvm",
|
|
# CUTLASS
|
|
"3rdparty/cutlass/include",
|
|
"3rdparty/cutlass/tools",
|
|
# Composable Kernel
|
|
"3rdparty/composable_kernel/include",
|
|
"3rdparty/composable_kernel/library",
|
|
"testing/**",
|
|
"examples/**",
|
|
]
|
|
exclude = [
|
|
".git",
|
|
".github",
|
|
"**/.git",
|
|
"**/.github",
|
|
"3rdparty/**",
|
|
"build",
|
|
]
|
|
|
|
[tool.scikit-build.wheel.packages]
|
|
tilelang = "tilelang"
|
|
"tilelang/src" = "src"
|
|
# NOTE: The mapping below places the contents of '3rdparty' inside 'tilelang/3rdparty' in the wheel.
|
|
# This is necessary to find TVM shared libraries at runtime.
|
|
# The vendored 3rdparty contents in wheel should be same as sdist.
|
|
# TVM
|
|
"tilelang/3rdparty/tvm/src" = "3rdparty/tvm/src"
|
|
"tilelang/3rdparty/tvm/python" = "3rdparty/tvm/python"
|
|
"tilelang/3rdparty/tvm/include" = "3rdparty/tvm/include"
|
|
"tilelang/3rdparty/tvm/version.py" = "3rdparty/tvm/version.py"
|
|
# CUTLASS
|
|
"tilelang/3rdparty/cutlass/include" = "3rdparty/cutlass/include"
|
|
"tilelang/3rdparty/cutlass/tools" = "3rdparty/cutlass/tools"
|
|
# Composable Kernel
|
|
"tilelang/3rdparty/composable_kernel/include" = "3rdparty/composable_kernel/include"
|
|
"tilelang/3rdparty/composable_kernel/library" = "3rdparty/composable_kernel/library"
|
|
|
|
[tool.yapf]
|
|
based_on_style = "yapf"
|
|
column_limit = 100
|
|
indent_width = 4
|
|
|
|
[tool.codespell]
|
|
ignore-words = "docs/spelling_wordlist.txt"
|
|
skip = [
|
|
"build",
|
|
"3rdparty",
|
|
"dist",
|
|
".venv"
|
|
]
|
|
|
|
[tool.ruff]
|
|
target-version = "py39"
|
|
line-length = 100
|
|
output-format = "full"
|
|
|
|
exclude = [
|
|
"3rdparty",
|
|
"examples/deepseek_v32/inference",
|
|
]
|
|
|
|
[tool.ruff.lint.per-file-ignores]
|
|
# Do not upgrade type hint in testing and examples.
|
|
# See https://github.com/tile-ai/tilelang/issues/1079 for more information.
|
|
"testing/**.py" = ["UP", "FA"]
|
|
"examples/**.py" = ["UP", "FA"]
|
|
|
|
[tool.ruff.lint]
|
|
select = [
|
|
# pycodestyle
|
|
"E", "W",
|
|
# Pyflakes
|
|
"F",
|
|
# pyupgrade
|
|
"UP", "FA",
|
|
# flake8-bugbear
|
|
"B",
|
|
# flake8-simplify
|
|
"SIM",
|
|
# isort
|
|
# "I",
|
|
]
|
|
ignore = [
|
|
# Module level import not at top of file
|
|
"E402",
|
|
# star imports
|
|
"F405", "F403",
|
|
# ambiguous name
|
|
"E741",
|
|
# line too long
|
|
"E501",
|
|
# if-else-block instead of ternary
|
|
"SIM108",
|
|
# key in dict.keys()
|
|
"SIM118",
|
|
# open file w.o. ctx manager
|
|
"SIM115",
|
|
# memory leaks
|
|
"B019",
|
|
# zip without explicit strict
|
|
"B905",
|
|
# No such file or directory
|
|
"E902",
|
|
]
|
|
|
|
[tool.pytest.ini_options]
|
|
verbosity_assertions = 3
|
|
filterwarnings = ["always"]
|
|
|
|
[tool.cibuildwheel]
|
|
archs = ["auto64"]
|
|
skip = "*musllinux*"
|
|
build-frontend = "build"
|
|
environment = { PYTHONDEVMODE = "1", PYTHONUNBUFFERED = "1" }
|
|
environment-pass = [
|
|
"CUDA_VERSION",
|
|
"NO_VERSION_LABEL",
|
|
"NO_TOOLCHAIN_VERSION",
|
|
"NO_GIT_VERSION",
|
|
"COLUMNS",
|
|
"CMAKE_GENERATOR",
|
|
"CMAKE_BUILD_PARALLEL_LEVEL",
|
|
"FORCE_COLOR",
|
|
"CLICOLOR_FORCE",
|
|
]
|
|
before-build = "env -0 | sort -z | tr '\\0' '\\n'"
|
|
windows.before-build = "set"
|
|
test-command = [
|
|
"python -c 'import tilelang; print(tilelang.__version__)'",
|
|
]
|
|
|
|
[tool.cibuildwheel.linux]
|
|
environment.PYTHONDEVMODE = "1"
|
|
environment.PYTHONUNBUFFERED = "1"
|
|
environment.PATH = "/usr/local/cuda/bin:$PATH"
|
|
environment.LD_LIBRARY_PATH = "/usr/local/cuda/lib64:/usr/local/cuda/lib64/stubs:$LD_LIBRARY_PATH"
|
|
# Pin to glibc 2.17 for x86 and 2.28 for aarch64 for now
|
|
# TODO: upgrade to manylinux_2_28 at some time
|
|
manylinux-x86_64-image = "manylinux2014" # CentOS 7
|
|
manylinux-aarch64-image = "manylinux_2_28" # AlmaLinux 8
|
|
# Install CUDA runtime and stub driver library
|
|
# manylinux_2_28 uses gcc 14, which needs CUDA 12.8
|
|
before-all = """
|
|
set -eux
|
|
|
|
cat /etc/*-release
|
|
uname -a
|
|
|
|
case "$(uname -m)" in
|
|
"x86_64")
|
|
DEFAULT_CUDA_VERSION="12.1"
|
|
yum-config-manager --add-repo https://developer.download.nvidia.cn/compute/cuda/repos/rhel7/x86_64/cuda-rhel7.repo
|
|
;;
|
|
"aarch64")
|
|
DEFAULT_CUDA_VERSION="12.8"
|
|
dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel8/sbsa/cuda-rhel8.repo
|
|
;;
|
|
*)
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
cudaver="$(echo "${CUDA_VERSION:-$DEFAULT_CUDA_VERSION}" | cut -d '.' -f-2)"
|
|
v="${cudaver//./-}"
|
|
yum install -y "cuda-minimal-build-${v}" "cuda-driver-devel-${v}" "cuda-nvrtc-devel-${v}" nvidia-driver-cuda-libs
|
|
"""
|
|
repair-wheel-command = [
|
|
"auditwheel -v repair --exclude libtvm_ffi.so --exclude libcuda.so.1 --exclude '/usr/local/cuda*' -w {dest_dir} {wheel}",
|
|
"pipx run abi3audit --verbose --strict {wheel}",
|
|
]
|
|
|
|
[tool.cibuildwheel.macos]
|
|
repair-wheel-command = [
|
|
"delocate-wheel --verbose --ignore-missing-dependencies --no-sanitize-rpaths --require-archs {delocate_archs} -w {dest_dir} -v {wheel}",
|
|
"pipx run abi3audit --verbose --strict {wheel}",
|
|
]
|
|
|
|
[[tool.cibuildwheel.overrides]]
|
|
select = "*linux*x86_64*"
|
|
# CentOS 7 is too old to run import test. Do wheel installation test only.
|
|
test-command = [
|
|
"echo 'Wheel is installed successfully'",
|
|
]
|