[CI] Made build-wheels compatible with system LLVM setup (#138)

This speeds up wheelhouse build time by ~10x
This commit is contained in:
Philippe Tillet
2021-07-22 18:03:51 -07:00
committed by Philippe Tillet
parent 8eb63bcb01
commit 76c6f24fb6
7 changed files with 20 additions and 12 deletions

View File

@@ -16,7 +16,7 @@ jobs:
set -o errexit set -o errexit
python3 --version python3 --version
python3 -m pip install --upgrade pip python3 -m pip install --upgrade pip
pip3 install cibuildwheel==1.10.0 pip3 install cibuildwheel==2.0.0
pip3 install twine pip3 install twine
displayName: Install dependencies displayName: Install dependencies
- bash: | - bash: |
@@ -28,7 +28,11 @@ jobs:
echo "base-dir=/project" >> python/setup.cfg echo "base-dir=/project" >> python/setup.cfg
displayName: Patch setup.py displayName: Patch setup.py
- bash: | - bash: |
export CIBW_BEFORE_BUILD="pip install cmake" export CIBW_MANYLINUX_X86_64_IMAGE="manylinux2014"
export CIBW_MANYLINUX_PYPY_X86_64_IMAGE="manylinux2014"
export CIBW_BEFORE_BUILD="pip install cmake;\
yum install -y llvm11 llvm11-devel llvm11-static llvm11-libs zlib-devel;"
export CIBW_SKIP="{cp,pp}35-*"
export CIBW_BUILD="{cp,pp}3*-manylinux_x86_64" export CIBW_BUILD="{cp,pp}3*-manylinux_x86_64"
python3 -m cibuildwheel python --output-dir wheelhouse python3 -m cibuildwheel python --output-dir wheelhouse
displayName: Build wheels displayName: Build wheels

View File

@@ -53,7 +53,6 @@ if(BUILD_PYTHON_MODULE)
add_definitions(-DWITH_CUTLASS_BINDINGS) add_definitions(-DWITH_CUTLASS_BINDINGS)
set(CUTLASS_LIBRARIES "cutlass.a") set(CUTLASS_LIBRARIES "cutlass.a")
endif() endif()
message(STATUS ${CUTLASS_INCLUDE_PATH})
include_directories("." ${PYTHON_SRC_PATH} ${PYTHON_INCLUDE_DIRS} ${CUTLASS_INCLUDE_DIR}) include_directories("." ${PYTHON_SRC_PATH} ${PYTHON_INCLUDE_DIRS} ${CUTLASS_INCLUDE_DIR})
link_directories(${PYTHON_LINK_DIRS} ${CUTLASS_LIBRARY_DIR}) link_directories(${PYTHON_LINK_DIRS} ${CUTLASS_LIBRARY_DIR})
set(PYTHON_SRC ${PYTHON_SRC_PATH}/main.cc ${PYTHON_SRC_PATH}/triton.cc ${PYTHON_SRC_PATH}/superblock.cc ${CUTLASS_SRC}) set(PYTHON_SRC ${PYTHON_SRC_PATH}/main.cc ${PYTHON_SRC_PATH}/triton.cc ${PYTHON_SRC_PATH}/superblock.cc ${CUTLASS_SRC})
@@ -65,7 +64,7 @@ file(GLOB_RECURSE LIBTRITON_SRC lib/*.cc)
add_library(triton SHARED ${LIBTRITON_SRC} ${PYTHON_SRC}) add_library(triton SHARED ${LIBTRITON_SRC} ${PYTHON_SRC})
target_link_options(triton PRIVATE ${LLVM_LDFLAGS}) target_link_options(triton PRIVATE ${LLVM_LDFLAGS})
target_link_libraries(triton ${LLVM_LIBRARIES} ${LLVM_SYSTEM_LIBS}) target_link_libraries(triton ${LLVM_LIBRARIES} ${LLVM_SYSTEM_LIBS})
message(STATUS ${LLVM_LDFLAGS})
if(BUILD_PYTHON_MODULE) if(BUILD_PYTHON_MODULE)
set(CMAKE_SHARED_LIBRARY_SUFFIX ".so") set(CMAKE_SHARED_LIBRARY_SUFFIX ".so")

View File

@@ -33,12 +33,12 @@
# We also want an user-specified LLVM_ROOT_DIR to take precedence over the # We also want an user-specified LLVM_ROOT_DIR to take precedence over the
# system default locations such as /usr/local/bin. Executing find_program() # system default locations such as /usr/local/bin. Executing find_program()
# multiples times is the approach recommended in the docs. # multiples times is the approach recommended in the docs.
set(llvm_config_names llvm-config-12.0 llvm-config120 llvm-config-12 set(llvm_config_names llvm-config-12.0 llvm-config120 llvm-config-12 llvm-config-12-64
llvm-config-11.0 llvm-config110 llvm-config-11 llvm-config-11.0 llvm-config110 llvm-config-11 llvm-config-11-64
llvm-config-10.0 llvm-config100 llvm-config-10 llvm-config-10.0 llvm-config100 llvm-config-10 llvm-config-10-64
llvm-config-9.0 llvm-config90 llvm-config-9 llvm-config-9.0 llvm-config90 llvm-config-9 llvm-config-9-64
llvm-config-8.0 llvm-config80 llvm-config-8 llvm-config-8.0 llvm-config80 llvm-config-8 llvm-config-8-64
llvm-config-7.0 llvm-config70 llvm-config-7 llvm-config-7.0 llvm-config70 llvm-config-7 llvm-config-7-64
llvm-config-6.0 llvm-config60 llvm-config-6.0 llvm-config60
llvm-config) llvm-config)
find_program(LLVM_CONFIG find_program(LLVM_CONFIG

View File

@@ -4,6 +4,7 @@
#define _TRITON_IR_DISPATCH_H_ #define _TRITON_IR_DISPATCH_H_
#include "triton/ir/builder.h" #include "triton/ir/builder.h"
#include <stdexcept>
namespace triton{ namespace triton{
namespace ir{ namespace ir{

View File

@@ -1,4 +1,5 @@
#include <cassert> #include <cassert>
#include <stdexcept>
#include "triton/ir/constant.h" #include "triton/ir/constant.h"
#include "triton/ir/type.h" #include "triton/ir/type.h"
#include "triton/ir/context.h" #include "triton/ir/context.h"

View File

@@ -1,4 +1,5 @@
#include <cassert> #include <cassert>
#include <stdexcept>
#include "triton/ir/type.h" #include "triton/ir/type.h"
#include "triton/ir/context.h" #include "triton/ir/context.h"
#include "triton/ir/context_impl.h" #include "triton/ir/context_impl.h"

View File

@@ -7,12 +7,14 @@ import subprocess
import distutils import distutils
import glob import glob
import tempfile import tempfile
import shutil
from distutils.version import LooseVersion from distutils.version import LooseVersion
from setuptools import setup, Extension, find_packages from setuptools import setup, Extension, find_packages
from setuptools.command.build_ext import build_ext from setuptools.command.build_ext import build_ext
from setuptools.command.test import test as TestCommand from setuptools.command.test import test as TestCommand
import distutils.spawn import distutils.spawn
import urllib.request
import tarfile
class CMakeExtension(Extension): class CMakeExtension(Extension):
def __init__(self, name, path, sourcedir=""): def __init__(self, name, path, sourcedir=""):
@@ -66,7 +68,7 @@ class CMakeBuild(build_ext):
"-DBUILD_TUTORIALS=OFF", "-DBUILD_TUTORIALS=OFF",
"-DBUILD_PYTHON_MODULE=ON", "-DBUILD_PYTHON_MODULE=ON",
#'-DPYTHON_EXECUTABLE=' + sys.executable, #'-DPYTHON_EXECUTABLE=' + sys.executable,
'-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON', #'-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON',
"-DTRITON_LLVM_BUILD_DIR=" + llvm_build_dir, "-DTRITON_LLVM_BUILD_DIR=" + llvm_build_dir,
"-DPYTHON_INCLUDE_DIRS=" + ";".join(python_include_dirs) "-DPYTHON_INCLUDE_DIRS=" + ";".join(python_include_dirs)
] ]