Skip to content

Commit

Permalink
fix runtime load
Browse files Browse the repository at this point in the history
  • Loading branch information
merrymercy committed Jun 23, 2018
1 parent 6420092 commit aebd3fd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
5 changes: 3 additions & 2 deletions python/tvm/_ffi/runtime_ctypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from __future__ import absolute_import

import ctypes
import json
import numpy as np
from .base import _LIB, check_call
from .. import _api_internal
Expand Down Expand Up @@ -184,10 +185,10 @@ def max_thread_dimensions(self):
Returns
-------
dims: Tuple of int
dims: List of int
The maximum length of threadIdx.x, threadIdx.y, threadIdx.z
"""
return tuple(_api_internal._GetDeviceAttr(
return json.loads(_api_internal._GetDeviceAttr(
self.device_type, self.device_id, 8))

def sync(self):
Expand Down
6 changes: 3 additions & 3 deletions src/runtime/cuda/cuda_device_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ class CUDADeviceAPI final : public DeviceAPI {
CUDA_CALL(cudaDeviceGetAttribute(
&dims[2], cudaDevAttrMaxBlockDimZ, ctx.device_id));

*rv = tvm::Array<tvm::Expr>({static_cast<int32_t>(dims[0]),
static_cast<int32_t>(dims[1]),
static_cast<int32_t>(dims[2])});
std::stringstream ss; // use json string to return multiple int values;
ss << "[" << dims[0] <<", " << dims[1] << ", " << dims[2] << "]";
*rv = ss.str();
return;
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/runtime/opencl/opencl_device_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ void OpenCLWorkspace::GetAttr(
OPENCL_CALL(clGetDeviceInfo(
devices[index], CL_DEVICE_MAX_WORK_ITEM_SIZES, sizeof(dims), dims, nullptr));

*rv = tvm::Array<tvm::Expr>({static_cast<int32_t>(dims[0]),
static_cast<int32_t>(dims[1]),
static_cast<int32_t>(dims[2])});
std::stringstream ss; // use json string to return multiple int values;
ss << "[" << dims[0] <<", " << dims[1] << ", " << dims[2] << "]";
*rv = ss.str();
break;
}
}
Expand Down

0 comments on commit aebd3fd

Please sign in to comment.