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
76 lines
2.6 KiB
C++
76 lines
2.6 KiB
C++
/*
|
|
* Copyright (c) Advanced Micro Devices, Inc., or its affiliates.
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
|
|
/*
|
|
* Test Scenarios:
|
|
* 1. Perform simple and pinned host memory of hipMemcpyHtoA API
|
|
* 2. Allocate Memory from one GPU device and call hipMemcpyHtoA from Peer
|
|
* GPU device
|
|
* 3. Perform hipMemcpyHtoA Negative Scenarios
|
|
* 4. Perform bytecount 0 validation for hipMemcpyHtoA API
|
|
*/
|
|
|
|
#include <hip_test_common.hh>
|
|
#include <hip_test_checkers.hh>
|
|
|
|
|
|
static constexpr auto NUM_W{10};
|
|
static constexpr auto NUM_H{1};
|
|
static constexpr auto copy_bytes{2};
|
|
|
|
/*
|
|
This testcase performs the peer device context scenario
|
|
of hipMemcpyHtoA API
|
|
Memory is allocated in GPU-0 and the API is triggered from GPU-1
|
|
Input: "B_h" which is initialized with 1.6
|
|
Output: "A_d" output of hipMemcpyHtoA is copied to "hData" host variable
|
|
validated the result with "B_h"
|
|
*/
|
|
#if HT_AMD
|
|
HIP_TEMPLATE_TEST_CASE(Unit_hipMemcpyHtoA_multiDevice_PeerDeviceContext, char, int, float) {
|
|
CHECK_IMAGE_SUPPORT
|
|
int numDevices = 0;
|
|
HIP_CHECK(hipGetDeviceCount(&numDevices));
|
|
if (numDevices > 1) {
|
|
int peerAccess = 0;
|
|
HIP_CHECK(hipDeviceCanAccessPeer(&peerAccess, 1, 0));
|
|
if (!peerAccess) {
|
|
HIP_SKIP_TEST(HipTest::SkipReason::kPeerAccessUnavailable);
|
|
} else {
|
|
HIP_CHECK(hipSetDevice(0));
|
|
hipArray_t A_d;
|
|
TestType *hData{nullptr}, *B_h{nullptr};
|
|
size_t width{NUM_W * sizeof(TestType)};
|
|
|
|
// Initialization of data
|
|
HipTest::initArrays<TestType>(nullptr, nullptr, nullptr, &hData, &B_h, nullptr, NUM_W);
|
|
HipTest::setDefaultData<TestType>(NUM_W, hData, B_h, nullptr);
|
|
hipChannelFormatDesc desc = hipCreateChannelDesc<TestType>();
|
|
HIP_CHECK(hipMallocArray(&A_d, &desc, NUM_W, NUM_H, hipArrayDefault));
|
|
HIP_CHECK(hipMemcpy2DToArray(A_d, 0, 0, hData, width, width, NUM_H, hipMemcpyHostToDevice));
|
|
|
|
// Changing the device context
|
|
HIP_CHECK(hipSetDevice(1));
|
|
|
|
// Performing API call
|
|
HIP_CHECK(hipMemcpyHtoA(A_d, 0, B_h, copy_bytes * sizeof(TestType)));
|
|
HIP_CHECK(hipMemcpy2DFromArray(hData, sizeof(TestType) * NUM_W, A_d, 0, 0,
|
|
sizeof(TestType) * NUM_W, 1, hipMemcpyDeviceToHost));
|
|
|
|
// Validating the result
|
|
REQUIRE(HipTest::checkArray(B_h, hData, copy_bytes, NUM_H) == true);
|
|
|
|
// DeAllocating the memory
|
|
HIP_CHECK(hipFreeArray(A_d));
|
|
REQUIRE(HipTest::freeArrays<TestType>(nullptr, nullptr, nullptr, hData, B_h, nullptr,
|
|
false) == true);
|
|
}
|
|
} else {
|
|
HIP_SKIP_TEST(HipTest::SkipReason::kFewerThanTwoGpus);
|
|
}
|
|
}
|
|
#endif
|