SWDEV-470698 - fix formatting, add format check workflow (#657)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
5840940caa
Коммит
f7338717ae
@@ -82,39 +82,32 @@ TEST_CASE("Unit_hipGraphAddChildGraphNode_Negative") {
|
||||
hipGraph_t graph, childgraph1;
|
||||
int *A_d{nullptr}, *B_d{nullptr};
|
||||
int *A_h{nullptr}, *B_h{nullptr};
|
||||
HipTest::initArrays<int>(&A_d, &B_d, nullptr,
|
||||
&A_h, &B_h, nullptr,
|
||||
N, false);
|
||||
HipTest::initArrays<int>(&A_d, &B_d, nullptr, &A_h, &B_h, nullptr, N, false);
|
||||
|
||||
HIP_CHECK(hipGraphCreate(&graph, 0));
|
||||
hipGraphNode_t memcpyH2D_A, childGraphNode1;
|
||||
HIP_CHECK(hipGraphCreate(&childgraph1, 0));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_A, childgraph1, nullptr,
|
||||
0, A_h, B_d,
|
||||
Nbytes, hipMemcpyDeviceToHost));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_A, childgraph1, nullptr, 0, A_h, B_d, Nbytes,
|
||||
hipMemcpyDeviceToHost));
|
||||
|
||||
SECTION("Pass nullptr to graph noe") {
|
||||
REQUIRE(hipGraphAddChildGraphNode(nullptr, graph,
|
||||
nullptr, 0, childgraph1)
|
||||
== hipErrorInvalidValue);
|
||||
REQUIRE(hipGraphAddChildGraphNode(nullptr, graph, nullptr, 0, childgraph1) ==
|
||||
hipErrorInvalidValue);
|
||||
}
|
||||
|
||||
SECTION("Pass nullptr to graph") {
|
||||
REQUIRE(hipGraphAddChildGraphNode(&childGraphNode1, nullptr,
|
||||
nullptr, 0, childgraph1)
|
||||
== hipErrorInvalidValue);
|
||||
REQUIRE(hipGraphAddChildGraphNode(&childGraphNode1, nullptr, nullptr, 0, childgraph1) ==
|
||||
hipErrorInvalidValue);
|
||||
}
|
||||
|
||||
SECTION("Pass nullptr to child graph") {
|
||||
REQUIRE(hipGraphAddChildGraphNode(&childGraphNode1, graph,
|
||||
nullptr, 0, nullptr)
|
||||
== hipErrorInvalidValue);
|
||||
REQUIRE(hipGraphAddChildGraphNode(&childGraphNode1, graph, nullptr, 0, nullptr) ==
|
||||
hipErrorInvalidValue);
|
||||
}
|
||||
|
||||
SECTION("Pass invalid depdencies") {
|
||||
REQUIRE(hipGraphAddChildGraphNode(&childGraphNode1, graph,
|
||||
nullptr, 10, childgraph1)
|
||||
== hipErrorInvalidValue);
|
||||
REQUIRE(hipGraphAddChildGraphNode(&childGraphNode1, graph, nullptr, 10, childgraph1) ==
|
||||
hipErrorInvalidValue);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,12 +130,11 @@ TEST_CASE("Unit_hipGraphAddChildGraphNode_OrgGraphAsChildGraph") {
|
||||
size_t numNodes;
|
||||
hipStream_t streamForGraph;
|
||||
HIP_CHECK(hipStreamCreate(&streamForGraph));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_B, graph, nullptr, 0, B_d, B_h,
|
||||
Nbytes, hipMemcpyHostToDevice));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_A, graph, nullptr, 0, A_h, B_d,
|
||||
Nbytes, hipMemcpyDeviceToHost));
|
||||
HIP_CHECK(hipGraphAddChildGraphNode(&childGraphNode1, graph,
|
||||
nullptr, 0, graph));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_B, graph, nullptr, 0, B_d, B_h, Nbytes,
|
||||
hipMemcpyHostToDevice));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_A, graph, nullptr, 0, A_h, B_d, Nbytes,
|
||||
hipMemcpyDeviceToHost));
|
||||
HIP_CHECK(hipGraphAddChildGraphNode(&childGraphNode1, graph, nullptr, 0, graph));
|
||||
|
||||
HIP_CHECK(hipGraphAddDependencies(graph, &memcpyH2D_B, &memcpyH2D_A, 1));
|
||||
|
||||
@@ -179,23 +171,17 @@ TEST_CASE("Unit_hipGraphAddChildGraphNode_ExecuteChildGraph") {
|
||||
hipStream_t streamForGraph;
|
||||
HIP_CHECK(hipStreamCreate(&streamForGraph));
|
||||
HIP_CHECK(hipGraphCreate(&childgraph1, 0));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_B, childgraph1, nullptr,
|
||||
0, B_d, B_h,
|
||||
Nbytes, hipMemcpyHostToDevice));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_A, childgraph1, nullptr,
|
||||
0, A_h, B_d,
|
||||
Nbytes, hipMemcpyDeviceToHost));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_C, graph, nullptr,
|
||||
0, C_d, C_h,
|
||||
Nbytes, hipMemcpyHostToDevice));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_C, graph, nullptr,
|
||||
0, A_h, C_d,
|
||||
Nbytes, hipMemcpyDeviceToHost));
|
||||
HIP_CHECK(hipGraphAddChildGraphNode(&childGraphNode1, graph,
|
||||
nullptr, 0, childgraph1));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_B, childgraph1, nullptr, 0, B_d, B_h, Nbytes,
|
||||
hipMemcpyHostToDevice));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_A, childgraph1, nullptr, 0, A_h, B_d, Nbytes,
|
||||
hipMemcpyDeviceToHost));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_C, graph, nullptr, 0, C_d, C_h, Nbytes,
|
||||
hipMemcpyHostToDevice));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_C, graph, nullptr, 0, A_h, C_d, Nbytes,
|
||||
hipMemcpyDeviceToHost));
|
||||
HIP_CHECK(hipGraphAddChildGraphNode(&childGraphNode1, graph, nullptr, 0, childgraph1));
|
||||
|
||||
HIP_CHECK(hipGraphAddDependencies(childgraph1, &memcpyH2D_B,
|
||||
&memcpyH2D_A, 1));
|
||||
HIP_CHECK(hipGraphAddDependencies(childgraph1, &memcpyH2D_B, &memcpyH2D_A, 1));
|
||||
|
||||
// Instantiate and launch the childgraph
|
||||
HIP_CHECK(hipGraphInstantiate(&graphExec, childgraph1, nullptr, nullptr, 0));
|
||||
@@ -205,7 +191,7 @@ TEST_CASE("Unit_hipGraphAddChildGraphNode_ExecuteChildGraph") {
|
||||
// Verify childgraph execution result
|
||||
for (size_t i = 0; i < N; i++) {
|
||||
if (B_h[i] != A_h[i]) {
|
||||
INFO("Validation failed B_h[i] " << B_h[i] << "A_h[i] "<< A_h[i]);
|
||||
INFO("Validation failed B_h[i] " << B_h[i] << "A_h[i] " << A_h[i]);
|
||||
REQUIRE(false);
|
||||
}
|
||||
}
|
||||
@@ -237,15 +223,13 @@ TEST_CASE("Unit_hipGraphAddChildGraphNode_CloneChildGraph") {
|
||||
hipStream_t streamForGraph;
|
||||
HIP_CHECK(hipStreamCreate(&streamForGraph));
|
||||
HIP_CHECK(hipGraphCreate(&childgraph1, 0));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_A, childgraph1, nullptr,
|
||||
0, A_d, A_h,
|
||||
Nbytes, hipMemcpyHostToDevice));
|
||||
HIP_CHECK(hipGraphAddChildGraphNode(&childGraphNode1, graph,
|
||||
nullptr, 0, childgraph1));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_A, childgraph1, nullptr, 0, A_d, A_h, Nbytes,
|
||||
hipMemcpyHostToDevice));
|
||||
HIP_CHECK(hipGraphAddChildGraphNode(&childGraphNode1, graph, nullptr, 0, childgraph1));
|
||||
|
||||
// Added new memcpy node to the cloned graph
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_B, graph, nullptr, 0, B_h, A_d,
|
||||
Nbytes, hipMemcpyDeviceToHost));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_B, graph, nullptr, 0, B_h, A_d, Nbytes,
|
||||
hipMemcpyDeviceToHost));
|
||||
HIP_CHECK(hipGraphAddDependencies(graph, &childGraphNode1, &memcpyH2D_B, 1));
|
||||
|
||||
// Cloned the graph
|
||||
@@ -259,7 +243,7 @@ TEST_CASE("Unit_hipGraphAddChildGraphNode_CloneChildGraph") {
|
||||
// Verify childgraph execution result
|
||||
for (size_t i = 0; i < N; i++) {
|
||||
if (B_h[i] != A_h[i]) {
|
||||
INFO("Validation failed B_h[i] " << B_h[i] << "A_h[i] "<< A_h[i]);
|
||||
INFO("Validation failed B_h[i] " << B_h[i] << "A_h[i] " << A_h[i]);
|
||||
REQUIRE(false);
|
||||
}
|
||||
}
|
||||
@@ -292,41 +276,32 @@ TEST_CASE("Unit_hipGraphAddChildGraphNode_MultipleChildNodes") {
|
||||
unsigned blocks = HipTest::setNumBlocks(blocksPerCU, threadsPerBlock, N);
|
||||
|
||||
HIP_CHECK(hipGraphCreate(&graph, 0));
|
||||
hipGraphNode_t memcpyH2D_A, memcpyH2D_B, childGraphNode1,
|
||||
childGraphNode2, memcpyD2H_C;
|
||||
hipGraphNode_t memcpyH2D_A, memcpyH2D_B, childGraphNode1, childGraphNode2, memcpyD2H_C;
|
||||
hipStream_t streamForGraph;
|
||||
HIP_CHECK(hipStreamCreate(&streamForGraph));
|
||||
HIP_CHECK(hipGraphCreate(&childgraph1, 0));
|
||||
HIP_CHECK(hipGraphCreate(&childgraph2, 0));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_A, childgraph1, nullptr,
|
||||
0, A_d, A_h,
|
||||
Nbytes, hipMemcpyHostToDevice));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_B, childgraph2, nullptr,
|
||||
0, B_d, B_h,
|
||||
Nbytes, hipMemcpyHostToDevice));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_A, childgraph1, nullptr, 0, A_d, A_h, Nbytes,
|
||||
hipMemcpyHostToDevice));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_B, childgraph2, nullptr, 0, B_d, B_h, Nbytes,
|
||||
hipMemcpyHostToDevice));
|
||||
|
||||
HIP_CHECK(hipGraphAddChildGraphNode(&childGraphNode1, graph,
|
||||
nullptr, 0, childgraph1));
|
||||
HIP_CHECK(hipGraphAddChildGraphNode(&childGraphNode2, graph,
|
||||
nullptr, 0, childgraph2));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyD2H_C, graph, nullptr,
|
||||
0, C_h, C_d,
|
||||
Nbytes, hipMemcpyDeviceToHost));
|
||||
HIP_CHECK(hipGraphAddChildGraphNode(&childGraphNode1, graph, nullptr, 0, childgraph1));
|
||||
HIP_CHECK(hipGraphAddChildGraphNode(&childGraphNode2, graph, nullptr, 0, childgraph2));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyD2H_C, graph, nullptr, 0, C_h, C_d, Nbytes,
|
||||
hipMemcpyDeviceToHost));
|
||||
|
||||
void* kernelArgs2[] = {&A_d, &B_d, &C_d, reinterpret_cast<void *>(&NElem)};
|
||||
kernelNodeParams.func = reinterpret_cast<void *>(HipTest::vectorADD<int>);
|
||||
void* kernelArgs2[] = {&A_d, &B_d, &C_d, reinterpret_cast<void*>(&NElem)};
|
||||
kernelNodeParams.func = reinterpret_cast<void*>(HipTest::vectorADD<int>);
|
||||
kernelNodeParams.gridDim = dim3(blocks);
|
||||
kernelNodeParams.blockDim = dim3(threadsPerBlock);
|
||||
kernelNodeParams.sharedMemBytes = 0;
|
||||
kernelNodeParams.kernelParams = reinterpret_cast<void**>(kernelArgs2);
|
||||
kernelNodeParams.extra = nullptr;
|
||||
HIP_CHECK(hipGraphAddKernelNode(&kernel_vecAdd, graph, nullptr, 0,
|
||||
&kernelNodeParams));
|
||||
HIP_CHECK(hipGraphAddKernelNode(&kernel_vecAdd, graph, nullptr, 0, &kernelNodeParams));
|
||||
|
||||
HIP_CHECK(hipGraphAddDependencies(graph, &childGraphNode1,
|
||||
&childGraphNode2, 1));
|
||||
HIP_CHECK(hipGraphAddDependencies(graph, &childGraphNode2,
|
||||
&kernel_vecAdd, 1));
|
||||
HIP_CHECK(hipGraphAddDependencies(graph, &childGraphNode1, &childGraphNode2, 1));
|
||||
HIP_CHECK(hipGraphAddDependencies(graph, &childGraphNode2, &kernel_vecAdd, 1));
|
||||
HIP_CHECK(hipGraphAddDependencies(graph, &kernel_vecAdd, &memcpyD2H_C, 1));
|
||||
|
||||
// Instantiate and launch the childgraph
|
||||
@@ -382,8 +357,7 @@ TEST_CASE("Unit_hipGraphAddChildGraphNode_SingleChildNode") {
|
||||
memsetParams.elementSize = sizeof(char);
|
||||
memsetParams.width = Nbytes;
|
||||
memsetParams.height = 1;
|
||||
HIP_CHECK(hipGraphAddMemsetNode(&memset_A, childgraph, nullptr, 0,
|
||||
&memsetParams));
|
||||
HIP_CHECK(hipGraphAddMemsetNode(&memset_A, childgraph, nullptr, 0, &memsetParams));
|
||||
|
||||
memset(&memsetParams, 0, sizeof(memsetParams));
|
||||
memsetParams.dst = reinterpret_cast<void*>(B_d);
|
||||
@@ -392,56 +366,44 @@ TEST_CASE("Unit_hipGraphAddChildGraphNode_SingleChildNode") {
|
||||
memsetParams.elementSize = sizeof(char);
|
||||
memsetParams.width = Nbytes;
|
||||
memsetParams.height = 1;
|
||||
HIP_CHECK(hipGraphAddMemsetNode(&memset_B, childgraph, nullptr, 0,
|
||||
&memsetParams));
|
||||
HIP_CHECK(hipGraphAddMemsetNode(&memset_B, childgraph, nullptr, 0, &memsetParams));
|
||||
|
||||
void* kernelArgs1[] = {&C_d, &memsetVal, reinterpret_cast<void *>(&NElem)};
|
||||
kernelNodeParams.func =
|
||||
reinterpret_cast<void *>(HipTest::memsetReverse<int>);
|
||||
void* kernelArgs1[] = {&C_d, &memsetVal, reinterpret_cast<void*>(&NElem)};
|
||||
kernelNodeParams.func = reinterpret_cast<void*>(HipTest::memsetReverse<int>);
|
||||
kernelNodeParams.gridDim = dim3(blocks);
|
||||
kernelNodeParams.blockDim = dim3(threadsPerBlock);
|
||||
kernelNodeParams.sharedMemBytes = 0;
|
||||
kernelNodeParams.kernelParams = reinterpret_cast<void**>(kernelArgs1);
|
||||
kernelNodeParams.extra = nullptr;
|
||||
HIP_CHECK(hipGraphAddKernelNode(&memsetKer_C, childgraph, nullptr, 0,
|
||||
&kernelNodeParams));
|
||||
HIP_CHECK(hipGraphAddKernelNode(&memsetKer_C, childgraph, nullptr, 0, &kernelNodeParams));
|
||||
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_A, childgraph, nullptr,
|
||||
0, A_d, A_h,
|
||||
Nbytes, hipMemcpyHostToDevice));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_A, childgraph, nullptr, 0, A_d, A_h, Nbytes,
|
||||
hipMemcpyHostToDevice));
|
||||
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_B, childgraph, nullptr,
|
||||
0, B_d, B_h,
|
||||
Nbytes, hipMemcpyHostToDevice));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_B, childgraph, nullptr, 0, B_d, B_h, Nbytes,
|
||||
hipMemcpyHostToDevice));
|
||||
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyD2H_C, childgraph, nullptr,
|
||||
0, C_h, C_d,
|
||||
Nbytes, hipMemcpyDeviceToHost));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyD2H_C, childgraph, nullptr, 0, C_h, C_d, Nbytes,
|
||||
hipMemcpyDeviceToHost));
|
||||
|
||||
void* kernelArgs2[] = {&A_d, &B_d, &C_d, reinterpret_cast<void *>(&NElem)};
|
||||
kernelNodeParams.func = reinterpret_cast<void *>(HipTest::vectorADD<int>);
|
||||
void* kernelArgs2[] = {&A_d, &B_d, &C_d, reinterpret_cast<void*>(&NElem)};
|
||||
kernelNodeParams.func = reinterpret_cast<void*>(HipTest::vectorADD<int>);
|
||||
kernelNodeParams.gridDim = dim3(blocks);
|
||||
kernelNodeParams.blockDim = dim3(threadsPerBlock);
|
||||
kernelNodeParams.sharedMemBytes = 0;
|
||||
kernelNodeParams.kernelParams = reinterpret_cast<void**>(kernelArgs2);
|
||||
kernelNodeParams.extra = nullptr;
|
||||
HIP_CHECK(hipGraphAddKernelNode(&kernel_vecAdd, childgraph, nullptr, 0,
|
||||
&kernelNodeParams));
|
||||
HIP_CHECK(hipGraphAddKernelNode(&kernel_vecAdd, childgraph, nullptr, 0, &kernelNodeParams));
|
||||
|
||||
// Create dependencies
|
||||
HIP_CHECK(hipGraphAddDependencies(childgraph, &memset_A, &memcpyH2D_A, 1));
|
||||
HIP_CHECK(hipGraphAddDependencies(childgraph, &memset_B, &memcpyH2D_B, 1));
|
||||
HIP_CHECK(hipGraphAddDependencies(childgraph, &memcpyH2D_A,
|
||||
&kernel_vecAdd, 1));
|
||||
HIP_CHECK(hipGraphAddDependencies(childgraph, &memcpyH2D_B,
|
||||
&kernel_vecAdd, 1));
|
||||
HIP_CHECK(hipGraphAddDependencies(childgraph, &memsetKer_C,
|
||||
&kernel_vecAdd, 1));
|
||||
HIP_CHECK(hipGraphAddDependencies(childgraph, &kernel_vecAdd,
|
||||
&memcpyD2H_C, 1));
|
||||
HIP_CHECK(hipGraphAddDependencies(childgraph, &memcpyH2D_A, &kernel_vecAdd, 1));
|
||||
HIP_CHECK(hipGraphAddDependencies(childgraph, &memcpyH2D_B, &kernel_vecAdd, 1));
|
||||
HIP_CHECK(hipGraphAddDependencies(childgraph, &memsetKer_C, &kernel_vecAdd, 1));
|
||||
HIP_CHECK(hipGraphAddDependencies(childgraph, &kernel_vecAdd, &memcpyD2H_C, 1));
|
||||
|
||||
HIP_CHECK(hipGraphAddChildGraphNode(&ChildGraphNode, graph,
|
||||
nullptr, 0, childgraph));
|
||||
HIP_CHECK(hipGraphAddChildGraphNode(&ChildGraphNode, graph, nullptr, 0, childgraph));
|
||||
// Instantiate and launch the childgraph
|
||||
HIP_CHECK(hipGraphInstantiate(&graphExec, graph, nullptr, nullptr, 0));
|
||||
HIP_CHECK(hipGraphLaunch(graphExec, streamForGraph));
|
||||
@@ -458,24 +420,24 @@ TEST_CASE("Unit_hipGraphAddChildGraphNode_SingleChildNode") {
|
||||
}
|
||||
|
||||
// Kernel functions
|
||||
static __global__ void ker_vec_mul(int *A, int *B, int *C) {
|
||||
static __global__ void ker_vec_mul(int* A, int* B, int* C) {
|
||||
int i = threadIdx.x + blockDim.x * blockIdx.x;
|
||||
C[i] = A[i]*B[i];
|
||||
C[i] = A[i] * B[i];
|
||||
}
|
||||
|
||||
static __global__ void ker_vec_add(int *A, int *B) {
|
||||
static __global__ void ker_vec_add(int* A, int* B) {
|
||||
int i = threadIdx.x + blockDim.x * blockIdx.x;
|
||||
A[i] = A[i] + B[i];
|
||||
}
|
||||
|
||||
static __global__ void ker_vec_sub(int *A, int *B) {
|
||||
static __global__ void ker_vec_sub(int* A, int* B) {
|
||||
int i = threadIdx.x + blockDim.x * blockIdx.x;
|
||||
A[i] = A[i] - B[i];
|
||||
}
|
||||
|
||||
static __global__ void ker_vec_sqr(int *A, int *B) {
|
||||
static __global__ void ker_vec_sqr(int* A, int* B) {
|
||||
int i = threadIdx.x + blockDim.x * blockIdx.x;
|
||||
A[i] = B[i]*B[i];
|
||||
A[i] = B[i] * B[i];
|
||||
}
|
||||
|
||||
enum class updateGraphNodeTests {
|
||||
@@ -495,16 +457,15 @@ typedef class nestedGraph {
|
||||
const int N = 1024;
|
||||
size_t Nbytes;
|
||||
const int threadsPerBlock = 256;
|
||||
const int blocks = (N/threadsPerBlock);
|
||||
const int blocks = (N / threadsPerBlock);
|
||||
const int threadsPerBlockUpd = 128;
|
||||
const int blocksUpd = (N/threadsPerBlockUpd);
|
||||
const int blocksUpd = (N / threadsPerBlockUpd);
|
||||
hipGraphNode_t memset_B1, memset_B2;
|
||||
hipGraphNode_t memcpyH2D_A1, memcpyH2D_A2, memcpyD2H_A3;
|
||||
hipGraphNode_t vec_mul1, vec_mul2, vec_add, vec_sqr, vec_sub;
|
||||
hipGraphNode_t child_node1, child_node2, child_node3;
|
||||
hipGraph_t graph[4]; // 4 level graph
|
||||
hipKernelNodeParams kerNodeParams1{}, kerNodeParams2{},
|
||||
kerNodeParams3{}, kerNodeParams4{};
|
||||
hipKernelNodeParams kerNodeParams1{}, kerNodeParams2{}, kerNodeParams3{}, kerNodeParams4{};
|
||||
int *A1_d, *A2_d, *A1_h, *A2_h, *A3_h;
|
||||
int *B1_d, *B2_d, *C1_d, *C2_d;
|
||||
hipMemsetParams memsetParams{};
|
||||
@@ -536,35 +497,29 @@ typedef class nestedGraph {
|
||||
HIP_CHECK(hipGraphCreate(&graph[3], 0));
|
||||
// Add the nodes to lowest level graph[2]
|
||||
void* kernelArgs1[] = {&A1_d, &B1_d, &C1_d};
|
||||
kerNodeParams1.func =
|
||||
reinterpret_cast<void *>(ker_vec_mul);
|
||||
kerNodeParams1.func = reinterpret_cast<void*>(ker_vec_mul);
|
||||
kerNodeParams1.gridDim = dim3(blocks);
|
||||
kerNodeParams1.blockDim = dim3(threadsPerBlock);
|
||||
kerNodeParams1.sharedMemBytes = 0;
|
||||
kerNodeParams1.kernelParams = reinterpret_cast<void**>(kernelArgs1);
|
||||
kerNodeParams1.extra = nullptr;
|
||||
HIP_CHECK(hipGraphAddKernelNode(&vec_mul1, graph[2], nullptr, 0,
|
||||
&kerNodeParams1));
|
||||
HIP_CHECK(hipGraphAddKernelNode(&vec_mul1, graph[2], nullptr, 0, &kerNodeParams1));
|
||||
void* kernelArgs2[] = {&A2_d, &B2_d, &C2_d};
|
||||
kerNodeParams2.func =
|
||||
reinterpret_cast<void *>(ker_vec_mul);
|
||||
kerNodeParams2.func = reinterpret_cast<void*>(ker_vec_mul);
|
||||
kerNodeParams2.gridDim = dim3(blocks);
|
||||
kerNodeParams2.blockDim = dim3(threadsPerBlock);
|
||||
kerNodeParams2.sharedMemBytes = 0;
|
||||
kerNodeParams2.kernelParams = reinterpret_cast<void**>(kernelArgs2);
|
||||
kerNodeParams2.extra = nullptr;
|
||||
HIP_CHECK(hipGraphAddKernelNode(&vec_mul2, graph[2], nullptr, 0,
|
||||
&kerNodeParams2));
|
||||
HIP_CHECK(hipGraphAddKernelNode(&vec_mul2, graph[2], nullptr, 0, &kerNodeParams2));
|
||||
void* kernelArgs3[] = {&C1_d, &C2_d};
|
||||
kerNodeParams3.func =
|
||||
reinterpret_cast<void *>(ker_vec_add);
|
||||
kerNodeParams3.func = reinterpret_cast<void*>(ker_vec_add);
|
||||
kerNodeParams3.gridDim = dim3(blocks);
|
||||
kerNodeParams3.blockDim = dim3(threadsPerBlock);
|
||||
kerNodeParams3.sharedMemBytes = 0;
|
||||
kerNodeParams3.kernelParams = reinterpret_cast<void**>(kernelArgs3);
|
||||
kerNodeParams3.extra = nullptr;
|
||||
HIP_CHECK(hipGraphAddKernelNode(&vec_add, graph[2], nullptr, 0,
|
||||
&kerNodeParams3));
|
||||
HIP_CHECK(hipGraphAddKernelNode(&vec_add, graph[2], nullptr, 0, &kerNodeParams3));
|
||||
// Resolve Dependencies in graph[2]
|
||||
HIP_CHECK(hipGraphAddDependencies(graph[2], &vec_mul1, &vec_add, 1));
|
||||
HIP_CHECK(hipGraphAddDependencies(graph[2], &vec_mul2, &vec_add, 1));
|
||||
@@ -576,8 +531,7 @@ typedef class nestedGraph {
|
||||
memsetParams.elementSize = sizeof(int);
|
||||
memsetParams.width = N;
|
||||
memsetParams.height = 1;
|
||||
HIP_CHECK(hipGraphAddMemsetNode(&memset_B1, graph[1], nullptr, 0,
|
||||
&memsetParams));
|
||||
HIP_CHECK(hipGraphAddMemsetNode(&memset_B1, graph[1], nullptr, 0, &memsetParams));
|
||||
memset(&memsetParams, 0, sizeof(memsetParams));
|
||||
memsetParams.dst = reinterpret_cast<void*>(B2_d);
|
||||
memsetParams.value = const_val2;
|
||||
@@ -585,38 +539,30 @@ typedef class nestedGraph {
|
||||
memsetParams.elementSize = sizeof(int);
|
||||
memsetParams.width = N;
|
||||
memsetParams.height = 1;
|
||||
HIP_CHECK(hipGraphAddMemsetNode(&memset_B2, graph[1], nullptr, 0,
|
||||
&memsetParams));
|
||||
HIP_CHECK(hipGraphAddChildGraphNode(&child_node1, graph[1],
|
||||
nullptr, 0, graph[2]));
|
||||
HIP_CHECK(hipGraphAddMemsetNode(&memset_B2, graph[1], nullptr, 0, &memsetParams));
|
||||
HIP_CHECK(hipGraphAddChildGraphNode(&child_node1, graph[1], nullptr, 0, graph[2]));
|
||||
void* kernelArgs4[] = {&C1_d, &C1_d};
|
||||
kerNodeParams3.func =
|
||||
reinterpret_cast<void *>(ker_vec_sqr);
|
||||
kerNodeParams3.func = reinterpret_cast<void*>(ker_vec_sqr);
|
||||
kerNodeParams3.gridDim = dim3(blocks);
|
||||
kerNodeParams3.blockDim = dim3(threadsPerBlock);
|
||||
kerNodeParams3.sharedMemBytes = 0;
|
||||
kerNodeParams3.kernelParams = reinterpret_cast<void**>(kernelArgs4);
|
||||
kerNodeParams3.extra = nullptr;
|
||||
HIP_CHECK(hipGraphAddKernelNode(&vec_sqr, graph[1], nullptr, 0,
|
||||
&kerNodeParams3));
|
||||
HIP_CHECK(hipGraphAddKernelNode(&vec_sqr, graph[1], nullptr, 0, &kerNodeParams3));
|
||||
HIP_CHECK(hipGraphAddDependencies(graph[1], &memset_B1, &child_node1, 1));
|
||||
HIP_CHECK(hipGraphAddDependencies(graph[1], &memset_B2, &child_node1, 1));
|
||||
HIP_CHECK(hipGraphAddDependencies(graph[1], &child_node1, &vec_sqr, 1));
|
||||
// Add nodes to graph[0]
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_A1, graph[0], nullptr,
|
||||
0, A1_d, A1_h, Nbytes, hipMemcpyHostToDevice));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_A2, graph[0], nullptr,
|
||||
0, A2_d, A2_h, Nbytes, hipMemcpyHostToDevice));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyD2H_A3, graph[0], nullptr,
|
||||
0, A3_h, C1_d, Nbytes, hipMemcpyDeviceToHost));
|
||||
HIP_CHECK(hipGraphAddChildGraphNode(&child_node2, graph[0],
|
||||
nullptr, 0, graph[1]));
|
||||
HIP_CHECK(hipGraphAddDependencies(graph[0], &memcpyH2D_A1,
|
||||
&child_node2, 1));
|
||||
HIP_CHECK(hipGraphAddDependencies(graph[0], &memcpyH2D_A2,
|
||||
&child_node2, 1));
|
||||
HIP_CHECK(hipGraphAddDependencies(graph[0], &child_node2,
|
||||
&memcpyD2H_A3, 1));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_A1, graph[0], nullptr, 0, A1_d, A1_h, Nbytes,
|
||||
hipMemcpyHostToDevice));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_A2, graph[0], nullptr, 0, A2_d, A2_h, Nbytes,
|
||||
hipMemcpyHostToDevice));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyD2H_A3, graph[0], nullptr, 0, A3_h, C1_d, Nbytes,
|
||||
hipMemcpyDeviceToHost));
|
||||
HIP_CHECK(hipGraphAddChildGraphNode(&child_node2, graph[0], nullptr, 0, graph[1]));
|
||||
HIP_CHECK(hipGraphAddDependencies(graph[0], &memcpyH2D_A1, &child_node2, 1));
|
||||
HIP_CHECK(hipGraphAddDependencies(graph[0], &memcpyH2D_A2, &child_node2, 1));
|
||||
HIP_CHECK(hipGraphAddDependencies(graph[0], &child_node2, &memcpyD2H_A3, 1));
|
||||
}
|
||||
// Fill Random Input Data
|
||||
void fillRandInpData() {
|
||||
@@ -627,9 +573,7 @@ typedef class nestedGraph {
|
||||
}
|
||||
}
|
||||
// Get the root graph
|
||||
hipGraph_t* getRootGraph() {
|
||||
return &graph[0];
|
||||
}
|
||||
hipGraph_t* getRootGraph() { return &graph[0]; }
|
||||
// Get the root graph
|
||||
void updateInnermostNode(updateGraphNodeTests updatetype) {
|
||||
hipGraph_t embGraph1, embGraph2;
|
||||
@@ -638,8 +582,7 @@ typedef class nestedGraph {
|
||||
size_t numNodes{};
|
||||
HIP_CHECK(hipGraphGetNodes(embGraph2, nullptr, &numNodes));
|
||||
hipGraphNode_t* nodes =
|
||||
reinterpret_cast<hipGraphNode_t *>(
|
||||
malloc(numNodes*sizeof(hipGraphNode_t)));
|
||||
reinterpret_cast<hipGraphNode_t*>(malloc(numNodes * sizeof(hipGraphNode_t)));
|
||||
HIP_CHECK(hipGraphGetNodes(embGraph2, nodes, &numNodes));
|
||||
// Get the Graph node from the embedded graph
|
||||
size_t nodeIdx = 0;
|
||||
@@ -656,8 +599,7 @@ typedef class nestedGraph {
|
||||
free(nodes);
|
||||
numNodes = 0;
|
||||
HIP_CHECK(hipGraphGetNodes(embGraph1, nullptr, &numNodes));
|
||||
nodes = reinterpret_cast<hipGraphNode_t *>(
|
||||
malloc(numNodes*sizeof(hipGraphNode_t)));
|
||||
nodes = reinterpret_cast<hipGraphNode_t*>(malloc(numNodes * sizeof(hipGraphNode_t)));
|
||||
// Get the kernel node from the extracted embedded graph
|
||||
HIP_CHECK(hipGraphGetNodes(embGraph1, nodes, &numNodes));
|
||||
nodeIdx = 0;
|
||||
@@ -667,36 +609,33 @@ typedef class nestedGraph {
|
||||
HIP_CHECK(hipGraphNodeGetType(nodes[idx], &nodeType));
|
||||
if (nodeType == hipGraphNodeTypeKernel) {
|
||||
HIP_CHECK(hipGraphKernelNodeGetParams(nodes[idx], &nodeParam));
|
||||
if (nodeParam.func == reinterpret_cast<void *>(ker_vec_add)) {
|
||||
if (nodeParam.func == reinterpret_cast<void*>(ker_vec_add)) {
|
||||
nodeIdx = idx;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (updatetype == updateGraphNodeTests::updateFunKerNodParamTest) {
|
||||
nodeParam.func = reinterpret_cast<void *>(ker_vec_sub);
|
||||
nodeParam.func = reinterpret_cast<void*>(ker_vec_sub);
|
||||
HIP_CHECK(hipGraphKernelNodeSetParams(nodes[nodeIdx], &nodeParam));
|
||||
} else if (updatetype == updateGraphNodeTests::deleteAddNewKerNodTest) {
|
||||
// delete the kernel add node
|
||||
HIP_CHECK(hipGraphDestroyNode(nodes[nodeIdx]));
|
||||
// add kernel subtract node to embGraph1
|
||||
void* kernelArgs[] = {&C1_d, &C2_d};
|
||||
kerNodeParams3.func =
|
||||
reinterpret_cast<void *>(ker_vec_sub);
|
||||
kerNodeParams3.func = reinterpret_cast<void*>(ker_vec_sub);
|
||||
kerNodeParams3.gridDim = dim3(blocks);
|
||||
kerNodeParams3.blockDim = dim3(threadsPerBlock);
|
||||
kerNodeParams3.sharedMemBytes = 0;
|
||||
kerNodeParams3.kernelParams = reinterpret_cast<void**>(kernelArgs);
|
||||
kerNodeParams3.extra = nullptr;
|
||||
HIP_CHECK(hipGraphAddKernelNode(&vec_sub, embGraph1, nullptr, 0,
|
||||
&kerNodeParams3));
|
||||
HIP_CHECK(hipGraphAddKernelNode(&vec_sub, embGraph1, nullptr, 0, &kerNodeParams3));
|
||||
// Create new dependencies
|
||||
for (size_t idx = 0; idx < numNodes; idx++) {
|
||||
if (idx == nodeIdx) {
|
||||
continue;
|
||||
}
|
||||
HIP_CHECK(hipGraphAddDependencies(embGraph1, &nodes[idx],
|
||||
&vec_sub, 1));
|
||||
HIP_CHECK(hipGraphAddDependencies(embGraph1, &nodes[idx], &vec_sub, 1));
|
||||
}
|
||||
} else if (updatetype == updateGraphNodeTests::updateGrdBlkParamTest) {
|
||||
nodeParam.blockDim = threadsPerBlockUpd;
|
||||
@@ -708,34 +647,26 @@ typedef class nestedGraph {
|
||||
// add graph EventRecordNode -> Subtract Kernel -> EventRecordNode as
|
||||
// child node
|
||||
void* kernelArgs[] = {&C1_d, &C2_d};
|
||||
kerNodeParams3.func =
|
||||
reinterpret_cast<void *>(ker_vec_sub);
|
||||
kerNodeParams3.func = reinterpret_cast<void*>(ker_vec_sub);
|
||||
kerNodeParams3.gridDim = dim3(blocks);
|
||||
kerNodeParams3.blockDim = dim3(threadsPerBlock);
|
||||
kerNodeParams3.sharedMemBytes = 0;
|
||||
kerNodeParams3.kernelParams = reinterpret_cast<void**>(kernelArgs);
|
||||
kerNodeParams3.extra = nullptr;
|
||||
HIP_CHECK(hipGraphAddKernelNode(&vec_sub, graph[3], nullptr, 0,
|
||||
&kerNodeParams3));
|
||||
HIP_CHECK(hipGraphAddKernelNode(&vec_sub, graph[3], nullptr, 0, &kerNodeParams3));
|
||||
HIP_CHECK(hipEventCreate(&eventstart));
|
||||
HIP_CHECK(hipEventCreate(&eventend));
|
||||
HIP_CHECK(hipGraphAddEventRecordNode(&event_start, graph[3], nullptr,
|
||||
0, eventstart));
|
||||
HIP_CHECK(hipGraphAddEventRecordNode(&event_final, graph[3], nullptr,
|
||||
0, eventend));
|
||||
HIP_CHECK(hipGraphAddDependencies(graph[3], &event_start,
|
||||
&vec_sub, 1));
|
||||
HIP_CHECK(hipGraphAddDependencies(graph[3], &vec_sub,
|
||||
&event_final, 1));
|
||||
HIP_CHECK(hipGraphAddChildGraphNode(&child_node3, embGraph1, nullptr,
|
||||
0, graph[3]));
|
||||
HIP_CHECK(hipGraphAddEventRecordNode(&event_start, graph[3], nullptr, 0, eventstart));
|
||||
HIP_CHECK(hipGraphAddEventRecordNode(&event_final, graph[3], nullptr, 0, eventend));
|
||||
HIP_CHECK(hipGraphAddDependencies(graph[3], &event_start, &vec_sub, 1));
|
||||
HIP_CHECK(hipGraphAddDependencies(graph[3], &vec_sub, &event_final, 1));
|
||||
HIP_CHECK(hipGraphAddChildGraphNode(&child_node3, embGraph1, nullptr, 0, graph[3]));
|
||||
// Create new dependencies
|
||||
for (size_t idx = 0; idx < numNodes; idx++) {
|
||||
if (idx == nodeIdx) {
|
||||
continue;
|
||||
}
|
||||
HIP_CHECK(hipGraphAddDependencies(embGraph1, &nodes[idx],
|
||||
&child_node3, 1));
|
||||
HIP_CHECK(hipGraphAddDependencies(embGraph1, &nodes[idx], &child_node3, 1));
|
||||
}
|
||||
}
|
||||
free(nodes);
|
||||
@@ -743,17 +674,17 @@ typedef class nestedGraph {
|
||||
// Function to validate result
|
||||
void validateOutData(updateGraphNodeTests updatetype) {
|
||||
if ((updatetype == updateGraphNodeTests::normalTest) ||
|
||||
(updatetype == updateGraphNodeTests::updateGrdBlkParamTest)) {
|
||||
(updatetype == updateGraphNodeTests::updateGrdBlkParamTest)) {
|
||||
for (int i = 0; i < N; i++) {
|
||||
int result = (const_val1*A1_h[i] + const_val2*A2_h[i]);
|
||||
int result = (const_val1 * A1_h[i] + const_val2 * A2_h[i]);
|
||||
result = result * result;
|
||||
REQUIRE(result == A3_h[i]);
|
||||
}
|
||||
} else if ((updatetype == updateGraphNodeTests::deleteAddNewKerNodTest)
|
||||
|| (updatetype == updateGraphNodeTests::updateFunKerNodParamTest)
|
||||
|| (updatetype == updateGraphNodeTests::addAnotherChildNodeTest)) {
|
||||
} else if ((updatetype == updateGraphNodeTests::deleteAddNewKerNodTest) ||
|
||||
(updatetype == updateGraphNodeTests::updateFunKerNodParamTest) ||
|
||||
(updatetype == updateGraphNodeTests::addAnotherChildNodeTest)) {
|
||||
for (int i = 0; i < N; i++) {
|
||||
int result = (const_val1*A1_h[i] - const_val2*A2_h[i]);
|
||||
int result = (const_val1 * A1_h[i] - const_val2 * A2_h[i]);
|
||||
result = result * result;
|
||||
REQUIRE(result == A3_h[i]);
|
||||
}
|
||||
@@ -784,15 +715,14 @@ typedef class nestedGraph {
|
||||
child graph.
|
||||
*/
|
||||
TEST_CASE("Unit_hipGraphAddChildGraphNode_Cmplx_NestedGraphs") {
|
||||
hipGraph_t *graph;
|
||||
hipGraph_t* graph;
|
||||
hipStream_t streamForGraph;
|
||||
hipGraphExec_t graphExec;
|
||||
class nestedGraph nestedGraphObj;
|
||||
graph = nestedGraphObj.getRootGraph();
|
||||
HIP_CHECK(hipStreamCreate(&streamForGraph));
|
||||
// Instantiate and launch the childgraph
|
||||
HIP_CHECK(hipGraphInstantiate(&graphExec, (*graph), nullptr,
|
||||
nullptr, 0));
|
||||
HIP_CHECK(hipGraphInstantiate(&graphExec, (*graph), nullptr, nullptr, 0));
|
||||
for (int iter = 0; iter < TEST_LOOP_SIZE; iter++) {
|
||||
nestedGraphObj.fillRandInpData();
|
||||
HIP_CHECK(hipGraphLaunch(graphExec, streamForGraph));
|
||||
@@ -816,8 +746,7 @@ TEST_CASE("Unit_hipGraphAddChildGraphNode_CmplxClone_NestedGraphs") {
|
||||
HIP_CHECK(hipGraphClone(&clonedGraph, *graph));
|
||||
HIP_CHECK(hipStreamCreate(&streamForGraph));
|
||||
// Instantiate and launch the childgraph
|
||||
HIP_CHECK(hipGraphInstantiate(&graphExec, clonedGraph, nullptr,
|
||||
nullptr, 0));
|
||||
HIP_CHECK(hipGraphInstantiate(&graphExec, clonedGraph, nullptr, nullptr, 0));
|
||||
for (int iter = 0; iter < TEST_LOOP_SIZE; iter++) {
|
||||
nestedGraphObj.fillRandInpData();
|
||||
HIP_CHECK(hipGraphLaunch(graphExec, streamForGraph));
|
||||
@@ -837,8 +766,7 @@ TEST_CASE("Unit_hipGraphAddChildGraphNode_EmptyGraphAsChildNode") {
|
||||
hipGraphNode_t child_node;
|
||||
HIP_CHECK(hipGraphCreate(&graph, 0));
|
||||
HIP_CHECK(hipGraphCreate(&graphChild, 0));
|
||||
HIP_CHECK(hipGraphAddChildGraphNode(&child_node, graph,
|
||||
nullptr, 0, graphChild));
|
||||
HIP_CHECK(hipGraphAddChildGraphNode(&child_node, graph, nullptr, 0, graphChild));
|
||||
HIP_CHECK(hipGraphDestroy(graphChild));
|
||||
HIP_CHECK(hipGraphDestroy(graph));
|
||||
}
|
||||
@@ -849,22 +777,19 @@ TEST_CASE("Unit_hipGraphAddChildGraphNode_EmptyGraphAsChildNode") {
|
||||
function is updated to a different function.
|
||||
*/
|
||||
TEST_CASE("Unit_hipGraphAddChildGraphNode_CmplxNstGrph_UpdKerFun") {
|
||||
hipGraph_t *graph;
|
||||
hipGraph_t* graph;
|
||||
hipStream_t streamForGraph;
|
||||
hipGraphExec_t graphExec;
|
||||
class nestedGraph nestedGraphObj;
|
||||
graph = nestedGraphObj.getRootGraph();
|
||||
nestedGraphObj.updateInnermostNode(
|
||||
updateGraphNodeTests::updateFunKerNodParamTest);
|
||||
nestedGraphObj.updateInnermostNode(updateGraphNodeTests::updateFunKerNodParamTest);
|
||||
HIP_CHECK(hipStreamCreate(&streamForGraph));
|
||||
// Instantiate and launch the childgraph
|
||||
HIP_CHECK(hipGraphInstantiate(&graphExec, (*graph), nullptr,
|
||||
nullptr, 0));
|
||||
HIP_CHECK(hipGraphInstantiate(&graphExec, (*graph), nullptr, nullptr, 0));
|
||||
nestedGraphObj.fillRandInpData();
|
||||
HIP_CHECK(hipGraphLaunch(graphExec, streamForGraph));
|
||||
HIP_CHECK(hipStreamSynchronize(streamForGraph));
|
||||
nestedGraphObj.validateOutData(
|
||||
updateGraphNodeTests::updateFunKerNodParamTest);
|
||||
nestedGraphObj.validateOutData(updateGraphNodeTests::updateFunKerNodParamTest);
|
||||
HIP_CHECK(hipStreamDestroy(streamForGraph));
|
||||
HIP_CHECK(hipGraphExecDestroy(graphExec));
|
||||
}
|
||||
@@ -881,18 +806,15 @@ TEST_CASE("Unit_hipGraphAddChildGraphNode_CmplxNstGrph_UpdKerFun_Clone") {
|
||||
hipGraphExec_t graphExec;
|
||||
class nestedGraph nestedGraphObj;
|
||||
graph = nestedGraphObj.getRootGraph();
|
||||
nestedGraphObj.updateInnermostNode(
|
||||
updateGraphNodeTests::updateFunKerNodParamTest);
|
||||
nestedGraphObj.updateInnermostNode(updateGraphNodeTests::updateFunKerNodParamTest);
|
||||
HIP_CHECK(hipGraphClone(&clonedGraph, *graph));
|
||||
HIP_CHECK(hipStreamCreate(&streamForGraph));
|
||||
// Instantiate and launch the childgraph
|
||||
HIP_CHECK(hipGraphInstantiate(&graphExec, clonedGraph, nullptr,
|
||||
nullptr, 0));
|
||||
HIP_CHECK(hipGraphInstantiate(&graphExec, clonedGraph, nullptr, nullptr, 0));
|
||||
nestedGraphObj.fillRandInpData();
|
||||
HIP_CHECK(hipGraphLaunch(graphExec, streamForGraph));
|
||||
HIP_CHECK(hipStreamSynchronize(streamForGraph));
|
||||
nestedGraphObj.validateOutData(
|
||||
updateGraphNodeTests::updateFunKerNodParamTest);
|
||||
nestedGraphObj.validateOutData(updateGraphNodeTests::updateFunKerNodParamTest);
|
||||
HIP_CHECK(hipStreamDestroy(streamForGraph));
|
||||
HIP_CHECK(hipGraphExecDestroy(graphExec));
|
||||
HIP_CHECK(hipGraphDestroy(clonedGraph));
|
||||
@@ -904,22 +826,19 @@ TEST_CASE("Unit_hipGraphAddChildGraphNode_CmplxNstGrph_UpdKerFun_Clone") {
|
||||
parameters - blocksize and gridsize are updated.
|
||||
*/
|
||||
TEST_CASE("Unit_hipGraphAddChildGraphNode_CmplxNstGrph_UpdKerDim") {
|
||||
hipGraph_t *graph;
|
||||
hipGraph_t* graph;
|
||||
hipStream_t streamForGraph;
|
||||
hipGraphExec_t graphExec;
|
||||
class nestedGraph nestedGraphObj;
|
||||
graph = nestedGraphObj.getRootGraph();
|
||||
nestedGraphObj.updateInnermostNode(
|
||||
updateGraphNodeTests::updateGrdBlkParamTest);
|
||||
nestedGraphObj.updateInnermostNode(updateGraphNodeTests::updateGrdBlkParamTest);
|
||||
HIP_CHECK(hipStreamCreate(&streamForGraph));
|
||||
// Instantiate and launch the childgraph
|
||||
HIP_CHECK(hipGraphInstantiate(&graphExec, (*graph), nullptr,
|
||||
nullptr, 0));
|
||||
HIP_CHECK(hipGraphInstantiate(&graphExec, (*graph), nullptr, nullptr, 0));
|
||||
nestedGraphObj.fillRandInpData();
|
||||
HIP_CHECK(hipGraphLaunch(graphExec, streamForGraph));
|
||||
HIP_CHECK(hipStreamSynchronize(streamForGraph));
|
||||
nestedGraphObj.validateOutData(
|
||||
updateGraphNodeTests::updateGrdBlkParamTest);
|
||||
nestedGraphObj.validateOutData(updateGraphNodeTests::updateGrdBlkParamTest);
|
||||
HIP_CHECK(hipStreamDestroy(streamForGraph));
|
||||
HIP_CHECK(hipGraphExecDestroy(graphExec));
|
||||
}
|
||||
@@ -930,22 +849,19 @@ TEST_CASE("Unit_hipGraphAddChildGraphNode_CmplxNstGrph_UpdKerDim") {
|
||||
a new node.
|
||||
*/
|
||||
TEST_CASE("Unit_hipGraphAddChildGraphNode_CmplxNstGrph_DelAddNode") {
|
||||
hipGraph_t *graph;
|
||||
hipGraph_t* graph;
|
||||
hipStream_t streamForGraph;
|
||||
hipGraphExec_t graphExec;
|
||||
class nestedGraph nestedGraphObj;
|
||||
graph = nestedGraphObj.getRootGraph();
|
||||
nestedGraphObj.updateInnermostNode(
|
||||
updateGraphNodeTests::deleteAddNewKerNodTest);
|
||||
nestedGraphObj.updateInnermostNode(updateGraphNodeTests::deleteAddNewKerNodTest);
|
||||
HIP_CHECK(hipStreamCreate(&streamForGraph));
|
||||
// Instantiate and launch the childgraph
|
||||
HIP_CHECK(hipGraphInstantiate(&graphExec, (*graph), nullptr,
|
||||
nullptr, 0));
|
||||
HIP_CHECK(hipGraphInstantiate(&graphExec, (*graph), nullptr, nullptr, 0));
|
||||
nestedGraphObj.fillRandInpData();
|
||||
HIP_CHECK(hipGraphLaunch(graphExec, streamForGraph));
|
||||
HIP_CHECK(hipStreamSynchronize(streamForGraph));
|
||||
nestedGraphObj.validateOutData(
|
||||
updateGraphNodeTests::deleteAddNewKerNodTest);
|
||||
nestedGraphObj.validateOutData(updateGraphNodeTests::deleteAddNewKerNodTest);
|
||||
HIP_CHECK(hipStreamDestroy(streamForGraph));
|
||||
HIP_CHECK(hipGraphExecDestroy(graphExec));
|
||||
}
|
||||
@@ -962,18 +878,15 @@ TEST_CASE("Unit_hipGraphAddChildGraphNode_CmplxNstGrph_AddNode_Clone") {
|
||||
hipGraphExec_t graphExec;
|
||||
class nestedGraph nestedGraphObj;
|
||||
graph = nestedGraphObj.getRootGraph();
|
||||
nestedGraphObj.updateInnermostNode(
|
||||
updateGraphNodeTests::deleteAddNewKerNodTest);
|
||||
nestedGraphObj.updateInnermostNode(updateGraphNodeTests::deleteAddNewKerNodTest);
|
||||
HIP_CHECK(hipGraphClone(&clonedGraph, *graph));
|
||||
HIP_CHECK(hipStreamCreate(&streamForGraph));
|
||||
// Instantiate and launch the childgraph
|
||||
HIP_CHECK(hipGraphInstantiate(&graphExec, clonedGraph, nullptr,
|
||||
nullptr, 0));
|
||||
HIP_CHECK(hipGraphInstantiate(&graphExec, clonedGraph, nullptr, nullptr, 0));
|
||||
nestedGraphObj.fillRandInpData();
|
||||
HIP_CHECK(hipGraphLaunch(graphExec, streamForGraph));
|
||||
HIP_CHECK(hipStreamSynchronize(streamForGraph));
|
||||
nestedGraphObj.validateOutData(
|
||||
updateGraphNodeTests::deleteAddNewKerNodTest);
|
||||
nestedGraphObj.validateOutData(updateGraphNodeTests::deleteAddNewKerNodTest);
|
||||
HIP_CHECK(hipStreamDestroy(streamForGraph));
|
||||
HIP_CHECK(hipGraphExecDestroy(graphExec));
|
||||
HIP_CHECK(hipGraphDestroy(clonedGraph));
|
||||
@@ -985,22 +898,19 @@ TEST_CASE("Unit_hipGraphAddChildGraphNode_CmplxNstGrph_AddNode_Clone") {
|
||||
a new child graph node.
|
||||
*/
|
||||
TEST_CASE("Unit_hipGraphAddChildGraphNode_CmplxNstGrph_AddChdNode") {
|
||||
hipGraph_t *graph;
|
||||
hipGraph_t* graph;
|
||||
hipStream_t streamForGraph;
|
||||
hipGraphExec_t graphExec;
|
||||
class nestedGraph nestedGraphObj;
|
||||
graph = nestedGraphObj.getRootGraph();
|
||||
nestedGraphObj.updateInnermostNode(
|
||||
updateGraphNodeTests::deleteAddNewKerNodTest);
|
||||
nestedGraphObj.updateInnermostNode(updateGraphNodeTests::deleteAddNewKerNodTest);
|
||||
HIP_CHECK(hipStreamCreate(&streamForGraph));
|
||||
// Instantiate and launch the childgraph
|
||||
HIP_CHECK(hipGraphInstantiate(&graphExec, (*graph), nullptr,
|
||||
nullptr, 0));
|
||||
HIP_CHECK(hipGraphInstantiate(&graphExec, (*graph), nullptr, nullptr, 0));
|
||||
nestedGraphObj.fillRandInpData();
|
||||
HIP_CHECK(hipGraphLaunch(graphExec, streamForGraph));
|
||||
HIP_CHECK(hipStreamSynchronize(streamForGraph));
|
||||
nestedGraphObj.validateOutData(
|
||||
updateGraphNodeTests::deleteAddNewKerNodTest);
|
||||
nestedGraphObj.validateOutData(updateGraphNodeTests::deleteAddNewKerNodTest);
|
||||
HIP_CHECK(hipStreamDestroy(streamForGraph));
|
||||
HIP_CHECK(hipGraphExecDestroy(graphExec));
|
||||
}
|
||||
@@ -1016,27 +926,24 @@ TEST_CASE("Unit_hipGraphAddChildGraphNode_CmplxNstGrph_AddChdNode_Clone") {
|
||||
hipGraphExec_t graphExec;
|
||||
class nestedGraph nestedGraphObj;
|
||||
graph = nestedGraphObj.getRootGraph();
|
||||
nestedGraphObj.updateInnermostNode(
|
||||
updateGraphNodeTests::deleteAddNewKerNodTest);
|
||||
nestedGraphObj.updateInnermostNode(updateGraphNodeTests::deleteAddNewKerNodTest);
|
||||
HIP_CHECK(hipGraphClone(&clonedGraph, *graph));
|
||||
HIP_CHECK(hipStreamCreate(&streamForGraph));
|
||||
// Instantiate and launch the childgraph
|
||||
HIP_CHECK(hipGraphInstantiate(&graphExec, clonedGraph, nullptr,
|
||||
nullptr, 0));
|
||||
HIP_CHECK(hipGraphInstantiate(&graphExec, clonedGraph, nullptr, nullptr, 0));
|
||||
nestedGraphObj.fillRandInpData();
|
||||
HIP_CHECK(hipGraphLaunch(graphExec, streamForGraph));
|
||||
HIP_CHECK(hipStreamSynchronize(streamForGraph));
|
||||
nestedGraphObj.validateOutData(
|
||||
updateGraphNodeTests::deleteAddNewKerNodTest);
|
||||
nestedGraphObj.validateOutData(updateGraphNodeTests::deleteAddNewKerNodTest);
|
||||
HIP_CHECK(hipStreamDestroy(streamForGraph));
|
||||
HIP_CHECK(hipGraphExecDestroy(graphExec));
|
||||
HIP_CHECK(hipGraphDestroy(clonedGraph));
|
||||
}
|
||||
|
||||
// Function to validate result
|
||||
static void validateResults(int *A1_h, int *A2_h, size_t N) {
|
||||
static void validateResults(int* A1_h, int* A2_h, size_t N) {
|
||||
for (size_t i = 0; i < N; i++) {
|
||||
int result = (A1_h[i]*A1_h[i]);
|
||||
int result = (A1_h[i] * A1_h[i]);
|
||||
REQUIRE(result == A2_h[i]);
|
||||
}
|
||||
}
|
||||
@@ -1053,101 +960,89 @@ TEST_CASE("Unit_hipGraphAddChildGraphNode_MultGraphsAsSingleGraph") {
|
||||
size_t size = 1024;
|
||||
constexpr auto blocksPerCU = 6;
|
||||
constexpr auto threadsPerBlock = 256;
|
||||
unsigned blocks = HipTest::setNumBlocks(blocksPerCU,
|
||||
threadsPerBlock, size);
|
||||
unsigned blocks = HipTest::setNumBlocks(blocksPerCU, threadsPerBlock, size);
|
||||
hipGraph_t graph1, graph2, graph3, graph4;
|
||||
std::vector<hipGraphNode_t> nodeDependencies;
|
||||
HIP_CHECK(hipGraphCreate(&graph1, 0));
|
||||
HIP_CHECK(hipGraphCreate(&graph2, 0));
|
||||
HIP_CHECK(hipGraphCreate(&graph3, 0));
|
||||
HIP_CHECK(hipGraphCreate(&graph4, 0));
|
||||
int *inputVec_d1{nullptr}, *inputVec_h1{nullptr}, *outputVec_h1{nullptr},
|
||||
*outputVec_d1{nullptr};
|
||||
int *inputVec_d2{nullptr}, *inputVec_h2{nullptr}, *outputVec_h2{nullptr},
|
||||
*outputVec_d2{nullptr};
|
||||
int *inputVec_d3{nullptr}, *inputVec_h3{nullptr}, *outputVec_h3{nullptr},
|
||||
*outputVec_d3{nullptr};
|
||||
int *inputVec_d1{nullptr}, *inputVec_h1{nullptr}, *outputVec_h1{nullptr}, *outputVec_d1{nullptr};
|
||||
int *inputVec_d2{nullptr}, *inputVec_h2{nullptr}, *outputVec_h2{nullptr}, *outputVec_d2{nullptr};
|
||||
int *inputVec_d3{nullptr}, *inputVec_h3{nullptr}, *outputVec_h3{nullptr}, *outputVec_d3{nullptr};
|
||||
// host and device allocation
|
||||
HipTest::initArrays<int>(&inputVec_d1, &outputVec_d1, nullptr,
|
||||
&inputVec_h1, &outputVec_h1, nullptr, size, false);
|
||||
HipTest::initArrays<int>(&inputVec_d2, &outputVec_d2, nullptr,
|
||||
&inputVec_h2, &outputVec_h2, nullptr, size, false);
|
||||
HipTest::initArrays<int>(&inputVec_d3, &outputVec_d3, nullptr,
|
||||
&inputVec_h3, &outputVec_h3, nullptr, size, false);
|
||||
HipTest::initArrays<int>(&inputVec_d1, &outputVec_d1, nullptr, &inputVec_h1, &outputVec_h1,
|
||||
nullptr, size, false);
|
||||
HipTest::initArrays<int>(&inputVec_d2, &outputVec_d2, nullptr, &inputVec_h2, &outputVec_h2,
|
||||
nullptr, size, false);
|
||||
HipTest::initArrays<int>(&inputVec_d3, &outputVec_d3, nullptr, &inputVec_h3, &outputVec_h3,
|
||||
nullptr, size, false);
|
||||
// add nodes to graph
|
||||
hipGraphNode_t memcpyH2D_1, memcpyH2D_2, memcpyH2D_3;
|
||||
hipGraphNode_t vecSqr1, vecSqr2, vecSqr3;
|
||||
hipGraphNode_t memcpyD2H_1, memcpyD2H_2, memcpyD2H_3;
|
||||
hipGraphNode_t childGraphNode1, childGraphNode2, childGraphNode3;
|
||||
// Create memcpy h2d nodes
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_1, graph1, nullptr,
|
||||
0, inputVec_d1, inputVec_h1, (sizeof(int)*size), hipMemcpyHostToDevice));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_2, graph1, nullptr,
|
||||
0, inputVec_d2, inputVec_h2, (sizeof(int)*size), hipMemcpyHostToDevice));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_3, graph1, nullptr,
|
||||
0, inputVec_d3, inputVec_h3, (sizeof(int)*size), hipMemcpyHostToDevice));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_1, graph1, nullptr, 0, inputVec_d1, inputVec_h1,
|
||||
(sizeof(int) * size), hipMemcpyHostToDevice));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_2, graph1, nullptr, 0, inputVec_d2, inputVec_h2,
|
||||
(sizeof(int) * size), hipMemcpyHostToDevice));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyH2D_3, graph1, nullptr, 0, inputVec_d3, inputVec_h3,
|
||||
(sizeof(int) * size), hipMemcpyHostToDevice));
|
||||
// Create child node and add it to graph4
|
||||
HIP_CHECK(hipGraphAddChildGraphNode(&childGraphNode1, graph4, nullptr, 0,
|
||||
graph1));
|
||||
HIP_CHECK(hipGraphAddChildGraphNode(&childGraphNode1, graph4, nullptr, 0, graph1));
|
||||
nodeDependencies.clear();
|
||||
nodeDependencies.push_back(childGraphNode1);
|
||||
// Creating kernel nodes
|
||||
hipKernelNodeParams kerNodeParams1{}, kerNodeParams2{}, kerNodeParams3{};
|
||||
void* kernelArgs1[] = {reinterpret_cast<void*>(&inputVec_d1),
|
||||
reinterpret_cast<void*>(&outputVec_d1),
|
||||
reinterpret_cast<void*>(&size)};
|
||||
reinterpret_cast<void*>(&outputVec_d1), reinterpret_cast<void*>(&size)};
|
||||
kerNodeParams1.func = reinterpret_cast<void*>(HipTest::vector_square<int>);
|
||||
kerNodeParams1.gridDim = dim3(blocks);
|
||||
kerNodeParams1.blockDim = dim3(threadsPerBlock);
|
||||
kerNodeParams1.sharedMemBytes = 0;
|
||||
kerNodeParams1.kernelParams = reinterpret_cast<void**>(kernelArgs1);
|
||||
kerNodeParams1.extra = nullptr;
|
||||
HIP_CHECK(hipGraphAddKernelNode(&vecSqr1, graph2, nullptr, 0,
|
||||
&kerNodeParams1));
|
||||
HIP_CHECK(hipGraphAddKernelNode(&vecSqr1, graph2, nullptr, 0, &kerNodeParams1));
|
||||
void* kernelArgs2[] = {reinterpret_cast<void*>(&inputVec_d2),
|
||||
reinterpret_cast<void*>(&outputVec_d2),
|
||||
reinterpret_cast<void*>(&size)};
|
||||
reinterpret_cast<void*>(&outputVec_d2), reinterpret_cast<void*>(&size)};
|
||||
kerNodeParams2.func = reinterpret_cast<void*>(HipTest::vector_square<int>);
|
||||
kerNodeParams2.gridDim = dim3(blocks);
|
||||
kerNodeParams2.blockDim = dim3(threadsPerBlock);
|
||||
kerNodeParams2.sharedMemBytes = 0;
|
||||
kerNodeParams2.kernelParams = reinterpret_cast<void**>(kernelArgs2);
|
||||
kerNodeParams2.extra = nullptr;
|
||||
HIP_CHECK(hipGraphAddKernelNode(&vecSqr2, graph2, nullptr, 0,
|
||||
&kerNodeParams2));
|
||||
HIP_CHECK(hipGraphAddKernelNode(&vecSqr2, graph2, nullptr, 0, &kerNodeParams2));
|
||||
void* kernelArgs3[] = {reinterpret_cast<void*>(&inputVec_d3),
|
||||
reinterpret_cast<void*>(&outputVec_d3),
|
||||
reinterpret_cast<void*>(&size)};
|
||||
reinterpret_cast<void*>(&outputVec_d3), reinterpret_cast<void*>(&size)};
|
||||
kerNodeParams3.func = reinterpret_cast<void*>(HipTest::vector_square<int>);
|
||||
kerNodeParams3.gridDim = dim3(blocks);
|
||||
kerNodeParams3.blockDim = dim3(threadsPerBlock);
|
||||
kerNodeParams3.sharedMemBytes = 0;
|
||||
kerNodeParams3.kernelParams = reinterpret_cast<void**>(kernelArgs3);
|
||||
kerNodeParams3.extra = nullptr;
|
||||
HIP_CHECK(hipGraphAddKernelNode(&vecSqr3, graph2, nullptr, 0,
|
||||
&kerNodeParams3));
|
||||
HIP_CHECK(hipGraphAddKernelNode(&vecSqr3, graph2, nullptr, 0, &kerNodeParams3));
|
||||
// Create child node and add it to graph4
|
||||
HIP_CHECK(hipGraphAddChildGraphNode(&childGraphNode2, graph4,
|
||||
nodeDependencies.data(), nodeDependencies.size(), graph2));
|
||||
HIP_CHECK(hipGraphAddChildGraphNode(&childGraphNode2, graph4, nodeDependencies.data(),
|
||||
nodeDependencies.size(), graph2));
|
||||
nodeDependencies.clear();
|
||||
nodeDependencies.push_back(childGraphNode2);
|
||||
// Create memcpy d2h nodes
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyD2H_1, graph3, nullptr, 0,
|
||||
outputVec_h1, outputVec_d1, (sizeof(int)*size), hipMemcpyDeviceToHost));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyD2H_2, graph3, nullptr, 0,
|
||||
outputVec_h2, outputVec_d2, (sizeof(int)*size), hipMemcpyDeviceToHost));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyD2H_3, graph3, nullptr, 0,
|
||||
outputVec_h3, outputVec_d3, (sizeof(int)*size), hipMemcpyDeviceToHost));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyD2H_1, graph3, nullptr, 0, outputVec_h1, outputVec_d1,
|
||||
(sizeof(int) * size), hipMemcpyDeviceToHost));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyD2H_2, graph3, nullptr, 0, outputVec_h2, outputVec_d2,
|
||||
(sizeof(int) * size), hipMemcpyDeviceToHost));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpyD2H_3, graph3, nullptr, 0, outputVec_h3, outputVec_d3,
|
||||
(sizeof(int) * size), hipMemcpyDeviceToHost));
|
||||
// Create child node and add it to graph4
|
||||
HIP_CHECK(hipGraphAddChildGraphNode(&childGraphNode3, graph4,
|
||||
nodeDependencies.data(), nodeDependencies.size(), graph3));
|
||||
HIP_CHECK(hipGraphAddChildGraphNode(&childGraphNode3, graph4, nodeDependencies.data(),
|
||||
nodeDependencies.size(), graph3));
|
||||
nodeDependencies.clear();
|
||||
// Create executable graph
|
||||
hipStream_t streamForGraph;
|
||||
hipGraphExec_t graphExec{nullptr};
|
||||
HIP_CHECK(hipStreamCreate(&streamForGraph));
|
||||
HIP_CHECK(hipGraphInstantiate(&graphExec, graph4, nullptr,
|
||||
nullptr, 0));
|
||||
HIP_CHECK(hipGraphInstantiate(&graphExec, graph4, nullptr, nullptr, 0));
|
||||
// Execute graph
|
||||
for (int iter = 0; iter < TEST_LOOP_SIZE; iter++) {
|
||||
// Inititalize random input data
|
||||
@@ -1166,12 +1061,12 @@ TEST_CASE("Unit_hipGraphAddChildGraphNode_MultGraphsAsSingleGraph") {
|
||||
HIP_CHECK(hipGraphExecDestroy(graphExec));
|
||||
HIP_CHECK(hipStreamDestroy(streamForGraph));
|
||||
// Free
|
||||
HipTest::freeArrays<int>(inputVec_d1, outputVec_d1, nullptr,
|
||||
inputVec_h1, outputVec_h1, nullptr, false);
|
||||
HipTest::freeArrays<int>(inputVec_d2, outputVec_d2, nullptr,
|
||||
inputVec_h2, outputVec_h2, nullptr, false);
|
||||
HipTest::freeArrays<int>(inputVec_d3, outputVec_d3, nullptr,
|
||||
inputVec_h3, outputVec_h3, nullptr, false);
|
||||
HipTest::freeArrays<int>(inputVec_d1, outputVec_d1, nullptr, inputVec_h1, outputVec_h1, nullptr,
|
||||
false);
|
||||
HipTest::freeArrays<int>(inputVec_d2, outputVec_d2, nullptr, inputVec_h2, outputVec_h2, nullptr,
|
||||
false);
|
||||
HipTest::freeArrays<int>(inputVec_d3, outputVec_d3, nullptr, inputVec_h3, outputVec_h3, nullptr,
|
||||
false);
|
||||
HIP_CHECK(hipGraphDestroy(graph4));
|
||||
HIP_CHECK(hipGraphDestroy(graph3));
|
||||
HIP_CHECK(hipGraphDestroy(graph2));
|
||||
@@ -1191,13 +1086,13 @@ TEST_CASE("Unit_hipGraphAddChildGraphNode_CmplxNstGrph_MultGPU") {
|
||||
SUCCEED("skipping the testcases as numDevices < 2");
|
||||
return;
|
||||
}
|
||||
hipGraph_t **graph = new hipGraph_t *[devcount]();
|
||||
hipGraph_t** graph = new hipGraph_t*[devcount]();
|
||||
REQUIRE(graph != nullptr);
|
||||
hipStream_t *streamForGraph = new hipStream_t[devcount];
|
||||
hipStream_t* streamForGraph = new hipStream_t[devcount];
|
||||
REQUIRE(streamForGraph != nullptr);
|
||||
hipGraphExec_t *graphExec = new hipGraphExec_t[devcount];
|
||||
hipGraphExec_t* graphExec = new hipGraphExec_t[devcount];
|
||||
REQUIRE(graphExec != nullptr);
|
||||
clNestedGraph** nestedGraphObj = new clNestedGraph *[devcount]();
|
||||
clNestedGraph** nestedGraphObj = new clNestedGraph*[devcount]();
|
||||
REQUIRE(nestedGraphObj != nullptr);
|
||||
// Create graph resources for each devices
|
||||
for (int dev = 0; dev < devcount; dev++) {
|
||||
@@ -1207,8 +1102,7 @@ TEST_CASE("Unit_hipGraphAddChildGraphNode_CmplxNstGrph_MultGPU") {
|
||||
graph[dev] = nestedGraphObj[dev]->getRootGraph();
|
||||
HIP_CHECK(hipStreamCreate(&streamForGraph[dev]));
|
||||
// Instantiate and launch the childgraph
|
||||
HIP_CHECK(hipGraphInstantiate(&graphExec[dev], *(graph[dev]), nullptr,
|
||||
nullptr, 0));
|
||||
HIP_CHECK(hipGraphInstantiate(&graphExec[dev], *(graph[dev]), nullptr, nullptr, 0));
|
||||
}
|
||||
// Execute graph in each GPU
|
||||
for (int dev = 0; dev < devcount; dev++) {
|
||||
@@ -1220,8 +1114,7 @@ TEST_CASE("Unit_hipGraphAddChildGraphNode_CmplxNstGrph_MultGPU") {
|
||||
for (int dev = 0; dev < devcount; dev++) {
|
||||
HIP_CHECK(hipSetDevice(dev));
|
||||
HIP_CHECK(hipStreamSynchronize(streamForGraph[dev]));
|
||||
nestedGraphObj[dev]->validateOutData(
|
||||
updateGraphNodeTests::normalTest);
|
||||
nestedGraphObj[dev]->validateOutData(updateGraphNodeTests::normalTest);
|
||||
}
|
||||
// Destroy graph resources
|
||||
for (int dev = 0; dev < devcount; dev++) {
|
||||
|
||||
Ссылка в новой задаче
Block a user