Unverified Commit 0075d8ce by Samuel Committed by GitHub

[CRT]Compilation warnings fixed for 32bit and 64bit compilation (#5349)

parent baff99c8
...@@ -41,12 +41,12 @@ int main(int argc, char **argv) { ...@@ -41,12 +41,12 @@ int main(int argc, char **argv) {
struct timeval t0, t1, t2, t3, t4, t5; struct timeval t0, t1, t2, t3, t4, t5;
gettimeofday(&t0, 0); gettimeofday(&t0, 0);
auto *handle = tvm_runtime_create(json_data, params_data, params_size); void *handle = tvm_runtime_create(json_data, params_data, params_size);
gettimeofday(&t1, 0); gettimeofday(&t1, 0);
float input_storage[1 * 3 * 224 * 224]; float input_storage[1 * 3 * 224 * 224];
FILE * fp = fopen(argv[1], "rb"); FILE * fp = fopen(argv[1], "rb");
fread(input_storage, 3 * 224 * 224, 4, fp); (void)fread(input_storage, 3 * 224 * 224, 4, fp);
fclose(fp); fclose(fp);
DLTensor input; DLTensor input;
...@@ -85,7 +85,7 @@ int main(int argc, char **argv) { ...@@ -85,7 +85,7 @@ int main(int argc, char **argv) {
float max_iter = -FLT_MAX; float max_iter = -FLT_MAX;
int32_t max_index = -1; int32_t max_index = -1;
for (auto i = 0; i < OUTPUT_LEN; ++i) { for (int i = 0; i < OUTPUT_LEN; ++i) {
if (output_storage[i] > max_iter) { if (output_storage[i] > max_iter) {
max_iter = output_storage[i]; max_iter = output_storage[i];
max_index = i; max_index = i;
......
...@@ -48,7 +48,7 @@ int TVMBackendParallelLaunch(FTVMParallelLambda flambda, void* cdata, int num_ta ...@@ -48,7 +48,7 @@ int TVMBackendParallelLaunch(FTVMParallelLambda flambda, void* cdata, int num_ta
int TVMBackendRegisterSystemLibSymbol(const char* name, void* ptr) { int TVMBackendRegisterSystemLibSymbol(const char* name, void* ptr) {
g_fexecs = vrealloc(g_fexecs, sizeof(TVMPackedFunc) * (g_fexecs_count + 1)); g_fexecs = vrealloc(g_fexecs, sizeof(TVMPackedFunc) * (g_fexecs_count + 1));
snprintf(g_fexecs[g_fexecs_count].name, sizeof(g_fexecs[g_fexecs_count].name), name); snprintf(g_fexecs[g_fexecs_count].name, sizeof(g_fexecs[g_fexecs_count].name), "%s", name);
g_fexecs[g_fexecs_count].fexec = ptr; g_fexecs[g_fexecs_count].fexec = ptr;
g_fexecs_count++; g_fexecs_count++;
return 0; return 0;
......
...@@ -696,13 +696,13 @@ void TVMGraphRuntime_SetupStorage(TVMGraphRuntime * runtime) { ...@@ -696,13 +696,13 @@ void TVMGraphRuntime_SetupStorage(TVMGraphRuntime * runtime) {
runtime->data_entry_count = runtime->node_row_ptr[runtime->node_row_ptr_count - 1]; runtime->data_entry_count = runtime->node_row_ptr[runtime->node_row_ptr_count - 1];
runtime->data_entry = vmalloc(sizeof(TVMNDArray) * runtime->data_entry_count); runtime->data_entry = vmalloc(sizeof(TVMNDArray) * runtime->data_entry_count);
for (idx = 0; idx < runtime->data_entry_count; ++idx) { for (idx = 0; idx < runtime->data_entry_count; ++idx) {
size_t storage_id = attrs->storage_id[idx]; uint32_t storage_id = attrs->storage_id[idx];
CHECK(storage_id < runtime->storage_pool_count); CHECK(storage_id < runtime->storage_pool_count);
runtime->data_entry[idx] = runtime->data_entry[idx] =
TVMNDArray_CreateView(&(runtime->storage_pool[storage_id]), TVMNDArray_CreateView(&(runtime->storage_pool[storage_id]),
attrs->shape+idx*TVM_CRT_MAX_NDIM, attrs->ndim[idx], vtype[idx]); attrs->shape+idx*TVM_CRT_MAX_NDIM, attrs->ndim[idx], vtype[idx]);
CHECK_NE(runtime->data_entry[idx].dl_tensor.data, 0, CHECK_NE(runtime->data_entry[idx].dl_tensor.data, 0,
"fail to create for node with idx=%d, storage_id=%lu\n", idx, storage_id); "fail to create for node with idx=%d, storage_id=%u\n", idx, storage_id);
} }
// Release memory // Release memory
......
...@@ -182,6 +182,7 @@ int JSONReader_ReadString(JSONReader * reader, char * out_str) { ...@@ -182,6 +182,7 @@ int JSONReader_ReadString(JSONReader * reader, char * out_str) {
} }
if (ch == EOF || ch == '\r' || ch == '\n') { if (ch == EOF || ch == '\r' || ch == '\n') {
fprintf(stderr, "Error at line X, Expect \'\"\' but reach end of line\n"); fprintf(stderr, "Error at line X, Expect \'\"\' but reach end of line\n");
status = -1;
} }
} }
snprintf(out_str, sizeof(output), "%s", output); snprintf(out_str, sizeof(output), "%s", output);
......
...@@ -92,8 +92,8 @@ int TVMNDArray_Load(TVMNDArray * ret, const char ** strm) { ...@@ -92,8 +92,8 @@ int TVMNDArray_Load(TVMNDArray * ret, const char ** strm) {
int64_t data_byte_size; int64_t data_byte_size;
data_byte_size = ((int64_t*)*strm)[0]; *strm += sizeof(data_byte_size); // NOLINT(*) data_byte_size = ((int64_t*)*strm)[0]; *strm += sizeof(data_byte_size); // NOLINT(*)
if (!(data_byte_size == num_elems * elem_bytes)) { if (!(data_byte_size == num_elems * elem_bytes)) {
fprintf(stderr, "invalid DLTensor file format: data_byte_size=%ld, " fprintf(stderr, "invalid DLTensor file format: data_byte_size=%jd, "
"while num_elems*elem_bytes=%ld\n", "while num_elems*elem_bytes=%jd\n",
data_byte_size, (num_elems * elem_bytes)); data_byte_size, (num_elems * elem_bytes));
status = -1; status = -1;
} }
......
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