Skip to content

Fix simulation of multi-memory systems #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Deprecated
### Removed
### Fixed

- Simulation of systems with multiple global memories ([#29]).

### Security

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

## [2022.1] - 2021-12-01

Expand Down
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,13 @@ include(CTest)
# See https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html
include(GNUInstallDirs)

# Windows defines its own versions of min() and max() which conflict with the
# versions from the standard library. Disable the Windows versions by defining
# the NOMINMAX macro. This must be set before including acl.h, which
# eventually leads to the inclusion of windows.h, where the min and max macros
# are defined.
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS NOMINMAX)

# acl_hostxml includes acl.h, but we don't want to create a cyclic dependency,
# so we create a header only library here
add_library(acl_headers INTERFACE)
Expand Down
9 changes: 9 additions & 0 deletions src/acl_mem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4408,6 +4408,15 @@ void acl_resize_reserved_allocations_for_device(cl_mem mem,
unsigned int num_global_mem_systems =
def.autodiscovery_def.num_global_mem_systems;

// For the simulation flow we don't know how many memory systems will exist
// until we load the .aocx, which may not happen until somewhat later.
// Reserving space is quite cheap, so reserve space for many memory systems.
int offline_mode = 0;
(void)acl_get_offline_device_user_setting(&offline_mode);
if (offline_mode == ACL_CONTEXT_MPSIM) {
num_global_mem_systems = std::max(num_global_mem_systems, 128u);
}

#ifdef MEM_DEBUG_MSG
printf(
"resizing reserved_allocations, physical_device_id:%u, target_size:%u \n",
Expand Down