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]
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user