Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove comparison of unsigned expression < 0 warning #6319

Merged
merged 2 commits into from
Sep 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/runtime/crt/common/ndarray.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

#include "crt_config.h"

TVMNDArray TVMNDArray_Create(uint32_t ndim, const tvm_index_t* shape, DLDataType dtype,
TVMNDArray TVMNDArray_Create(int32_t ndim, const tvm_index_t* shape, DLDataType dtype,
DLContext ctx) {
TVMNDArray ret;
memset(&ret, 0, sizeof(TVMNDArray));
Expand All @@ -42,12 +42,12 @@ TVMNDArray TVMNDArray_Create(uint32_t ndim, const tvm_index_t* shape, DLDataType
return ret;
}

TVMNDArray TVMNDArray_Empty(uint32_t ndim, const tvm_index_t* shape, DLDataType dtype,
TVMNDArray TVMNDArray_Empty(int32_t ndim, const tvm_index_t* shape, DLDataType dtype,
DLContext ctx) {
TVMNDArray ret = TVMNDArray_Create(ndim, shape, dtype, ctx);
int64_t num_elems = 1;
int elem_bytes = (dtype.bits + 7) / 8;
uint32_t idx;
int32_t idx;
for (idx = 0; idx < ret.dl_tensor.ndim; ++idx) {
num_elems *= shape[idx];
}
Expand All @@ -68,11 +68,11 @@ int TVMNDArray_Load(TVMNDArray* ret, const char** strm) {
reserved = ((uint64_t*)*strm)[0]; // NOLINT(*)
*strm += sizeof(reserved);
DLContext ctx;
uint32_t ndim;
int ndim; // sizeof ndim should match dlpack
DLDataType dtype;
ctx = ((DLContext*)*strm)[0]; // NOLINT(*)
*strm += sizeof(ctx);
ndim = ((uint32_t*)*strm)[0]; // NOLINT(*)
ndim = ((int*)*strm)[0]; // NOLINT(*)
*strm += sizeof(ndim);
dtype = ((DLDataType*)*strm)[0]; // NOLINT(*)
*strm += sizeof(dtype);
Expand All @@ -85,7 +85,7 @@ int TVMNDArray_Load(TVMNDArray* ret, const char** strm) {
status = -1;
}
int64_t shape[TVM_CRT_MAX_NDIM] = {0};
uint32_t idx;
int32_t idx;
if (ndim != 0) {
for (idx = 0; idx < ndim; idx++) {
shape[idx] = ((int64_t*)*strm)[0]; // NOLINT(*)
Expand Down Expand Up @@ -114,7 +114,7 @@ int TVMNDArray_Load(TVMNDArray* ret, const char** strm) {
return status;
}

TVMNDArray TVMNDArray_CreateView(TVMNDArray* arr, const tvm_index_t* shape, uint32_t ndim,
TVMNDArray TVMNDArray_CreateView(TVMNDArray* arr, const tvm_index_t* shape, int32_t ndim,
DLDataType dtype) {
TVMNDArray ret = TVMNDArray_Create(ndim, shape, dtype, arr->dl_tensor.ctx);
ret.dl_tensor.data = arr->dl_tensor.data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ typedef struct TVMNDArray {
DLTensor dl_tensor;
} TVMNDArray;

TVMNDArray TVMNDArray_Create(uint32_t ndim, const tvm_index_t* shape, DLDataType dtype,
TVMNDArray TVMNDArray_Create(int32_t ndim, const tvm_index_t* shape, DLDataType dtype,
DLContext ctx);

TVMNDArray TVMNDArray_Empty(uint32_t ndim, const tvm_index_t* shape, DLDataType dtype,
TVMNDArray TVMNDArray_Empty(int32_t ndim, const tvm_index_t* shape, DLDataType dtype,
DLContext ctx);

int TVMNDArray_Load(TVMNDArray* ret, const char** strm);

TVMNDArray TVMNDArray_CreateView(TVMNDArray* arr, const tvm_index_t* shape, uint32_t ndim,
TVMNDArray TVMNDArray_CreateView(TVMNDArray* arr, const tvm_index_t* shape, int32_t ndim,
DLDataType dtype);

int TVMNDArray_Release(TVMNDArray* arr);
Expand Down