Add tests for external sharing not dependant on semaphores. (#1648)

* Add tests for external sharing not dependant on semaphores.

Additional external sharing tests that use fences instead of semaphores.

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>

* Fix clang-format

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>

* Apply changes for review.

Apply changes for review:
- Make VkFence + clFinish a synchronization option to existing tests
instead of creating a separate test that uses fence.

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>

* Fix build break.

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>

* Fix resource release conditions.

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>

* Fix fence usage.

Fixed following fence issues:
- Add missing link to command buffer
- Add fence reset before wait

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>

* Add Vulkan wrapper for fence.

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>

* Rework fence reset.

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>

* Change synchronisation mechanisms.

Changes made:
- wait for fence with clFinish
- queue submit with wait for fence

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>

* Replace clFinish with vkWaitForFences.

Replaced clFinish with vkWaitForFences in Vulkan exectution context.

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>

* Replace remaining clFinish with vkWaitForFences.

Replaced remaining clFinish with vkWaitForFences in Vulkan exectution context.

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>

* Fix review comments for synchoronisation simplification.

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>

* Fix review comments for synchoronisation simplification for remaining tests.

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>

* Fix condition check.

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>

---------

Signed-off-by: Paweł Jastrzębski <p.k.jastrzebski@gmail.com>
This commit is contained in:
Paweł Jastrzębski
2023-07-11 17:55:37 +02:00
committed by GitHub
parent 2686b9e2c1
commit 1ab4b26821
4 changed files with 338 additions and 77 deletions

View File

@@ -52,7 +52,8 @@ static void params_reset()
}
extern int test_buffer_common(cl_device_id device_, cl_context context_,
cl_command_queue queue_, int numElements_);
cl_command_queue queue_, int numElements_,
float use_fence);
extern int test_image_common(cl_device_id device_, cl_context context_,
cl_command_queue queue_, int numElements_);
@@ -61,7 +62,7 @@ int test_buffer_single_queue(cl_device_id device_, cl_context context_,
{
params_reset();
log_info("RUNNING TEST WITH ONE QUEUE...... \n\n");
return test_buffer_common(device_, context_, queue_, numElements_);
return test_buffer_common(device_, context_, queue_, numElements_, false);
}
int test_buffer_multiple_queue(cl_device_id device_, cl_context context_,
cl_command_queue queue_, int numElements_)
@@ -69,7 +70,7 @@ int test_buffer_multiple_queue(cl_device_id device_, cl_context context_,
params_reset();
numCQ = 2;
log_info("RUNNING TEST WITH TWO QUEUE...... \n\n");
return test_buffer_common(device_, context_, queue_, numElements_);
return test_buffer_common(device_, context_, queue_, numElements_, false);
}
int test_buffer_multiImport_sameCtx(cl_device_id device_, cl_context context_,
cl_command_queue queue_, int numElements_)
@@ -78,7 +79,7 @@ int test_buffer_multiImport_sameCtx(cl_device_id device_, cl_context context_,
multiImport = true;
log_info("RUNNING TEST WITH MULTIPLE DEVICE MEMORY IMPORT "
"IN SAME CONTEXT...... \n\n");
return test_buffer_common(device_, context_, queue_, numElements_);
return test_buffer_common(device_, context_, queue_, numElements_, false);
}
int test_buffer_multiImport_diffCtx(cl_device_id device_, cl_context context_,
cl_command_queue queue_, int numElements_)
@@ -88,7 +89,45 @@ int test_buffer_multiImport_diffCtx(cl_device_id device_, cl_context context_,
multiCtx = true;
log_info("RUNNING TEST WITH MULTIPLE DEVICE MEMORY IMPORT "
"IN DIFFERENT CONTEXT...... \n\n");
return test_buffer_common(device_, context_, queue_, numElements_);
return test_buffer_common(device_, context_, queue_, numElements_, false);
}
int test_buffer_single_queue_fence(cl_device_id device_, cl_context context_,
cl_command_queue queue_, int numElements_)
{
params_reset();
log_info("RUNNING TEST WITH ONE QUEUE...... \n\n");
return test_buffer_common(device_, context_, queue_, numElements_, true);
}
int test_buffer_multiple_queue_fence(cl_device_id device_, cl_context context_,
cl_command_queue queue_, int numElements_)
{
params_reset();
numCQ = 2;
log_info("RUNNING TEST WITH TWO QUEUE...... \n\n");
return test_buffer_common(device_, context_, queue_, numElements_, true);
}
int test_buffer_multiImport_sameCtx_fence(cl_device_id device_,
cl_context context_,
cl_command_queue queue_,
int numElements_)
{
params_reset();
multiImport = true;
log_info("RUNNING TEST WITH MULTIPLE DEVICE MEMORY IMPORT "
"IN SAME CONTEXT...... \n\n");
return test_buffer_common(device_, context_, queue_, numElements_, true);
}
int test_buffer_multiImport_diffCtx_fence(cl_device_id device_,
cl_context context_,
cl_command_queue queue_,
int numElements_)
{
params_reset();
multiImport = true;
multiCtx = true;
log_info("RUNNING TEST WITH MULTIPLE DEVICE MEMORY IMPORT "
"IN DIFFERENT CONTEXT...... \n\n");
return test_buffer_common(device_, context_, queue_, numElements_, true);
}
int test_image_single_queue(cl_device_id device_, cl_context context_,
cl_command_queue queue_, int numElements_)
@@ -110,6 +149,10 @@ test_definition test_list[] = { ADD_TEST(buffer_single_queue),
ADD_TEST(buffer_multiple_queue),
ADD_TEST(buffer_multiImport_sameCtx),
ADD_TEST(buffer_multiImport_diffCtx),
ADD_TEST(buffer_single_queue_fence),
ADD_TEST(buffer_multiple_queue_fence),
ADD_TEST(buffer_multiImport_sameCtx_fence),
ADD_TEST(buffer_multiImport_diffCtx_fence),
ADD_TEST(image_single_queue),
ADD_TEST(image_multiple_queue),
ADD_TEST(consistency_external_buffer),