From 1ea72d6f29a5cae1708c25568de292480f916804 Mon Sep 17 00:00:00 2001 From: Tianqi Chen <tqchen@users.noreply.github.com> Date: Sun, 21 May 2017 13:16:12 -0700 Subject: [PATCH] [DLPACK] Upgrade to the latest version (#150) --- dlpack | 2 +- python/tvm/_ffi/_cython/base.pxi | 2 +- python/tvm/_ffi/runtime_ctypes.py | 6 +++--- src/codegen/llvm/codegen_llvm.cc | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dlpack b/dlpack index 9f433c5ec..a6e09b58d 160000 --- a/dlpack +++ b/dlpack @@ -1 +1 @@ -Subproject commit 9f433c5ecfdd47184339cdd2b99706d24fae3aa1 +Subproject commit a6e09b58dc00ee0065f5b7879800e646fbb01d1e diff --git a/python/tvm/_ffi/_cython/base.pxi b/python/tvm/_ffi/_cython/base.pxi index 6c3d8069d..3e3055cb3 100644 --- a/python/tvm/_ffi/_cython/base.pxi +++ b/python/tvm/_ffi/_cython/base.pxi @@ -26,8 +26,8 @@ cdef extern from "tvm/runtime/c_runtime_api.h": uint16_t lanes ctypedef struct DLContext: - int device_id int device_type + int device_id ctypedef struct DLTensor: void* data diff --git a/python/tvm/_ffi/runtime_ctypes.py b/python/tvm/_ffi/runtime_ctypes.py index c11638fe3..107961482 100644 --- a/python/tvm/_ffi/runtime_ctypes.py +++ b/python/tvm/_ffi/runtime_ctypes.py @@ -68,8 +68,8 @@ RPC_SESS_MASK = 128 class TVMContext(ctypes.Structure): """TVM context strucure.""" - _fields_ = [("device_id", ctypes.c_int), - ("device_type", ctypes.c_int)] + _fields_ = [("device_type", ctypes.c_int), + ("device_id", ctypes.c_int)] MASK2STR = { 1 : 'cpu', 2 : 'gpu', @@ -88,8 +88,8 @@ class TVMContext(ctypes.Structure): } def __init__(self, device_type, device_id): super(TVMContext, self).__init__() - self.device_id = device_id self.device_type = device_type + self.device_id = device_id @property def exist(self): diff --git a/src/codegen/llvm/codegen_llvm.cc b/src/codegen/llvm/codegen_llvm.cc index 299cea96f..ea66bce43 100644 --- a/src/codegen/llvm/codegen_llvm.cc +++ b/src/codegen/llvm/codegen_llvm.cc @@ -361,11 +361,11 @@ llvm::Value* CodeGenLLVM::CreateStructRefPtr( } case intrinsic::kArrDeviceId: { return builder_->CreateInBoundsGEP( - buf, {index, ConstInt32(1), ConstInt32(0)}); + buf, {index, ConstInt32(1), ConstInt32(1)}); } case intrinsic::kArrDeviceType: { return builder_->CreateInBoundsGEP( - buf, {index, ConstInt32(1), ConstInt32(1)}); + buf, {index, ConstInt32(1), ConstInt32(0)}); } case intrinsic::kTVMValueContent: { CHECK_EQ(t.lanes(), 1); -- GitLab