Skip to content

Commit fed6298

Browse files
authored
[BUILD] Add clang to build matrix, -Werror (apache#1273)
1 parent a81ebd9 commit fed6298

File tree

10 files changed

+35
-22
lines changed

10 files changed

+35
-22
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ if(MSVC)
8282
else(MSVC)
8383
include(CheckCXXCompilerFlag)
8484
check_cxx_compiler_flag("-std=c++11" SUPPORT_CXX11)
85-
set(CMAKE_C_FLAGS "-O3 -Wall -fPIC")
86-
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -std=c++11")
85+
set(CMAKE_C_FLAGS "-O2 -Wall -fPIC ${CMAKE_C_FLAGS}")
86+
set(CMAKE_CXX_FLAGS "-O2 -Wall -fPIC -std=c++11 ${CMAKE_CXX_FLAGS}")
8787
endif(MSVC)
8888

8989
# add source group

Jenkinsfile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ stage('Build') {
9696
echo set\\(USE_SORT ON\\) >> config.cmake
9797
echo set\\(USE_GRAPH_RUNTIME ON\\) >> config.cmake
9898
echo set\\(USE_BLAS openblas\\) >> config.cmake
99+
echo set\\(CMAKE_CXX_COMPILER g++\\) >> config.cmake
100+
echo set\\(CMAKE_CXX_FLAGS -Werror\\) >> config.cmake
99101
"""
100102
make('gpu', 'build', '-j2')
101103
pack_lib('gpu', tvm_multilib)
@@ -106,7 +108,9 @@ stage('Build') {
106108
cp ../cmake/config.cmake .
107109
echo set\\(USE_OPENCL ON\\) >> config.cmake
108110
echo set\\(USE_ROCM ON\\) >> config.cmake
109-
echo set\\(USE_VULKAN OFF\\) >> config.cmake
111+
echo set\\(USE_VULKAN ON\\) >> config.cmake
112+
echo set\\(CMAKE_CXX_COMPILER clang-6.0\\) >> config.cmake
113+
echo set\\(CMAKE_CXX_FLAGS -Werror\\) >> config.cmake
110114
"""
111115
make('gpu', 'build2', '-j2')
112116
}
@@ -122,6 +126,8 @@ stage('Build') {
122126
cp ../cmake/config.cmake .
123127
echo set\\(USE_SORT ON\\) >> config.cmake
124128
echo set\\(USE_LLVM llvm-config-4.0\\) >> config.cmake
129+
echo set\\(CMAKE_CXX_COMPILER g++\\) >> config.cmake
130+
echo set\\(CMAKE_CXX_FLAGS -Werror\\) >> config.cmake
125131
"""
126132
make('cpu', 'build', '-j2')
127133
pack_lib('cpu', tvm_lib)
@@ -142,6 +148,8 @@ stage('Build') {
142148
echo set\\(USE_SORT ON\\) >> config.cmake
143149
echo set\\(USE_RPC ON\\) >> config.cmake
144150
echo set\\(USE_LLVM llvm-config-5.0\\) >> config.cmake
151+
echo set\\(CMAKE_CXX_COMPILER g++\\) >> config.cmake
152+
echo set\\(CMAKE_CXX_FLAGS -Werror\\) >> config.cmake
145153
"""
146154
make('i386', 'build', '-j2')
147155
pack_lib('i386', tvm_multilib)

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
<img src=https://raw.githubusercontent.com/tqchen/tvm.ai/master/images/logo/tvm-logo-small.png width=128/> Open Deep Learning Compiler Stack
22
==============================================
33

4-
[![GitHub license](http://dmlc.github.io/img/apache2.svg)](./LICENSE)
4+
[![GitHub license](https://dmlc.github.io/img/apache2.svg)](./LICENSE)
55
[![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/)
66

7-
[Documentation](http://docs.tvm.ai) |
7+
[Documentation](https://docs.tvm.ai) |
88
[Contributors](CONTRIBUTORS.md) |
9-
[Community](http://tvm.ai/community.html) |
9+
[Community](https://tvm.ai/community.html) |
1010
[Release Notes](NEWS.md)
1111

1212
TVM is a compiler stack for deep learning systems. It is designed to close the gap between the
1313
productivity-focused deep learning frameworks, and the performance- and efficiency-focused hardware backends.
1414
TVM works with deep learning frameworks to provide end to end compilation to different backends.
15-
Checkout the [tvm stack homepage](http://tvm.ai/) for more information.
15+
Checkout the [tvm stack homepage](https://tvm.ai/) for more information.
1616

1717
License
1818
-------
@@ -21,7 +21,7 @@ License
2121
Contribute to TVM
2222
-----------------
2323
TVM adopts apache committer model, we aim to create an open source project that is maintained and owned by the community.
24-
Checkout the [Contributor Guide](http://docs.tvm.ai/contribute/)
24+
Checkout the [Contributor Guide](https://docs.tvm.ai/contribute/)
2525

2626
Acknowledgement
2727
---------------

nnvm/src/core/symbolic.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ std::vector<NodePtr> Symbol::ListInputs(ListInputOption option) const {
200200
std::vector<NodePtr> vlist;
201201
vlist.reserve(this->outputs.size());
202202
static auto& fmutate_inputs = Op::GetAttr<FMutateInputs>("FMutateInputs");
203-
DFSVisit(this->outputs, [&ret, &mutable_set, &vlist](const NodePtr &node) {
203+
DFSVisit(this->outputs, [&mutable_set, &vlist](const NodePtr &node) {
204204
if (node->is_variable()) {
205205
vlist.push_back(node);
206206
} else if (fmutate_inputs.count(node->op())) {

src/contrib/sort/sort.cc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,14 @@ TVM_REGISTER_GLOBAL("tvm.contrib.sort.argsort")
7878
int64_t full_idx = base_idx + k * axis_mul_after;
7979
sorter.emplace_back(std::make_pair(k, *(data_ptr + full_idx)));
8080
}
81-
std::stable_sort(sorter.begin(), sorter.end(),
82-
is_descend ? CompareDescend<float>
83-
: CompareAscend<float>);
81+
if (is_descend) {
82+
std::stable_sort(sorter.begin(), sorter.end(), CompareDescend<float>);
83+
} else {
84+
std::stable_sort(sorter.begin(), sorter.end(), CompareAscend<float>);
85+
}
8486
for (int32_t k = 0; k < input->shape[axis]; ++k) {
8587
*(static_cast<int32_t *>(output->data) + base_idx + k * axis_mul_after)
86-
= k < sorter.size() ? sorter[k].first : k;
88+
= k < static_cast<int32_t>(sorter.size()) ? sorter[k].first : k;
8789
}
8890
}
8991
}

src/runtime/opengl/opengl_device_api.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,10 +328,11 @@ static TextureFormat GetTextureFormat(TVMType type) {
328328
LOG(FATAL) << "Unsupported type bits " << type.bits;
329329
}
330330
}
331-
default:
331+
default: {
332332
LOG(FATAL) << "Unsupported type code" << type.code;
333+
}
333334
}
334-
assert(false);
335+
return {GL_R32F, GL_RED, GL_FLOAT};
335336
}
336337

337338
Texture OpenGLWorkspace::CreateTexture(TVMType type, size_t nbytes) {

src/runtime/opengl/opengl_module.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,10 @@ inline std::string OpenGLArgKind2String(OpenGLArgKind kind) {
8888
return "input_texture";
8989
case OpenGLArgKind::kUniform:
9090
return "uniform";
91+
default:
92+
LOG(FATAL) << "invalid arg kind";
93+
return "";
9194
}
92-
assert(false);
9395
}
9496

9597
inline OpenGLArgKind String2OpenGLArgKind(const std::string& str) {
@@ -101,7 +103,7 @@ inline OpenGLArgKind String2OpenGLArgKind(const std::string& str) {
101103
return OpenGLArgKind::kUniform;
102104
} else {
103105
LOG(FATAL) << "Invalid OpenGL arg kind.";
104-
assert(false);
106+
return OpenGLArgKind::kUniform;
105107
}
106108
}
107109

tests/ci_build/Dockerfile.gpu

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ RUN bash /install/ubuntu_install_onnx.sh
6060
RUN pip3 install Pillow
6161

6262
# disable vulkan for now
63-
# COPY install/ubuntu_install_vulkan.sh /install/ubuntu_install_vulkan.sh
64-
# RUN bash /install/ubuntu_install_vulkan.sh
63+
COPY install/ubuntu_install_vulkan.sh /install/ubuntu_install_vulkan.sh
64+
RUN bash /install/ubuntu_install_vulkan.sh
6565

6666
# Environment variables
6767
ENV PATH=/usr/local/nvidia/bin:${PATH}

tests/ci_build/install/ubuntu_install_llvm.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ echo deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial main\
1919
>> /etc/apt/sources.list.d/llvm.list
2020

2121
wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
22-
apt-get update && apt-get install -y --force-yes llvm-4.0 llvm-5.0 llvm-6.0
22+
apt-get update && apt-get install -y --force-yes llvm-4.0 llvm-5.0 llvm-6.0 clang-6.0

topi/include/topi/reduction.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,8 @@ inline FCommReduce MakeCommReducer(FCombine fcombine,
238238
for (size_t i = 0; i < exprs.size(); ++i) {
239239
auto dtype = exprs[i].type();
240240
dtypes.push_back(dtype);
241-
lhs.push_back(var("lhs_" + std::to_string(i), dtype));
242-
rhs.push_back(var("rhs_" + std::to_string(i), dtype));
241+
lhs.push_back(var(name + "_lhs_" + std::to_string(i), dtype));
242+
rhs.push_back(var(name + "_rhs_" + std::to_string(i), dtype));
243243
}
244244

245245
auto result = fcombine(lhs, rhs);

0 commit comments

Comments
 (0)