diff --git a/projects/hip-tests/catch/hipTestMain/config/config_amd_linux b/projects/hip-tests/catch/hipTestMain/config/config_amd_linux index 8d891b9e576..13148179cfd 100644 --- a/projects/hip-tests/catch/hipTestMain/config/config_amd_linux +++ b/projects/hip-tests/catch/hipTestMain/config/config_amd_linux @@ -23,7 +23,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/projects/hip-tests/catch/hipTestMain/config/config_amd_windows b/projects/hip-tests/catch/hipTestMain/config/config_amd_windows index 91a6107dcf3..c338f61c0f8 100644 --- a/projects/hip-tests/catch/hipTestMain/config/config_amd_windows +++ b/projects/hip-tests/catch/hipTestMain/config/config_amd_windows @@ -102,7 +102,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/projects/hip-tests/catch/hipTestMain/config/config_amd_wsl.json b/projects/hip-tests/catch/hipTestMain/config/config_amd_wsl.json index 424cc0c83d2..2e5ec2c6233 100644 --- a/projects/hip-tests/catch/hipTestMain/config/config_amd_wsl.json +++ b/projects/hip-tests/catch/hipTestMain/config/config_amd_wsl.json @@ -92,7 +92,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/projects/hip-tests/catch/unit/executionControl/CMakeLists.txt b/projects/hip-tests/catch/unit/executionControl/CMakeLists.txt index 5e30302b885..671357e1f1f 100644 --- a/projects/hip-tests/catch/unit/executionControl/CMakeLists.txt +++ b/projects/hip-tests/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/projects/hip-tests/catch/unit/executionControl/hipFuncSetAttribute.cc b/projects/hip-tests/catch/unit/executionControl/hipFuncSetAttribute.cc index 43607bc11be..da1692051dc 100644 --- a/projects/hip-tests/catch/unit/executionControl/hipFuncSetAttribute.cc +++ b/projects/hip-tests/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. * @}