@@ -1411,6 +1411,43 @@ static void acl_kernel_if_update_status_query(acl_kernel_if *kern,
1411
1411
}
1412
1412
}
1413
1413
1414
+ // Processes finished kernel invocation.
1415
+ static void acl_kernel_if_update_status_finish (acl_kernel_if *kern,
1416
+ const unsigned int accel_id,
1417
+ const int activation_id,
1418
+ const unsigned int printf_size) {
1419
+ #ifdef TEST_PROFILING_HARDWARE
1420
+ // Test readback of fake profile data using the acl_hal_mmd function that
1421
+ // would be called from the acl runtime.
1422
+ ACL_KERNEL_IF_DEBUG_MSG (kern, " :: testing profile hardware on accel_id=%u.\n " ,
1423
+ accel_id);
1424
+
1425
+ uint64_t data[10 ];
1426
+ acl_hal_mmd_get_profile_data (kern->physical_device_id , accel_id, data, 6 );
1427
+ acl_hal_mmd_reset_profile_counters (kern->physical_device_id , accel_id);
1428
+ acl_hal_mmd_get_profile_data (kern->physical_device_id , accel_id, data, 6 );
1429
+ #endif
1430
+
1431
+ // Just clear the "done" bit. The "go" bit should already have been
1432
+ // cleared, but this is harmless anyway.
1433
+ // Since csr version 19, done bit is cleared when finish counter is read.
1434
+ // Since csr version 2022.3, done bit needs to be cleared explicitly.
1435
+ if (kern->csr_version == CSR_VERSION_ID_18_1 ||
1436
+ kern->csr_version >= CSR_VERSION_ID_2022_3) {
1437
+ unsigned int dum;
1438
+ acl_kernel_cra_write (kern, accel_id, KERNEL_OFFSET_CSR, 0 );
1439
+ acl_kernel_cra_read (kern, accel_id, KERNEL_OFFSET_CSR, &dum);
1440
+ }
1441
+
1442
+ if (kern->accel_num_printfs [accel_id] > 0 ) {
1443
+ ACL_KERNEL_IF_DEBUG_MSG (kern,
1444
+ " :: Calling acl_process_printf_buffer_fn with "
1445
+ " activation_id=%d and printf_size=%u.\n " ,
1446
+ activation_id, printf_size);
1447
+ acl_process_printf_buffer_fn (activation_id, (int )printf_size, 0 );
1448
+ }
1449
+ }
1450
+
1414
1451
// Called when we receive a kernel status interrupt. Cycle through all of
1415
1452
// the running accelerators and check for updated status.
1416
1453
void acl_kernel_if_update_status (acl_kernel_if *kern) {
@@ -1470,36 +1507,8 @@ void acl_kernel_if_update_status(acl_kernel_if *kern) {
1470
1507
// Tell the host library this job is done
1471
1508
kern->accel_job_ids [accel_id][next_queue_back] = -1 ;
1472
1509
1473
- #ifdef TEST_PROFILING_HARDWARE
1474
- // Test readback of fake profile data using the acl_hal_mmd function that
1475
- // would be called from the acl runtime.
1476
- ACL_KERNEL_IF_DEBUG_MSG (
1477
- kern, " :: testing profile hardware on accel_id=%u.\n " , accel_id);
1478
-
1479
- uint64_t data[10 ];
1480
- acl_hal_mmd_get_profile_data (kern->physical_device_id , accel_id, data, 6 );
1481
- acl_hal_mmd_reset_profile_counters (kern->physical_device_id , accel_id);
1482
- acl_hal_mmd_get_profile_data (kern->physical_device_id , accel_id, data, 6 );
1483
- #endif
1484
-
1485
- // Just clear the "done" bit. The "go" bit should already have been
1486
- // cleared, but this is harmless anyway.
1487
- // Since csr version 19, done bit is cleared when finish counter is read.
1488
- // Since csr version 2022.3, done bit needs to be cleared explicitly.
1489
- if (kern->csr_version == CSR_VERSION_ID_18_1 ||
1490
- kern->csr_version >= CSR_VERSION_ID_2022_3) {
1491
- unsigned int dum;
1492
- acl_kernel_cra_write (kern, accel_id, KERNEL_OFFSET_CSR, 0 );
1493
- acl_kernel_cra_read (kern, accel_id, KERNEL_OFFSET_CSR, &dum);
1494
- }
1495
-
1496
- if (kern->accel_num_printfs [accel_id] > 0 ) {
1497
- ACL_KERNEL_IF_DEBUG_MSG (kern,
1498
- " :: Calling acl_process_printf_buffer_fn with "
1499
- " activation_id=%d and printf_size=%u.\n " ,
1500
- activation_id, printf_size);
1501
- acl_process_printf_buffer_fn (activation_id, (int )printf_size, 0 );
1502
- }
1510
+ acl_kernel_if_update_status_finish (kern, accel_id, activation_id,
1511
+ printf_size);
1503
1512
1504
1513
// Executing the following update after reading from performance
1505
1514
// and efficiency monitors will clobber the throughput reported by
0 commit comments