Skip to content

Commit

Permalink
Fix TSAN data races
Browse files Browse the repository at this point in the history
------------------------------------------------------

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.
  • Loading branch information
sherry-yuan committed Feb 8, 2022
1 parent 8cd410f commit d1fc462
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions test/acl_command_queue_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,6 @@ MT_TEST(acl_command_queue, create_with_properties) {
CHECK_EQUAL(CL_SUCCESS, clReleaseCommandQueue(cq));
CHECK_EQUAL(1, acl_ref_count(cq));
CHECK_EQUAL(CL_SUCCESS, clReleaseCommandQueue(cq));
CHECK_EQUAL(0, acl_ref_count(cq));
ACL_LOCKED(CHECK(!acl_command_queue_is_valid(cq)));

// wait until all threads do their checks on the 0-ref-count command
// queue before starting the next iteration of the loop and creating new
Expand Down Expand Up @@ -421,8 +419,6 @@ MT_TEST(acl_command_queue, create_with_properties) {
CHECK_EQUAL(CL_SUCCESS, clReleaseCommandQueue(cq));
CHECK_EQUAL(1, acl_ref_count(cq));
CHECK_EQUAL(CL_SUCCESS, clReleaseCommandQueue(cq));
CHECK_EQUAL(0, acl_ref_count(cq));
ACL_LOCKED(CHECK(!acl_command_queue_is_valid(cq)));

// wait until all threads do their checks on the 0-ref-count command
// queue before starting the next iteration of the loop and creating new
Expand Down Expand Up @@ -674,15 +670,6 @@ MT_TEST(acl_command_queue, after_context_release) {
// Should be able to release all the way.
CHECK_EQUAL(CL_SUCCESS, clReleaseCommandQueue(cq0));
CHECK_EQUAL(CL_SUCCESS, clReleaseCommandQueue(cq1));
CHECK_EQUAL(0, acl_ref_count(cq0));
CHECK_EQUAL(0, acl_ref_count(cq1));

ACL_LOCKED(CHECK(!acl_command_queue_is_valid(cq0)));
ACL_LOCKED(CHECK(!acl_command_queue_is_valid(cq1)));

// And once it's gone, it's gone.
CHECK_EQUAL(CL_INVALID_COMMAND_QUEUE, clReleaseCommandQueue(cq0));
CHECK_EQUAL(CL_INVALID_COMMAND_QUEUE, clReleaseCommandQueue(cq1));
}

// Main Event is in an OOO queue. It has a dependent event in an in-order queue.
Expand Down

0 comments on commit d1fc462

Please # to comment.