Skip to content
This repository was archived by the owner on Apr 28, 2023. It is now read-only.

Commit 7dbb65b

Browse files
Move to trunk LLVM
This commit switches from Tapir which is based on LLVM 5.0 to trunk LLVM. The main motivation is that LLVM 5.0 NVPTX only supports ancient cuda architectures and that FB internally uses an LLVM that is much closer to trunk.
1 parent b77b583 commit 7dbb65b

File tree

14 files changed

+127
-137
lines changed

14 files changed

+127
-137
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ jobs:
99
steps:
1010
- checkout
1111
- run:
12-
name: conda_tapir_halide
12+
name: conda_llvm_halide
1313
command: |
1414
. /opt/conda/anaconda/bin/activate
1515
source activate tc_build
16-
conda install -y -c nicolasvasilache llvm-tapir50 halide
16+
conda install -y -c nicolasvasilache llvm-trunk halide
1717
1818
- run:
1919
name: check_formatting

.github/ISSUE_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ When submitting a bug report, please include the following information (where re
1616
- GCC/GXX version (if compiling from source):
1717
- LLVM/Tapir git hash used (if compiling from source):
1818

19-
To get the hash, run: `$HOME/clang+llvm-tapir5.0/bin/clang --version`
19+
To get the hash, run: `$CONDA_PREFIX/bin/clang --version`
2020

2121
- Commit hash of our repo and submodules (if compiling from source):
2222

.jenkins/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ cd /var/lib/jenkins/workspace
6060
git submodule update --init --recursive
6161

6262
source activate tc_build
63-
conda install -y -c nicolasvasilache llvm-tapir50 halide
63+
conda install -y -c nicolasvasilache llvm-trunk halide
6464
conda install -y -c conda-forge eigen
6565
conda install -y -c nicolasvasilache caffe2
6666

conda_recipes/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ nvidia-docker run --rm -i -t tc-cuda9.0-cudnn7.1-ubuntu16.04-devel
1717

1818
We are ready to build conda package for TC.
1919
To simplify the build process we ship TC dependencies as conda packages.
20-
We need to build packages for `llvm-tapir50`, `Halide`, `Caffe2` (optional) and finally `Tensor Comprehensions`.
20+
We need to build packages for `llvm-trunk`, `Halide`, `Caffe2` (optional) and finally `Tensor Comprehensions`.
2121

2222
For building each package, we need to specify a `build version`, `build number` and
2323
`git hash`. This information is used to build each package.

conda_recipes/conda_build_tc.sh

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,27 +28,31 @@ time conda build -c $ANACONDA_USER --python 3.6 caffe2
2828
echo "Caffe2 packaged Successfully"
2929

3030
###############################################################################
31-
# LLVM_TAPIR settings
32-
LLVM_TAPIR_BUILD_VERSION="1.0.0"
33-
LLVM_TAPIR_BUILD_NUMBER=1
34-
LLVM_TAPIR_GIT_HASH="1482504e234a65bffc8c54de8de9fc877822345d"
31+
# LLVM_TRUNK settings
32+
LLVM_TRUNK_BUILD_VERSION="1.0.0"
33+
LLVM_TRUNK_BUILD_NUMBER=1
34+
LLVM_TRUNK_SOURCE_DIR=$(mktemp -d /tmp/d.XXXXXX)
35+
trap 'rm -rf "${LLVM_TRUNK_SOURCE_DIR}"' EXIT
3536

36-
echo "Building llvm-tapir50"
37-
echo "LLVM_TAPIR_BUILD_VERSION: $LLVM_TAPIR_BUILD_VERSION LLVM_TAPIR_BUILD_NUMBER: ${LLVM_TAPIR_BUILD_NUMBER}"
37+
svn co http://llvm.org/svn/llvm-project/llvm/trunk ${LLVM_TRUNK_SOURCE_DIR}
38+
svn co http://llvm.org/svn/llvm-project/cfe/trunk ${LLVM_TRUNK_SOURCE_DIR}/tools/clang
3839

39-
export LLVM_TAPIR_BUILD_VERSION=$LLVM_TAPIR_BUILD_VERSION
40-
export LLVM_TAPIR_BUILD_NUMBER=$LLVM_TAPIR_BUILD_NUMBER
41-
export LLVM_TAPIR_GIT_HASH=$LLVM_TAPIR_GIT_HASH
40+
echo "Building llvm-trunk"
41+
echo "LLVM_TRUNK_BUILD_VERSION: $LLVM_TRUNK_BUILD_VERSION LLVM_TRUNK_BUILD_NUMBER: ${LLVM_TRUNK_BUILD_NUMBER}"
4242

43-
time conda build -c $ANACONDA_USER --python 3.6 llvm-tapir50
43+
export LLVM_TRUNK_BUILD_VERSION=$LLVM_TRUNK_BUILD_VERSION
44+
export LLVM_TRUNK_BUILD_NUMBER=$LLVM_TRUNK_BUILD_NUMBER
45+
export LLVM_TRUNK_SOURCE_DIR=$LLVM_TRUNK_SOURCE_DIR
4446

45-
echo "llvm-tapir50 packaged Successfully"
47+
time conda build -c $ANACONDA_USER --python 3.6 llvm-trunk
48+
49+
echo "llvm-trunk packaged Successfully"
4650

4751
##############################################################################
4852
# Halide settings
4953
HALIDE_BUILD_VERSION="1.0.0"
50-
HALIDE_BUILD_NUMBER=0
51-
HALIDE_GIT_HASH="35be67b3a3e4c4461f79949109ff35c54cf307de"
54+
HALIDE_BUILD_NUMBER=1
55+
HALIDE_GIT_HASH="0b29cacf636852933892bbaa61dd2050c8dcaff2"
5256

5357
echo "Packaging HALIDE ==> HALIDE_BUILD_VERSION: ${HALIDE_BUILD_VERSION} HALIDE_BUILD_NUMBER: ${HALIDE_BUILD_NUMBER}"
5458

@@ -75,4 +79,3 @@ echo "HALIDE packaged Successfully"
7579
#time conda build -c $ANACONDA_USER --python 3.6 tensor_comprehensions
7680
#
7781
#echo "Tensor Comprehensions packaged Successfully"
78-
#

conda_recipes/halide/meta.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ source:
88

99
requirements:
1010
build:
11-
- llvm-tapir50==1.0.0
11+
- llvm-trunk==1.0.0
1212
- cmake
1313
run:
14-
- llvm-tapir50==1.0.0
14+
- llvm-trunk==1.0.0
1515
- cmake
1616

1717
build:

conda_recipes/llvm-trunk/build.sh

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
# code gets checked out at below:
6+
# $SOURCE_DIR ===> <anaconda_root>/conda-bld/llvm-trunk_<timestamp>/work
7+
#
8+
# build directory gets created at $SOURCE_DIR/build
9+
#
10+
# CONDA environment for debugging:
11+
# cd <anaconda_root>/conda-bld/llvm-trunk_<timestamp>
12+
# source activate ./_h_env_...... # long placeholders
13+
#
14+
# $CONDA_PREFIX and $PREFIX are set to the same value i.e. the environment value
15+
#
16+
# Installation happens in the $PREFIX which is the environment and rpath is set
17+
# to that
18+
#
19+
# For tests, a new environment _test_env_.... is created
20+
# During the tests, you will see that the llvm-trunk package gets checked out
21+
# NOTE: once the build finished, the packaging and unpackaging step takes long
22+
# and might seem like it's stuck but it's not.
23+
24+
CMAKE_VERSION=${CMAKE_VERSION:="`which cmake3 || which cmake`"}
25+
VERBOSE=${VERBOSE:=0}
26+
27+
echo "CONDA_PREFIX: ${CONDA_PREFIX}"
28+
echo "PREFIX: ${PREFIX}"
29+
30+
echo "Building llvm-trunk conda package"
31+
32+
echo "Clean up existing build packages if any"
33+
rm -rf llvm_build || true
34+
35+
mkdir -p llvm_build
36+
cd llvm_build
37+
38+
echo "Configuring llvm-trunk"
39+
VERBOSE=${VERBOSE} ${CMAKE_VERSION} \
40+
-DCMAKE_INSTALL_PREFIX=${PREFIX} \
41+
-DCOMPILER_RT_BUILD_CILKTOOLS=OFF \
42+
-DLLVM_ENABLE_CXX1Y=ON \
43+
-DLLVM_ENABLE_TERMINFO=OFF \
44+
-DLLVM_BUILD_TESTS=OFF \
45+
-DLLVM_ENABLE_ASSERTIONS=ON \
46+
-DCMAKE_BUILD_TYPE=Release \
47+
-DLLVM_BUILD_LLVM_DYLIB=ON \
48+
-DLLVM_TARGETS_TO_BUILD="X86;NVPTX" \
49+
-DLLVM_ENABLE_EH=ON \
50+
-DLLVM_ENABLE_OCAMLDOC=OFF \
51+
-DLLVM_INSTALL_OCAMLDOC_HTML_DIR=/tmp \
52+
-DLLVM_OCAML_INSTALL_PATH=/tmp \
53+
-DLLVM_ENABLE_RTTI=ON .. || exit 1
54+
55+
echo "Installing llvm-trunk"
56+
VERBOSE=${VERBOSE} make -j"$(nproc)" -s || exit 1
57+
58+
VERBOSE=${VERBOSE} make install -j"$(nproc)" -s || exit 1
59+
60+
echo SUCCESS || echo FAILURE
61+
62+
echo "Successfully built llvm-trunk conda package"

conda_recipes/llvm-trunk/meta.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package:
2+
name: llvm-trunk
3+
version: "{{ environ.get('LLVM_TRUNK_BUILD_VERSION') }}"
4+
5+
source:
6+
path: "{{ environ.get('LLVM_TRUNK_SOURCE_DIR') }}"
7+
8+
requirements:
9+
build:
10+
- cmake
11+
run:
12+
- cmake
13+
14+
build:
15+
number: {{ environ.get('LLVM_TRUNK_BUILD_NUMBER') }}
16+
skip: True # [win]
17+
18+
test:
19+
commands:
20+
- $PREFIX/bin/llvm-config --libs
21+
- $PREFIX/bin/llc -version
22+
- test -f $PREFIX/include/llvm/Pass.h
23+
- test -f $PREFIX/lib/libLLVMCore.a
24+
25+
- $PREFIX/bin/clang --version
26+
- $PREFIX/bin/clang++ --version
27+
- $PREFIX/bin/clang-check --version
28+
- test -f $PREFIX/include/clang/Lex/Lexer.h
29+
- test -f $PREFIX/lib/libclangBasic.a
30+
31+
extra:
32+
recipe-maintainers:
33+
- nicolasvasilache

conda_recipes/tensor_comprehensions/meta.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ source:
88

99
requirements:
1010
build:
11-
- llvm-tapir50==1.0.0
11+
- llvm-trunk==1.0.0
1212
- halide==1.0.0
1313
- caffe2==1.0.0
1414
- pytorch==0.4.0
@@ -17,7 +17,7 @@ requirements:
1717
- setuptools
1818

1919
run:
20-
- llvm-tapir50==1.0.0
20+
- llvm-trunk==1.0.0
2121
- halide==1.0.0
2222
- caffe2==1.0.0
2323
- pytorch==0.4.0

docs/source/installation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Create a new environment in which TC will be built and install core dependencies
6666
conda create -y --name tc_build python=3.6
6767
conda activate tc_build
6868
conda install -y pyyaml mkl-include pytest
69-
conda install -y -c nicolasvasilache llvm-tapir50 halide
69+
conda install -y -c nicolasvasilache llvm-trunk halide
7070
7171
Then install the PyTorch version that corresponds to your system binaries
7272
(e.g. cuda 9.0):

tc/core/polyhedral/llvm_jit.cc

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ std::string find_library_path(std::string library) {
7272
namespace tc {
7373

7474
#if LLVM_VERSION_MAJOR <= 6
75+
7576
Jit::Jit()
7677
: TM_(EngineBuilder().selectTarget()),
7778
DL_(TM_->createDataLayout()),
@@ -103,11 +104,13 @@ void Jit::addModule(std::shared_ptr<Module> M) {
103104
auto res = compileLayer_.addModule(M, std::move(Resolver));
104105
TC_CHECK(res) << "Failed to jit compile.";
105106
}
107+
106108
#else
109+
107110
Jit::Jit()
108-
: SSP(),
109-
ES(SSP),
111+
: ES(),
110112
Resolver(llvm::orc::createLegacyLookupResolver(
113+
ES,
111114
[this](const std::string& Name) -> JITSymbol {
112115
if (auto Sym = compileLayer_.findSymbol(Name, false))
113116
return Sym;
@@ -136,10 +139,6 @@ Jit::Jit()
136139
}
137140
}
138141

139-
// Note that this copy may cause tapir tests to fail
140-
// However, this code will never use tapir code
141-
// and once the LLVM API churn stops, will be modified
142-
// to be properly compatable.
143142
void Jit::addModule(std::shared_ptr<Module> M) {
144143
M->setTargetTriple(TM_->getTargetTriple().str());
145144
auto K = ES.allocateVModule();

tc/core/polyhedral/llvm_jit.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ class Scop;
3434
class Jit {
3535
private:
3636
#if LLVM_VERSION_MAJOR > 6
37-
llvm::orc::SymbolStringPool SSP;
3837
llvm::orc::ExecutionSession ES;
3938
std::shared_ptr<llvm::orc::SymbolResolver> Resolver;
4039
#endif

test/CMakeLists.txt

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,19 +63,6 @@ target_link_libraries(
6363

6464
tc_core_cpu tc_lang tc_aten pthread)
6565

66-
if (WITH_TAPIR)
67-
add_executable(test_mapper_tapir test_mapper_tapir.cc)
68-
add_test(test_mapper_tapir test_mapper_tapir)
69-
target_link_libraries(
70-
test_mapper_tapir
71-
72-
${GTEST_LIBRARIES}
73-
${ATEN_LIBRARIES}
74-
-lLLVM
75-
76-
tc_core_cpu tc_lang tc_aten pthread)
77-
endif()
78-
7966
################################################################################
8067
# Lang tests
8168
################################################################################

test/test_mapper_tapir.cc

Lines changed: 0 additions & 93 deletions
This file was deleted.

0 commit comments

Comments
 (0)