From 9cbf685920ad371e7629fd93313b964c24d16e3b Mon Sep 17 00:00:00 2001 From: Eric Xu Date: Tue, 10 May 2022 07:55:55 -0700 Subject: [PATCH 1/3] added comments for pll_setting_t struct --- include/acl_pll.h | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/include/acl_pll.h b/include/acl_pll.h index 4314d146..1ef55036 100644 --- a/include/acl_pll.h +++ b/include/acl_pll.h @@ -8,16 +8,18 @@ #include "acl_bsp_io.h" +//Settings for the Phase-Locked-Loop +//note that we use double frequency of the kernel clock for some double-pumped memories typedef struct { - unsigned int freq_khz; - unsigned int m; - unsigned int n; - unsigned int k; - unsigned int c0; - unsigned int c1; - unsigned int r; - unsigned int cp; - unsigned int div; + unsigned int freq_khz; /* output frequency in kHZ */ + unsigned int m; /* multiplier factor */ + unsigned int n; /* 1st divider factor */ + unsigned int k; /* 2nd divider factor */ + unsigned int c0; /* output divider for kernal clock */ + unsigned int c1; /* output divider for double kernal clock */ + unsigned int r; /* lowpass filter setting */ + unsigned int cp; /* charge pump gain setting */ + unsigned int div; /* PLL mode */ } pll_setting_t; typedef struct { From fbd92f91d441a9b4e7bc0b969c28cae4d9e6ebc8 Mon Sep 17 00:00:00 2001 From: Eric Xu Date: Tue, 10 May 2022 09:09:29 -0700 Subject: [PATCH 2/3] Added comments for pll_settings_str --- src/acl_device.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/acl_device.cpp b/src/acl_device.cpp index 71f11a51..e6fe1b94 100644 --- a/src/acl_device.cpp +++ b/src/acl_device.cpp @@ -708,6 +708,8 @@ clReleaseDevice(cl_device_id device) { ACL_EXPORT CL_API_ENTRY cl_int clReconfigurePLLIntelFPGA(cl_device_id device, const char *pll_settings_str) { + // To get the format of the second string argument please refer to the code comments specified + // for struct pll_setting_t in include/acl_pll.h const acl_hal_t *hal; cl_int configure_status; acl_lock(); From f740eabce1681c82700bd219eb1a7beb9f3a53da Mon Sep 17 00:00:00 2001 From: Eric Xu Date: Wed, 11 May 2022 14:00:22 -0700 Subject: [PATCH 3/3] Sanitize changes to adhere with clang format --- include/acl_pll.h | 23 ++++++++++++----------- src/acl_device.cpp | 4 ++-- src/acl_kernel_if.cpp | 5 ++--- src/acl_mem.cpp | 19 ++++++++----------- 4 files changed, 24 insertions(+), 27 deletions(-) diff --git a/include/acl_pll.h b/include/acl_pll.h index 1ef55036..da00aad4 100644 --- a/include/acl_pll.h +++ b/include/acl_pll.h @@ -8,18 +8,19 @@ #include "acl_bsp_io.h" -//Settings for the Phase-Locked-Loop -//note that we use double frequency of the kernel clock for some double-pumped memories +// Settings for the Phase-Locked-Loop +// note that we use double frequency of the kernel clock for some double-pumped +// memories typedef struct { - unsigned int freq_khz; /* output frequency in kHZ */ - unsigned int m; /* multiplier factor */ - unsigned int n; /* 1st divider factor */ - unsigned int k; /* 2nd divider factor */ - unsigned int c0; /* output divider for kernal clock */ - unsigned int c1; /* output divider for double kernal clock */ - unsigned int r; /* lowpass filter setting */ - unsigned int cp; /* charge pump gain setting */ - unsigned int div; /* PLL mode */ + unsigned int freq_khz; /* output frequency in kHZ */ + unsigned int m; /* multiplier factor */ + unsigned int n; /* 1st divider factor */ + unsigned int k; /* 2nd divider factor */ + unsigned int c0; /* output divider for kernal clock */ + unsigned int c1; /* output divider for double kernal clock */ + unsigned int r; /* lowpass filter setting */ + unsigned int cp; /* charge pump gain setting */ + unsigned int div; /* PLL mode */ } pll_setting_t; typedef struct { diff --git a/src/acl_device.cpp b/src/acl_device.cpp index e6fe1b94..210ef231 100644 --- a/src/acl_device.cpp +++ b/src/acl_device.cpp @@ -708,8 +708,8 @@ clReleaseDevice(cl_device_id device) { ACL_EXPORT CL_API_ENTRY cl_int clReconfigurePLLIntelFPGA(cl_device_id device, const char *pll_settings_str) { - // To get the format of the second string argument please refer to the code comments specified - // for struct pll_setting_t in include/acl_pll.h + // To get the format of the second string argument please refer to the code + // comments specified for struct pll_setting_t in include/acl_pll.h const acl_hal_t *hal; cl_int configure_status; acl_lock(); diff --git a/src/acl_kernel_if.cpp b/src/acl_kernel_if.cpp index 9501716a..5ebdf439 100644 --- a/src/acl_kernel_if.cpp +++ b/src/acl_kernel_if.cpp @@ -1211,9 +1211,8 @@ void acl_kernel_if_launch_kernel_on_custom_sof( } else { offset = (unsigned int)KERNEL_OFFSET_INVOCATION_IMAGE; image_p = (uintptr_t) & (image->work_dim); - image_size_static = - (size_t)((uintptr_t) & (image->arg_value) - (uintptr_t) & - (image->work_dim)); + image_size_static = (size_t)( + (uintptr_t) & (image->arg_value) - (uintptr_t) & (image->work_dim)); } if ((kern->io.debug_verbosity) >= 2) { diff --git a/src/acl_mem.cpp b/src/acl_mem.cpp index af10328d..afae7ba2 100644 --- a/src/acl_mem.cpp +++ b/src/acl_mem.cpp @@ -5604,8 +5604,8 @@ void acl_mem_migrate_buffer(void *user_data, acl_device_op_t *op) { #ifdef MEM_DEBUG_MSG printf("release block %zx (%u:%u) ", - (size_t)(src_mem->reserved_allocations[src_device] - [src_mem_id]), + (size_t)( + src_mem->reserved_allocations[src_device][src_mem_id]), src_device, src_mem_id); #endif remove_mem_block_linked_list( @@ -5991,9 +5991,8 @@ static void l_mem_transfer_buffer_explicitly(cl_context context, dst_unmap_cmd.info.mem_xfer.map_flags = CL_MAP_WRITE; } dst_unmap_cmd.info.mem_xfer.src_mem = context->unwrapped_host_mem; - dst_unmap_cmd.info.mem_xfer.src_offset[0] = - (size_t)((char *)dst_mem->host_mem.aligned_ptr - - (char *)ACL_MEM_ALIGN); + dst_unmap_cmd.info.mem_xfer.src_offset[0] = (size_t)( + (char *)dst_mem->host_mem.aligned_ptr - (char *)ACL_MEM_ALIGN); dst_unmap_cmd.info.mem_xfer.src_offset[1] = 0; dst_unmap_cmd.info.mem_xfer.src_offset[2] = 0; dst_unmap_cmd.info.mem_xfer.dst_mem = dst_mem; @@ -6340,9 +6339,8 @@ void acl_copy_device_buffers_to_host_before_programming( cmd.info.mem_xfer.src_offset[2] = 0; cmd.info.mem_xfer.dst_mem = context2->unwrapped_host_mem; if (mem->flags & CL_MEM_USE_HOST_PTR) { - cmd.info.mem_xfer.dst_offset[0] = - (size_t)((char *)mem->fields.buffer_objs.host_ptr - - (char *)ACL_MEM_ALIGN); + cmd.info.mem_xfer.dst_offset[0] = (size_t)( + (char *)mem->fields.buffer_objs.host_ptr - (char *)ACL_MEM_ALIGN); } else { cmd.info.mem_xfer.dst_offset[0] = (size_t)((char *)mem->host_mem.aligned_ptr - (char *)ACL_MEM_ALIGN); @@ -6486,9 +6484,8 @@ void acl_copy_device_buffers_from_host_after_programming( cmd.type = CL_COMMAND_WRITE_BUFFER; cmd.info.mem_xfer.src_mem = context2->unwrapped_host_mem; if (mem->flags & CL_MEM_USE_HOST_PTR) { - cmd.info.mem_xfer.src_offset[0] = - (size_t)((char *)mem->fields.buffer_objs.host_ptr - - (char *)ACL_MEM_ALIGN); + cmd.info.mem_xfer.src_offset[0] = (size_t)( + (char *)mem->fields.buffer_objs.host_ptr - (char *)ACL_MEM_ALIGN); } else { cmd.info.mem_xfer.src_offset[0] = (size_t)((char *)mem->host_mem.aligned_ptr - (char *)ACL_MEM_ALIGN);