Files
TheRock/rocm-systems/projects/hip-tests/catch/unit/stream/streamCommon.cc
T
derek.holloway 7502bf64a4
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
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

89 lines
2.5 KiB
C++

/*
* Copyright (c) Advanced Micro Devices, Inc., or its affiliates.
*
* SPDX-License-Identifier: MIT
*/
#include "streamCommon.hh"
namespace hip {
inline namespace internal {
bool checkStreamPriority_(hipStream_t stream, bool checkPriority = false, int priority_ = 0) {
int priority{0};
HIP_CHECK(hipStreamGetPriority(stream, &priority));
if (checkPriority) {
if (priority_ != priority) {
UNSCOPED_INFO("Priority Mismatch, Expected Priority: " << priority_
<< " Actual Priority: " << priority);
return false;
}
} else {
int priority_low{0}, priority_high{0};
HIP_CHECK(hipDeviceGetStreamPriorityRange(&priority_low, &priority_high));
if (priority_low < priority || priority_high > priority) {
UNSCOPED_INFO("Priority Mismatch, Expected Priority Range: "
<< priority_low << " - " << priority_high << " Actual Priority: " << priority);
return false;
}
}
return true;
}
bool checkStreamFlags_(hipStream_t stream, bool checkFlags = false, unsigned flags_ = 0) {
unsigned flags{0};
HIP_CHECK(hipStreamGetFlags(stream, &flags));
if (checkFlags) {
if (flags_ != flags) {
UNSCOPED_INFO("Flags Mismatch, Expected Flag: " << flags_ << " Actual Flag: " << flags);
return false;
}
} else {
if (flags != hipStreamDefault && flags != hipStreamNonBlocking) {
UNSCOPED_INFO("Flags Mismatch, Expected Flag: " << hipStreamDefault << " or "
<< hipStreamNonBlocking
<< " Actual Flag: " << flags);
return false;
}
}
return true;
}
} // namespace internal
inline namespace stream {
/* Empty kernel to ensure work finishes on the stream quickly */
__global__ void empty_kernel() {}
bool checkStream(hipStream_t stream) {
{ // Check default flags
auto res = checkStreamFlags_(stream, true, hipStreamDefault);
if (!res) return false;
}
{ // Check default Priority
auto res = checkStreamPriority_(stream);
if (!res) return false;
}
return true;
}
bool checkStreamPriorityAndFlags(hipStream_t stream, int priority, unsigned int flags) {
{ // Check flags
auto res = checkStreamFlags_(stream, true, flags);
if (!res) return false;
}
{ // Check priority
auto res = checkStreamPriority_(stream, true, priority);
if (!res) return false;
}
return true;
}
} // namespace stream
} // namespace hip