Commit fed6298b by Tianqi Chen Committed by GitHub

[BUILD] Add clang to build matrix, -Werror (#1273)

parent a81ebd90
...@@ -82,8 +82,8 @@ if(MSVC) ...@@ -82,8 +82,8 @@ if(MSVC)
else(MSVC) else(MSVC)
include(CheckCXXCompilerFlag) include(CheckCXXCompilerFlag)
check_cxx_compiler_flag("-std=c++11" SUPPORT_CXX11) check_cxx_compiler_flag("-std=c++11" SUPPORT_CXX11)
set(CMAKE_C_FLAGS "-O3 -Wall -fPIC") set(CMAKE_C_FLAGS "-O2 -Wall -fPIC ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -std=c++11") set(CMAKE_CXX_FLAGS "-O2 -Wall -fPIC -std=c++11 ${CMAKE_CXX_FLAGS}")
endif(MSVC) endif(MSVC)
# add source group # add source group
......
...@@ -96,6 +96,8 @@ stage('Build') { ...@@ -96,6 +96,8 @@ stage('Build') {
echo set\\(USE_SORT ON\\) >> config.cmake echo set\\(USE_SORT ON\\) >> config.cmake
echo set\\(USE_GRAPH_RUNTIME ON\\) >> config.cmake echo set\\(USE_GRAPH_RUNTIME ON\\) >> config.cmake
echo set\\(USE_BLAS openblas\\) >> config.cmake echo set\\(USE_BLAS openblas\\) >> config.cmake
echo set\\(CMAKE_CXX_COMPILER g++\\) >> config.cmake
echo set\\(CMAKE_CXX_FLAGS -Werror\\) >> config.cmake
""" """
make('gpu', 'build', '-j2') make('gpu', 'build', '-j2')
pack_lib('gpu', tvm_multilib) pack_lib('gpu', tvm_multilib)
...@@ -106,7 +108,9 @@ stage('Build') { ...@@ -106,7 +108,9 @@ stage('Build') {
cp ../cmake/config.cmake . cp ../cmake/config.cmake .
echo set\\(USE_OPENCL ON\\) >> config.cmake echo set\\(USE_OPENCL ON\\) >> config.cmake
echo set\\(USE_ROCM ON\\) >> config.cmake echo set\\(USE_ROCM ON\\) >> config.cmake
echo set\\(USE_VULKAN OFF\\) >> config.cmake echo set\\(USE_VULKAN ON\\) >> config.cmake
echo set\\(CMAKE_CXX_COMPILER clang-6.0\\) >> config.cmake
echo set\\(CMAKE_CXX_FLAGS -Werror\\) >> config.cmake
""" """
make('gpu', 'build2', '-j2') make('gpu', 'build2', '-j2')
} }
...@@ -122,6 +126,8 @@ stage('Build') { ...@@ -122,6 +126,8 @@ stage('Build') {
cp ../cmake/config.cmake . cp ../cmake/config.cmake .
echo set\\(USE_SORT ON\\) >> config.cmake echo set\\(USE_SORT ON\\) >> config.cmake
echo set\\(USE_LLVM llvm-config-4.0\\) >> config.cmake echo set\\(USE_LLVM llvm-config-4.0\\) >> config.cmake
echo set\\(CMAKE_CXX_COMPILER g++\\) >> config.cmake
echo set\\(CMAKE_CXX_FLAGS -Werror\\) >> config.cmake
""" """
make('cpu', 'build', '-j2') make('cpu', 'build', '-j2')
pack_lib('cpu', tvm_lib) pack_lib('cpu', tvm_lib)
...@@ -142,6 +148,8 @@ stage('Build') { ...@@ -142,6 +148,8 @@ stage('Build') {
echo set\\(USE_SORT ON\\) >> config.cmake echo set\\(USE_SORT ON\\) >> config.cmake
echo set\\(USE_RPC ON\\) >> config.cmake echo set\\(USE_RPC ON\\) >> config.cmake
echo set\\(USE_LLVM llvm-config-5.0\\) >> config.cmake echo set\\(USE_LLVM llvm-config-5.0\\) >> config.cmake
echo set\\(CMAKE_CXX_COMPILER g++\\) >> config.cmake
echo set\\(CMAKE_CXX_FLAGS -Werror\\) >> config.cmake
""" """
make('i386', 'build', '-j2') make('i386', 'build', '-j2')
pack_lib('i386', tvm_multilib) pack_lib('i386', tvm_multilib)
......
<img src=https://raw.githubusercontent.com/tqchen/tvm.ai/master/images/logo/tvm-logo-small.png width=128/> Open Deep Learning Compiler Stack <img src=https://raw.githubusercontent.com/tqchen/tvm.ai/master/images/logo/tvm-logo-small.png width=128/> Open Deep Learning Compiler Stack
============================================== ==============================================
[![GitHub license](http://dmlc.github.io/img/apache2.svg)](./LICENSE) [![GitHub license](https://dmlc.github.io/img/apache2.svg)](./LICENSE)
[![Build Status](http://mode-gpu.cs.washington.edu:8080/buildStatus/icon?job=dmlc/tvm/master)](http://mode-gpu.cs.washington.edu:8080/job/dmlc/job/tvm/job/master/) [![Build Status](http://mode-gpu.cs.washington.edu:8080/buildStatus/icon?job=dmlc/tvm/master)](http://mode-gpu.cs.washington.edu:8080/job/dmlc/job/tvm/job/master/)
[Documentation](http://docs.tvm.ai) | [Documentation](https://docs.tvm.ai) |
[Contributors](CONTRIBUTORS.md) | [Contributors](CONTRIBUTORS.md) |
[Community](http://tvm.ai/community.html) | [Community](https://tvm.ai/community.html) |
[Release Notes](NEWS.md) [Release Notes](NEWS.md)
TVM is a compiler stack for deep learning systems. It is designed to close the gap between the TVM is a compiler stack for deep learning systems. It is designed to close the gap between the
productivity-focused deep learning frameworks, and the performance- and efficiency-focused hardware backends. productivity-focused deep learning frameworks, and the performance- and efficiency-focused hardware backends.
TVM works with deep learning frameworks to provide end to end compilation to different backends. TVM works with deep learning frameworks to provide end to end compilation to different backends.
Checkout the [tvm stack homepage](http://tvm.ai/) for more information. Checkout the [tvm stack homepage](https://tvm.ai/) for more information.
License License
------- -------
...@@ -21,7 +21,7 @@ License ...@@ -21,7 +21,7 @@ License
Contribute to TVM Contribute to TVM
----------------- -----------------
TVM adopts apache committer model, we aim to create an open source project that is maintained and owned by the community. TVM adopts apache committer model, we aim to create an open source project that is maintained and owned by the community.
Checkout the [Contributor Guide](http://docs.tvm.ai/contribute/) Checkout the [Contributor Guide](https://docs.tvm.ai/contribute/)
Acknowledgement Acknowledgement
--------------- ---------------
......
...@@ -200,7 +200,7 @@ std::vector<NodePtr> Symbol::ListInputs(ListInputOption option) const { ...@@ -200,7 +200,7 @@ std::vector<NodePtr> Symbol::ListInputs(ListInputOption option) const {
std::vector<NodePtr> vlist; std::vector<NodePtr> vlist;
vlist.reserve(this->outputs.size()); vlist.reserve(this->outputs.size());
static auto& fmutate_inputs = Op::GetAttr<FMutateInputs>("FMutateInputs"); static auto& fmutate_inputs = Op::GetAttr<FMutateInputs>("FMutateInputs");
DFSVisit(this->outputs, [&ret, &mutable_set, &vlist](const NodePtr &node) { DFSVisit(this->outputs, [&mutable_set, &vlist](const NodePtr &node) {
if (node->is_variable()) { if (node->is_variable()) {
vlist.push_back(node); vlist.push_back(node);
} else if (fmutate_inputs.count(node->op())) { } else if (fmutate_inputs.count(node->op())) {
......
...@@ -78,12 +78,14 @@ TVM_REGISTER_GLOBAL("tvm.contrib.sort.argsort") ...@@ -78,12 +78,14 @@ TVM_REGISTER_GLOBAL("tvm.contrib.sort.argsort")
int64_t full_idx = base_idx + k * axis_mul_after; int64_t full_idx = base_idx + k * axis_mul_after;
sorter.emplace_back(std::make_pair(k, *(data_ptr + full_idx))); sorter.emplace_back(std::make_pair(k, *(data_ptr + full_idx)));
} }
std::stable_sort(sorter.begin(), sorter.end(), if (is_descend) {
is_descend ? CompareDescend<float> std::stable_sort(sorter.begin(), sorter.end(), CompareDescend<float>);
: CompareAscend<float>); } else {
std::stable_sort(sorter.begin(), sorter.end(), CompareAscend<float>);
}
for (int32_t k = 0; k < input->shape[axis]; ++k) { for (int32_t k = 0; k < input->shape[axis]; ++k) {
*(static_cast<int32_t *>(output->data) + base_idx + k * axis_mul_after) *(static_cast<int32_t *>(output->data) + base_idx + k * axis_mul_after)
= k < sorter.size() ? sorter[k].first : k; = k < static_cast<int32_t>(sorter.size()) ? sorter[k].first : k;
} }
} }
} }
......
...@@ -328,10 +328,11 @@ static TextureFormat GetTextureFormat(TVMType type) { ...@@ -328,10 +328,11 @@ static TextureFormat GetTextureFormat(TVMType type) {
LOG(FATAL) << "Unsupported type bits " << type.bits; LOG(FATAL) << "Unsupported type bits " << type.bits;
} }
} }
default: default: {
LOG(FATAL) << "Unsupported type code" << type.code; LOG(FATAL) << "Unsupported type code" << type.code;
}
} }
assert(false); return {GL_R32F, GL_RED, GL_FLOAT};
} }
Texture OpenGLWorkspace::CreateTexture(TVMType type, size_t nbytes) { Texture OpenGLWorkspace::CreateTexture(TVMType type, size_t nbytes) {
......
...@@ -88,8 +88,10 @@ inline std::string OpenGLArgKind2String(OpenGLArgKind kind) { ...@@ -88,8 +88,10 @@ inline std::string OpenGLArgKind2String(OpenGLArgKind kind) {
return "input_texture"; return "input_texture";
case OpenGLArgKind::kUniform: case OpenGLArgKind::kUniform:
return "uniform"; return "uniform";
default:
LOG(FATAL) << "invalid arg kind";
return "";
} }
assert(false);
} }
inline OpenGLArgKind String2OpenGLArgKind(const std::string& str) { inline OpenGLArgKind String2OpenGLArgKind(const std::string& str) {
...@@ -101,7 +103,7 @@ inline OpenGLArgKind String2OpenGLArgKind(const std::string& str) { ...@@ -101,7 +103,7 @@ inline OpenGLArgKind String2OpenGLArgKind(const std::string& str) {
return OpenGLArgKind::kUniform; return OpenGLArgKind::kUniform;
} else { } else {
LOG(FATAL) << "Invalid OpenGL arg kind."; LOG(FATAL) << "Invalid OpenGL arg kind.";
assert(false); return OpenGLArgKind::kUniform;
} }
} }
......
...@@ -60,8 +60,8 @@ RUN bash /install/ubuntu_install_onnx.sh ...@@ -60,8 +60,8 @@ RUN bash /install/ubuntu_install_onnx.sh
RUN pip3 install Pillow RUN pip3 install Pillow
# disable vulkan for now # disable vulkan for now
# COPY install/ubuntu_install_vulkan.sh /install/ubuntu_install_vulkan.sh COPY install/ubuntu_install_vulkan.sh /install/ubuntu_install_vulkan.sh
# RUN bash /install/ubuntu_install_vulkan.sh RUN bash /install/ubuntu_install_vulkan.sh
# Environment variables # Environment variables
ENV PATH=/usr/local/nvidia/bin:${PATH} ENV PATH=/usr/local/nvidia/bin:${PATH}
......
...@@ -19,4 +19,4 @@ echo deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial main\ ...@@ -19,4 +19,4 @@ echo deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial main\
>> /etc/apt/sources.list.d/llvm.list >> /etc/apt/sources.list.d/llvm.list
wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
apt-get update && apt-get install -y --force-yes llvm-4.0 llvm-5.0 llvm-6.0 apt-get update && apt-get install -y --force-yes llvm-4.0 llvm-5.0 llvm-6.0 clang-6.0
...@@ -238,8 +238,8 @@ inline FCommReduce MakeCommReducer(FCombine fcombine, ...@@ -238,8 +238,8 @@ inline FCommReduce MakeCommReducer(FCombine fcombine,
for (size_t i = 0; i < exprs.size(); ++i) { for (size_t i = 0; i < exprs.size(); ++i) {
auto dtype = exprs[i].type(); auto dtype = exprs[i].type();
dtypes.push_back(dtype); dtypes.push_back(dtype);
lhs.push_back(var("lhs_" + std::to_string(i), dtype)); lhs.push_back(var(name + "_lhs_" + std::to_string(i), dtype));
rhs.push_back(var("rhs_" + std::to_string(i), dtype)); rhs.push_back(var(name + "_rhs_" + std::to_string(i), dtype));
} }
auto result = fcombine(lhs, rhs); auto result = fcombine(lhs, rhs);
......
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