Skip to content

Commit

Permalink
Fix UB bug in extensions/cl_khr_command_buffer/command_buffer_event_s…
Browse files Browse the repository at this point in the history
…ync.cpp

RunCombufWaitForSecQueueCombuf() is launching two clEnqueueFillBuffer commands
on two separate queues, however both had the same buffer argument, and there
was no synchronization between the commands.

* add an event dependency to the second FillBuffer to ensure correct execution
* change the fill pattern of the first FillBuffer to a different pattern
  • Loading branch information
franz committed Oct 1, 2024
1 parent e88e5fb commit 136e428
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ struct CommandBufferEventSync : public BasicCommandBufferTest

// process secondary queue
error =
clEnqueueFillBuffer(queue_sec, in_mem, &pattern_pri, sizeof(cl_int),
clEnqueueFillBuffer(queue_sec, in_mem, &pattern_sec, sizeof(cl_int),
0, data_size(), 0, nullptr, nullptr);
test_error(error, "clEnqueueFillBuffer failed");

Expand All @@ -594,7 +594,7 @@ struct CommandBufferEventSync : public BasicCommandBufferTest

// process primary queue
error = clEnqueueFillBuffer(queue, in_mem, &pattern_pri, sizeof(cl_int),
0, data_size(), 0, nullptr, event_ptrs[0]);
0, data_size(), 1, &test_event, event_ptrs[0]);
test_error(error, "clEnqueueFillBuffer failed");

cl_event wait_list[] = { test_event,
Expand Down

0 comments on commit 136e428

Please sign in to comment.