Skip to content

Commit 3dd9998

Browse files
committed
Use usable range only for device allocations
1 parent ab79b20 commit 3dd9998

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/acl_device.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,9 +331,19 @@ CL_API_ENTRY cl_int CL_API_CALL clGetDeviceInfoIntelFPGA(
331331
ACL_GLOBAL_MEM_DEVICE_PRIVATE) {
332332
global_mem_size += ACL_RANGE_SIZE(
333333
device->def.autodiscovery_def.global_mem_defs[gmem_idx].range);
334-
cl_ulong curr_size = ACL_RANGE_SIZE(
335-
device->def.autodiscovery_def.global_mem_defs[gmem_idx]
336-
.get_usable_range());
334+
cl_ulong curr_size = 0;
335+
// TODO: investigate if ACL_MEM_ALIGN of 0x400 is still required to
336+
// perform device allocations to memory with 0 starting address
337+
if (device->def.autodiscovery_def.global_mem_defs[gmem_idx]
338+
.allocation_type &
339+
ACL_GLOBAL_MEM_DEVICE_ALLOCATION) {
340+
curr_size = ACL_RANGE_SIZE(
341+
device->def.autodiscovery_def.global_mem_defs[gmem_idx]
342+
.get_usable_range());
343+
} else {
344+
curr_size = ACL_RANGE_SIZE(
345+
device->def.autodiscovery_def.global_mem_defs[gmem_idx].range);
346+
}
337347
if (curr_size > size) {
338348
size = curr_size;
339349
}

0 commit comments

Comments
 (0)