Skip to content

Commit 33093f1

Browse files
authored
Fixed a bug for data reuse in vODLA Adapter. (alibaba#858)
1 parent 4d72737 commit 33093f1

File tree

1 file changed

+9
-22
lines changed

1 file changed

+9
-22
lines changed

ODLA/platforms/vodla/vODLA.cpp

+9-22
Original file line numberDiff line numberDiff line change
@@ -454,14 +454,8 @@ odla_status odla_BindToArgument(odla_value value, const odla_void* data_ptr,
454454
std::cout << "[vODLA] ERROR: input data " << idx << " pointer is NULL.\n";
455455
return ODLA_FAILURE;
456456
}
457-
if (context->ipPtr[idx] != data_ptr) {
458-
context->ipPtr[idx] = data_ptr;
459-
context->dataChg = true;
460-
#ifdef DEBUG
461-
std::cout << "[vODLA] DEBUG: input " << idx << " address changed to "
462-
<< data_ptr << "\n";
463-
#endif
464-
}
457+
context->ipPtr[idx] = data_ptr;
458+
context->dataChg = true;
465459
context->ipNum++;
466460
return ODLA_SUCCESS;
467461
}
@@ -484,14 +478,8 @@ odla_status odla_BindToOutput(odla_value value, odla_void* data_ptr,
484478
std::cout << "[vODLA] ERROR: output data " << idx << " pointer is NULL.\n";
485479
return ODLA_FAILURE;
486480
}
487-
if (context->opPtr[idx] != data_ptr) {
488-
context->opPtr[idx] = data_ptr;
489-
context->dataChg = true;
490-
#ifdef DEBUG
491-
std::cout << "[vODLA] DEBUG: output " << idx << " address changed to "
492-
<< data_ptr << "\n";
493-
#endif
494-
}
481+
context->opPtr[idx] = data_ptr;
482+
context->dataChg = true;
495483
context->opNum++;
496484
return ODLA_SUCCESS;
497485
}
@@ -614,10 +602,6 @@ void deallocDMA(struct vodh_infer_options& vodh_infer_opt,
614602
/*DeAllocate DMA for outputs*/
615603
if (vodh_infer_res.output && op) {
616604
for (u32 i = 0; i < vodh_infer_res.output_num; i++) {
617-
#ifdef DEBUG
618-
printf("output %d data at %p\n", i, vodh_infer_result.output[i]->data);
619-
#endif
620-
621605
vodh_free(vodh_infer_res.output[i]->data);
622606
vodh_infer_res.output[i]->data = NULL;
623607
delete vodh_infer_res.output[i];
@@ -648,6 +632,11 @@ bool allocDMA(struct vodh_infer_options& vodh_infer_opt,
648632

649633
/* Alloc DMA memory for input data */
650634
u32 ip_mem_cap = 0;
635+
#ifdef DEBUG
636+
std::cout << "[vODLA] DEBUG: vodh_infer_opt.input_num "
637+
<< vodh_infer_opt.input_num << " context->ipNum " << context->ipNum
638+
<< std::endl;
639+
#endif
651640
if (vodh_infer_opt.input_num != context->ipNum) {
652641
deallocDMA(vodh_infer_opt, vodh_infer_res, true, false);
653642
vodh_infer_opt.input_num = context->ipNum;
@@ -955,9 +944,7 @@ odla_status odla_ExecuteComputation(odla_computation comp, odla_context context,
955944
vodh_infer_opt.model.use_file = 1; // use file path instead of DMA
956945
vodh_infer_opt.context = context->vodla_context_;
957946
strcpy(vodh_infer_opt.model.weight_file, comp->wtFile.c_str());
958-
#ifdef DEBUG
959947
std::cout << "[vODLA] INFO: start remote inference...\n";
960-
#endif
961948

962949
#ifdef TIMING
963950
std::cout << "[vODLA] INFO: loop " << LOOP_CNT << " times.\n";

0 commit comments

Comments
 (0)