EXSWHTEC-224 - Test cases ID clean up and documentation for Device Management (#70)
- Test cases ID clean up and documentation for Device Management - Adjust doxygen comments to fix bugs - Adjust defgroup comments for test modules
This commit is contained in:
committad av
GitHub
förälder
9f5bb4219a
incheckning
d0295c4295
@@ -24,13 +24,31 @@ THE SOFTWARE.
|
||||
#include <hip_test_common.hh>
|
||||
#include <threaded_zig_zag_test.hh>
|
||||
|
||||
/**
|
||||
* @addtogroup hipDeviceSetCacheConfig hipDeviceSetCacheConfig
|
||||
* @{
|
||||
* @ingroup DeviceTest
|
||||
* `hipDeviceSetCacheConfig(hipFuncCache_t cacheConfig)` -
|
||||
* Set L1/Shared cache partition.
|
||||
*/
|
||||
|
||||
namespace {
|
||||
constexpr std::array<hipFuncCache_t, 4> kCacheConfigs{
|
||||
hipFuncCachePreferNone, hipFuncCachePreferShared, hipFuncCachePreferL1,
|
||||
hipFuncCachePreferEqual};
|
||||
} // anonymous namespace
|
||||
|
||||
|
||||
/**
|
||||
* Test Description
|
||||
* ------------------------
|
||||
* - Check that `hipSuccess` is returned for all enumerators of `hipFuncCache_t`
|
||||
* Test source
|
||||
* ------------------------
|
||||
* - unit/device/hipDeviceSetGetCacheConfig.cc
|
||||
* Test requirements
|
||||
* ------------------------
|
||||
* - HIP_VERSION >= 5.2
|
||||
*/
|
||||
TEST_CASE("Unit_hipDeviceSetCacheConfig_Positive_Basic") {
|
||||
const auto device = GENERATE(range(0, HipTest::getDeviceCount()));
|
||||
HIP_CHECK(hipSetDevice(device));
|
||||
@@ -41,6 +59,21 @@ TEST_CASE("Unit_hipDeviceSetCacheConfig_Positive_Basic") {
|
||||
HIP_CHECK(hipDeviceSetCacheConfig(cache_config));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Description
|
||||
* ------------------------
|
||||
* - Handle invalid cache config (-1):
|
||||
* -# When platform is AMD
|
||||
* - Expected output: return `hipErrorNotSupported`
|
||||
* -# When platform is NVIDIA
|
||||
* - Expected output: return `hipErrorInvalidValue`
|
||||
* Test source
|
||||
* ------------------------
|
||||
* - unit/device/hipDeviceSetGetCacheConfig.cc
|
||||
* Test requirements
|
||||
* ------------------------
|
||||
* - HIP_VERSION >= 5.2
|
||||
*/
|
||||
TEST_CASE("Unit_hipDeviceSetCacheConfig_Negative_Parameters") {
|
||||
#if HT_AMD
|
||||
HIP_CHECK_ERROR(hipDeviceSetCacheConfig(static_cast<hipFuncCache_t>(-1)), hipSuccess);
|
||||
@@ -49,6 +82,31 @@ TEST_CASE("Unit_hipDeviceSetCacheConfig_Negative_Parameters") {
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* End doxygen group hipDeviceSetCacheConfig.
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup hipDeviceGetCacheConfig hipDeviceGetCacheConfig
|
||||
* @{
|
||||
* @ingroup DeviceTest
|
||||
* `hipDeviceGetCacheConfig(hipFuncCache_t* cacheConfig)` -
|
||||
* Get Cache configuration for a specific Device.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Test Description
|
||||
* ------------------------
|
||||
* - Check that default cache config is returned if set
|
||||
* has not been called previously.
|
||||
* Test source
|
||||
* ------------------------
|
||||
* - unit/device/hipDeviceSetGetCacheConfig.cc
|
||||
* Test requirements
|
||||
* ------------------------
|
||||
* - HIP_VERSION >= 5.2
|
||||
*/
|
||||
TEST_CASE("Unit_hipDeviceGetCacheConfig_Positive_Default") {
|
||||
const auto device = GENERATE(range(0, HipTest::getDeviceCount()));
|
||||
HIP_CHECK(hipSetDevice(device));
|
||||
@@ -59,6 +117,19 @@ TEST_CASE("Unit_hipDeviceGetCacheConfig_Positive_Default") {
|
||||
REQUIRE(cache_config == hipFuncCachePreferNone);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Description
|
||||
* ------------------------
|
||||
* - Check that the returned cache configuration is equal to
|
||||
* the one that is set previously.
|
||||
* - Verify for multiple devices.
|
||||
* Test source
|
||||
* ------------------------
|
||||
* - unit/device/hipDeviceSetGetCacheConfig.cc
|
||||
* Test requirements
|
||||
* ------------------------
|
||||
* - HIP_VERSION >= 5.2
|
||||
*/
|
||||
TEST_CASE("Unit_hipDeviceGetCacheConfig_Positive_Basic") {
|
||||
const auto device = GENERATE(range(0, HipTest::getDeviceCount()));
|
||||
HIP_CHECK(hipSetDevice(device));
|
||||
@@ -74,6 +145,18 @@ TEST_CASE("Unit_hipDeviceGetCacheConfig_Positive_Basic") {
|
||||
REQUIRE(returned_cache_config == cache_config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Description
|
||||
* ------------------------
|
||||
* - Check that the returned cache configuration from the main thread
|
||||
* is equal to the one that is set previously from different thread.
|
||||
* Test source
|
||||
* ------------------------
|
||||
* - unit/device/hipDeviceSetGetCacheConfig.cc
|
||||
* Test requirements
|
||||
* ------------------------
|
||||
* - HIP_VERSION >= 5.2
|
||||
*/
|
||||
TEST_CASE("Unit_hipDeviceGetCacheConfig_Positive_Threaded") {
|
||||
class HipDeviceSetGetCacheConfigTest : public ThreadedZigZagTest<HipDeviceSetGetCacheConfigTest> {
|
||||
public:
|
||||
@@ -99,6 +182,19 @@ TEST_CASE("Unit_hipDeviceGetCacheConfig_Positive_Threaded") {
|
||||
test.run();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Description
|
||||
* ------------------------
|
||||
* - Verify handling of invalid arguments:
|
||||
* -# When cache config is `nullptr`
|
||||
* - Expected output: return `hipErrorInvalidValue`
|
||||
* Test source
|
||||
* ------------------------
|
||||
* - unit/device/hipDeviceSetGetCacheConfig.cc
|
||||
* Test requirements
|
||||
* ------------------------
|
||||
* - HIP_VERSION >= 5.2
|
||||
*/
|
||||
TEST_CASE("Unit_HipDeviceGetCacheConfig_Negative_Parameters") {
|
||||
HIP_CHECK_ERROR(hipDeviceGetCacheConfig(nullptr), hipErrorInvalidValue);
|
||||
}
|
||||
|
||||
Referens i nytt ärende
Block a user