Skip to content

Commit

Permalink
[CRT]Compilation warnings fixed for 32bit and 64bit compilation (apac…
Browse files Browse the repository at this point in the history
  • Loading branch information
siju-samuel authored and Trevor Morris committed Jun 18, 2020
1 parent 26c693b commit a24c38a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
6 changes: 3 additions & 3 deletions apps/bundle_deploy/demo_static.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ int main(int argc, char **argv) {
struct timeval t0, t1, t2, t3, t4, t5;
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);

float input_storage[1 * 3 * 224 * 224];
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);

DLTensor input;
Expand Down Expand Up @@ -85,7 +85,7 @@ int main(int argc, char **argv) {

float max_iter = -FLT_MAX;
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) {
max_iter = output_storage[i];
max_index = i;
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/crt/crt_backend_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ int TVMBackendParallelLaunch(FTVMParallelLambda flambda, void* cdata, int num_ta

int TVMBackendRegisterSystemLibSymbol(const char* name, void* ptr) {
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_count++;
return 0;
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/crt/graph_runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 = vmalloc(sizeof(TVMNDArray) * runtime->data_entry_count);
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);
runtime->data_entry[idx] =
TVMNDArray_CreateView(&(runtime->storage_pool[storage_id]),
attrs->shape+idx*TVM_CRT_MAX_NDIM, attrs->ndim[idx], vtype[idx]);
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
Expand Down
1 change: 1 addition & 0 deletions src/runtime/crt/load_json.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ int JSONReader_ReadString(JSONReader * reader, char * out_str) {
}
if (ch == EOF || ch == '\r' || ch == '\n') {
fprintf(stderr, "Error at line X, Expect \'\"\' but reach end of line\n");
status = -1;
}
}
snprintf(out_str, sizeof(output), "%s", output);
Expand Down
8 changes: 4 additions & 4 deletions src/runtime/crt/ndarray.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
Expand Down Expand Up @@ -92,8 +92,8 @@ int TVMNDArray_Load(TVMNDArray * ret, const char ** strm) {
int64_t data_byte_size;
data_byte_size = ((int64_t*)*strm)[0]; *strm += sizeof(data_byte_size); // NOLINT(*)
if (!(data_byte_size == num_elems * elem_bytes)) {
fprintf(stderr, "invalid DLTensor file format: data_byte_size=%ld, "
"while num_elems*elem_bytes=%ld\n",
fprintf(stderr, "invalid DLTensor file format: data_byte_size=%jd, "
"while num_elems*elem_bytes=%jd\n",
data_byte_size, (num_elems * elem_bytes));
status = -1;
}
Expand Down

0 comments on commit a24c38a

Please sign in to comment.