Skip to content

Commit b54670c

Browse files
Add done_cra_writes function to the HAL
This commit adds the `simulation_streaming_interface_done_cra_writes()` function to the HAL. When called, the function signals the simulator that the runtime has finished writing all CRA args for a specific kernel with streaming control interface. This allows the kernell to begin computing and eventually finish any tasks it needs to complete.
1 parent f66baab commit b54670c

File tree

4 files changed

+22
-3
lines changed

4 files changed

+22
-3
lines changed

include/acl_hal.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,9 @@ typedef struct {
245245
void (*simulation_streaming_kernel_done)(unsigned int physical_device_id,
246246
const std::string &signal_name,
247247
unsigned int &finish_counter);
248+
249+
void (*simulation_streaming_interface_done_cra_writes)(
250+
const unsigned int physical_device_id, const int accel_id);
248251
} acl_hal_t;
249252

250253
/// Linked list of MMD library names to load.

include/acl_hal_mmd.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,11 @@ typedef struct {
149149
// accounted and returned in a subsequent invocation of this function.
150150
void (*aocl_mmd_simulation_streaming_kernel_done)(
151151
int handle, const std::string &signal_name, unsigned int &finish_counter);
152+
153+
// Signals a streaming kernel control that all of its CRA arguments have been
154+
// written and that it can start
155+
void (*aocl_mmd_simulation_streaming_interface_done_cra_writes)(
156+
const int device_handle, const int accel_id);
152157
} acl_mmd_dispatch_t;
153158

154159
typedef struct {

src/acl_hal_mmd.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ void acl_hal_mmd_simulation_streaming_kernel_start(
159159
void acl_hal_mmd_simulation_streaming_kernel_done(
160160
unsigned int physical_device_id, const std::string &kernel_name,
161161
unsigned int &finish_counter);
162+
void aocl_mmd_simulation_streaming_interface_done_cra_writes(
163+
unsigned int physical_device_id, const int accel_id);
162164

163165
static size_t acl_kernel_if_read(acl_bsp_io *io, dev_addr_t src, char *dest,
164166
size_t size);
@@ -353,6 +355,7 @@ static acl_hal_t acl_hal_mmd = {
353355
acl_hal_mmd_shared_alloc, // shared_alloc
354356
acl_hal_mmd_simulation_streaming_kernel_start, // simulation_streaming_kernel_start
355357
acl_hal_mmd_simulation_streaming_kernel_done, // simulation_streaming_kernel_done
358+
aocl_mmd_simulation_streaming_interface_done_cra_writes, // simulation_streaming_interface_done_cra_writes
356359
};
357360

358361
// This will contain the device physical id to tell us which device across all
@@ -2823,3 +2826,10 @@ void acl_hal_mmd_simulation_streaming_kernel_done(
28232826
.mmd_dispatch->aocl_mmd_simulation_streaming_kernel_done(
28242827
device_info[physical_device_id].handle, kernel_name, finish_counter);
28252828
}
2829+
2830+
void aocl_mmd_simulation_streaming_interface_done_cra_writes(
2831+
const unsigned int physical_device_id, const int accel_id) {
2832+
device_info[physical_device_id]
2833+
.mmd_dispatch->aocl_mmd_simulation_streaming_interface_done_cra_writes(
2834+
device_info[physical_device_id].handle, accel_id);
2835+
}

src/acl_kernel_if.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,9 +1252,8 @@ void acl_kernel_if_launch_kernel_on_custom_sof(
12521252
offset = (unsigned int)(KERNEL_OFFSET_INVOCATION_IMAGE +
12531253
kern->cra_address_offset);
12541254
image_p = (uintptr_t) & (image->work_dim);
1255-
image_size_static =
1256-
(size_t)((uintptr_t) & (image->arg_value) - (uintptr_t) &
1257-
(image->work_dim));
1255+
image_size_static = (size_t)(
1256+
(uintptr_t) & (image->arg_value) - (uintptr_t) & (image->work_dim));
12581257
}
12591258

12601259
if ((kern->io.debug_verbosity) >= 2) {
@@ -1309,6 +1308,8 @@ void acl_kernel_if_launch_kernel_on_custom_sof(
13091308
acl_get_hal()->simulation_streaming_kernel_start(
13101309
kern->physical_device_id,
13111310
kern->streaming_control_signal_names[accel_id]->start);
1311+
acl_get_hal()->simulation_streaming_interface_done_cra_writes(
1312+
kern->physical_device_id, accel_id);
13121313
return;
13131314
}
13141315

0 commit comments

Comments
 (0)