|
| 1 | +Installation Guide |
| 2 | +================== |
| 3 | + |
| 4 | +Installing with pip |
| 5 | +------------------- |
| 6 | + |
| 7 | +**Prerequisites for installation via wheel or PyPI:** |
| 8 | + |
| 9 | +- **Operating System**: Ubuntu 20.04 or later |
| 10 | + |
| 11 | +- **Python Version**: >= 3.8 |
| 12 | + |
| 13 | +- **CUDA Version**: >= 11.0 |
| 14 | + |
| 15 | +The easiest way to install TileLang is directly from PyPI using pip. To install the latest version, run the following command in your terminal: |
| 16 | + |
| 17 | +.. code:: bash |
| 18 | +
|
| 19 | + pip install tilelang |
| 20 | +
|
| 21 | +Alternatively, you may choose to install TileLang using prebuilt packages available on the Release Page: |
| 22 | + |
| 23 | +.. code:: bash |
| 24 | +
|
| 25 | + pip install tilelang-0.0.0.dev0+ubuntu.20.4.cu120-py3-none-any.whl |
| 26 | +
|
| 27 | +To install the latest version of TileLang from the GitHub repository, you can run the following command: |
| 28 | + |
| 29 | +.. code:: bash |
| 30 | +
|
| 31 | + pip install git+https://github.com/tile-ai/tilelang.git |
| 32 | +
|
| 33 | +After installing TileLang, you can verify the installation by running: |
| 34 | + |
| 35 | +.. code:: bash |
| 36 | +
|
| 37 | + python -c "import tilelang; print(tilelang.__version__)" |
| 38 | +
|
| 39 | +Building from Source |
| 40 | +-------------------- |
| 41 | + |
| 42 | +**Prerequisites for building from source:** |
| 43 | + |
| 44 | +- **Operating System**: Linux |
| 45 | + |
| 46 | +- **Python Version**: >= 3.7 |
| 47 | + |
| 48 | +- **CUDA Version**: >= 10.0 |
| 49 | + |
| 50 | +We recommend using a Docker container with the necessary dependencies to build TileLang from source. You can use the following command to run a Docker container with the required dependencies: |
| 51 | + |
| 52 | +.. code:: bash |
| 53 | +
|
| 54 | + docker run --gpus all -it --rm --ipc=host nvcr.io/nvidia/pytorch:23.01-py3 |
| 55 | +
|
| 56 | +To build and install TileLang directly from source, follow these steps. This process requires certain pre-requisites from Apache TVM, which can be installed on Ubuntu/Debian-based systems using the following commands: |
| 57 | + |
| 58 | +.. code:: bash |
| 59 | +
|
| 60 | + sudo apt-get update |
| 61 | + sudo apt-get install -y python3 python3-dev python3-setuptools gcc libtinfo-dev zlib1g-dev build-essential cmake libedit-dev libxml2-dev |
| 62 | +
|
| 63 | +After installing the prerequisites, you can clone the TileLang repository and install it using pip: |
| 64 | + |
| 65 | +.. code:: bash |
| 66 | +
|
| 67 | + git clone --recursive https://github.com/tile-ai/tilelang.git |
| 68 | + cd TileLang |
| 69 | + pip install . # Please be patient, this may take some time. |
| 70 | +
|
| 71 | +If you want to install TileLang in development mode, you can run the following command: |
| 72 | + |
| 73 | +.. code:: bash |
| 74 | +
|
| 75 | + pip install -e . |
| 76 | +
|
| 77 | +We currently provide three methods to install **TileLang**: |
| 78 | + |
| 79 | +1. Install from Source (using your own TVM installation) |
| 80 | + |
| 81 | +2. Install from Source (using the bundled TVM submodule) |
| 82 | + |
| 83 | +3. Install Using the Provided Script |
| 84 | + |
| 85 | + |
| 86 | +Method 1: Install from Source (Using Your Own TVM Installation) |
| 87 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 88 | + |
| 89 | +If you already have a compatible TVM installation, follow these steps: |
| 90 | + |
| 91 | +1. **Clone the Repository**: |
| 92 | + |
| 93 | + .. code:: bash |
| 94 | +
|
| 95 | + git clone --recursive https://github.com/tile-ai/tilelang |
| 96 | + cd TileLang |
| 97 | +
|
| 98 | + **Note**: Use the `--recursive` flag to include necessary submodules. |
| 99 | + |
| 100 | +2. **Configure Build Options**: |
| 101 | + |
| 102 | + Create a build directory and specify your existing TVM path: |
| 103 | + |
| 104 | + .. code:: bash |
| 105 | +
|
| 106 | + mkdir build |
| 107 | + cd build |
| 108 | + cmake .. -DTVM_PREBUILD_PATH=/your/path/to/tvm/build # e.g., /workspace/tvm/build |
| 109 | + make -j 16 |
| 110 | +
|
| 111 | +3. **Set Environment Variables**: |
| 112 | + |
| 113 | + Update `PYTHONPATH` to include the `tile-lang` Python module: |
| 114 | + |
| 115 | + .. code:: bash |
| 116 | +
|
| 117 | + export PYTHONPATH=/your/path/to/tile-lang/python:$PYTHONPATH |
| 118 | + # TVM_IMPORT_PYTHON_PATH is used by 3rd-party frameworks to import TVM |
| 119 | + export TVM_IMPORT_PYTHON_PATH=/your/path/to/tvm/python |
| 120 | +
|
| 121 | +Method 2: Install from Source (Using the Bundled TVM Submodule) |
| 122 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 123 | + |
| 124 | +If you prefer to use the built-in TVM version, follow these instructions: |
| 125 | + |
| 126 | +1. **Clone the Repository**: |
| 127 | + |
| 128 | + .. code:: bash |
| 129 | +
|
| 130 | + git clone --recursive https://github.com/tile-ai/tilelang |
| 131 | + cd TileLang |
| 132 | +
|
| 133 | + **Note**: Ensure the `--recursive` flag is included to fetch submodules. |
| 134 | + |
| 135 | +2. **Configure Build Options**: |
| 136 | + |
| 137 | + Copy the configuration file and enable the desired backends (e.g., LLVM and CUDA): |
| 138 | + |
| 139 | + .. code:: bash |
| 140 | +
|
| 141 | + mkdir build |
| 142 | + cp 3rdparty/tvm/cmake/config.cmake build |
| 143 | + cd build |
| 144 | + echo "set(USE_LLVM ON)" >> config.cmake |
| 145 | + echo "set(USE_CUDA ON)" >> config.cmake |
| 146 | + # or echo "set(USE_ROCM ON)" >> config.cmake to enable ROCm runtime |
| 147 | + cmake .. |
| 148 | + make -j 16 |
| 149 | +
|
| 150 | + The build outputs (e.g., `libtilelang.so`, `libtvm.so`, `libtvm_runtime.so`) will be generated in the `build` directory. |
| 151 | + |
| 152 | +3. **Set Environment Variables**: |
| 153 | + |
| 154 | + Ensure the `tile-lang` Python package is in your `PYTHONPATH`: |
| 155 | + |
| 156 | + .. code:: bash |
| 157 | +
|
| 158 | + export PYTHONPATH=/your/path/to/TileLang/python:$PYTHONPATH |
| 159 | +
|
| 160 | +Method 3: Install Using the Provided Script |
| 161 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 162 | + |
| 163 | +For a simplified installation, use the provided script: |
| 164 | + |
| 165 | +1. **Clone the Repository**: |
| 166 | + |
| 167 | + .. code:: bash |
| 168 | +
|
| 169 | + git clone --recursive https://github.com/tile-ai/tilelang |
| 170 | + cd TileLang |
| 171 | +
|
| 172 | +2. **Run the Installation Script**: |
| 173 | + |
| 174 | + .. code:: bash |
| 175 | +
|
| 176 | + bash install.sh |
| 177 | + # or bash `install_amd.sh` if you want to enable ROCm runtime |
0 commit comments