/* * Copyright (c) Advanced Micro Devices, Inc., or its affiliates. * * SPDX-License-Identifier: MIT */ #ifdef _WIN64 #define NOMINMAX #endif /* _WIN64 */ #include #include "vulkan_test.hh" #include "signal_semaphore_common.hh" #include "graph_tests_common.hh" /** * @addtogroup hipGraphAddExternalSemaphoresSignalNode hipGraphAddExternalSemaphoresSignalNode * @{ * @ingroup GraphTest * `hipGraphAddExternalSemaphoresSignalNode(hipGraphNode_t* pGraphNode, hipGraph_t graph, const * hipGraphNode_t* pDependencies, size_t numDependencies, const * hipExternalSemaphoreSignalNodeParams* nodeParams);` - Creates a external semaphor signal node and * adds it to a graph. */ /** * Test Description * ------------------------ * - Creates two host visible Vulkan buffers. * - Adds a buffer copy command which will copy from one buffer to another. * - Creates an external Vulkan binary semaphore. * - Creates a Vulkan fence and signals semaphore asynchronously. * - Waits for the operation to finish successfully. * Test source * ------------------------ * - unit/vulkan_interop/hipGraphAddExternalSemaphoresSignalNode.cc * Test requirements * ------------------------ * - HIP_VERSION >= 6.0 */ HIP_TEST_CASE(Unit_hipGraphAddExternalSemaphoresSignalNode_Positive_Basic) { SignalExternalSemaphoreCommon(GraphExtSemaphoreSignalWrapper<>); } // Timeline semaphores unsupported on AMD #if HT_NVIDIA /** * Test Description * ------------------------ * - Creates an external Vulkan timeline semaphore. * - Imports the semaphore and signals. * - Waits for the operation to finish successfully. * Test source * ------------------------ * - unit/vulkan_interop/hipGraphAddExternalSemaphoresSignalNode.cc * Test requirements * ------------------------ * - HIP_VERSION >= 6.0 */ HIP_TEST_CASE(Unit_hipGraphAddExternalSemaphoresSignalNode_Vulkan_Positive_Timeline_Semaphore) { SignalExternalTimelineSemaphoreCommon(GraphExtSemaphoreSignalWrapper<>); } /** * Test Description * ------------------------ * - Creates two host visible Vulkan buffers. * - Adds a buffer copy command which will copy from one buffer to another. * - Creates multiple external Vulkan binary semaphores. * - Createas a Vulkan fence and signals semaphores. * - Waits for the operations to finish successfully. * Test source * ------------------------ * - unit/vulkan_interop/hipGraphAddExternalSemaphoresSignalNode.cc * Test requirements * ------------------------ * - HIP_VERSION >= 6.0 */ HIP_TEST_CASE(Unit_hipGraphAddExternalSemaphoresSignalNode_Vulkan_Positive_Multiple_Semaphores) { SignalExternalMultipleSemaphoresCommon(GraphExtSemaphoreSignalWrapper<>); } #endif /** * Test Description * ------------------------ * - Test to verify hipGraphAddExternalSemaphoresSignalNode behavior with invalid arguments: * -# Nullptr graph * -# Nullptr graph node * -# Invalid numDependencies for null list of dependencies * -# Node in dependency is from different graph * -# Invalid numNodes * -# Duplicate node in dependencies * Test source * ------------------------ * - /unit/vulkan_interop/hipGraphAddExternalSemaphoresSignalNode.cc * Test requirements * ------------------------ * - HIP_VERSION >= 6.0 */ HIP_TEST_CASE(Unit_hipGraphAddExternalSemaphoresSignalNode_Vulkan_Negative_Parameters) { using namespace std::placeholders; hipGraph_t graph = nullptr; HIP_CHECK(hipGraphCreate(&graph, 0)); VulkanTest vkt(enable_validation); hipExternalSemaphoreSignalParams signal_params = {}; signal_params.params.fence.value = 1; auto hip_ext_semaphore = ImportBinarySemaphore(vkt); hipExternalSemaphoreSignalNodeParams node_params = {}; node_params.extSemArray = &hip_ext_semaphore; node_params.paramsArray = &signal_params; node_params.numExtSems = 1; GraphAddNodeCommonNegativeTests( std::bind(hipGraphAddExternalSemaphoresSignalNode, _1, _2, _3, _4, &node_params), graph); HIP_CHECK(hipDestroyExternalSemaphore(hip_ext_semaphore)); HIP_CHECK(hipGraphDestroy(graph)); } /** * End doxygen group GraphTest. * @} */