EXSWHTEC-224 - Test cases ID clean up and documentation for Device Memory Access (#88)

- Test cases ID clean up and documentation for Device Memory Access
- Added group for deprecated Context Management

[ROCm/hip-tests commit: 15c91808cc]
Cette révision appartient à :
milos-mozetic
2023-06-28 06:17:04 +02:00
révisé par GitHub
Parent a2ead92795
révision 16eee59975
7 fichiers modifiés avec 324 ajouts et 57 suppressions
+11 -11
Voir le fichier
@@ -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"
]
}
+16
Voir le fichier
@@ -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
* @{
+37 -10
Voir le fichier
@@ -23,16 +23,26 @@ THE SOFTWARE.
#include <hip_test_common.hh>
#include <hip_test_helper.hh>
/*
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();
+75 -10
Voir le fichier
@@ -23,16 +23,29 @@ THE SOFTWARE.
#include <hip_test_common.hh>
#include <hip_test_helper.hh>
/*
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) {
+39 -6
Voir le fichier
@@ -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 <hip_test_common.hh>
#include <hip/hip_runtime_api.h>
#include <utils.hh>
#include <resource_guards.hh>
/**
* @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;
+72 -10
Voir le fichier
@@ -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 <hip/hip_runtime_api.h>
#include <hip_test_common.hh>
#include <resource_guards.hh>
#include <utils.hh>
/**
* @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) {
+74 -10
Voir le fichier
@@ -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 <hip/hip_runtime_api.h>
#include <hip_test_common.hh>
#include <resource_guards.hh>
#include <utils.hh>
/**
* @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) {