Skip to content

Commit

Permalink
SWDEV-411064 - check if image is supported before running image speci…
Browse files Browse the repository at this point in the history
…fic tests

Also fix CU Mask test.

Change-Id: I0fbb93a1bcce131e0f98dee7cd5da9704d2ca8ac
  • Loading branch information
cjatin authored and rakesroy committed Nov 7, 2023
1 parent 8773e3a commit e605151
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
6 changes: 6 additions & 0 deletions catch/unit/errorHandling/hipGetLastError.cc
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ TEST_CASE("Unit_hipGetLastError_with_hipMemcpyDtoHAsync") {
*  - HIP_VERSION >= 6.0
*/
TEST_CASE("Unit_hipGetLastError_with_hipMemcpyParam2DAsync") {
CHECK_IMAGE_SUPPORT

float* A_h{nullptr}, *B_h{nullptr}, *C_h{nullptr}, * A_d{nullptr};
size_t pitch_A;
size_t width{WIDTH * sizeof(float)};
Expand Down Expand Up @@ -283,6 +285,8 @@ TEST_CASE("Unit_hipGetLastError_with_hipDrvMemcpy3DAsync") {
*/

TEST_CASE("Unit_hipGetLastError_with_hipMemcpy3DAsync") {
CHECK_IMAGE_SUPPORT

constexpr int width{10}, height{10}, depth{10};
auto size = width * height * depth * sizeof(int);
hipArray_t devArray;
Expand Down Expand Up @@ -469,6 +473,8 @@ TEST_CASE("Unit_hipGetLastError_with_hipMemPrefetchAsync") {
*/

TEST_CASE("Unit_hipGetLastError_with_hipMemcpy2DAsync") {
CHECK_IMAGE_SUPPORT

int* A_h{nullptr}, *A_d{nullptr};
size_t pitch_A;
size_t width{WIDTH * sizeof(int)};
Expand Down
2 changes: 2 additions & 0 deletions catch/unit/memory/hipMemcpy3DAsync.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ TEST_CASE("Unit_hipMemcpy3DAsync_Positive_Parameters") {
}

TEST_CASE("Unit_hipMemcpy3DAsync_Positive_Array") {
CHECK_IMAGE_SUPPORT

constexpr bool async = true;
SECTION("Array from/to Host") { Memcpy3DArrayHostShell<async>(Memcpy3DWrapper<async>); }
#if HT_NVIDIA // Disabled on AMD due to defect - EXSWHTEC-238
Expand Down
9 changes: 7 additions & 2 deletions catch/unit/stream/hipStreamGetCUMask.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ Testcase Scenarios :
*/

#include <hip_test_common.hh>

#include <cmath>
#include <vector>


Expand All @@ -33,8 +35,7 @@ Testcase Scenarios :
* Scenario to verify hipExtStreamGetCUMask api returns custom mask set.
*/
TEST_CASE("Unit_hipExtStreamGetCUMask_verifyDefaultAndCustomMask") {
constexpr int maxNum = 10;
std::vector<uint32_t> cuMask(maxNum);
constexpr unsigned maxCUPerValue = 32;
hipDeviceProp_t props;
std::stringstream ss;
std::string gCUMask;
Expand All @@ -53,6 +54,10 @@ TEST_CASE("Unit_hipExtStreamGetCUMask_verifyDefaultAndCustomMask") {
INFO("info: running on bus " << "0x" << props.pciBusID << " " <<
props.name << " with " << props.multiProcessorCount << " CUs");

const unsigned int maxNum =
static_cast<unsigned int>(std::ceil((props.multiProcessorCount * 1.0f) / maxCUPerValue));
std::vector<uint32_t> cuMask(maxNum);

// Get global CU Mask if exists
gCUMask = TestContext::getEnvVar("ROC_GLOBAL_CU_MASK");
if (!gCUMask.empty()) {
Expand Down

0 comments on commit e605151

Please sign in to comment.