Skip to content

Fix build failure with macro MEM_DEBUG_MSG #106

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 3 commits into from
Apr 21, 2022
Merged

Fix build failure with macro MEM_DEBUG_MSG #106

merged 3 commits into from
Apr 21, 2022

Conversation

pcolberg
Copy link
Contributor

@pcolberg pcolberg commented Apr 21, 2022

Found this as part of debugging for implementing #103:

../../src/acl_kernel.cpp:2856:59: error: ‘needed_physical_id’ was not declared in this scope
         printf("needed_physical_id %d needed_mem_id %d ", needed_physical_id,
                                                           ^~~~~~~~~~~~~~~~~~

@pcolberg pcolberg added the bug Something isn't working label Apr 21, 2022
@pcolberg pcolberg added this to the 2022.3 milestone Apr 21, 2022
@pcolberg pcolberg self-assigned this Apr 21, 2022
@pcolberg
Copy link
Contributor Author

pcolberg commented Apr 21, 2022

Klocwork is failing in a guarded section:

#ifdef MEM_DEBUG_MSG
printf("acl_reserve_buffer_block finished block_allocation:%zx, range:%zx - "
"%zx \n",
(size_t)block_allocation, (size_t)(block_allocation->range.begin),
(size_t)(block_allocation->range.next));
#endif

174 (Local) /__w/fpga-runtime-for-opencl/fpga-runtime-for-opencl/src/acl_mem.cpp:4479 UFM.DEREF.MIGHT (1:Critical) Analyze
Object 'block_allocation' was dereferenced at line 4479 after being freed by calling 'acl_delete<acl_block_allocation_t>' at line 4475
  * acl_mem.cpp:4450: block_allocation==nullptr is false
  * acl_mem.cpp:4456: mem->reserved_allocations[physical_device_id] .size() >target_mem_id is true
  * acl_mem.cpp:4457: mem->reserved_allocations[physical_device_id] [target_mem_id] ==0 is true
  * acl_mem.cpp:4458: mem->reserved_allocations_count[physical_device_id] [target_mem_id] ==0 is true
  * acl_mem.cpp:4470: result is false
  * acl_mem.cpp:4475: 'block_allocation' is freed by calling 'acl_delete<acl_block_allocation_t>'.
    * acl_support.h:31: Tracking 't'.
    * acl_support.h:31: 't' is freed by calling 'delete'.
  * acl_mem.cpp:4479: Freed pointer 'block_allocation' is used by calling 'printf'.

@pcolberg pcolberg requested a review from zibaiwan April 21, 2022 03:08
../../src/acl_kernel.cpp:2856:59: error: ‘needed_physical_id’ was not declared in this scope
         printf("needed_physical_id %d needed_mem_id %d ", needed_physical_id,
                                                           ^~~~~~~~~~~~~~~~~~

Signed-off-by: Peter Colberg <[email protected]>
174 (Local) /__w/fpga-runtime-for-opencl/fpga-runtime-for-opencl/src/acl_mem.cpp:4479 UFM.DEREF.MIGHT (1:Critical) Analyze
Object 'block_allocation' was dereferenced at line 4479 after being freed by calling 'acl_delete<acl_block_allocation_t>' at line 4475
  * acl_mem.cpp:4450: block_allocation==nullptr is false
  * acl_mem.cpp:4456: mem->reserved_allocations[physical_device_id] .size() >target_mem_id is true
  * acl_mem.cpp:4457: mem->reserved_allocations[physical_device_id] [target_mem_id] ==0 is true
  * acl_mem.cpp:4458: mem->reserved_allocations_count[physical_device_id] [target_mem_id] ==0 is true
  * acl_mem.cpp:4470: result is false
  * acl_mem.cpp:4475: 'block_allocation' is freed by calling 'acl_delete<acl_block_allocation_t>'.
    * acl_support.h:31: Tracking 't'.
    * acl_support.h:31: 't' is freed by calling 'delete'.
  * acl_mem.cpp:4479: Freed pointer 'block_allocation' is used by calling 'printf'.

Signed-off-by: Peter Colberg <[email protected]>
This prints diagnostic information in acl_mem.cpp and acl_kernel.cpp.

Signed-off-by: Peter Colberg <[email protected]>
Copy link
Contributor

@zibaiwan zibaiwan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this bug Peter!

@pcolberg pcolberg merged commit 02e5316 into intel:main Apr 21, 2022
@pcolberg pcolberg deleted the MEM_DEBUG_MSG branch April 21, 2022 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants