CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
189 lines
5.9 KiB
C++
189 lines
5.9 KiB
C++
/*
|
|
* Copyright (c) Advanced Micro Devices, Inc., or its affiliates.
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
|
|
#include <functional>
|
|
|
|
#include <hip_test_common.hh>
|
|
#include <hip_test_defgroups.hh>
|
|
#include <memcpy1d_tests_common.hh>
|
|
|
|
#include "graph_tests_common.hh"
|
|
|
|
static inline hipMemcpyKind ReverseMemcpyDirection(const hipMemcpyKind direction) {
|
|
switch (direction) {
|
|
case hipMemcpyHostToDevice:
|
|
return hipMemcpyDeviceToHost;
|
|
case hipMemcpyDeviceToHost:
|
|
return hipMemcpyHostToDevice;
|
|
default:
|
|
return direction;
|
|
}
|
|
};
|
|
|
|
/**
|
|
* @addtogroup hipGraphMemcpyNodeSetParams1D hipGraphMemcpyNodeSetParams1D
|
|
* @{
|
|
* @ingroup GraphTest
|
|
* `hipGraphMemcpyNodeSetParams1D(hipGraphNode_t node, void *dst, const void *src, size_t count,
|
|
* hipMemcpyKind kind)` - Sets a memcpy node's parameters to perform a 1-dimensional copy
|
|
*/
|
|
|
|
/**
|
|
* 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/hipGraphMemcpyNodeSetParams1D.cc
|
|
* Test requirements
|
|
* ------------------------
|
|
* - HIP_VERSION >= 5.2
|
|
*/
|
|
HIP_TEST_CASE(Unit_hipGraphMemcpyNodeSetParams1D_Positive_Basic) {
|
|
constexpr auto f = [](void* dst, void* src, size_t count, hipMemcpyKind direction) {
|
|
hipGraph_t graph = nullptr;
|
|
HIP_CHECK(hipGraphCreate(&graph, 0));
|
|
hipGraphNode_t node = nullptr;
|
|
HIP_CHECK(hipGraphAddMemcpyNode1D(&node, graph, nullptr, 0, src, dst, count / 2,
|
|
ReverseMemcpyDirection(direction)));
|
|
HIP_CHECK(hipGraphMemcpyNodeSetParams1D(node, dst, src, count, direction));
|
|
hipGraphExec_t graph_exec = nullptr;
|
|
HIP_CHECK(hipGraphInstantiate(&graph_exec, graph, nullptr, nullptr, 0));
|
|
HIP_CHECK(hipGraphLaunch(graph_exec, hipStreamPerThread));
|
|
HIP_CHECK(hipStreamSynchronize(hipStreamPerThread));
|
|
|
|
HIP_CHECK(hipGraphExecDestroy(graph_exec));
|
|
HIP_CHECK(hipGraphDestroy(graph));
|
|
|
|
return hipSuccess;
|
|
};
|
|
|
|
#if HT_NVIDIA
|
|
MemcpyWithDirectionCommonTests<false>(f);
|
|
#else
|
|
using namespace std::placeholders;
|
|
|
|
SECTION("Device to host") {
|
|
MemcpyDeviceToHostShell<false>(std::bind(f, _1, _2, _3, hipMemcpyDeviceToHost));
|
|
}
|
|
|
|
SECTION("Host to device") {
|
|
MemcpyHostToDeviceShell<false>(std::bind(f, _1, _2, _3, hipMemcpyHostToDevice));
|
|
}
|
|
|
|
SECTION("Device to device") {
|
|
SECTION("Peer access enabled") {
|
|
MemcpyDeviceToDeviceShell<false, true>(std::bind(f, _1, _2, _3, hipMemcpyDeviceToDevice));
|
|
}
|
|
SECTION("Peer access disabled") {
|
|
MemcpyDeviceToDeviceShell<false, false>(std::bind(f, _1, _2, _3, hipMemcpyDeviceToDevice));
|
|
}
|
|
}
|
|
|
|
SECTION("Device to device with default kind") {
|
|
SECTION("Peer access enabled") {
|
|
MemcpyDeviceToDeviceShell<false, true>(std::bind(f, _1, _2, _3, hipMemcpyDefault));
|
|
}
|
|
SECTION("Peer access disabled") {
|
|
MemcpyDeviceToDeviceShell<false, false>(std::bind(f, _1, _2, _3, hipMemcpyDefault));
|
|
}
|
|
}
|
|
|
|
// Disabled on AMD due to defect - EXSWHTEC-209
|
|
#if 0
|
|
SECTION("Host to host") {
|
|
MemcpyHostToHostShell<false>(std::bind(f, _1, _2, _3, hipMemcpyHostToHost));
|
|
}
|
|
|
|
SECTION("Host to host with default kind") {
|
|
MemcpyHostToHostShell<false>(std::bind(f, _1, _2, _3, hipMemcpyDefault));
|
|
}
|
|
#endif
|
|
|
|
// Disabled on AMD due to defect - EXSWHTEC-210
|
|
#if 0
|
|
SECTION("Device to host with default kind") {
|
|
MemcpyDeviceToHostShell<false>(std::bind(f, _1, _2, _3, hipMemcpyDefault));
|
|
}
|
|
|
|
SECTION("Host to device with default kind") {
|
|
MemcpyHostToDeviceShell<false>(std::bind(f, _1, _2, _3, hipMemcpyDefault));
|
|
}
|
|
#endif
|
|
|
|
#endif
|
|
}
|
|
|
|
/**
|
|
* Test Description
|
|
* ------------------------
|
|
* - Verify API behaviour with invalid arguments:
|
|
* -# node is nullptr
|
|
* -# 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/hipGraphMemcpyNodeSetParams1D.cc
|
|
* Test requirements
|
|
* ------------------------
|
|
* - HIP_VERSION >= 5.2
|
|
*/
|
|
HIP_TEST_CASE(Unit_hipGraphMemcpyNodeSetParams1D_Negative_Parameters) {
|
|
using namespace std::placeholders;
|
|
hipGraph_t graph = nullptr;
|
|
HIP_CHECK(hipGraphCreate(&graph, 0));
|
|
|
|
int src[2] = {}, dst[2] = {};
|
|
|
|
hipGraphNode_t node = nullptr;
|
|
HIP_CHECK(
|
|
hipGraphAddMemcpyNode1D(&node, graph, nullptr, 0, dst, src, sizeof(dst), hipMemcpyDefault));
|
|
|
|
|
|
SECTION("node == nullptr") {
|
|
HIP_CHECK_ERROR(hipGraphMemcpyNodeSetParams1D(nullptr, dst, src, sizeof(dst), hipMemcpyDefault),
|
|
hipErrorInvalidValue);
|
|
}
|
|
|
|
MemcpyWithDirectionCommonNegativeTests(
|
|
std::bind(hipGraphMemcpyNodeSetParams1D, node, _1, _2, _3, _4), dst, src, sizeof(dst),
|
|
hipMemcpyDefault);
|
|
|
|
SECTION("count == 0") {
|
|
HIP_CHECK_ERROR(hipGraphMemcpyNodeSetParams1D(node, dst, src, 0, hipMemcpyDefault),
|
|
hipErrorInvalidValue);
|
|
}
|
|
|
|
SECTION("count larger than dst allocation size") {
|
|
LinearAllocGuard<int> dev_dst(LinearAllocs::hipMalloc, sizeof(int));
|
|
HIP_CHECK_ERROR(
|
|
hipGraphMemcpyNodeSetParams1D(node, dev_dst.ptr(), src, sizeof(src), hipMemcpyDefault),
|
|
hipErrorInvalidValue);
|
|
}
|
|
|
|
SECTION("count larger than src allocation size") {
|
|
LinearAllocGuard<int> dev_src(LinearAllocs::hipMalloc, sizeof(int));
|
|
HIP_CHECK_ERROR(
|
|
hipGraphMemcpyNodeSetParams1D(node, dst, dev_src.ptr(), sizeof(dst), hipMemcpyDefault),
|
|
hipErrorInvalidValue);
|
|
}
|
|
|
|
HIP_CHECK(hipGraphDestroy(graph));
|
|
}
|
|
|
|
/**
|
|
* End doxygen group GraphTest.
|
|
* @}
|
|
*/
|