diff --git a/catch/hipTestMain/config/config_amd_linux b/catch/hipTestMain/config/config_amd_linux index 9780f0809..9a64bf318 100644 --- a/catch/hipTestMain/config/config_amd_linux +++ b/catch/hipTestMain/config/config_amd_linux @@ -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", diff --git a/catch/hipTestMain/config/config_amd_windows b/catch/hipTestMain/config/config_amd_windows index 26b2cec60..5d7fa4a91 100644 --- a/catch/hipTestMain/config/config_amd_windows +++ b/catch/hipTestMain/config/config_amd_windows @@ -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", diff --git a/catch/hipTestMain/config/config_amd_wsl.json b/catch/hipTestMain/config/config_amd_wsl.json index b7aca166c..fe92ecd90 100644 --- a/catch/hipTestMain/config/config_amd_wsl.json +++ b/catch/hipTestMain/config/config_amd_wsl.json @@ -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", diff --git a/catch/unit/executionControl/CMakeLists.txt b/catch/unit/executionControl/CMakeLists.txt index 5e30302b8..671357e1f 100644 --- a/catch/unit/executionControl/CMakeLists.txt +++ b/catch/unit/executionControl/CMakeLists.txt @@ -4,6 +4,7 @@ set(TEST_SRC hipLaunchKernel.cc hipLaunchCooperativeKernel.cc hipLaunchCooperativeKernelMultiDevice.cc + hipFuncSetAttribute.cc ) if(HIP_PLATFORM MATCHES "amd") @@ -18,7 +19,7 @@ else() set(TEST_SRC ${TEST_SRC} hipFuncSetCacheConfig.cc hipFuncSetSharedMemConfig.cc - hipFuncSetAttribute.cc + ) endif() diff --git a/catch/unit/executionControl/hipFuncSetAttribute.cc b/catch/unit/executionControl/hipFuncSetAttribute.cc index 43607bc11..da1692051 100644 --- a/catch/unit/executionControl/hipFuncSetAttribute.cc +++ b/catch/unit/executionControl/hipFuncSetAttribute.cc @@ -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(kernel))); HIP_CHECK(hipFuncSetAttribute(reinterpret_cast(kernel), hipFuncAttributePreferredSharedMemoryCarveout, 50)); + HIP_CHECK(hipFuncGetAttributes(&new_attributes, reinterpret_cast(kernel))); + REQUIRE(old_attributes.preferredShmemCarveout == new_attributes.preferredShmemCarveout); +#else + hipFuncAttributes new_attributes; - hipFuncAttributes attributes; - HIP_CHECK(hipFuncGetAttributes(&attributes, reinterpret_cast(kernel))); - - REQUIRE(attributes.preferredShmemCarveout == 50); + HIP_CHECK(hipFuncSetAttribute(reinterpret_cast(kernel), + hipFuncAttributePreferredSharedMemoryCarveout, 50)); + HIP_CHECK(hipFuncGetAttributes(&new_attributes, reinterpret_cast(kernel))); + REQUIRE(new_attributes.preferredShmemCarveout == 50); +#endif } /** @@ -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(kernel))); - - HIP_CHECK_ERROR(hipFuncSetAttribute(reinterpret_cast(kernel), - hipFuncAttributeMaxDynamicSharedMemorySize, 1024), - hipErrorNotSupported); - - hipFuncAttributes new_attributes; - HIP_CHECK(hipFuncGetAttributes(&new_attributes, reinterpret_cast(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(kernel))); - - HIP_CHECK_ERROR(hipFuncSetAttribute(reinterpret_cast(kernel), - hipFuncAttributePreferredSharedMemoryCarveout, 50), - hipErrorNotSupported); - - hipFuncAttributes new_attributes; - HIP_CHECK(hipFuncGetAttributes(&new_attributes, reinterpret_cast(kernel))); - - REQUIRE(old_attributes.preferredShmemCarveout == new_attributes.preferredShmemCarveout); -} - /** * End doxygen group ExecutionTest. * @}