Skip to content

Commit b6509d9

Browse files
committed
Move ACL_CONTEXT_MPSIM guard for set_kernel_cra_address_map to HAL MMD
1 parent 8749609 commit b6509d9

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

src/acl_hal_mmd.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1964,6 +1964,10 @@ void acl_hal_mmd_unstall_kernel(unsigned int physical_device_id,
19641964
acl_kernel_if_unstall_kernel(&kern[physical_device_id], activation_id);
19651965
}
19661966

1967+
static bool l_is_simulator_dispatch(acl_mmd_dispatch_t *mmd_dispatch) {
1968+
return mmd_dispatch->aocl_mmd_simulation_device_info != NULL;
1969+
}
1970+
19671971
static void update_simulator(int handle, unsigned int physical_device_id,
19681972
const acl_device_def_autodiscovery_t &dev) {
19691973
std::vector<aocl_mmd_memory_info_t> mem_info(dev.num_global_mem_systems);
@@ -2076,8 +2080,8 @@ int acl_hal_mmd_program_device(unsigned int physical_device_id,
20762080
// cases (e.g. features/printf/test), where there are multiple kernels and
20772081
// resources are released between kernel runs. For the simulator, only print
20782082
// this message once. This is a horrible kludge.
2079-
is_simulator = device_info[physical_device_id]
2080-
.mmd_dispatch->aocl_mmd_simulation_device_info != NULL;
2083+
is_simulator =
2084+
l_is_simulator_dispatch(device_info[physical_device_id].mmd_dispatch);
20812085
msg_printed = (cl_bool)CL_FALSE;
20822086
if (!(is_simulator && msg_printed)) {
20832087
ACL_HAL_DEBUG_MSG_VERBOSE(1, "Reprogramming device [%d] with handle %d\n",
@@ -2988,9 +2992,11 @@ void acl_hal_mmd_simulation_streaming_kernel_done(
29882992
void acl_hal_mmd_simulation_set_kernel_cra_address_map(
29892993
unsigned int physical_device_id,
29902994
const std::vector<uintptr_t> &kernel_csr_address_map) {
2991-
device_info[physical_device_id]
2992-
.mmd_dispatch->aocl_mmd_simulation_set_kernel_cra_address_map(
2993-
device_info[physical_device_id].handle, kernel_csr_address_map);
2995+
if (l_is_simulator_dispatch(device_info[physical_device_id].mmd_dispatch)) {
2996+
device_info[physical_device_id]
2997+
.mmd_dispatch->aocl_mmd_simulation_set_kernel_cra_address_map(
2998+
device_info[physical_device_id].handle, kernel_csr_address_map);
2999+
}
29943000
}
29953001

29963002
size_t acl_hal_mmd_read_csr(unsigned int physical_device_id, uintptr_t offset,

src/acl_kernel_if.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -817,10 +817,8 @@ int acl_kernel_if_update(const acl_device_def_autodiscovery_t &devdef,
817817
devdef.accel[ii].iface.name.c_str(), kern->accel_csr[ii].address,
818818
kern->accel_csr[ii].bytes);
819819
}
820-
if (acl_platform.offline_mode == ACL_CONTEXT_MPSIM) {
821-
acl_get_hal()->simulation_set_kernel_cra_address_map(
822-
kern->physical_device_id, kernel_csr_address_map);
823-
}
820+
acl_get_hal()->simulation_set_kernel_cra_address_map(
821+
kern->physical_device_id, kernel_csr_address_map);
824822

825823
// The Kernel performance monitor registers
826824
for (unsigned ii = 0; ii < devdef.accel.size(); ++ii) {

0 commit comments

Comments
 (0)