SWDEV-491267 - add stream capture test for Semaphore APIs (#572)

Co-authored-by: Li, Todd tiantuo <Toddtiantuo.Li@amd.com>
This commit is contained in:
systems-assistant[bot]
2025-09-21 15:13:30 -07:00
committed by GitHub
parent 5e7210980e
commit 69d96d9e0a
2 changed files with 50 additions and 1 deletions
@@ -21,6 +21,8 @@ THE SOFTWARE.
#include "vulkan_test.hh"
constexpr bool enable_validation = false;
TEST_CASE("Unit_hipDestroyExternalSemaphore_Vulkan_Negative_Parameters") {
SECTION("extSem == nullptr") {
HIP_CHECK_ERROR(hipDestroyExternalSemaphore(nullptr), hipErrorInvalidValue);
@@ -28,7 +30,6 @@ TEST_CASE("Unit_hipDestroyExternalSemaphore_Vulkan_Negative_Parameters") {
// Segfaults in Nvidia and Amd
#if 0
constexpr bool enable_validation = false;
SECTION("Double free") {
VulkanTest vkt(enable_validation);
const auto ext_semaphore = ImportBinarySemaphore(vkt);
@@ -37,3 +38,28 @@ TEST_CASE("Unit_hipDestroyExternalSemaphore_Vulkan_Negative_Parameters") {
}
#endif
}
/**
* Test Description
* ------------------------
* - Test hipDestroyExternalSemaphore while stream is capturing.
* Test source
* ------------------------
* - unit/vulkan_interop/hipDestroyExternalSemaphore.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 6.0
*/
TEST_CASE("Unit_hipDestroyExternalSemaphore_Vulkan_Capture") {
VulkanTest vkt(enable_validation);
const auto semaphore = vkt.CreateExternalSemaphore(VK_SEMAPHORE_TYPE_BINARY);
auto handle_desc = vkt.BuildSemaphoreDescriptor(semaphore, VK_SEMAPHORE_TYPE_BINARY);
hipExternalSemaphore_t ext_semaphore;
hipError_t memcpy_err = hipSuccess;
HIP_CHECK_ERROR(hipImportExternalSemaphore(&ext_semaphore, &handle_desc), memcpy_err);
BEGIN_CAPTURE_SYNC(memcpy_err, true);
HIP_CHECK_ERROR(hipDestroyExternalSemaphore(ext_semaphore), memcpy_err);
END_CAPTURE_SYNC(memcpy_err);
}
@@ -55,4 +55,27 @@ TEST_CASE("Unit_hipImportExternalSemaphore_Vulkan_Negative_Parameters") {
HIP_CHECK_ERROR(hipImportExternalSemaphore(&ext_semaphore, &handle_desc), hipErrorInvalidValue);
}
#endif
}
/**
* Test Description
* ------------------------
* - Test hipImportExternalSemaphore while stream is capturing.
* Test source
* ------------------------
* - unit/vulkan_interop/hipImportExternalSemaphore.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 6.0
*/
TEST_CASE("Unit_hipImportExternalSemaphore_Vulkan_Capture") {
VulkanTest vkt(enable_validation);
const auto semaphore = vkt.CreateExternalSemaphore(VK_SEMAPHORE_TYPE_BINARY);
auto handle_desc = vkt.BuildSemaphoreDescriptor(semaphore, VK_SEMAPHORE_TYPE_BINARY);
hipExternalSemaphore_t ext_semaphore;
hipError_t memcpy_err = hipSuccess;
BEGIN_CAPTURE_SYNC(memcpy_err, true);
HIP_CHECK_ERROR(hipImportExternalSemaphore(&ext_semaphore, &handle_desc), memcpy_err);
END_CAPTURE_SYNC(memcpy_err);
}