Skip to content

Commit d9df7a9

Browse files
bsyrowikpcolberg
authored andcommitted
Fix simulation of multi-memory systems
When the runtime is initialized it needs to advertise the available devices. For hardware this is fine because we can query the hardware via PCIe, but for the simulation flow we don't know what the board should look like until we receive an aocx file. To work around this restriction, we initialize the simulation flow using the autodiscovery string for the a10gx board. This is often fine, but in cases where we want to simulate a board with more memory systems we will encounter an issue. In particular, targeting different `buffer_location`s in the source will often result in this assertion: ``` /src/acl_device_op.cpp:677: int l_is_noop_migration(acl_device_op_t*): Assertion `src_mem->reserved_allocations[dest_device].size() > dest_mem_id' failed. ``` Ideally we would want to allocate this space dynamically based on the .aocx file; however, we get the .aocx file quite late for simulation flow, after we have already created buffers.
1 parent 5f7a08d commit d9df7a9

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
88
### Deprecated
99
### Removed
1010
### Fixed
11+
12+
- Simulation of systems with multiple global memories ([#29]).
13+
1114
### Security
1215

1316
[Unreleased]: https://github.com/intel/fpga-runtime-for-opencl/compare/v2022.1...HEAD
17+
[#29]: https://github.com/intel/fpga-runtime-for-opencl/pull/29
1418

1519
## [2022.1] - 2021-12-01
1620

src/acl_mem.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4408,6 +4408,15 @@ void acl_resize_reserved_allocations_for_device(cl_mem mem,
44084408
unsigned int num_global_mem_systems =
44094409
def.autodiscovery_def.num_global_mem_systems;
44104410

4411+
// For the simulation flow we don't know how many memory systems will exist
4412+
// until we load the .aocx, which may not happen until somewhat later.
4413+
// Reserving space is quite cheap, so reserve space for many memory systems.
4414+
int offline_mode = 0;
4415+
(void)acl_get_offline_device_user_setting(&offline_mode);
4416+
if (offline_mode == ACL_CONTEXT_MPSIM) {
4417+
num_global_mem_systems = std::max(num_global_mem_systems, 128u);
4418+
}
4419+
44114420
#ifdef MEM_DEBUG_MSG
44124421
printf(
44134422
"resizing reserved_allocations, physical_device_id:%u, target_size:%u \n",

0 commit comments

Comments
 (0)