@@ -117,8 +117,8 @@ bool Dpu::LoadElf(const FileSpec &elf_file_path) {
117
117
ModuleSP elf_mod (new Module (elf_file_path, k_dpu_arch));
118
118
119
119
struct dpu_set_t set = dpu_set_from_dpu (m_dpu);
120
- dpu_api_status_t status = dpu_load (set, elf_file_path.GetCString (), NULL );
121
- if (status != DPU_API_SUCCESS )
120
+ dpu_result_t status = dpu_load (set, elf_file_path.GetCString (), NULL );
121
+ if (status != DPU_OK )
122
122
return false ;
123
123
124
124
if (!SetPrintfSequenceAddrsFromRuntimeInfo ())
@@ -151,12 +151,12 @@ bool Dpu::Boot() {
151
151
sizeof (dpuinstruction_t ));
152
152
153
153
int res = dpu_custom_for_dpu (m_dpu, DPU_COMMAND_DPU_PREEXECUTION, NULL );
154
- if (res != DPU_API_SUCCESS )
154
+ if (res != DPU_OK )
155
155
return false ;
156
156
157
157
bool ignored;
158
158
res = dpu_launch_thread_on_dpu (m_dpu, DPU_BOOT_THREAD, false , &ignored);
159
- if (res != DPU_API_SUCCESS )
159
+ if (res != DPU_OK )
160
160
return false ;
161
161
162
162
dpu_is_running = true ;
@@ -245,10 +245,10 @@ bool Dpu::ResumeThreads(llvm::SmallVector<uint32_t, 8> *resume_list,
245
245
if (!m_context->ContextReadyForResumeOrStep ())
246
246
return false ;
247
247
248
- int ret = DPU_API_SUCCESS ;
248
+ int ret = DPU_OK ;
249
249
if (registers_has_been_modified) {
250
250
ret = dpu_restore_context_for_dpu (m_dpu, m_context->Get ());
251
- if (ret != DPU_API_SUCCESS )
251
+ if (ret != DPU_OK )
252
252
return false ;
253
253
registers_has_been_modified = false ;
254
254
}
@@ -310,7 +310,7 @@ bool Dpu::PrepareStepOverPrintfBkp(
310
310
if (stdout_file != NULL ) {
311
311
if (dpulog_read_and_display_contents_of (mram_buffer, mram_buffer_size,
312
312
stdout_file) !=
313
- DPU_API_SUCCESS ) {
313
+ DPU_OK ) {
314
314
goto PrepareStepOverPrintfBkp_err;
315
315
}
316
316
@@ -343,10 +343,10 @@ StateType Dpu::StepThread(uint32_t thread_index, unsigned int *exit_status) {
343
343
if (!m_context->ScheduledThread (thread_index))
344
344
return StateType::eStateStopped;
345
345
346
- int ret = DPU_API_SUCCESS ;
346
+ int ret = DPU_OK ;
347
347
if (registers_has_been_modified) {
348
348
ret = dpu_restore_context_for_dpu (m_dpu, m_context->Get ());
349
- if (ret != DPU_API_SUCCESS )
349
+ if (ret != DPU_OK )
350
350
return StateType::eStateCrashed;
351
351
registers_has_been_modified = false ;
352
352
}
@@ -383,7 +383,7 @@ StateType Dpu::StepThread(uint32_t thread_index, unsigned int *exit_status) {
383
383
return StateType::eStateCrashed;
384
384
}
385
385
386
- if (ret != DPU_API_SUCCESS )
386
+ if (ret != DPU_OK )
387
387
return StateType::eStateCrashed;
388
388
if (!m_context->DpuIsRunning ()) {
389
389
*exit_status = m_context->GetExitStatus ();
@@ -395,13 +395,13 @@ StateType Dpu::StepThread(uint32_t thread_index, unsigned int *exit_status) {
395
395
bool Dpu::WriteWRAM (uint32_t offset, const void *buf, size_t size) {
396
396
std::lock_guard<std::recursive_mutex> guard (m_rank->GetLock ());
397
397
398
- dpu_api_status_t ret;
398
+ dpu_result_t ret;
399
399
// fast path, everything is aligned
400
400
if (((offset & dpuword_size_mod) == 0 ) && ((size & dpuword_size_mod) == 0 )) {
401
401
const dpuword_t *words = static_cast <const dpuword_t *>(buf);
402
402
ret = dpu_copy_to_wram_for_dpu (m_dpu, offset / sizeof (dpuword_t ), words,
403
403
size / sizeof (dpuword_t ));
404
- return ret == DPU_API_SUCCESS ;
404
+ return ret == DPU_OK ;
405
405
}
406
406
407
407
// slow path
@@ -426,7 +426,7 @@ bool Dpu::WriteWRAM(uint32_t offset, const void *buf, size_t size) {
426
426
ret =
427
427
dpu_copy_from_wram_for_dpu (m_dpu, words, final_offset / sizeof (dpuword_t ),
428
428
final_size / sizeof (dpuword_t ));
429
- if (ret != DPU_API_SUCCESS ) {
429
+ if (ret != DPU_OK ) {
430
430
delete[] words;
431
431
return false ;
432
432
}
@@ -439,14 +439,14 @@ bool Dpu::WriteWRAM(uint32_t offset, const void *buf, size_t size) {
439
439
final_size / sizeof (dpuword_t ));
440
440
441
441
delete[] words;
442
- return ret == DPU_API_SUCCESS ;
442
+ return ret == DPU_OK ;
443
443
}
444
444
445
445
bool Dpu::ReadWRAM (uint32_t offset, void *buf, size_t size) {
446
446
std::lock_guard<std::recursive_mutex> guard (m_rank->GetLock ());
447
447
dpuword_t *words = static_cast <dpuword_t *>(buf);
448
448
449
- dpu_api_status_t ret;
449
+ dpu_result_t ret;
450
450
size_t final_size =
451
451
size + sizeof (dpuword_t ) - 1 + (offset & dpuword_size_mod);
452
452
@@ -470,20 +470,20 @@ bool Dpu::ReadWRAM(uint32_t offset, void *buf, size_t size) {
470
470
ret = dpu_copy_from_wram_for_dpu (m_dpu, words, offset / sizeof (dpuword_t ),
471
471
size / sizeof (dpuword_t ));
472
472
}
473
- return ret == DPU_API_SUCCESS ;
473
+ return ret == DPU_OK ;
474
474
}
475
475
476
476
bool Dpu::WriteIRAM (uint32_t offset, const void *buf, size_t size) {
477
477
std::lock_guard<std::recursive_mutex> guard (m_rank->GetLock ());
478
478
479
- dpu_api_status_t ret;
479
+ dpu_result_t ret;
480
480
// fast path, everything is aligned
481
481
if (((offset & instruction_size_mod) == 0 ) &&
482
482
((size & instruction_size_mod) == 0 )) {
483
483
const dpuinstruction_t *instrs = static_cast <const dpuinstruction_t *>(buf);
484
484
ret = dpu_copy_to_iram_for_dpu (m_dpu, offset / sizeof (dpuinstruction_t ),
485
485
instrs, size / sizeof (dpuinstruction_t ));
486
- return ret == DPU_API_SUCCESS ;
486
+ return ret == DPU_OK ;
487
487
}
488
488
489
489
// slow path
@@ -508,7 +508,7 @@ bool Dpu::WriteIRAM(uint32_t offset, const void *buf, size_t size) {
508
508
ret = dpu_copy_from_iram_for_dpu (m_dpu, instrs,
509
509
final_offset / sizeof (dpuinstruction_t ),
510
510
final_size / sizeof (dpuinstruction_t ));
511
- if (ret != DPU_API_SUCCESS ) {
511
+ if (ret != DPU_OK ) {
512
512
delete[] instrs;
513
513
return false ;
514
514
}
@@ -521,14 +521,14 @@ bool Dpu::WriteIRAM(uint32_t offset, const void *buf, size_t size) {
521
521
instrs, final_size / sizeof (dpuinstruction_t ));
522
522
523
523
delete[] instrs;
524
- return ret == DPU_API_SUCCESS ;
524
+ return ret == DPU_OK ;
525
525
}
526
526
527
527
bool Dpu::ReadIRAM (uint32_t offset, void *buf, size_t size) {
528
528
std::lock_guard<std::recursive_mutex> guard (m_rank->GetLock ());
529
529
dpuinstruction_t *instrs = static_cast <dpuinstruction_t *>(buf);
530
530
531
- dpu_api_status_t ret;
531
+ dpu_result_t ret;
532
532
size_t final_size =
533
533
size + sizeof (dpuinstruction_t ) - 1 + (offset & instruction_size_mod);
534
534
@@ -554,23 +554,23 @@ bool Dpu::ReadIRAM(uint32_t offset, void *buf, size_t size) {
554
554
offset / sizeof (dpuinstruction_t ),
555
555
size / sizeof (dpuinstruction_t ));
556
556
}
557
- return ret == DPU_API_SUCCESS ;
557
+ return ret == DPU_OK ;
558
558
}
559
559
560
560
bool Dpu::WriteMRAM (uint32_t offset, const void *buf, size_t size) {
561
561
std::lock_guard<std::recursive_mutex> guard (m_rank->GetLock ());
562
562
const uint8_t *bytes = static_cast <const uint8_t *>(buf);
563
563
564
- dpu_api_status_t ret = dpu_copy_to_mram (m_dpu, offset, bytes, size, 0 );
565
- return ret == DPU_API_SUCCESS ;
564
+ dpu_result_t ret = dpu_copy_to_mram (m_dpu, offset, bytes, size, 0 );
565
+ return ret == DPU_OK ;
566
566
}
567
567
568
568
bool Dpu::ReadMRAM (uint32_t offset, void *buf, size_t size) {
569
569
std::lock_guard<std::recursive_mutex> guard (m_rank->GetLock ());
570
570
uint8_t *bytes = static_cast <uint8_t *>(buf);
571
571
572
- dpu_api_status_t ret = dpu_copy_from_mram (m_dpu, bytes, offset, size, 0 );
573
- return ret == DPU_API_SUCCESS ;
572
+ dpu_result_t ret = dpu_copy_from_mram (m_dpu, bytes, offset, size, 0 );
573
+ return ret == DPU_OK ;
574
574
}
575
575
576
576
bool Dpu::AllocIRAMBuffer (uint8_t **iram, uint32_t *iram_size) {
@@ -596,24 +596,24 @@ bool Dpu::GenerateSaveCore(const char *exe_path, const char *core_file_path,
596
596
uint8_t *wram = new uint8_t [wram_size];
597
597
uint8_t *mram = new uint8_t [mram_size];
598
598
599
- dpu_api_status_t status;
599
+ dpu_result_t status;
600
600
if (wram != NULL && mram != NULL ) {
601
601
status = dpu_copy_from_wram_for_dpu (m_dpu, (dpuword_t *)wram, 0 ,
602
602
nb_word_in_wram);
603
- if (status != DPU_API_SUCCESS )
603
+ if (status != DPU_OK )
604
604
goto dpu_generate_save_core_exit;
605
605
status = dpu_copy_from_mram (m_dpu, mram, 0 , mram_size, DPU_PRIMARY_MRAM);
606
- if (status != DPU_API_SUCCESS )
606
+ if (status != DPU_OK )
607
607
goto dpu_generate_save_core_exit;
608
608
609
609
status =
610
610
dpu_create_core_dump (rank, exe_path, core_file_path, m_context->Get (),
611
611
wram, mram, iram, wram_size, mram_size, iram_size);
612
- if (status != DPU_API_SUCCESS )
612
+ if (status != DPU_OK )
613
613
goto dpu_generate_save_core_exit;
614
614
615
615
} else {
616
- status = DPU_API_SYSTEM_ERROR ;
616
+ status = DPU_ERR_SYSTEM ;
617
617
}
618
618
619
619
dpu_generate_save_core_exit:
@@ -695,7 +695,7 @@ unsigned int Dpu::GetDpuID() { return dpu_get_member_id(m_dpu); }
695
695
696
696
bool Dpu::SaveSliceContext (uint64_t structure_value, uint64_t slice_target,
697
697
dpu_bitfield_t host_mux_mram_state) {
698
- bool success = dpu_save_slice_context_for_dpu (m_dpu) == DPU_API_SUCCESS ;
698
+ bool success = dpu_save_slice_context_for_dpu (m_dpu) == DPU_OK ;
699
699
if (!success)
700
700
return false ;
701
701
@@ -705,7 +705,7 @@ bool Dpu::SaveSliceContext(uint64_t structure_value, uint64_t slice_target,
705
705
}
706
706
707
707
bool Dpu::RestoreSliceContext () {
708
- return dpu_restore_slice_context_for_dpu (m_dpu) == DPU_API_SUCCESS ;
708
+ return dpu_restore_slice_context_for_dpu (m_dpu) == DPU_OK ;
709
709
}
710
710
711
711
void Dpu::SetAttachSession () { attach_session = true ; }
0 commit comments