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

[Refactor] Refactor some build related configurations (#827)

* bugfix

* [Build] Update build dependencies and Dockerfile configuration

- Updated `pyproject.toml` and `requirements-build.txt` to specify Cython version as `Cython>=3.0.0`.
- Removed unnecessary dependencies from the build system.
- Enhanced `pypi.Dockerfile` to install gcc-9 and g++-9, and added ninja-build for improved build performance.
- Updated conda environment creation to include Python 3.9 to 3.12, while removing the Python 3.8 environment.

* cmake fix

* fix

* fix
parent 2f7dc52e
......@@ -5,6 +5,13 @@ cmake_minimum_required(VERSION 3.18)
project(TILE_LANG C CXX)
option(TILE_LANG_STATIC_STDCPP "Statically link libstdc++ for TileLang libraries" ON)
option(TILE_LANG_INSTALL_STATIC_LIB "Install the static library" ON)
if(TILE_LANG_STATIC_STDCPP)
message(STATUS "Enabling static linking of C++ standard library")
# Note: We'll apply static linking flags selectively to avoid Python extension conflicts
# The flags will be applied per-target below rather than globally
endif()
# Set default build type to Release if not provided
if(NOT CMAKE_BUILD_TYPE)
......@@ -63,18 +70,6 @@ if(TILE_LANG_INSTALL_STATIC_LIB)
set(BUILD_STATIC_RUNTIME ON)
endif()
if(TILE_LANG_STATIC_STDCPP)
message(STATUS "Enabling static linking of C++ standard library")
# Set compile flags for static linking of the C++ standard library
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libstdc++")
# For some compilers, additional flags may be required
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libstdc++")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -static-libstdc++")
endif()
endif()
# Enforce CUDA standard
if(USE_CUDA)
set(CMAKE_CUDA_STANDARD 17)
......@@ -232,6 +227,11 @@ add_library(tilelang_static STATIC $<TARGET_OBJECTS:tilelang_objs>)
add_dependencies(tilelang_static tvm_runtime)
set_target_properties(tilelang_static PROPERTIES OUTPUT_NAME tilelang)
# Apply static linking flags only to static library to avoid Python extension conflicts
if(TILE_LANG_STATIC_STDCPP AND CMAKE_CXX_COMPILER_ID MATCHES "GNU")
target_link_options(tilelang_static PRIVATE -static-libstdc++ -static-libgcc)
endif()
# Debug build type-specific definitions
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
target_compile_definitions(tilelang PRIVATE "TVM_LOG_DEBUG")
......
......@@ -2,24 +2,40 @@ FROM nvidia/cuda:12.1.0-devel-ubuntu18.04
RUN set -eux; \
apt-get update; \
apt-get install -y wget curl libtinfo-dev zlib1g-dev libssl-dev build-essential libedit-dev libxml2-dev git; \
# Install gcc-9 and g++-9
apt-get install -y software-properties-common; \
add-apt-repository ppa:ubuntu-toolchain-r/test -y; \
apt-get update; \
apt-get install -y wget curl libtinfo-dev zlib1g-dev libssl-dev build-essential \
libedit-dev libxml2-dev git gcc-9 g++-9; \
# Switch default gcc/g++ to new version
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 100; \
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 100; \
update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 100; \
update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 100; \
gcc --version; g++ --version; \
curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh; \
bash Miniconda3-latest-Linux-x86_64.sh -b -p /miniconda3; \
rm Miniconda3-latest-Linux-x86_64.sh
rm Miniconda3-latest-Linux-x86_64.sh;
RUN apt-get update && apt-get install -y ninja-build
ENV PATH=/miniconda3/bin/:$PATH
# ✅ Accept Anaconda Terms of Service for both required channels
RUN conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main && \
conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r
# Create environments
RUN set -eux; \
conda create -n py38 python=3.8 -y; \
conda create -n py39 python=3.9 -y; \
conda create -n py310 python=3.10 -y; \
conda create -n py311 python=3.11 -y; \
conda create -n py312 python=3.12 -y; \
ln -s /miniconda3/envs/py38/bin/python3.8 /usr/bin/python3.8; \
ln -s /miniconda3/envs/py39/bin/python3.9 /usr/bin/python3.9; \
ln -s /miniconda3/envs/py310/bin/python3.10 /usr/bin/python3.10; \
ln -s /miniconda3/envs/py311/bin/python3.11 /usr/bin/python3.11; \
ln -s /miniconda3/envs/py312/bin/python3.12 /usr/bin/python3.12; \
conda install -y cmake patchelf
WORKDIR /tilelang
\ No newline at end of file
WORKDIR /tilelang
......@@ -4,13 +4,9 @@ requires = [
"cmake>=3.26",
"packaging",
"setuptools>=61",
"torch",
"wheel",
"tox",
"auditwheel",
"patchelf",
"ninja",
"Cython",
"Cython>=3.0.0",
]
build-backend = "setuptools.build_meta"
......
# Should be mirrored in pyproject.toml
Cython
Cython>=3.0.0
build
cmake>=3.26
packaging
......@@ -9,3 +9,4 @@ wheel
tox
auditwheel
patchelf
ninja
# runtime requirements
Cython
Cython>=3.0.0
numpy>=1.23.5
tqdm>=4.62.3
typing_extensions>=4.10.0
......
#pragma once
#include "gemm_mma.h"
namespace tl {
using tl_mma::gemm_rs;
using tl_mma::gemm_sr;
using tl_mma::gemm_ss;
} // namespace tl
#pragma once
#include "gemm_mma.h"
namespace tl {
using tl_mma::gemm_rs;
using tl_mma::gemm_sr;
using tl_mma::gemm_ss;
} // namespace tl
......@@ -5,3 +5,9 @@
#include "cuda_fp8.h"
#include "gemm_mma.h"
namespace tl {
using tl_mma::gemm_rs;
using tl_mma::gemm_sr;
using tl_mma::gemm_ss;
} // namespace tl
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