Skip to content
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

Fix TSAN data races #74

Merged
merged 1 commit into from
Feb 18, 2022
Merged

Fix TSAN data races #74

merged 1 commit into from
Feb 18, 2022

Conversation

sherry-yuan
Copy link
Contributor

As found in #71, tsan reported several issues in the acl_test

Currently when release command queue are called (which frees the memory) subsequent still checks the values at the same address which cause tsan to report heap-use-after-free.

The test after_context_release are moved upward to be the first test because ctest execute the test in reverse order of how they appear in the cpp file. Given after_context_release will release the command queue, they should be run last, i.e place at the top in the test.cpp file.

Prerequisit for #63

Closes #71

@sherry-yuan sherry-yuan requested a review from pcolberg February 4, 2022 22:46
sherry-yuan added a commit to sherry-yuan/fpga-runtime-for-opencl that referenced this pull request Feb 4, 2022
@pcolberg pcolberg added this to the 2022.3 milestone Feb 7, 2022
@pcolberg
Copy link
Contributor

pcolberg commented Feb 7, 2022

Thanks @sherry-yuan for addressing thread safety!

I am not quite sure I understand the issue yet. The context context as well as the command queues cq0 and cq1 are created and released locally in test after_context_release. Why would their release affect another test executed afterwards? Would this not be considered a bug in the runtime?

@sherry-yuan
Copy link
Contributor Author

sherry-yuan commented Feb 7, 2022

Why would their release affect another test executed afterwards? Would this not be considered a bug in the runtime?

Thanks for noticing it! I realized this is not the cause after testing it again (probably things started working after multiple change and lead me into thinking all of them together fix the issue).

Updated the newest version to not change test order.

Copy link
Contributor

@pcolberg pcolberg left a comment

Choose a reason for hiding this comment

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

Thanks @sherry-yuan. How about moving the CMake support into a separate commit? This can be benefitial, e.g., when cherry-picking individual commits later, say for a release branch.

------------------------------------------------------

As found in intel#71, tsan reported several issues in the acl_test

Currently when release command queue are called (which frees the memory) subsequent still checks the values at the same address which cause tsan to report heap-use-after-free.
Copy link
Contributor

@pcolberg pcolberg left a comment

Choose a reason for hiding this comment

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

Thanks @sherry-yuan! For the changes in create_with_properties, how can the issues be reproduced? TSAN seems to pass fine with GCC 7.4.0, are these flagged by ASAN instead?

sherry-yuan added a commit to sherry-yuan/fpga-runtime-for-opencl that referenced this pull request Feb 17, 2022
sherry-yuan added a commit to sherry-yuan/fpga-runtime-for-opencl that referenced this pull request Feb 17, 2022
pcolberg
pcolberg previously approved these changes Feb 18, 2022
@pcolberg pcolberg merged commit aca879b into intel:main Feb 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TSAN Detected Data Race: Fix or Note as False Positive
2 participants