Retain output memory objects for simultaneous command buffer tests (#2429)

Memory objects created in `EnqueueSimultaneousPass()` are used by
kernels
that don't execute until the user event is signaled. Without retaining
these objects, they would be destroyed before the deferred kernel
execution occurs.
This commit is contained in:
Yilong Guo
2025-08-06 00:12:25 +08:00
committed by GitHub
parent da1008c5da
commit dacb944cf3

View File

@@ -337,6 +337,8 @@ struct SimultaneousMutableDispatchTest : public BasicMutableCommandBufferTest
* buffer_size_multiplier, * buffer_size_multiplier,
nullptr, &error); nullptr, &error);
test_error(error, "clCreateBuffer failed"); test_error(error, "clCreateBuffer failed");
// Retain new output memory object until the end of the test.
retained_output_buffers.push_back(new_out_mem);
cl_mutable_dispatch_arg_khr arg_1{ 1, sizeof(new_out_mem), cl_mutable_dispatch_arg_khr arg_1{ 1, sizeof(new_out_mem),
&new_out_mem }; &new_out_mem };
@@ -429,6 +431,8 @@ struct SimultaneousMutableDispatchTest : public BasicMutableCommandBufferTest
clKernelWrapper kernel_fill; clKernelWrapper kernel_fill;
clProgramWrapper program_fill; clProgramWrapper program_fill;
std::vector<clMemWrapper> retained_output_buffers;
const size_t test_global_work_size = 3 * sizeof(cl_int); const size_t test_global_work_size = 3 * sizeof(cl_int);
const cl_int pattern_pri = 42; const cl_int pattern_pri = 42;