Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion catch/hipTestMain/config/config_amd_linux
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"Unit_hipFuncSetCacheConfig_Positive_Basic",
"Unit_hipFuncSetCacheConfig_Negative_Parameters",
"Unit_hipFuncSetSharedMemConfig_Positive_Basic",
"Unit_hipFuncSetAttribute_Positive_PreferredSharedMemoryCarveout",
"NOTE: The following test is disabled due to defect - EXSWHTEC-241",
"NOTE: The following test is disabled due to defect - EXSWHTEC-242",
"Unit_hipFuncGetAttributes_Positive_Basic",
Expand Down
1 change: 0 additions & 1 deletion catch/hipTestMain/config/config_amd_windows
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@
"Unit_hipFuncSetCacheConfig_Positive_Basic",
"Unit_hipFuncSetCacheConfig_Negative_Parameters",
"Unit_hipFuncSetSharedMemConfig_Positive_Basic",
"Unit_hipFuncSetAttribute_Positive_PreferredSharedMemoryCarveout",
"Unit_hipEventCreateWithFlags_DisableSystemFence_HstVisMem",
"Unit_hipEventCreateWithFlags_DefaultFlg_HstVisMem",
"Unit_hipEventCreateWithFlags_DisableSystemFence_NonCohHstMem",
Expand Down
1 change: 0 additions & 1 deletion catch/hipTestMain/config/config_amd_wsl.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@
"Unit_hipFuncSetCacheConfig_Positive_Basic",
"Unit_hipFuncSetCacheConfig_Negative_Parameters",
"Unit_hipFuncSetSharedMemConfig_Positive_Basic",
"Unit_hipFuncSetAttribute_Positive_PreferredSharedMemoryCarveout",
"Unit_hipEventCreateWithFlags_DisableSystemFence_HstVisMem",
"Unit_hipEventCreateWithFlags_DefaultFlg_HstVisMem",
"Unit_hipEventCreateWithFlags_DisableSystemFence_NonCohHstMem",
Expand Down
3 changes: 2 additions & 1 deletion catch/unit/executionControl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ set(TEST_SRC
hipLaunchKernel.cc
hipLaunchCooperativeKernel.cc
hipLaunchCooperativeKernelMultiDevice.cc
hipFuncSetAttribute.cc
)

if(HIP_PLATFORM MATCHES "amd")
Expand All @@ -18,7 +19,7 @@ else()
set(TEST_SRC ${TEST_SRC}
hipFuncSetCacheConfig.cc
hipFuncSetSharedMemConfig.cc
hipFuncSetAttribute.cc

)
endif()

Expand Down
83 changes: 15 additions & 68 deletions catch/unit/executionControl/hipFuncSetAttribute.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,24 @@ TEST_CASE("Unit_hipFuncSetAttribute_Positive_MaxDynamicSharedMemorySize") {
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipFuncSetAttribute_Positive_PreferredSharedMemoryCarveout") {
#if (HT_AMD == 1)
// on AMD, it is completely ignored, i.e. no effect in L1/shared distribution; but
// also when queried again, its value must match the old value
hipFuncAttributes old_attributes, new_attributes;

HIP_CHECK(hipFuncGetAttributes(&old_attributes, reinterpret_cast<void*>(kernel)));
HIP_CHECK(hipFuncSetAttribute(reinterpret_cast<void*>(kernel),
hipFuncAttributePreferredSharedMemoryCarveout, 50));
HIP_CHECK(hipFuncGetAttributes(&new_attributes, reinterpret_cast<void*>(kernel)));
REQUIRE(old_attributes.preferredShmemCarveout == new_attributes.preferredShmemCarveout);
#else
hipFuncAttributes new_attributes;

hipFuncAttributes attributes;
HIP_CHECK(hipFuncGetAttributes(&attributes, reinterpret_cast<void*>(kernel)));

REQUIRE(attributes.preferredShmemCarveout == 50);
HIP_CHECK(hipFuncSetAttribute(reinterpret_cast<void*>(kernel),
hipFuncAttributePreferredSharedMemoryCarveout, 50));
HIP_CHECK(hipFuncGetAttributes(&new_attributes, reinterpret_cast<void*>(kernel)));
REQUIRE(new_attributes.preferredShmemCarveout == 50);
#endif
}

/**
Expand Down Expand Up @@ -205,70 +216,6 @@ TEST_CASE("Unit_hipFuncSetAttribute_Negative_Parameters") {
}
}

/**
* Test Description
* ------------------------
* - Sets `hipFuncAttributeMaxDynamicSharedMemorySize` to the non-supported value
* - Expected output: return `hipErrorNotSupported`
* Test source
* ------------------------
* - unit/executionControl/hipFuncSetAttribute.cc
* Test requirements
* ------------------------
* - Platform specific (AMD)
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipFuncSetAttribute_Positive_MaxDynamicSharedMemorySize_Not_Supported") {
#if HT_NVIDIA
HipTest::HIP_SKIP_TEST("This is an AMD specific test");
return;
#endif

hipFuncAttributes old_attributes;
HIP_CHECK(hipFuncGetAttributes(&old_attributes, reinterpret_cast<void*>(kernel)));

HIP_CHECK_ERROR(hipFuncSetAttribute(reinterpret_cast<void*>(kernel),
hipFuncAttributeMaxDynamicSharedMemorySize, 1024),
hipErrorNotSupported);

hipFuncAttributes new_attributes;
HIP_CHECK(hipFuncGetAttributes(&new_attributes, reinterpret_cast<void*>(kernel)));

REQUIRE(old_attributes.maxDynamicSharedSizeBytes == new_attributes.maxDynamicSharedSizeBytes);
}

/**
* Test Description
* ------------------------
* - Sets `hipFuncAttributePreferredSharedMemoryCarveout` to the non-supported value
* - Expected output: return `hipErrorNotSupported`
* Test source
* ------------------------
* - unit/executionControl/hipFuncSetAttribute.cc
* Test requirements
* ------------------------
* - Platform specific (AMD)
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipFuncSetAttribute_Positive_PreferredSharedMemoryCarveout_Not_Supported") {
#if HT_NVIDIA
HipTest::HIP_SKIP_TEST("This is an AMD specific test");
return;
#endif

hipFuncAttributes old_attributes;
HIP_CHECK(hipFuncGetAttributes(&old_attributes, reinterpret_cast<void*>(kernel)));

HIP_CHECK_ERROR(hipFuncSetAttribute(reinterpret_cast<void*>(kernel),
hipFuncAttributePreferredSharedMemoryCarveout, 50),
hipErrorNotSupported);

hipFuncAttributes new_attributes;
HIP_CHECK(hipFuncGetAttributes(&new_attributes, reinterpret_cast<void*>(kernel)));

REQUIRE(old_attributes.preferredShmemCarveout == new_attributes.preferredShmemCarveout);
}

/**
* End doxygen group ExecutionTest.
* @}
Expand Down
Loading