EXSWHTEC-217 - Implement new and update existing tests for the hipGraph*MemcpyNode family of APIs #48
Change-Id: Iae7ac9c855ba6e3288257e99e49f8b16cebb1bac
[ROCm/hip-tests commit: cefbaed5cf]
This commit is contained in:
committed by
Rakesh Roy
parent
25263b8553
commit
4194470cd6
@@ -1,13 +1,16 @@
|
||||
/*
|
||||
Copyright (c) 2022 Advanced Micro Devices, Inc. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -17,203 +20,264 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
Testcase Scenarios :
|
||||
Negative -
|
||||
1) Pass node as nullptr and verify api returns error code.
|
||||
2) Pass un-initialize node and verify api returns error code.
|
||||
3) Pass pNodeParams as nullptr and verify api returns error code.
|
||||
Functional -
|
||||
1) Add Memcpy node to graph, update the Memcpy node params with set and
|
||||
launch the graph and check updated params are taking effect.
|
||||
2) Add Memcpy node to graph, launch graph, then update the Memcpy node params
|
||||
with set and launch the graph and check updated params are taking effect.
|
||||
*/
|
||||
#include <functional>
|
||||
|
||||
#include <hip_test_common.hh>
|
||||
#include <hip_test_checkers.hh>
|
||||
#include <hip_test_defgroups.hh>
|
||||
#include <memcpy3d_tests_common.hh>
|
||||
|
||||
#define SIZE 10
|
||||
#include "graph_tests_common.hh"
|
||||
|
||||
/* Test verifies hipGraphMemcpyNodeSetParams API Negative scenarios.
|
||||
/**
|
||||
* @addtogroup hipGraphMemcpyNodeSetParams hipGraphMemcpyNodeSetParams
|
||||
* @{
|
||||
* @ingroup GraphTest
|
||||
* `hipGraphMemcpyNodeSetParams (hipGraphNode_t node, const hipMemcpy3DParms *pNodeParams)` - Sets a
|
||||
* memcpy node's parameters
|
||||
*/
|
||||
TEST_CASE("Unit_hipGraphMemcpyNodeSetParams_Negative") {
|
||||
CHECK_IMAGE_SUPPORT
|
||||
|
||||
constexpr int width{SIZE}, height{SIZE}, depth{SIZE};
|
||||
hipArray_t devArray;
|
||||
hipChannelFormatKind formatKind = hipChannelFormatKindSigned;
|
||||
hipMemcpy3DParms myparms;
|
||||
int* hData;
|
||||
uint32_t size = width * height * depth * sizeof(int);
|
||||
hData = reinterpret_cast<int*>(malloc(size));
|
||||
REQUIRE(hData != nullptr);
|
||||
memset(hData, 0, size);
|
||||
for (int i = 0; i < depth; i++) {
|
||||
for (int j = 0; j < height; j++) {
|
||||
for (int k = 0; k < width; k++) {
|
||||
hData[i*width*height + j*width + k] = i*width*height + j*width + k;
|
||||
}
|
||||
/**
|
||||
* Test Description
|
||||
* ------------------------
|
||||
* - Verify that node parameters get updated correctly by creating a node with valid but
|
||||
* incorrect parameters, and the setting them to the correct values after which the graph is
|
||||
* executed and the results of the memcpy verified.
|
||||
* The test is run for all possible memcpy directions, with both the corresponding memcpy
|
||||
* kind and hipMemcpyDefault, as well as half page and full page allocation sizes.
|
||||
* Test source
|
||||
* ------------------------
|
||||
* - unit/graph/hipGraphMemcpyNodeSetParams.cc
|
||||
* Test requirements
|
||||
* ------------------------
|
||||
* - HIP_VERSION >= 5.2
|
||||
*/
|
||||
TEST_CASE("Unit_hipGraphMemcpyNodeSetParams_Positive_Basic") {
|
||||
constexpr bool async = false;
|
||||
|
||||
SECTION("Device to host") {
|
||||
Memcpy3DDeviceToHostShell<async>(Memcpy3DWrapper<async, true, true>);
|
||||
}
|
||||
|
||||
SECTION("Device to host with default kind") {
|
||||
Memcpy3DDeviceToHostShell<async>(Memcpy3DWrapper<async, true, true>);
|
||||
}
|
||||
|
||||
SECTION("Host to device") {
|
||||
Memcpy3DHostToDeviceShell<async>(Memcpy3DWrapper<async, true, true>);
|
||||
}
|
||||
|
||||
SECTION("Host to device with default kind") {
|
||||
Memcpy3DHostToDeviceShell<async>(Memcpy3DWrapper<async, true, true>);
|
||||
}
|
||||
|
||||
SECTION("Host to host") { Memcpy3DHostToHostShell<async>(Memcpy3DWrapper<async, true, true>); }
|
||||
|
||||
SECTION("Host to host with default kind") {
|
||||
Memcpy3DHostToHostShell<async>(Memcpy3DWrapper<async, true, true>);
|
||||
}
|
||||
|
||||
SECTION("Device to device") {
|
||||
SECTION("Peer access enabled") {
|
||||
Memcpy3DDeviceToDeviceShell<async, true>(Memcpy3DWrapper<async, true, true>);
|
||||
}
|
||||
SECTION("Peer access disabled") {
|
||||
Memcpy3DDeviceToDeviceShell<async, false>(Memcpy3DWrapper<async, true, true>);
|
||||
}
|
||||
}
|
||||
hipChannelFormatDesc channelDesc = hipCreateChannelDesc(sizeof(int)*8,
|
||||
0, 0, 0, formatKind);
|
||||
HIP_CHECK(hipMalloc3DArray(&devArray, &channelDesc, make_hipExtent(width,
|
||||
height, depth), hipArrayDefault));
|
||||
memset(&myparms, 0x0, sizeof(hipMemcpy3DParms));
|
||||
myparms.srcPos = make_hipPos(0, 0, 0);
|
||||
myparms.dstPos = make_hipPos(0, 0, 0);
|
||||
myparms.extent = make_hipExtent(width , height, depth);
|
||||
myparms.srcPtr = make_hipPitchedPtr(hData, width * sizeof(int),
|
||||
width, height);
|
||||
myparms.dstArray = devArray;
|
||||
myparms.kind = hipMemcpyHostToDevice;
|
||||
|
||||
hipGraph_t graph;
|
||||
hipError_t ret;
|
||||
hipGraphNode_t memcpyNode;
|
||||
HIP_CHECK(hipGraphCreate(&graph, 0));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode(&memcpyNode, graph, NULL, 0, &myparms));
|
||||
|
||||
SECTION("Pass node as nullptr") {
|
||||
ret = hipGraphMemcpyNodeSetParams(nullptr, &myparms);
|
||||
REQUIRE(hipErrorInvalidValue == ret);
|
||||
}
|
||||
SECTION("Pass un-initialize node") {
|
||||
hipGraphNode_t memcpyNode_uninit{};
|
||||
ret = hipGraphMemcpyNodeSetParams(memcpyNode_uninit, &myparms);
|
||||
REQUIRE(hipErrorInvalidValue == ret);
|
||||
}
|
||||
SECTION("Pass SetNodeParams as nullptr") {
|
||||
ret = hipGraphMemcpyNodeSetParams(memcpyNode, nullptr);
|
||||
REQUIRE(hipErrorInvalidValue == ret);
|
||||
}
|
||||
HIP_CHECK(hipFreeArray(devArray));
|
||||
free(hData);
|
||||
HIP_CHECK(hipGraphDestroy(graph));
|
||||
}
|
||||
|
||||
/* Test verifies hipGraphMemcpyNodeSetParams API Functional scenarios.
|
||||
*/
|
||||
TEST_CASE("Unit_hipGraphMemcpyNodeSetParams_Functional") {
|
||||
CHECK_IMAGE_SUPPORT
|
||||
|
||||
constexpr int width{SIZE}, height{SIZE}, depth{SIZE};
|
||||
hipArray_t devArray;
|
||||
hipChannelFormatKind formatKind = hipChannelFormatKindSigned;
|
||||
hipMemcpy3DParms myparms, myparms1;
|
||||
uint32_t size = width * height * depth * sizeof(int);
|
||||
|
||||
int *hData = reinterpret_cast<int*>(malloc(size));
|
||||
REQUIRE(hData != nullptr);
|
||||
memset(hData, 0, size);
|
||||
int *hDataTemp = reinterpret_cast<int*>(malloc(size));
|
||||
REQUIRE(hDataTemp != nullptr);
|
||||
memset(hDataTemp, 0, size);
|
||||
int *hOutputData = reinterpret_cast<int *>(malloc(size));
|
||||
REQUIRE(hOutputData != nullptr);
|
||||
memset(hOutputData, 0, size);
|
||||
int *hOutputData1 = reinterpret_cast<int *>(malloc(size));
|
||||
REQUIRE(hOutputData1 != nullptr);
|
||||
memset(hOutputData1, 0, size);
|
||||
|
||||
for (int i = 0; i < depth; i++) {
|
||||
for (int j = 0; j < height; j++) {
|
||||
for (int k = 0; k < width; k++) {
|
||||
hData[i*width*height + j*width + k] = i*width*height + j*width + k;
|
||||
}
|
||||
SECTION("Device to device with default kind") {
|
||||
SECTION("Peer access enabled") {
|
||||
Memcpy3DDeviceToDeviceShell<async, true>(Memcpy3DWrapper<async, true, true>);
|
||||
}
|
||||
SECTION("Peer access disabled") {
|
||||
Memcpy3DDeviceToDeviceShell<async, false>(Memcpy3DWrapper<async, true, true>);
|
||||
}
|
||||
}
|
||||
hipChannelFormatDesc channelDesc = hipCreateChannelDesc(sizeof(int)*8,
|
||||
0, 0, 0, formatKind);
|
||||
HIP_CHECK(hipMalloc3DArray(&devArray, &channelDesc, make_hipExtent(width,
|
||||
height, depth), hipArrayDefault));
|
||||
memset(&myparms, 0x0, sizeof(hipMemcpy3DParms));
|
||||
|
||||
// Host to Device
|
||||
myparms.srcPos = make_hipPos(0, 0, 0);
|
||||
myparms.dstPos = make_hipPos(0, 0, 0);
|
||||
myparms.extent = make_hipExtent(width , height, depth);
|
||||
myparms.srcPtr = make_hipPitchedPtr(hData, width * sizeof(int),
|
||||
width, height);
|
||||
myparms.dstArray = devArray;
|
||||
myparms.kind = hipMemcpyHostToDevice;
|
||||
|
||||
hipGraph_t graph;
|
||||
hipGraphNode_t memcpyNode;
|
||||
std::vector<hipGraphNode_t> dependencies;
|
||||
hipStream_t streamForGraph;
|
||||
hipGraphExec_t graphExec;
|
||||
|
||||
HIP_CHECK(hipStreamCreate(&streamForGraph));
|
||||
HIP_CHECK(hipGraphCreate(&graph, 0));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode(&memcpyNode, graph, NULL, 0, &myparms));
|
||||
dependencies.push_back(memcpyNode);
|
||||
|
||||
// Device to host
|
||||
memset(&myparms1, 0x0, sizeof(hipMemcpy3DParms));
|
||||
myparms1.srcPos = make_hipPos(0, 0, 0);
|
||||
myparms1.dstPos = make_hipPos(0, 0, 0);
|
||||
myparms1.dstPtr = make_hipPitchedPtr(hDataTemp, width * sizeof(int),
|
||||
width, height);
|
||||
myparms1.srcArray = devArray;
|
||||
myparms1.extent = make_hipExtent(width, height, depth);
|
||||
myparms1.kind = hipMemcpyDeviceToHost;
|
||||
|
||||
HIP_CHECK(hipGraphAddMemcpyNode(&memcpyNode, graph, dependencies.data(),
|
||||
dependencies.size(), &myparms1));
|
||||
|
||||
SECTION("Update the memcpyNode and check") {
|
||||
// Device to host with updated host ptr hDataTemp -> hOutputData
|
||||
memset(&myparms1, 0x0, sizeof(hipMemcpy3DParms));
|
||||
myparms1.srcPos = make_hipPos(0, 0, 0);
|
||||
myparms1.dstPos = make_hipPos(0, 0, 0);
|
||||
myparms1.dstPtr = make_hipPitchedPtr(hOutputData, width * sizeof(int),
|
||||
width, height);
|
||||
myparms1.srcArray = devArray;
|
||||
myparms1.extent = make_hipExtent(width, height, depth);
|
||||
myparms1.kind = hipMemcpyDeviceToHost;
|
||||
|
||||
HIP_CHECK(hipGraphMemcpyNodeSetParams(memcpyNode, &myparms1));
|
||||
|
||||
// Instantiate and launch the graph
|
||||
HIP_CHECK(hipGraphInstantiate(&graphExec, graph, nullptr, nullptr, 0));
|
||||
HIP_CHECK(hipGraphLaunch(graphExec, streamForGraph));
|
||||
HIP_CHECK(hipStreamSynchronize(streamForGraph));
|
||||
|
||||
// Check result
|
||||
HipTest::checkArray(hData, hOutputData, width, height, depth);
|
||||
SECTION("Array from/to Host") {
|
||||
Memcpy3DArrayHostShell<async>(Memcpy3DWrapper<async, true, true>);
|
||||
}
|
||||
|
||||
SECTION("Update the memcpyNode again and check") {
|
||||
// Device to host with updated host ptr hOutputData -> hOutputData1
|
||||
memset(&myparms1, 0x0, sizeof(hipMemcpy3DParms));
|
||||
myparms1.srcPos = make_hipPos(0, 0, 0);
|
||||
myparms1.dstPos = make_hipPos(0, 0, 0);
|
||||
myparms1.dstPtr = make_hipPitchedPtr(hOutputData1, width * sizeof(int),
|
||||
width, height);
|
||||
myparms1.srcArray = devArray;
|
||||
myparms1.extent = make_hipExtent(width, height, depth);
|
||||
myparms1.kind = hipMemcpyDeviceToHost;
|
||||
|
||||
HIP_CHECK(hipGraphAddMemcpyNode(&memcpyNode, graph, dependencies.data(),
|
||||
dependencies.size(), &myparms1));
|
||||
HIP_CHECK(hipGraphMemcpyNodeSetParams(memcpyNode, &myparms1));
|
||||
|
||||
// Instantiate and launch the graph
|
||||
HIP_CHECK(hipGraphInstantiate(&graphExec, graph, nullptr, nullptr, 0));
|
||||
HIP_CHECK(hipGraphLaunch(graphExec, streamForGraph));
|
||||
HIP_CHECK(hipStreamSynchronize(streamForGraph));
|
||||
|
||||
// Check result
|
||||
HipTest::checkArray(hData, hOutputData1, width, height, depth);
|
||||
#if HT_NVIDIA // Disabled on AMD due to defect - EXSWHTEC-220
|
||||
SECTION("Array from/to Device") {
|
||||
Memcpy3DArrayDeviceShell<async>(Memcpy3DWrapper<async, true, true>);
|
||||
}
|
||||
HIP_CHECK(hipGraphExecDestroy(graphExec));
|
||||
HIP_CHECK(hipGraphDestroy(graph));
|
||||
HIP_CHECK(hipStreamDestroy(streamForGraph));
|
||||
HIP_CHECK(hipFreeArray(devArray));
|
||||
free(hData);
|
||||
free(hDataTemp);
|
||||
free(hOutputData);
|
||||
free(hOutputData1);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Description
|
||||
* ------------------------
|
||||
* - Verify API behaviour with invalid arguments:
|
||||
* -# node is nullptr
|
||||
* -# graph is nullptr
|
||||
* -# pDependencies is nullptr when numDependencies is not zero
|
||||
* -# A node in pDependencies originates from a different graph
|
||||
* -# numDependencies is invalid
|
||||
* -# A node is duplicated in pDependencies
|
||||
* -# dst is nullptr
|
||||
* -# src is nullptr
|
||||
* -# kind is an invalid enum value
|
||||
* -# count is zero
|
||||
* -# count is larger than dst allocation size
|
||||
* -# count is larger than src allocation size
|
||||
* Test source
|
||||
* ------------------------
|
||||
* - unit/graph/hipGraphAddMemcpyNode.cc
|
||||
* Test requirements
|
||||
* ------------------------
|
||||
* - HIP_VERSION >= 5.2
|
||||
*/
|
||||
TEST_CASE("Unit_hipGraphMemcpyNodeSetParams_Negative_Parameters") {
|
||||
using namespace std::placeholders;
|
||||
|
||||
constexpr hipExtent extent{128 * sizeof(int), 128, 8};
|
||||
|
||||
constexpr auto NegativeTests = [](hipPitchedPtr dst_ptr, hipPos dst_pos, hipPitchedPtr src_ptr,
|
||||
hipPos src_pos, hipExtent extent, hipMemcpyKind kind) {
|
||||
hipGraph_t graph = nullptr;
|
||||
HIP_CHECK(hipGraphCreate(&graph, 0));
|
||||
hipGraphNode_t node = nullptr;
|
||||
|
||||
SECTION("node == nullptr") {
|
||||
auto params = GetMemcpy3DParms(dst_ptr, dst_pos, src_ptr, src_pos, extent, kind);
|
||||
HIP_CHECK_ERROR(hipGraphMemcpyNodeSetParams(nullptr, ¶ms), hipErrorInvalidValue);
|
||||
}
|
||||
|
||||
SECTION("dst_ptr.ptr == nullptr") {
|
||||
hipPitchedPtr invalid_ptr = dst_ptr;
|
||||
invalid_ptr.ptr = nullptr;
|
||||
auto params = GetMemcpy3DParms(invalid_ptr, dst_pos, src_ptr, src_pos, extent, kind);
|
||||
HIP_CHECK_ERROR(hipGraphMemcpyNodeSetParams(node, ¶ms), hipErrorInvalidValue);
|
||||
}
|
||||
|
||||
SECTION("src_ptr.ptr == nullptr") {
|
||||
hipPitchedPtr invalid_ptr = src_ptr;
|
||||
invalid_ptr.ptr = nullptr;
|
||||
auto params = GetMemcpy3DParms(dst_ptr, dst_pos, invalid_ptr, src_pos, extent, kind);
|
||||
HIP_CHECK_ERROR(hipGraphMemcpyNodeSetParams(node, ¶ms), hipErrorInvalidValue);
|
||||
}
|
||||
|
||||
SECTION("dst_ptr.pitch < width") {
|
||||
hipPitchedPtr invalid_ptr = dst_ptr;
|
||||
invalid_ptr.pitch = extent.width - 1;
|
||||
auto params = GetMemcpy3DParms(invalid_ptr, dst_pos, src_ptr, src_pos, extent, kind);
|
||||
HIP_CHECK_ERROR(hipGraphMemcpyNodeSetParams(node, ¶ms), hipErrorInvalidPitchValue);
|
||||
}
|
||||
|
||||
SECTION("src_ptr.pitch < width") {
|
||||
hipPitchedPtr invalid_ptr = src_ptr;
|
||||
invalid_ptr.pitch = extent.width - 1;
|
||||
auto params = GetMemcpy3DParms(dst_ptr, dst_pos, invalid_ptr, src_pos, extent, kind);
|
||||
HIP_CHECK_ERROR(hipGraphMemcpyNodeSetParams(node, ¶ms), hipErrorInvalidPitchValue);
|
||||
}
|
||||
|
||||
SECTION("dst_ptr.pitch > max pitch") {
|
||||
int attr = 0;
|
||||
HIP_CHECK(hipDeviceGetAttribute(&attr, hipDeviceAttributeMaxPitch, 0));
|
||||
hipPitchedPtr invalid_ptr = dst_ptr;
|
||||
invalid_ptr.pitch = attr;
|
||||
auto params = GetMemcpy3DParms(invalid_ptr, dst_pos, src_ptr, src_pos, extent, kind);
|
||||
HIP_CHECK_ERROR(hipGraphMemcpyNodeSetParams(node, ¶ms), hipErrorInvalidValue);
|
||||
}
|
||||
|
||||
SECTION("src_ptr.pitch > max pitch") {
|
||||
int attr = 0;
|
||||
HIP_CHECK(hipDeviceGetAttribute(&attr, hipDeviceAttributeMaxPitch, 0));
|
||||
hipPitchedPtr invalid_ptr = src_ptr;
|
||||
invalid_ptr.pitch = attr;
|
||||
auto params = GetMemcpy3DParms(dst_ptr, dst_pos, invalid_ptr, src_pos, extent, kind);
|
||||
HIP_CHECK_ERROR(hipGraphMemcpyNodeSetParams(node, ¶ms), hipErrorInvalidValue);
|
||||
}
|
||||
|
||||
SECTION("extent.width + dst_pos.x > dst_ptr.pitch") {
|
||||
hipPos invalid_pos = dst_pos;
|
||||
invalid_pos.x = dst_ptr.pitch - extent.width + 1;
|
||||
auto params = GetMemcpy3DParms(dst_ptr, invalid_pos, src_ptr, src_pos, extent, kind);
|
||||
HIP_CHECK_ERROR(hipGraphMemcpyNodeSetParams(node, ¶ms), hipErrorInvalidValue);
|
||||
}
|
||||
|
||||
SECTION("extent.width + src_pos.x > src_ptr.pitch") {
|
||||
hipPos invalid_pos = src_pos;
|
||||
invalid_pos.x = src_ptr.pitch - extent.width + 1;
|
||||
auto params = GetMemcpy3DParms(dst_ptr, dst_pos, src_ptr, invalid_pos, extent, kind);
|
||||
HIP_CHECK_ERROR(hipGraphMemcpyNodeSetParams(node, ¶ms), hipErrorInvalidValue);
|
||||
}
|
||||
|
||||
SECTION("dst_pos.y out of bounds") {
|
||||
hipPos invalid_pos = dst_pos;
|
||||
invalid_pos.y = 1;
|
||||
auto params = GetMemcpy3DParms(dst_ptr, invalid_pos, src_ptr, src_pos, extent, kind);
|
||||
HIP_CHECK_ERROR(hipGraphMemcpyNodeSetParams(node, ¶ms), hipErrorInvalidValue);
|
||||
}
|
||||
|
||||
SECTION("src_pos.y out of bounds") {
|
||||
hipPos invalid_pos = src_pos;
|
||||
invalid_pos.y = 1;
|
||||
auto params = GetMemcpy3DParms(dst_ptr, dst_pos, src_ptr, invalid_pos, extent, kind);
|
||||
HIP_CHECK_ERROR(hipGraphMemcpyNodeSetParams(node, ¶ms), hipErrorInvalidValue);
|
||||
}
|
||||
|
||||
SECTION("dst_pos.z out of bounds") {
|
||||
hipPos invalid_pos = dst_pos;
|
||||
invalid_pos.z = 1;
|
||||
auto params = GetMemcpy3DParms(dst_ptr, invalid_pos, src_ptr, src_pos, extent, kind);
|
||||
HIP_CHECK_ERROR(hipGraphMemcpyNodeSetParams(node, ¶ms), hipErrorInvalidValue);
|
||||
}
|
||||
|
||||
SECTION("src_pos.z out of bounds") {
|
||||
hipPos invalid_pos = src_pos;
|
||||
invalid_pos.z = 1;
|
||||
auto params = GetMemcpy3DParms(dst_ptr, dst_pos, src_ptr, invalid_pos, extent, kind);
|
||||
HIP_CHECK_ERROR(hipGraphMemcpyNodeSetParams(node, ¶ms), hipErrorInvalidValue);
|
||||
}
|
||||
|
||||
SECTION("Invalid MemcpyKind") {
|
||||
auto params = GetMemcpy3DParms(dst_ptr, dst_pos, src_ptr, src_pos, extent,
|
||||
static_cast<hipMemcpyKind>(-1));
|
||||
HIP_CHECK_ERROR(hipGraphMemcpyNodeSetParams(node, ¶ms), hipErrorInvalidMemcpyDirection);
|
||||
}
|
||||
|
||||
HIP_CHECK(hipGraphDestroy(graph));
|
||||
};
|
||||
|
||||
SECTION("Host to Device") {
|
||||
LinearAllocGuard3D<int> device_alloc(extent);
|
||||
LinearAllocGuard<int> host_alloc(
|
||||
LinearAllocs::hipHostMalloc,
|
||||
device_alloc.pitch() * device_alloc.height() * device_alloc.depth());
|
||||
NegativeTests(device_alloc.pitched_ptr(), make_hipPos(0, 0, 0),
|
||||
make_hipPitchedPtr(host_alloc.ptr(), device_alloc.pitch(), device_alloc.width(),
|
||||
device_alloc.height()),
|
||||
make_hipPos(0, 0, 0), extent, hipMemcpyHostToDevice);
|
||||
}
|
||||
|
||||
SECTION("Device to Host") {
|
||||
LinearAllocGuard3D<int> device_alloc(extent);
|
||||
LinearAllocGuard<int> host_alloc(
|
||||
LinearAllocs::hipHostMalloc,
|
||||
device_alloc.pitch() * device_alloc.height() * device_alloc.depth());
|
||||
NegativeTests(make_hipPitchedPtr(host_alloc.ptr(), device_alloc.pitch(), device_alloc.width(),
|
||||
device_alloc.height()),
|
||||
make_hipPos(0, 0, 0), device_alloc.pitched_ptr(), make_hipPos(0, 0, 0), extent,
|
||||
hipMemcpyDeviceToHost);
|
||||
}
|
||||
|
||||
SECTION("Host to Host") {
|
||||
LinearAllocGuard<int> src_alloc(LinearAllocs::hipHostMalloc,
|
||||
extent.width * extent.height * extent.depth);
|
||||
LinearAllocGuard<int> dst_alloc(LinearAllocs::hipHostMalloc,
|
||||
extent.width * extent.height * extent.depth);
|
||||
NegativeTests(make_hipPitchedPtr(dst_alloc.ptr(), extent.width, extent.width, extent.height),
|
||||
make_hipPos(0, 0, 0),
|
||||
make_hipPitchedPtr(src_alloc.ptr(), extent.width, extent.width, extent.height),
|
||||
make_hipPos(0, 0, 0), extent, hipMemcpyHostToHost);
|
||||
}
|
||||
|
||||
SECTION("Device to Device") {
|
||||
LinearAllocGuard3D<int> src_alloc(extent);
|
||||
LinearAllocGuard3D<int> dst_alloc(extent);
|
||||
NegativeTests(dst_alloc.pitched_ptr(), make_hipPos(0, 0, 0), src_alloc.pitched_ptr(),
|
||||
make_hipPos(0, 0, 0), extent, hipMemcpyDeviceToDevice);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user