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
157 lines
5.0 KiB
C++
157 lines
5.0 KiB
C++
/*
|
|
* Copyright (c) Advanced Micro Devices, Inc., or its affiliates.
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
|
|
#include "execution_control_common.hh"
|
|
|
|
#include <hip_test_common.hh>
|
|
#include <hip/hip_runtime_api.h>
|
|
#include <resource_guards.hh>
|
|
#include <utils.hh>
|
|
|
|
HIP_TEST_CASE(Unit_hipLaunchCooperativeKernelMultiDevice_Positive_Basic) {
|
|
if (!DeviceAttributesSupport(0, hipDeviceAttributeCooperativeLaunch)) {
|
|
HIP_SKIP_TEST(HipTest::SkipReason::kCooperativeLaunchUnsupported);
|
|
}
|
|
|
|
const auto device_count = HipTest::getDeviceCount();
|
|
if (device_count < 2) {
|
|
HIP_SKIP_TEST(HipTest::SkipReason::kFewerThanTwoGpus);
|
|
}
|
|
|
|
std::vector<hipLaunchParams> params_list(device_count);
|
|
|
|
int device = 0;
|
|
for (auto& params : params_list) {
|
|
params.func = reinterpret_cast<void*>(coop_kernel);
|
|
params.gridDim = dim3{1, 1, 1};
|
|
params.blockDim = dim3{1, 1, 1};
|
|
params.args = nullptr;
|
|
params.sharedMem = 0;
|
|
HIP_CHECK(hipSetDevice(device++));
|
|
HIP_CHECK(hipStreamCreate(¶ms.stream));
|
|
}
|
|
|
|
HIP_CHECK(hipLaunchCooperativeKernelMultiDevice(params_list.data(), device_count, 0u));
|
|
|
|
for (const auto params : params_list) {
|
|
HIP_CHECK(hipStreamSynchronize(params.stream));
|
|
}
|
|
|
|
for (const auto params : params_list) {
|
|
HIP_CHECK(hipStreamDestroy(params.stream));
|
|
}
|
|
}
|
|
|
|
HIP_TEST_CASE(Unit_hipLaunchCooperativeKernelMultiDevice_Negative_Parameters) {
|
|
if (!DeviceAttributesSupport(0, hipDeviceAttributeCooperativeLaunch)) {
|
|
HIP_SKIP_TEST(HipTest::SkipReason::kCooperativeLaunchUnsupported);
|
|
}
|
|
|
|
const auto device_count = HipTest::getDeviceCount();
|
|
if (device_count < 2) {
|
|
HIP_SKIP_TEST(HipTest::SkipReason::kFewerThanTwoGpus);
|
|
}
|
|
|
|
std::vector<hipLaunchParams> params_list(device_count);
|
|
|
|
int device = 0;
|
|
for (auto& params : params_list) {
|
|
params.func = reinterpret_cast<void*>(coop_kernel);
|
|
params.gridDim = dim3{1, 1, 1};
|
|
params.blockDim = dim3{1, 1, 1};
|
|
params.args = nullptr;
|
|
params.sharedMem = 0;
|
|
HIP_CHECK(hipSetDevice(device++));
|
|
HIP_CHECK(hipStreamCreate(¶ms.stream));
|
|
}
|
|
|
|
SECTION("launchParamsList == nullptr") {
|
|
HIP_CHECK_ERROR(hipLaunchCooperativeKernelMultiDevice(nullptr, device_count, 0u),
|
|
hipErrorInvalidValue);
|
|
}
|
|
|
|
SECTION("numDevices == 0") {
|
|
HIP_CHECK_ERROR(hipLaunchCooperativeKernelMultiDevice(params_list.data(), 0, 0u),
|
|
hipErrorInvalidValue);
|
|
}
|
|
|
|
SECTION("numDevices > device count") {
|
|
#if HT_AMD
|
|
HIP_CHECK_ERROR(hipLaunchCooperativeKernelMultiDevice(params_list.data(), device_count + 1, 0u),
|
|
hipErrorInvalidDevice);
|
|
#else
|
|
HIP_CHECK_ERROR(hipLaunchCooperativeKernelMultiDevice(params_list.data(), device_count + 1, 0u),
|
|
hipErrorInvalidValue);
|
|
#endif
|
|
}
|
|
|
|
SECTION("invalid flags") {
|
|
HIP_CHECK_ERROR(hipLaunchCooperativeKernelMultiDevice(params_list.data(), device_count, 999),
|
|
hipErrorInvalidValue);
|
|
}
|
|
|
|
if (device_count > 1) {
|
|
SECTION("launchParamsList.func doesn't match across all devices") {
|
|
params_list[1].func = reinterpret_cast<void*>(kernel);
|
|
HIP_CHECK_ERROR(hipLaunchCooperativeKernelMultiDevice(params_list.data(), device_count, 0u),
|
|
hipErrorInvalidValue);
|
|
}
|
|
|
|
SECTION("launchParamsList.gridDim doesn't match across all kernels") {
|
|
params_list[1].gridDim = dim3{2, 2, 2};
|
|
HIP_CHECK_ERROR(hipLaunchCooperativeKernelMultiDevice(params_list.data(), device_count, 0u),
|
|
hipErrorInvalidValue);
|
|
}
|
|
|
|
SECTION("launchParamsList.blockDim doesn't match across all kernels") {
|
|
params_list[1].blockDim = dim3{2, 2, 2};
|
|
HIP_CHECK_ERROR(hipLaunchCooperativeKernelMultiDevice(params_list.data(), device_count, 0u),
|
|
hipErrorInvalidValue);
|
|
}
|
|
|
|
SECTION("launchParamsList.sharedMem doesn't match across all kernels") {
|
|
params_list[1].sharedMem = 1024;
|
|
HIP_CHECK_ERROR(hipLaunchCooperativeKernelMultiDevice(params_list.data(), device_count, 0u),
|
|
hipErrorInvalidValue);
|
|
}
|
|
}
|
|
|
|
for (const auto params : params_list) {
|
|
HIP_CHECK(hipStreamDestroy(params.stream));
|
|
}
|
|
}
|
|
|
|
HIP_TEST_CASE(Unit_hipLaunchCooperativeKernelMultiDevice_Negative_MultiKernelSameDevice) {
|
|
if (!DeviceAttributesSupport(0, hipDeviceAttributeCooperativeLaunch)) {
|
|
HIP_SKIP_TEST(HipTest::SkipReason::kCooperativeLaunchUnsupported);
|
|
}
|
|
|
|
const auto device_count = HipTest::getDeviceCount();
|
|
if (device_count < 2) {
|
|
HIP_SKIP_TEST(HipTest::SkipReason::kFewerThanTwoGpus);
|
|
}
|
|
|
|
HIP_CHECK(hipSetDevice(0));
|
|
|
|
std::vector<hipLaunchParams> params_list(2);
|
|
|
|
for (auto& params : params_list) {
|
|
params.func = reinterpret_cast<void*>(coop_kernel);
|
|
params.gridDim = dim3{1, 1, 1};
|
|
params.blockDim = dim3{1, 1, 1};
|
|
params.args = nullptr;
|
|
params.sharedMem = 0;
|
|
HIP_CHECK(hipStreamCreate(¶ms.stream));
|
|
}
|
|
|
|
HIP_CHECK_ERROR(hipLaunchCooperativeKernelMultiDevice(params_list.data(), 2, 0u),
|
|
hipErrorInvalidDevice);
|
|
|
|
for (const auto params : params_list) {
|
|
HIP_CHECK(hipStreamDestroy(params.stream));
|
|
}
|
|
}
|