diff --git a/projects/hip-tests/catch/hipTestMain/config/config_amd_linux_MI2xx.json b/projects/hip-tests/catch/hipTestMain/config/config_amd_linux_MI2xx.json index ee1afd5acc..a7f158e9b4 100644 --- a/projects/hip-tests/catch/hipTestMain/config/config_amd_linux_MI2xx.json +++ b/projects/hip-tests/catch/hipTestMain/config/config_amd_linux_MI2xx.json @@ -9,17 +9,17 @@ "Unit_BuiltinAtomicsRTC__fminCoherentGlobalMem", "Unit_BuiltInAtomicAdd_CoherentGlobalMemWithRtc", "Unit_hipMemGetAddressRange_Negative", - "Unit_hipExternalMemoryGetMappedBuffer_Vulkan_Positive_Read_Write", - "Unit_hipExternalMemoryGetMappedBuffer_Vulkan_Negative_Parameters", - "Unit_hipImportExternalMemory_Vulkan_Negative_Parameters", - "Unit_hipWaitExternalSemaphoresAsync_Vulkan_Positive_Binary_Semaphore", - "Unit_hipWaitExternalSemaphoresAsync_Vulkan_Positive_Multiple_Semaphores", - "Unit_hipWaitExternalSemaphoresAsync_Vulkan_Negative_Parameters", - "Unit_hipSignalExternalSemaphoresAsync_Vulkan_Positive_Binary_Semaphore", - "Unit_hipSignalExternalSemaphoresAsync_Vulkan_Positive_Multiple_Semaphores", - "Unit_hipSignalExternalSemaphoresAsync_Vulkan_Negative_Parameters", - "Unit_hipImportExternalSemaphore_Vulkan_Negative_Parameters", - "Unit_hipDestroyExternalSemaphore_Vulkan_Negative_Parameters" + "Unit_hipExternalMemoryGetMappedBuffer_Vulkan_Positive_Read_Write", + "Unit_hipExternalMemoryGetMappedBuffer_Vulkan_Negative_Parameters", + "Unit_hipImportExternalMemory_Vulkan_Negative_Parameters", + "Unit_hipWaitExternalSemaphoresAsync_Vulkan_Positive_Binary_Semaphore", + "Unit_hipWaitExternalSemaphoresAsync_Vulkan_Positive_Multiple_Semaphores", + "Unit_hipWaitExternalSemaphoresAsync_Vulkan_Negative_Parameters", + "Unit_hipSignalExternalSemaphoresAsync_Vulkan_Positive_Binary_Semaphore", + "Unit_hipSignalExternalSemaphoresAsync_Vulkan_Positive_Multiple_Semaphores", + "Unit_hipSignalExternalSemaphoresAsync_Vulkan_Negative_Parameters", + "Unit_hipImportExternalSemaphore_Vulkan_Negative_Parameters", + "Unit_hipDestroyExternalSemaphore_Vulkan_Negative_Parameters" ] } diff --git a/projects/hip-tests/catch/include/hip_test_defgroups.hh b/projects/hip-tests/catch/include/hip_test_defgroups.hh index b0e57cd791..d7ff394a8b 100644 --- a/projects/hip-tests/catch/include/hip_test_defgroups.hh +++ b/projects/hip-tests/catch/include/hip_test_defgroups.hh @@ -57,6 +57,14 @@ THE SOFTWARE. * @} */ +/** + * @defgroup PeerToPeerTest PeerToPeer Device Memory Access + * @{ + * This section describes tests for the PeerToPeer device memory access functions of HIP runtime API. + * @warning PeerToPeer support is experimental. + * @} + */ + /** * @defgroup ShflTest warp shuffle function Management * @{ @@ -64,6 +72,14 @@ THE SOFTWARE. * @} */ +/** + * @defgroup ContextTest Context Management + * @{ + * This section describes tests for the context management functions of HIP runtime API. + * @warning All Context Management APIs are **deprecated** and shall not be implemented. + * @} + */ + /** * @defgroup StreamTest Stream Management * @{ diff --git a/projects/hip-tests/catch/unit/device/hipDeviceCanAccessPeer.cc b/projects/hip-tests/catch/unit/device/hipDeviceCanAccessPeer.cc index 5945d51224..78d2ac5ca5 100644 --- a/projects/hip-tests/catch/unit/device/hipDeviceCanAccessPeer.cc +++ b/projects/hip-tests/catch/unit/device/hipDeviceCanAccessPeer.cc @@ -23,16 +23,26 @@ THE SOFTWARE. #include #include -/* - Positive tests: - - for each peer check other peer access - - Negative tests: - - canAccessPeer pointer is nullptr - - deviceId is invalid - - peerDeviceId is invalid -*/ +/** + * @addtogroup hipDeviceCanAccessPeer hipDeviceCanAccessPeer + * @{ + * @ingroup PeerToPeerTest + * `hipDeviceCanAccessPeer(int* canAccessPeer, int deviceId, int peerDeviceId)` - + * Determine if a device can access a peer's memory. + */ +/** + * Test Description + * ------------------------ + * - Verifies that each available device can access memory from all other devices. + * Test source + * ------------------------ + * - unit/device/hipDeviceCanAccessPeer.cc + * Test requirements + * ------------------------ + * - Multi-device + * - HIP_VERSION >= 5.2 + */ TEST_CASE("Unit_hipDeviceCanAccessPeer_positive") { int canAccessPeer = 0; int deviceCount = HipTest::getGeviceCount(); @@ -54,7 +64,24 @@ TEST_CASE("Unit_hipDeviceCanAccessPeer_positive") { } } - +/** + * Test Description + * ------------------------ + * - Verifies handling of invalid arguments: + * -# When output pointer to the peer result is `nullptr` + * - Expected output: return `hipErrorInvalidValue` + * -# When device ID is invalid (-1 or out of bounds) + * - Expected output: return `hipErrorInvalidDevice` + * -# When peer device ID is invalid (-1 or out of bounds) + * - Expected output: return `hipErrorInvalidDevice` + * Test source + * ------------------------ + * - unit/device/hipDeviceCanAccessPeer.cc + * Test requirements + * ------------------------ + * - Multi-device + * - HIP_VERSION >= 5.2 + */ TEST_CASE("Unit_hipDeviceCanAccessPeer_negative") { int canAccessPeer = 0; int deviceCount = HipTest::getGeviceCount(); diff --git a/projects/hip-tests/catch/unit/device/hipDeviceEnableDisablePeerAccess.cc b/projects/hip-tests/catch/unit/device/hipDeviceEnableDisablePeerAccess.cc index d6cd24853d..bf85cbe0e8 100644 --- a/projects/hip-tests/catch/unit/device/hipDeviceEnableDisablePeerAccess.cc +++ b/projects/hip-tests/catch/unit/device/hipDeviceEnableDisablePeerAccess.cc @@ -23,16 +23,29 @@ THE SOFTWARE. #include #include -/* - Positive tests: - - for each peer change and check other peer access +/** + * @addtogroup hipDeviceEnablePeerAccess hipDeviceEnablePeerAccess + * @{ + * @ingroup PeerToPeerTest + * `hipDeviceEnablePeerAccess(int peerDeviceId, unsigned int flags)` - + * Enable direct access from current device's virtual address space to memory allocations + * physically located on a peer device. + */ - Negative tests: - - peerDeviceId is invalid - - flag value is invalid - - peer access is enabled/disabled twice - - peer access is disabled before being enabled -*/ +/** + * Test Description + * ------------------------ + * - Enables peer access for each GPU pair. + * - Disables peer access for each GPU pair. + * Test source + * ------------------------ + * - unit/device/hipDeviceEnableDisablePeerAccess.cc + * Test requirements + * ------------------------ + * - PeerToPeer supported + * - Multi-device + * - HIP_VERSION >= 5.2 + */ TEST_CASE("Unit_hipDeviceEnableDisablePeerAccess_positive") { int canAccessPeer = 0; int deviceCount = HipTest::getGeviceCount(); @@ -56,7 +69,24 @@ TEST_CASE("Unit_hipDeviceEnableDisablePeerAccess_positive") { } } - +/** + * Test Description + * ------------------------ + * - Validates handling of invalid arguments: + * -# When peer device ID is invalid (-1 or out of bounds) + * - Expected output: return `hipErrorInvalidDevice` + * -# When flag is invalid (-1) + * - Expected output: return `hipErrorInvalidValue` + * -# When peer access has already been enabled + * - Expected output: return `hipErrorPeerAccessAleadyEnabled` + * Test source + * ------------------------ + * - unit/device/hipDeviceEnableDisablePeerAccess.cc + * Test requirements + * ------------------------ + * - Multi-device + * - HIP_VERSION >= 5.2 + */ TEST_CASE("Unit_hipDeviceEnablePeerAccess_negative") { int deviceCount = HipTest::getGeviceCount(); if (deviceCount < 2) { @@ -86,6 +116,41 @@ TEST_CASE("Unit_hipDeviceEnablePeerAccess_negative") { } } +/** + * End doxygen group hipDeviceEnablePeerAccess. + * @} + */ + +/** + * @addtogroup hipDeviceDisablePeerAccess hipDeviceDisablePeerAccess + * @{ + * @ingroup PeerToPeerTest + * hipDeviceDisablePeerAccess(int peerDeviceId)` - + * Disable direct access from current device's virtual address space + * to memory allocations physically located on a peer device. + * ________________________ + * Test cases from other modules: + * - @ref Unit_hipDeviceEnableDisablePeerAccess_positive + */ + +/** + * Test Description + * ------------------------ + * - Validates handling of invalid arguments: + * -# When peer device ID is invalid (-1 or out of bounds) + * - Expected output: return `hipErrorInvalidDevice` + * -# When peer access is not enabled + * - Expected output: return `hipErrorPeerAccessNotEnabled` + * -# When peer access is already disabled + * - Expected output: return `hipErrorPeerAccessNotEnabled` + * Test source + * ------------------------ + * - unit/device/hipDeviceEnableDisablePeerAccess.cc + * Test requirements + * ------------------------ + * - Multi-device + * - HIP_VERSION >= 5.2 + */ TEST_CASE("Unit_hipDeviceDisablePeerAccess_negative") { int deviceCount = HipTest::getGeviceCount(); if (deviceCount < 2) { diff --git a/projects/hip-tests/catch/unit/memory/hipMemGetAddressRange.cc b/projects/hip-tests/catch/unit/memory/hipMemGetAddressRange.cc index d63433c696..c6237bbd11 100644 --- a/projects/hip-tests/catch/unit/memory/hipMemGetAddressRange.cc +++ b/projects/hip-tests/catch/unit/memory/hipMemGetAddressRange.cc @@ -16,17 +16,35 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* -Testcase Scenarios : -Unit_hipMemGetAddressRange_Positive - Test hipMemGetAddressRange api for various memory allocation -types and offsets Unit_hipMemGetAddressRange_Negative - Test unsuccessful execution of -hipMemGetAddressRange api when parameters are invalid -*/ + #include #include #include #include +/** + * @addtogroup hipMemGetAddressRange hipMemGetAddressRange + * @{ + * @ingroup PeerToPeerTest + * `hipMemGetAddressRange(hipDeviceptr_t* pbase, size_t* psize, hipDeviceptr_t dptr)` - + * Get information on memory allocations. + */ + +/** + * Test Description + * ------------------------ + * - Allocate memory and check if base and size match allocated memory values. + * - Check for various offset values from base memory address: + * - Host address range + * - Device address range + * - Pitch address range + * Test source + * ------------------------ + * - unit/memory/hipMemGetAddressRange.cc + * Test requirements + * ------------------------ + * - HIP_VERSION >= 5.2 + */ TEST_CASE("Unit_hipMemGetAddressRange_Positive") { hipDeviceptr_t base_ptr; size_t mem_size = 0; @@ -67,6 +85,21 @@ TEST_CASE("Unit_hipMemGetAddressRange_Positive") { } } +/** + * Test Description + * ------------------------ + * - Validates handling of invalid arguments: + * -# When device handle is not valid + * - Expected output: return `hipErrorNotFound` + * -# When offset is greated than allocated size + * - Expected output: return `hipErrorNotFound` + * Test source + * ------------------------ + * - unit/memory/hipMemGetAddressRange.cc + * Test requirements + * ------------------------ + * - HIP_VERSION >= 5.2 + */ TEST_CASE("Unit_hipMemGetAddressRange_Negative") { hipDeviceptr_t base_ptr; size_t mem_size = 0; diff --git a/projects/hip-tests/catch/unit/memory/hipMemcpyPeer.cc b/projects/hip-tests/catch/unit/memory/hipMemcpyPeer.cc index 8c91281cf6..95698b63df 100644 --- a/projects/hip-tests/catch/unit/memory/hipMemcpyPeer.cc +++ b/projects/hip-tests/catch/unit/memory/hipMemcpyPeer.cc @@ -16,21 +16,35 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* -Testcase Scenarios : -Unit_hipMemcpyPeer_Positive_Default - Test basic P2P memcpy between two devices -with hipMemcpyPeer api Unit_hipMemcpyPeer_Positive_Synchronization_Behavior - -Test synchronization behavior for hipMemcpyPeer api -Unit_hipMemcpyPeer_Positive_ZeroSize - Test that no data is copied when -sizeBytes is set to 0 Unit_hipMemcpyPeer_Negative_Parameters - Test unsuccessful -execution of hipMemcpyPeer api when parameters are invalid -*/ + #include #include #include #include +/** + * @addtogroup hipMemcpyPeer hipMemcpyPeer + * @{ + * @ingroup PeerToPeerTest + * `hipMemcpyPeer(void* dst, int dstDeviceId, const void* src, + * int srcDeviceId, size_t sizeBytes)` - + * Copies memory from one device to memory on another device. + */ +/** + * Test Description + * ------------------------ + * - Performs basic peer to peer memcpy functionality between each pair of devices. + * - Launches computation kernel. + * Test source + * ------------------------ + * - unit/memory/hipMemcpyPeer.cc + * Test requirements + * ------------------------ + * - Peer access supported + * - Multi-device + * - HIP_VERSION >= 5.2 + */ TEST_CASE("Unit_hipMemcpyPeer_Positive_Default") { const auto device_count = HipTest::getDeviceCount(); if (device_count < 2) { @@ -77,6 +91,19 @@ TEST_CASE("Unit_hipMemcpyPeer_Positive_Default") { } } +/** + * Test Description + * ------------------------ + * - Checks synchronization behavior for peer memcpy. + * Test source + * ------------------------ + * - unit/memory/hipMemcpyPeer.cc + * Test requirements + * ------------------------ + * - Peer access supported + * - Multi-device + * - HIP_VERSION >= 5.2 + */ TEST_CASE("Unit_hipMemcpyPeer_Positive_Synchronization_Behavior") { HIP_CHECK(hipDeviceSynchronize()); @@ -111,6 +138,19 @@ TEST_CASE("Unit_hipMemcpyPeer_Positive_Synchronization_Behavior") { } } +/** + * Test Description + * ------------------------ + * - Checks that no data is copied if size is set to 0. + * Test source + * ------------------------ + * - unit/memory/hipMemcpyPeer.cc + * Test requirements + * ------------------------ + * - Peer access supported + * - Multi-device + * - HIP_VERSION >= 5.2 + */ TEST_CASE("Unit_hipMemcpyPeer_Positive_ZeroSize") { const auto device_count = HipTest::getDeviceCount(); if (device_count < 2) { @@ -151,7 +191,6 @@ TEST_CASE("Unit_hipMemcpyPeer_Positive_ZeroSize") { constexpr int set_value_h = 21; std::fill_n(result.host_ptr(), element_count, set_value_h); - HIP_CHECK(hipMemcpyPeer(dst_alloc.ptr(), dst_device, src_alloc.ptr(), src_device, 0)); HIP_CHECK( @@ -165,6 +204,29 @@ TEST_CASE("Unit_hipMemcpyPeer_Positive_ZeroSize") { } } +/** + * Test Description + * ------------------------ + * - Validates handling of invalid arguments: + * -# When output destination pointer is `nullptr` + * - Expected output: return `hipErrorInvalidValue` + * -# When source pointer is `nullptr` + * - Expected output: return `hipErrorInvalidValue` + * -# When copying more than allocated + * - Expected output: return `hipErrorInvalidValue` + * -# When destination device ID is not valid (out of bounds) + * - Expected output: return `hipErrorInvalidDevice` + * -# When source device ID is not valid (out of bounds) + * - Expected output: return `hipErrorInvalidDevice` + * Test source + * ------------------------ + * - unit/memory/hipMemcpyPeer.cc + * Test requirements + * ------------------------ + * - Peer access supported + * - Multi-device + * - HIP_VERSION >= 5.2 + */ TEST_CASE("Unit_hipMemcpyPeer_Negative_Parameters") { const auto device_count = HipTest::getDeviceCount(); if (device_count < 2) { diff --git a/projects/hip-tests/catch/unit/memory/hipMemcpyPeerAsync.cc b/projects/hip-tests/catch/unit/memory/hipMemcpyPeerAsync.cc index a84ade3329..d86da680d2 100644 --- a/projects/hip-tests/catch/unit/memory/hipMemcpyPeerAsync.cc +++ b/projects/hip-tests/catch/unit/memory/hipMemcpyPeerAsync.cc @@ -16,22 +16,35 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* -Testcase Scenarios : -Unit_hipMemcpyPeerAsync_Positive_Default - Test basic P2P async memcpy between -two devices with hipMemcpyPeerAsync api -Unit_hipMemcpyPeerAsync_Positive_Synchronization_Behavior - Test synchronization -behavior for hipMemcpyPeerAsync api Unit_hipMemcpyPeerAsync_Positive_ZeroSize - -Test that no data is copied when sizeBytes is set to 0 -Unit_hipMemcpyPeerAsync_Negative_Parameters - Test unsuccessful execution of -hipMemcpyPeerAsync api when parameters are invalid -*/ + #include #include #include #include +/** + * @addtogroup hipMemcpyPeerAsync hipMemcpyPeerAsync + * @{ + * @ingroup PeerToPeerTest + * `hipMemcpyPeerAsync(void* dst, int dstDeviceId, const void* src, + * int srcDevice, size_t sizeBytes, hipStream_t stream __dparm(0))` - + * Copies memory from one device to memory on another device. + */ +/** + * Test Description + * ------------------------ + * - Performs basic peer to peer async memcpy functionality between each pair of devices. + * - Launches computation kernel. + * Test source + * ------------------------ + * - unit/memory/hipMemcpyPeerAsync.cc + * Test requirements + * ------------------------ + * - Peer access supported + * - Multi-device + * - HIP_VERSION >= 5.2 + */ TEST_CASE("Unit_hipMemcpyPeerAsync_Positive_Default") { const auto device_count = HipTest::getDeviceCount(); if (device_count < 2) { @@ -86,6 +99,19 @@ TEST_CASE("Unit_hipMemcpyPeerAsync_Positive_Default") { } } +/** + * Test Description + * ------------------------ + * - Checks synchronization behavior for peer async memcpy. + * Test source + * ------------------------ + * - unit/memory/hipMemcpyPeerAsync.cc + * Test requirements + * ------------------------ + * - Peer access supported + * - Multi-device + * - HIP_VERSION >= 5.2 + */ TEST_CASE("Unit_hipMemcpyPeerAsync_Positive_Synchronization_Behavior") { HIP_CHECK(hipDeviceSynchronize()); @@ -124,6 +150,19 @@ TEST_CASE("Unit_hipMemcpyPeerAsync_Positive_Synchronization_Behavior") { } } +/** + * Test Description + * ------------------------ + * - Checks that no data is copied if size is set to 0. + * Test source + * ------------------------ + * - unit/memory/hipMemcpyPeerAsync.cc + * Test requirements + * ------------------------ + * - Peer access supported + * - Multi-device + * - HIP_VERSION >= 5.2 + */ TEST_CASE("Unit_hipMemcpyPeerAsync_Positive_ZeroSize") { const auto device_count = HipTest::getDeviceCount(); if (device_count < 2) { @@ -184,6 +223,31 @@ TEST_CASE("Unit_hipMemcpyPeerAsync_Positive_ZeroSize") { } } +/** + * Test Description + * ------------------------ + * - Validates handling of invalid arguments: + * -# When output destination pointer is `nullptr` + * - Expected output: return `hipErrorInvalidValue` + * -# When source pointer is `nullptr` + * - Expected output: return `hipErrorInvalidValue` + * -# When copying more than allocated + * - Expected output: return `hipErrorInvalidValue` + * -# When destination device ID is not valid (out of bounds) + * - Expected output: return `hipErrorInvalidDevice` + * -# When source device ID is not valid (out of bounds) + * - Expected output: return `hipErrorInvalidDevice` + * -# When stream is not valid + * - Expected output: return `hipErrorContextIsDestroyed` + * Test source + * ------------------------ + * - unit/memory/hipMemcpyPeerAsync.cc + * Test requirements + * ------------------------ + * - Peer access supported + * - Multi-device + * - HIP_VERSION >= 5.2 + */ TEST_CASE("Unit_hipMemcpyPeerAsync_Negative_Parameters") { const auto device_count = HipTest::getDeviceCount(); if (device_count < 2) {