Commit 1d0d876b by Tianqi Chen Committed by GitHub

[TEST/CI] 32bit compatibility and CI. (#159)

parent 28edb461
......@@ -82,7 +82,7 @@ stage('Build') {
cp make/config.mk .
echo USE_CUDA=1 >> config.mk
echo USE_OPENCL=1 >> config.mk
echo LLVM_CONFIG=llvm-config >> config.mk
echo LLVM_CONFIG=llvm-config-4.0 >> config.mk
echo USE_RPC=1 >> config.mk
echo USE_BLAS=openblas >> config.mk
"""
......@@ -105,6 +105,22 @@ stage('Build') {
pack_lib('cpu')
}
}
},
'i386': {
node('CPU' && 'linux') {
ws('workspace/tvm/build-i386') {
init_git()
sh """
cp make/config.mk .
echo USE_CUDA=0 >> config.mk
echo USE_OPENCL=0 >> config.mk
echo LLVM_CONFIG=llvm-config-4.0 >> config.mk
echo USE_RPC=1 >> config.mk
"""
make('i386', '-j4')
pack_lib('i386')
}
}
}
}
......@@ -120,6 +136,18 @@ stage('Unit Test') {
}
}
},
'python2/3: i386': {
node('CPU' && 'linux') {
ws('workspace/tvm/ut-python-i386') {
init_git()
unpack_lib('i386', tvm_lib)
timeout(time: max_time, unit: 'MINUTES') {
sh "${docker_run} i386 ./tests/scripts/task_python_unittest.sh"
sh "${docker_run} i386 ./tests/scripts/task_python_integration.sh"
}
}
}
},
'cpp': {
node('linux') {
ws('workspace/tvm/ut-cpp') {
......
......@@ -12,7 +12,8 @@ include $(config)
.PHONY: clean all test doc pylint cpplint lint verilog cython cython2 cython3
all: lib/libtvm.so lib/libtvm_runtime.so lib/libtvm.a
BUILD_TARGETS ?= lib/libtvm.so lib/libtvm_runtime.so lib/libtvm.a
all: ${BUILD_TARGETS}
# The source code dependencies
LIB_HALIDEIR = HalideIR/lib/libHalideIR.a
......
from ..base import TVMError
from libcpp.vector cimport vector
from cpython.version cimport PY_MAJOR_VERSION
from libc.stdint cimport int64_t, uint8_t, uint16_t
from libc.stdint cimport int64_t, uint64_t, uint8_t, uint16_t
import ctypes
cdef enum TVMTypeCode:
......@@ -36,7 +36,7 @@ cdef extern from "tvm/runtime/c_runtime_api.h":
DLDataType dtype
int64_t* shape
int64_t* strides
size_t byte_offset;
uint64_t byte_offset;
ctypedef struct TVMValue:
int64_t v_int64
......
......@@ -9,7 +9,7 @@ cdef class NDArrayBase:
if handle is None:
self.chandle = NULL
else:
ptr = ctypes.addressof(handle.contents)
ptr = ctypes.cast(handle, ctypes.c_void_p).value
self.chandle = <DLTensor*>(ptr)
property _dltensor_addr:
......@@ -48,8 +48,9 @@ def _reg_dltensor(cls):
_DLTENSOR_COMPATS += (cls,)
def _make_array(handle, is_view):
handle = ctypes.cast(handle, TVMArrayHandle)
return _CLASS_NDARRAY(handle, is_view)
cdef unsigned long long ptr
ptr = ctypes.cast(handle, ctypes.c_void_p).value
return c_make_array(<void*>ptr, is_view)
cdef object _CLASS_NDARRAY = None
......
......@@ -139,6 +139,6 @@ class TVMArray(ctypes.Structure):
("dtype", TVMType),
("shape", ctypes.POINTER(tvm_shape_index_t)),
("strides", ctypes.POINTER(tvm_shape_index_t)),
("byte_offset", ctypes.c_size_t)]
("byte_offset", ctypes.c_uint64)]
TVMArrayHandle = ctypes.POINTER(TVMArray)
"""Namespace of executables python files that directly run throw cmd"""
"""Start an RPC server"""
from __future__ import absolute_import
import logging
import argparse
from ..contrib import rpc
def main():
"""Main funciton"""
parser = argparse.ArgumentParser()
parser.add_argument('--host', type=str, default="0.0.0.0",
help='the hostname of the server')
parser.add_argument('--port', type=int, default=9090,
help='The port of the PRC')
parser.add_argument('--port_end', type=int, default=9199,
help='The end search port of the PRC')
args = parser.parse_args()
logging.basicConfig(level=logging.INFO)
server = rpc.Server(args.host, args.port, args.port_end)
server.proc.join()
if __name__ == "__main__":
main()
......@@ -18,7 +18,7 @@ void CodeGenLLVM::Init(const std::string& module_name,
llvm::LLVMContext* ctx) {
InitializeLLVM();
static_assert(sizeof(TVMValue) == sizeof(double), "invariant");
static_assert(alignof(TVMValue) == alignof(double), "invariant");
// static_assert(alignof(TVMValue) == alignof(double), "invariant");
// clear maps
var_map_.clear();
str_map_.clear();
......
......@@ -96,7 +96,7 @@ void CodeGenStackVM::VisitStmt_(const Store* op) {
StackVM::OpCode code = StackVM::GetStore(Type2TVMType(op->value.type()));
if (const IntImm* index = op->index.as<IntImm>()) {
this->Push(op->value);
this->PushOp(code, op->index.as<IntImm>()->value);
this->PushOp(code, index->value);
} else {
this->Push(op->index);
this->PushOp(StackVM::PUSH_I64, op->value.type().element_of().bytes());
......@@ -179,7 +179,7 @@ void CodeGenStackVM::VisitExpr_(const Call* op) {
const IntImm* num = op->args[1].as<IntImm>();
CHECK(num != nullptr);
static_assert(alignof(TVMValue) % alignof(TVMArray) == 0, "invariant");
static_assert(alignof(TVMValue) % alignof(tvm_index_t) == 0, "invariant");
// static_assert(alignof(TVMValue) % alignof(tvm_index_t) == 0, "invariant");
size_t unit = sizeof(TVMValue);
size_t size = 0;
if (type == "shape") {
......@@ -200,7 +200,7 @@ void CodeGenStackVM::VisitExpr_(const Call* op) {
CHECK_EQ(op->args.size(), 1U);
this->Push(op->args[0]);
this->PushOp(StackVM::PUSH_I64, 0);
this->PushOp(StackVM::EQ_I64);
this->PushOp(StackVM::EQ_HANDLE);
} else {
LOG(FATAL) << "unknown function call " << op->name;
}
......
......@@ -102,6 +102,8 @@ int64_t StackVM::PrintCode(std::ostream& os, int64_t pc) const {
STACK_VM_PRINT_CODE0(EQ_F64);
STACK_VM_PRINT_CODE0(LT_F64);
STACK_VM_PRINT_CODE0(LE_F64);
// handle.
STACK_VM_PRINT_CODE0(EQ_HANDLE);
// addressing load
STACK_VM_PRINT_CODE1(ARRAY_LOAD_UINT32);
STACK_VM_PRINT_CODE1(ARRAY_LOAD_INT32);
......@@ -213,6 +215,7 @@ void StackVM::Run(State* s) const {
case EQ_F64: STACK_VM_CMPOP(==, v_float64); break;
case LT_F64: STACK_VM_CMPOP(<, v_float64); break;
case LE_F64: STACK_VM_CMPOP(<=, v_float64); break;
case EQ_HANDLE: STACK_VM_CMPOP(==, v_handle); break;
// addressing
case ARRAY_LOAD_UINT32: STACK_VM_LOAD(.v_int64, int64_t, uint32_t); break;
case ARRAY_LOAD_INT32: STACK_VM_LOAD(.v_int64, int64_t, int32_t); break;
......
......@@ -55,6 +55,8 @@ class StackVM {
EQ_F64,
LT_F64,
LE_F64,
// Pointer comparison
EQ_HANDLE,
/*!
* \brief Routine to load data from address with const offset.
* \code
......
......@@ -6,6 +6,7 @@ RUN apt-get update
COPY install/ubuntu_*.sh /install/
RUN bash /install/ubuntu_install_core.sh
RUN bash /install/ubuntu_install_python.sh
RUN bash /install/ubuntu_install_sphinx.sh
RUN bash /install/ubuntu_install_llvm.sh
RUN bash /install/ubuntu_install_opencl.sh
RUN bash /install/ubuntu_install_iverilog.sh
......
FROM ioft/i386-ubuntu:14.04
RUN apt-get update
COPY install/ubuntu_*.sh /install/
RUN bash /install/ubuntu_install_core.sh
RUN bash /install/ubuntu_install_python.sh
RUN bash /install/ubuntu_install_llvm.sh
cd /usr
wget http://releases.llvm.org/4.0.0/clang+llvm-4.0.0-x86_64-linux-gnu-ubuntu-14.04.tar.xz
tar xf clang+llvm-4.0.0-x86_64-linux-gnu-ubuntu-14.04.tar.xz
chmod -R a+xr clang+llvm-4.0.0-x86_64-linux-gnu-ubuntu-14.04
rm clang+llvm-4.0.0-x86_64-linux-gnu-ubuntu-14.04.tar.xz
cd -
echo deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-4.0 main\
>> /etc/apt/sources.list.d/llvm.list
echo deb-src http://apt.llvm.org/trusty/ llvm-toolchain-trusty-4.0 main\
>> /etc/apt/sources.list.d/llvm.list
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
......@@ -6,5 +6,3 @@ cd /tmp && wget https://bootstrap.pypa.io/get-pip.py && python3 get-pip.py && py
pip2 install nose pylint numpy nose-timer cython
pip3 install nose pylint numpy nose-timer cython
pip install sphinx>=1.5.5 sphinx-gallery sphinx_rtd_theme matplotlib Image recommonmark
pip install sphinx>=1.5.5 sphinx-gallery sphinx_rtd_theme matplotlib Image recommonmark
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