Merge 'rocm-smi/amd-staging' into 'amd-smi/amd-dev'
Signed-off-by: Charis Poag <Charis.Poag@amd.com> Change-Id: Id35c9807c45a965c968fb430e3ce4f3c7069c210
This commit is contained in:
@@ -1,64 +0,0 @@
|
||||
# Required Defines first:
|
||||
option(INSTALL_GTEST "Install GTest (only useful if GTest is not already installed)" OFF)
|
||||
|
||||
# Try to find googletest
|
||||
find_package(GTest 1.12.0)
|
||||
|
||||
# GTest_FOUND is set to TRUE if ANY version is found
|
||||
# GTest_VERSION is set if 1.11.0 or newer version is found
|
||||
if(NOT GTest_FOUND STREQUAL "TRUE" OR NOT DEFINED GTest_VERSION)
|
||||
# Google Test wasn't found. Download and compile ourselves
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
googletest
|
||||
GIT_REPOSITORY https://github.com/google/googletest.git
|
||||
GIT_TAG release-1.12.0)
|
||||
FetchContent_MakeAvailable(googletest)
|
||||
endif()
|
||||
|
||||
enable_testing()
|
||||
|
||||
if(WIN32)
|
||||
message("amd_smi library test suite is not supported on Windows platform")
|
||||
return()
|
||||
endif()
|
||||
|
||||
#
|
||||
# Print out the build configuration being used:
|
||||
#
|
||||
# Build Src directory
|
||||
# Build Binary directory
|
||||
# Build Type: Debug Vs Release
|
||||
# Compiler Version, etc
|
||||
#
|
||||
message("")
|
||||
message("Build Configuration:")
|
||||
message("-----------BuildType: " ${CMAKE_BUILD_TYPE})
|
||||
message("------------Compiler: " ${CMAKE_CXX_COMPILER})
|
||||
message("-------------Version: " ${CMAKE_CXX_COMPILER_VERSION})
|
||||
message("--------Proj Src Dir: " ${PROJECT_SOURCE_DIR})
|
||||
message("--------Proj Bld Dir: " ${PROJECT_BINARY_DIR})
|
||||
message("--------Proj Lib Dir: " ${PROJECT_BINARY_DIR}/lib)
|
||||
message("--------Proj Exe Dir: " ${PROJECT_BINARY_DIR}/bin)
|
||||
message("")
|
||||
|
||||
# Other source directories
|
||||
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/functional functionalSources)
|
||||
|
||||
set(TEST "rsmitst64")
|
||||
|
||||
# Source files
|
||||
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} tstSources)
|
||||
|
||||
# Header file include path
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
|
||||
|
||||
# Build rules
|
||||
add_executable(${TEST} ${tstSources} ${functionalSources})
|
||||
|
||||
target_link_libraries(${TEST} rocm_smi64 c stdc++ pthread GTest::gtest_main)
|
||||
|
||||
#install(
|
||||
# TARGETS ${TEST}
|
||||
# DESTINATION ${SHARE_INSTALL_PREFIX}/tests
|
||||
# COMPONENT tests)
|
||||
@@ -1,188 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
#include "api_support_read.h"
|
||||
#include "../test_common.h"
|
||||
#include "../test_utils.h"
|
||||
|
||||
TestAPISupportRead::TestAPISupportRead() : TestBase() {
|
||||
set_title("RSMI API Support Read Test");
|
||||
set_description("This test verifies that the supported APIs are corretly "
|
||||
"identified.");
|
||||
}
|
||||
|
||||
TestAPISupportRead::~TestAPISupportRead(void) {
|
||||
}
|
||||
|
||||
void TestAPISupportRead::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestAPISupportRead::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestAPISupportRead::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestAPISupportRead::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// rsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
void TestAPISupportRead::Run(void) {
|
||||
rsmi_status_t err;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
rsmi_func_id_iter_handle_t iter_handle, var_iter, sub_var_iter;
|
||||
rsmi_func_id_value_t value;
|
||||
|
||||
for (uint32_t x = 0; x < num_iterations(); ++x) {
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
IF_VERB(STANDARD) {
|
||||
PrintDeviceHeader(i);
|
||||
std::cout << "Supported RSMI Functions:" << std::endl;
|
||||
std::cout << "\tVariants (Monitors)" << std::endl;
|
||||
}
|
||||
err = rsmi_dev_supported_func_iterator_open(i, &iter_handle);
|
||||
CHK_ERR_ASRT(err)
|
||||
|
||||
while (1) {
|
||||
err = rsmi_func_iter_value_get(iter_handle, &value);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Function Name: " << value.name << std::endl;
|
||||
}
|
||||
err = rsmi_dev_supported_variant_iterator_open(iter_handle, &var_iter);
|
||||
if (err != RSMI_STATUS_NO_DATA) {
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\tVariants/Monitors: ";
|
||||
}
|
||||
while (1) {
|
||||
err = rsmi_func_iter_value_get(var_iter, &value);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
if (value.id == RSMI_DEFAULT_VARIANT) {
|
||||
std::cout << "Default Variant ";
|
||||
} else {
|
||||
std::cout << value.id;
|
||||
}
|
||||
std::cout << " (";
|
||||
}
|
||||
err =
|
||||
rsmi_dev_supported_variant_iterator_open(var_iter, &sub_var_iter);
|
||||
if (err != RSMI_STATUS_NO_DATA) {
|
||||
CHK_ERR_ASRT(err)
|
||||
|
||||
while (1) {
|
||||
err = rsmi_func_iter_value_get(sub_var_iter, &value);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << value.id << ", ";
|
||||
}
|
||||
err = rsmi_func_iter_next(sub_var_iter);
|
||||
|
||||
if (err == RSMI_STATUS_NO_DATA) {
|
||||
break;
|
||||
}
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
err = rsmi_dev_supported_func_iterator_close(&sub_var_iter);
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "), ";
|
||||
}
|
||||
err = rsmi_func_iter_next(var_iter);
|
||||
|
||||
if (err == RSMI_STATUS_NO_DATA) {
|
||||
break;
|
||||
}
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << std::endl;
|
||||
}
|
||||
err = rsmi_dev_supported_func_iterator_close(&var_iter);
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
|
||||
err = rsmi_func_iter_next(iter_handle);
|
||||
|
||||
if (err == RSMI_STATUS_NO_DATA) {
|
||||
break;
|
||||
}
|
||||
CHK_ERR_ASRT(err)
|
||||
|
||||
// err = rsmi_dev_supported_variant_iterator_open(iter_handle, &var_iter);
|
||||
//
|
||||
}
|
||||
err = rsmi_dev_supported_func_iterator_close(&iter_handle);
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_ROCM_SMI_TEST_FUNCTIONAL_API_SUPPORT_READ_H_
|
||||
#define TESTS_ROCM_SMI_TEST_FUNCTIONAL_API_SUPPORT_READ_H_
|
||||
|
||||
#include "../test_base.h"
|
||||
|
||||
class TestAPISupportRead : public TestBase {
|
||||
public:
|
||||
TestAPISupportRead();
|
||||
|
||||
// @Brief: Destructor for test case of TestAPISupportRead
|
||||
virtual ~TestAPISupportRead();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_ROCM_SMI_TEST_FUNCTIONAL_API_SUPPORT_READ_H_
|
||||
@@ -1,174 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
#include "err_cnt_read.h"
|
||||
#include "../test_common.h"
|
||||
|
||||
TestErrCntRead::TestErrCntRead() : TestBase() {
|
||||
set_title("RSMI Error Count Read Test");
|
||||
set_description("The Error Count Read tests verifies that error counts"
|
||||
" can be read properly.");
|
||||
}
|
||||
|
||||
TestErrCntRead::~TestErrCntRead(void) {
|
||||
}
|
||||
|
||||
void TestErrCntRead::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestErrCntRead::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestErrCntRead::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestErrCntRead::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// rsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
|
||||
void TestErrCntRead::Run(void) {
|
||||
rsmi_status_t err;
|
||||
rsmi_error_count_t ec;
|
||||
uint64_t enabled_mask;
|
||||
rsmi_ras_err_state_t err_state;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t x = 0; x < num_iterations(); ++x) {
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(i);
|
||||
|
||||
err = rsmi_dev_ecc_enabled_get(i, &enabled_mask);
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout <<
|
||||
"\t**Error Count Enabled Mask get is not supported on this machine"
|
||||
<< std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_ecc_enabled_get(i, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_NOT_SUPPORTED);
|
||||
|
||||
continue;
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_ecc_enabled_get(i, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Block Error Mask: 0x" << std::hex << enabled_mask <<
|
||||
std::endl;
|
||||
}
|
||||
}
|
||||
for (uint32_t b = RSMI_GPU_BLOCK_FIRST;
|
||||
b <= RSMI_GPU_BLOCK_LAST; b = b*2) {
|
||||
err = rsmi_dev_ecc_status_get(i, static_cast<rsmi_gpu_block_t>(b),
|
||||
&err_state);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Error Count status for " <<
|
||||
GetBlockNameStr(static_cast<rsmi_gpu_block_t>(b)) <<
|
||||
" block: " << GetErrStateNameStr(err_state) << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_ecc_status_get(i, static_cast<rsmi_gpu_block_t>(b),
|
||||
nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
|
||||
err = rsmi_dev_ecc_count_get(i, static_cast<rsmi_gpu_block_t>(b), &ec);
|
||||
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Error Count for " <<
|
||||
GetBlockNameStr(static_cast<rsmi_gpu_block_t>(b)) <<
|
||||
": Not supported for this device" << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_ecc_count_get(i, static_cast<rsmi_gpu_block_t>(b),
|
||||
nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_NOT_SUPPORTED);
|
||||
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Error counts for " <<
|
||||
GetBlockNameStr(static_cast<rsmi_gpu_block_t>(b)) << " block: "
|
||||
<< std::endl;
|
||||
std::cout << "\t\tCorrectable errors: " << ec.correctable_err
|
||||
<< std::endl;
|
||||
std::cout << "\t\tUncorrectable errors: " << ec.uncorrectable_err
|
||||
<< std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_ecc_count_get(i, static_cast<rsmi_gpu_block_t>(b),
|
||||
nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_ROCM_SMI_TEST_FUNCTIONAL_ERR_CNT_READ_H_
|
||||
#define TESTS_ROCM_SMI_TEST_FUNCTIONAL_ERR_CNT_READ_H_
|
||||
|
||||
#include "../test_base.h"
|
||||
|
||||
class TestErrCntRead : public TestBase {
|
||||
public:
|
||||
TestErrCntRead();
|
||||
|
||||
// @Brief: Destructor for test case of TestErrCntRead
|
||||
virtual ~TestErrCntRead();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_ROCM_SMI_TEST_FUNCTIONAL_ERR_CNT_READ_H_
|
||||
@@ -1,197 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2020, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
#include "evt_notif_read_write.h"
|
||||
#include "../test_common.h"
|
||||
#include "../test_utils.h"
|
||||
|
||||
TestEvtNotifReadWrite::TestEvtNotifReadWrite() : TestBase() {
|
||||
set_title("RSMI Event Notification Read/Write Test");
|
||||
set_description("The Event Notification Read/Write tests verifies that "
|
||||
"we can configure to collect various event types and then read them");
|
||||
}
|
||||
|
||||
TestEvtNotifReadWrite::~TestEvtNotifReadWrite(void) {
|
||||
}
|
||||
|
||||
void TestEvtNotifReadWrite::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestEvtNotifReadWrite::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestEvtNotifReadWrite::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestEvtNotifReadWrite::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// rsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
void TestEvtNotifReadWrite::Run(void) {
|
||||
rsmi_status_t ret;
|
||||
uint32_t dv_ind;
|
||||
|
||||
TestBase::Run();
|
||||
if (num_monitor_devs() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (setup_failed_) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" <<
|
||||
std::endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
rsmi_evt_notification_type_t evt_type = RSMI_EVT_NOTIF_FIRST;
|
||||
uint64_t mask = RSMI_EVENT_MASK_FROM_INDEX(evt_type);
|
||||
while (evt_type <= RSMI_EVT_NOTIF_LAST) {
|
||||
mask |= RSMI_EVENT_MASK_FROM_INDEX(evt_type);
|
||||
evt_type = static_cast<rsmi_evt_notification_type_t>(
|
||||
static_cast<uint32_t>(evt_type)+1);
|
||||
}
|
||||
|
||||
for (dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) {
|
||||
ret = rsmi_event_notification_init(dv_ind);
|
||||
if (ret == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout <<
|
||||
"Event notification is not supported for this driver version." <<
|
||||
std::endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
ASSERT_EQ(ret, RSMI_STATUS_SUCCESS);
|
||||
ret = rsmi_event_notification_mask_set(dv_ind, mask);
|
||||
ASSERT_EQ(ret, RSMI_STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
rsmi_evt_notification_data_t data[10];
|
||||
uint32_t num_elem = 10;
|
||||
bool read_again = false;
|
||||
|
||||
ret = rsmi_event_notification_get(10000, &num_elem, data);
|
||||
if (ret == RSMI_STATUS_SUCCESS || ret == RSMI_STATUS_INSUFFICIENT_SIZE) {
|
||||
EXPECT_LE(num_elem, 10) <<
|
||||
"Expected the number of elements found to be <= buffer size (10)";
|
||||
IF_VERB(STANDARD) {
|
||||
for (uint32_t i = 0; i < num_elem; ++i) {
|
||||
std::cout << "\tdv_ind=" << data[i].dv_ind <<
|
||||
" Type: " << NameFromEvtNotifType(data[i].event) <<
|
||||
" Mesg: " << data[i].message << std::endl;
|
||||
if (data[i].event == RSMI_EVT_NOTIF_GPU_PRE_RESET) {
|
||||
read_again = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
IF_VERB(STANDARD) {
|
||||
if (ret == RSMI_STATUS_INSUFFICIENT_SIZE) {
|
||||
std::cout <<
|
||||
"\t\tBuffer size is 10, but more than 10 events are available." <<
|
||||
std::endl;
|
||||
}
|
||||
}
|
||||
} else if (ret == RSMI_STATUS_NO_DATA) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\tNo events were collected." << std::endl;
|
||||
}
|
||||
} else {
|
||||
// This should always fail. We want to print out the return code.
|
||||
EXPECT_EQ(ret, RSMI_STATUS_SUCCESS) <<
|
||||
"Unexpected return code for rsmi_event_notification_get()";
|
||||
}
|
||||
|
||||
// In case GPU Pre reset event was collected in the previous read,
|
||||
// read again to get the GPU Post reset event.
|
||||
if (read_again) {
|
||||
ret = rsmi_event_notification_get(10000, &num_elem, data);
|
||||
if (ret == RSMI_STATUS_SUCCESS || ret == RSMI_STATUS_INSUFFICIENT_SIZE) {
|
||||
EXPECT_LE(num_elem, 10) <<
|
||||
"Expected the number of elements found to be <= buffer size (10)";
|
||||
IF_VERB(STANDARD) {
|
||||
for (uint32_t i = 0; i < num_elem; ++i) {
|
||||
std::cout << "\tdv_ind=" << data[i].dv_ind <<
|
||||
" Type: " << NameFromEvtNotifType(data[i].event) <<
|
||||
" Mesg: " << data[i].message << std::endl;
|
||||
}
|
||||
}
|
||||
IF_VERB(STANDARD) {
|
||||
if (ret == RSMI_STATUS_INSUFFICIENT_SIZE) {
|
||||
std::cout <<
|
||||
"\t\tBuffer size is 10, but more than 10 events are available." <<
|
||||
std::endl;
|
||||
}
|
||||
}
|
||||
} else if (ret == RSMI_STATUS_NO_DATA) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\tNo further events were collected." << std::endl;
|
||||
}
|
||||
} else {
|
||||
// This should always fail. We want to print out the return code.
|
||||
EXPECT_EQ(ret, RSMI_STATUS_SUCCESS) <<
|
||||
"Unexpected return code for rsmi_event_notification_get()";
|
||||
}
|
||||
}
|
||||
|
||||
for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) {
|
||||
ret = rsmi_event_notification_stop(dv_ind);
|
||||
ASSERT_EQ(ret, RSMI_STATUS_SUCCESS);
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2020, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_ROCM_SMI_TEST_FUNCTIONAL_EVT_NOTIF_READ_WRITE_H_
|
||||
#define TESTS_ROCM_SMI_TEST_FUNCTIONAL_EVT_NOTIF_READ_WRITE_H_
|
||||
|
||||
#include "../test_base.h"
|
||||
|
||||
class TestEvtNotifReadWrite : public TestBase {
|
||||
public:
|
||||
TestEvtNotifReadWrite();
|
||||
|
||||
// @Brief: Destructor for test case of TestEvtNotifReadWrite
|
||||
virtual ~TestEvtNotifReadWrite();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_ROCM_SMI_TEST_FUNCTIONAL_EVT_NOTIF_READ_WRITE_H_
|
||||
@@ -1,144 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
#include "fan_read.h"
|
||||
#include "../test_common.h"
|
||||
|
||||
TestFanRead::TestFanRead() : TestBase() {
|
||||
set_title("RSMI Fan Read Test");
|
||||
set_description("The Fan Read tests verifies that the fan monitors can be "
|
||||
"read properly.");
|
||||
}
|
||||
|
||||
TestFanRead::~TestFanRead(void) {
|
||||
}
|
||||
|
||||
void TestFanRead::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestFanRead::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestFanRead::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestFanRead::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// rsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
|
||||
void TestFanRead::Run(void) {
|
||||
uint64_t val_ui64;
|
||||
rsmi_status_t err;
|
||||
int64_t val_i64;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
for (uint32_t x = 0; x < num_iterations(); ++x) {
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(i);
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Current Fan Speed: ";
|
||||
}
|
||||
err = rsmi_dev_fan_speed_get(i, 0, &val_i64);
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**" << ": " <<
|
||||
"Not supported on this machine" << std::endl;
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_fan_speed_get(i, 0, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
|
||||
err = rsmi_dev_fan_speed_max_get(i, 0, &val_ui64);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << val_i64/static_cast<float>(val_ui64)*100;
|
||||
std::cout << "% ("<< val_i64 << "/" << val_ui64 << ")" << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_fan_speed_max_get(i, 0, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Current fan RPMs: ";
|
||||
}
|
||||
err = rsmi_dev_fan_rpms_get(i, 0, &val_i64);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << val_i64 << std::endl;
|
||||
}
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_fan_rpms_get(i, 0, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_ROCM_SMI_TEST_FUNCTIONAL_FAN_READ_H_
|
||||
#define TESTS_ROCM_SMI_TEST_FUNCTIONAL_FAN_READ_H_
|
||||
|
||||
#include "../test_base.h"
|
||||
|
||||
class TestFanRead : public TestBase {
|
||||
public:
|
||||
TestFanRead();
|
||||
|
||||
// @Brief: Destructor for test case of TestFanRead
|
||||
virtual ~TestFanRead();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_ROCM_SMI_TEST_FUNCTIONAL_FAN_READ_H_
|
||||
@@ -1,178 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
#include "fan_read_write.h"
|
||||
#include "../test_common.h"
|
||||
|
||||
TestFanReadWrite::TestFanReadWrite() : TestBase() {
|
||||
set_title("RSMI Fan Read/Write Test");
|
||||
set_description("The Fan Read tests verifies that the fan monitors can be "
|
||||
"read and controlled properly.");
|
||||
}
|
||||
|
||||
TestFanReadWrite::~TestFanReadWrite(void) {
|
||||
}
|
||||
|
||||
void TestFanReadWrite::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestFanReadWrite::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestFanReadWrite::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestFanReadWrite::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// rsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
|
||||
void TestFanReadWrite::Run(void) {
|
||||
rsmi_status_t ret;
|
||||
int64_t orig_speed;
|
||||
int64_t new_speed;
|
||||
int64_t cur_speed;
|
||||
uint64_t max_speed;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) {
|
||||
PrintDeviceHeader(dv_ind);
|
||||
|
||||
ret = rsmi_dev_fan_speed_get(dv_ind, 0, &orig_speed);
|
||||
if (ret == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**" << ": " <<
|
||||
"Not supported on this machine" << std::endl;
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
CHK_ERR_ASRT(ret)
|
||||
}
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Original fan speed: " << orig_speed << std::endl;
|
||||
}
|
||||
|
||||
if (orig_speed == 0) {
|
||||
std::cout << "***System fan speed value is 0. Skip fan test." <<
|
||||
std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
ret = rsmi_dev_fan_speed_max_get(dv_ind, 0, &max_speed);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
new_speed = 1.1 * orig_speed;
|
||||
|
||||
if (new_speed > static_cast<int64_t>(max_speed)) {
|
||||
std::cout <<
|
||||
"***System fan speed value is close to max. Will not adjust upward." <<
|
||||
std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Setting fan speed to " << new_speed << std::endl;
|
||||
}
|
||||
|
||||
ret = rsmi_dev_fan_speed_set(dv_ind, 0, new_speed);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
sleep(4);
|
||||
|
||||
ret = rsmi_dev_fan_speed_get(dv_ind, 0, &cur_speed);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "New fan speed: " << cur_speed << std::endl;
|
||||
}
|
||||
|
||||
// EXPECT_TRUE((cur_speed > 0.95 * new_speed &&
|
||||
// cur_speed < 1.1 * new_speed) ||
|
||||
// cur_speed > 0.95 * RSMI_MAX_FAN_SPEED);
|
||||
IF_VERB(STANDARD) {
|
||||
if (!((cur_speed > 0.95 * new_speed && cur_speed < 1.1 * new_speed) ||
|
||||
(cur_speed > 0.95 * RSMI_MAX_FAN_SPEED))) {
|
||||
std::cout << "WARNING: Fan speed is not within the expected range!" <<
|
||||
std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Resetting fan control to auto..." << std::endl;
|
||||
}
|
||||
|
||||
ret = rsmi_dev_fan_reset(dv_ind, 0);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
sleep(3);
|
||||
|
||||
ret = rsmi_dev_fan_speed_get(dv_ind, 0, &cur_speed);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "End fan speed: " << cur_speed << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_ROCM_SMI_TEST_FUNCTIONAL_FAN_READ_WRITE_H_
|
||||
#define TESTS_ROCM_SMI_TEST_FUNCTIONAL_FAN_READ_WRITE_H_
|
||||
|
||||
#include "../test_base.h"
|
||||
|
||||
class TestFanReadWrite : public TestBase {
|
||||
public:
|
||||
TestFanReadWrite();
|
||||
|
||||
// @Brief: Destructor for test case of TestFanReadWrite
|
||||
virtual ~TestFanReadWrite();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_ROCM_SMI_TEST_FUNCTIONAL_FAN_READ_WRITE_H_
|
||||
@@ -1,167 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
#include "frequencies_read.h"
|
||||
#include "../test_common.h"
|
||||
|
||||
TestFrequenciesRead::TestFrequenciesRead() : TestBase() {
|
||||
set_title("RSMI Frequencies Read Test");
|
||||
set_description("The Frequency Read tests verifies that the "
|
||||
"available and current frequency levels can be read properly.");
|
||||
}
|
||||
|
||||
TestFrequenciesRead::~TestFrequenciesRead(void) {
|
||||
}
|
||||
|
||||
void TestFrequenciesRead::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestFrequenciesRead::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestFrequenciesRead::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestFrequenciesRead::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// rsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
|
||||
static void print_frequencies(rsmi_frequencies_t *f, uint32_t *l = nullptr) {
|
||||
assert(f != nullptr);
|
||||
for (uint32_t j = 0; j < f->num_supported; ++j) {
|
||||
std::cout << "\t** " << j << ": " << f->frequency[j];
|
||||
if (l != nullptr) {
|
||||
std::cout << "T/s; x" << l[j];
|
||||
} else {
|
||||
std::cout << "Hz";
|
||||
}
|
||||
|
||||
if (j == f->current) {
|
||||
std::cout << " *";
|
||||
}
|
||||
std::cout << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void TestFrequenciesRead::Run(void) {
|
||||
rsmi_status_t err;
|
||||
rsmi_frequencies_t f;
|
||||
rsmi_pcie_bandwidth_t b;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t x = 0; x < num_iterations(); ++x) {
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
auto freq_output = [&](rsmi_clk_type_t t, const char *name) {
|
||||
err = rsmi_dev_gpu_clk_freq_get(i, t, &f);
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout << "\t**Get " << name <<
|
||||
": Not supported on this machine" << std::endl;
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_gpu_clk_freq_get(i, t, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Supported " << name << " clock frequencies: ";
|
||||
std::cout << f.num_supported << std::endl;
|
||||
print_frequencies(&f);
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_gpu_clk_freq_get(i, t, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
PrintDeviceHeader(i);
|
||||
|
||||
freq_output(RSMI_CLK_TYPE_MEM, "Supported GPU Memory");
|
||||
freq_output(RSMI_CLK_TYPE_SYS, "Supported GPU");
|
||||
freq_output(RSMI_CLK_TYPE_DF, "Data Fabric Clock");
|
||||
freq_output(RSMI_CLK_TYPE_DCEF, "Display Controller Engine Clock");
|
||||
freq_output(RSMI_CLK_TYPE_SOC, "SOC Clock");
|
||||
|
||||
err = rsmi_dev_pci_bandwidth_get(i, &b);
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout << "\t**Get PCIE Bandwidth: Not supported on this machine"
|
||||
<< std::endl;
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_pci_bandwidth_get(i, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Supported PCIe bandwidths: ";
|
||||
std::cout << b.transfer_rate.num_supported << std::endl;
|
||||
print_frequencies(&b.transfer_rate, b.lanes);
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_pci_bandwidth_get(i, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_ROCM_SMI_TEST_FUNCTIONAL_FREQUENCIES_READ_H_
|
||||
#define TESTS_ROCM_SMI_TEST_FUNCTIONAL_FREQUENCIES_READ_H_
|
||||
|
||||
#include "../test_base.h"
|
||||
|
||||
class TestFrequenciesRead : public TestBase {
|
||||
public:
|
||||
TestFrequenciesRead();
|
||||
|
||||
// @Brief: Destructor for test case of TestFrequenciesRead
|
||||
virtual ~TestFrequenciesRead();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_ROCM_SMI_TEST_FUNCTIONAL_FREQUENCIES_READ_H_
|
||||
@@ -1,220 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include <bitset>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
#include "frequencies_read_write.h"
|
||||
#include "../test_common.h"
|
||||
|
||||
|
||||
TestFrequenciesReadWrite::TestFrequenciesReadWrite() : TestBase() {
|
||||
set_title("RSMI Frequencies Read/Write Test");
|
||||
set_description("The Frequencies tests verify that the frequency "
|
||||
"settings can be read and controlled properly.");
|
||||
}
|
||||
|
||||
TestFrequenciesReadWrite::~TestFrequenciesReadWrite(void) {
|
||||
}
|
||||
|
||||
void TestFrequenciesReadWrite::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestFrequenciesReadWrite::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestFrequenciesReadWrite::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestFrequenciesReadWrite::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// rsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
|
||||
void TestFrequenciesReadWrite::Run(void) {
|
||||
rsmi_status_t ret;
|
||||
rsmi_frequencies_t f;
|
||||
uint32_t freq_bitmask;
|
||||
rsmi_clk_type rsmi_clk;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) {
|
||||
PrintDeviceHeader(dv_ind);
|
||||
|
||||
for (uint32_t clk = (uint32_t)RSMI_CLK_TYPE_FIRST;
|
||||
clk <= RSMI_CLK_TYPE_LAST; ++clk) {
|
||||
rsmi_clk = (rsmi_clk_type)clk;
|
||||
|
||||
auto freq_read = [&]() -> bool {
|
||||
ret = rsmi_dev_gpu_clk_freq_get(dv_ind, rsmi_clk, &f);
|
||||
if (ret == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout << "\t**Set " << FreqEnumToStr(rsmi_clk) <<
|
||||
": Not supported on this machine" << std::endl;
|
||||
return false;
|
||||
} else {
|
||||
// CHK_ERR_ASRT(ret)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Initial frequency for clock " <<
|
||||
FreqEnumToStr(rsmi_clk) << " is " << f.current << std::endl;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
auto freq_write = [&]() {
|
||||
// Set clocks to something other than the usual default of the lowest
|
||||
// frequency.
|
||||
freq_bitmask = 0b01100; // Try the 3rd and 4th clocks
|
||||
|
||||
std::string freq_bm_str =
|
||||
std::bitset<RSMI_MAX_NUM_FREQUENCIES>(freq_bitmask).to_string();
|
||||
|
||||
freq_bm_str.erase(0, std::min(freq_bm_str.find_first_not_of('0'),
|
||||
freq_bm_str.size()-1));
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Setting frequency mask for " <<
|
||||
FreqEnumToStr(rsmi_clk) << " to 0b" << freq_bm_str << " ..." <<
|
||||
std::endl;
|
||||
}
|
||||
ret = rsmi_dev_gpu_clk_freq_set(dv_ind, rsmi_clk, freq_bitmask);
|
||||
//Certain ASICs does not allow to set particular clocks. If set function for a clock returns
|
||||
//permission error despite root access, manually set ret value to success and return
|
||||
if (ret == RSMI_STATUS_PERMISSION && geteuid() == 0) {
|
||||
std::cout << "\t**Set " << FreqEnumToStr(rsmi_clk) <<
|
||||
": Not supported on this machine. Skipping..." << std::endl;
|
||||
ret = RSMI_STATUS_SUCCESS;
|
||||
return;
|
||||
}
|
||||
CHK_ERR_ASRT(ret)
|
||||
ret = rsmi_dev_gpu_clk_freq_get(dv_ind, rsmi_clk, &f);
|
||||
if (ret != RSMI_STATUS_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Frequency is now index " << f.current << std::endl;
|
||||
std::cout << "Resetting mask to all frequencies." << std::endl;
|
||||
}
|
||||
ret = rsmi_dev_gpu_clk_freq_set(dv_ind, rsmi_clk, 0xFFFFFFFF);
|
||||
if (ret != RSMI_STATUS_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
|
||||
ret = rsmi_dev_perf_level_set(dv_ind, RSMI_DEV_PERF_LEVEL_AUTO);
|
||||
if (ret != RSMI_STATUS_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
if (freq_read()) {
|
||||
CHK_ERR_ASRT(ret)
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
freq_write();
|
||||
CHK_ERR_ASRT(ret)
|
||||
#if 0
|
||||
ret = rsmi_dev_gpu_clk_freq_get(dv_ind, rsmi_clk, &f);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Initial frequency for clock " << rsmi_clk << " is " <<
|
||||
f.current << std::endl;
|
||||
}
|
||||
// Set clocks to something other than the usual default of the lowest
|
||||
// frequency.
|
||||
freq_bitmask = 0b01100; // Try the 3rd and 4th clocks
|
||||
|
||||
std::string freq_bm_str =
|
||||
std::bitset<RSMI_MAX_NUM_FREQUENCIES>(freq_bitmask).to_string();
|
||||
|
||||
freq_bm_str.erase(0, std::min(freq_bm_str.find_first_not_of('0'),
|
||||
freq_bm_str.size()-1));
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Setting frequency mask for clock " << rsmi_clk <<
|
||||
" to 0b" << freq_bm_str << " ..." << std::endl;
|
||||
}
|
||||
ret = rsmi_dev_gpu_clk_freq_set(dv_ind, rsmi_clk, freq_bitmask);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
ret = rsmi_dev_gpu_clk_freq_get(dv_ind, rsmi_clk, &f);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Frequency is now index " << f.current << std::endl;
|
||||
std::cout << "Resetting mask to all frequencies." << std::endl;
|
||||
}
|
||||
ret = rsmi_dev_gpu_clk_freq_set(dv_ind, rsmi_clk, 0xFFFFFFFF);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
ret = rsmi_dev_perf_level_set(dv_ind, RSMI_DEV_PERF_LEVEL_AUTO);
|
||||
CHK_ERR_ASRT(ret)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_ROCM_SMI_TEST_FUNCTIONAL_FREQUENCIES_READ_WRITE_H_
|
||||
#define TESTS_ROCM_SMI_TEST_FUNCTIONAL_FREQUENCIES_READ_WRITE_H_
|
||||
|
||||
#include "../test_base.h"
|
||||
|
||||
class TestFrequenciesReadWrite : public TestBase {
|
||||
public:
|
||||
TestFrequenciesReadWrite();
|
||||
|
||||
// @Brief: Destructor for test case of TestFrequenciesReadWrite
|
||||
virtual ~TestFrequenciesReadWrite();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_ROCM_SMI_TEST_FUNCTIONAL_FREQUENCIES_READ_WRITE_H_
|
||||
@@ -1,120 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
#include "gpu_busy_read.h"
|
||||
#include "../test_common.h"
|
||||
|
||||
TestGPUBusyRead::TestGPUBusyRead() : TestBase() {
|
||||
set_title("RSMI GPU Busy Read Test");
|
||||
set_description("The GPU Busy Read tests verifies that the gpu busy "
|
||||
"percentage can be read properly.");
|
||||
}
|
||||
|
||||
TestGPUBusyRead::~TestGPUBusyRead(void) {
|
||||
}
|
||||
|
||||
void TestGPUBusyRead::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestGPUBusyRead::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestGPUBusyRead::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestGPUBusyRead::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// rsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
|
||||
void TestGPUBusyRead::Run(void) {
|
||||
rsmi_status_t err;
|
||||
uint32_t val_ui32;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t x = 0; x < num_iterations(); ++x) {
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(i);
|
||||
|
||||
err = rsmi_dev_busy_percent_get(i, &val_ui32);
|
||||
if (err != RSMI_STATUS_SUCCESS) {
|
||||
if (err == RSMI_STATUS_FILE_ERROR) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**GPU Busy Percent: Not supported on this machine"
|
||||
<< std::endl;
|
||||
}
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
} else {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**GPU Busy Percent (Percent Idle):" << std::dec <<
|
||||
val_ui32 << " (" << 100 - val_ui32 << ")" << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_ROCM_SMI_TEST_FUNCTIONAL_GPU_BUSY_READ_H_
|
||||
#define TESTS_ROCM_SMI_TEST_FUNCTIONAL_GPU_BUSY_READ_H_
|
||||
|
||||
#include "../test_base.h"
|
||||
|
||||
class TestGPUBusyRead : public TestBase {
|
||||
public:
|
||||
TestGPUBusyRead();
|
||||
|
||||
// @Brief: Destructor for test case of TestGPUBusyRead
|
||||
virtual ~TestGPUBusyRead();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_ROCM_SMI_TEST_FUNCTIONAL_GPU_BUSY_READ_H_
|
||||
@@ -1,194 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2020, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
#include "gpu_metrics_read.h"
|
||||
#include "../test_common.h"
|
||||
|
||||
|
||||
TestGpuMetricsRead::TestGpuMetricsRead() : TestBase() {
|
||||
set_title("RSMI GPU Metrics Read Test");
|
||||
set_description("The GPU Metrics tests verifies that "
|
||||
"the gpu metrics info can be read properly.");
|
||||
}
|
||||
|
||||
TestGpuMetricsRead::~TestGpuMetricsRead(void) {
|
||||
}
|
||||
|
||||
void TestGpuMetricsRead::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestGpuMetricsRead::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestGpuMetricsRead::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestGpuMetricsRead::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// rsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
|
||||
void TestGpuMetricsRead::Run(void) {
|
||||
rsmi_status_t err;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(i);
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**GPU METRICS:\n";
|
||||
}
|
||||
rsmi_gpu_metrics_t smu;
|
||||
err = rsmi_dev_gpu_metrics_info_get(i, &smu);
|
||||
if (err != RSMI_STATUS_SUCCESS) {
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**" <<
|
||||
"Not supported on this machine" << std::endl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
CHK_ERR_ASRT(err);
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << std::dec << "system_clock_counter="
|
||||
<< smu.system_clock_counter << '\n';
|
||||
std::cout << std::dec << "temperature_edge="
|
||||
<< smu.temperature_edge << '\n';
|
||||
std::cout << std::dec << "temperature_hotspot="
|
||||
<< smu.temperature_hotspot << '\n';
|
||||
std::cout << std::dec << "temperature_mem="
|
||||
<< smu.temperature_mem << '\n';
|
||||
std::cout << std::dec << "temperature_vrgfx="
|
||||
<< smu.temperature_vrgfx << '\n';
|
||||
std::cout << std::dec << "temperature_vrsoc="
|
||||
<< smu.temperature_vrsoc << '\n';
|
||||
std::cout << std::dec << "temperature_vrmem="
|
||||
<< smu.temperature_vrmem << '\n';
|
||||
std::cout << std::dec << "average_gfx_activity="
|
||||
<< smu.average_gfx_activity << '\n';
|
||||
std::cout << std::dec << "average_umc_activity="
|
||||
<< smu.average_umc_activity << '\n';
|
||||
std::cout << std::dec << "average_mm_activity="
|
||||
<< smu.average_mm_activity << '\n';
|
||||
std::cout << std::dec << "average_socket_power="
|
||||
<< smu.average_socket_power << '\n';
|
||||
std::cout << std::dec << "energy_accumulator="
|
||||
<< smu.energy_accumulator << '\n';
|
||||
std::cout << std::dec << "average_gfxclk_frequency="
|
||||
<< smu.average_gfxclk_frequency << '\n';
|
||||
std::cout << std::dec << "average_gfxclk_frequency="
|
||||
<< smu.average_gfxclk_frequency << '\n';
|
||||
std::cout << std::dec << "average_uclk_frequency="
|
||||
<< smu.average_uclk_frequency << '\n';
|
||||
std::cout << std::dec << "average_vclk0_frequency="
|
||||
<< smu.average_vclk0_frequency << '\n';
|
||||
std::cout << std::dec << "average_dclk0_frequency="
|
||||
<< smu.average_dclk0_frequency << '\n';
|
||||
std::cout << std::dec << "average_vclk1_frequency="
|
||||
<< smu.average_vclk1_frequency << '\n';
|
||||
std::cout << std::dec << "average_dclk1_frequency="
|
||||
<< smu.average_dclk1_frequency << '\n';
|
||||
std::cout << std::dec << "current_gfxclk="
|
||||
<< smu.current_gfxclk << '\n';
|
||||
std::cout << std::dec << "current_socclk="
|
||||
<< smu.current_socclk << '\n';
|
||||
std::cout << std::dec << "current_uclk="
|
||||
<< smu.current_uclk << '\n';
|
||||
std::cout << std::dec << "current_vclk0="
|
||||
<< smu.current_vclk0 << '\n';
|
||||
std::cout << std::dec << "current_dclk0="
|
||||
<< smu.current_dclk0 << '\n';
|
||||
std::cout << std::dec << "current_vclk1="
|
||||
<< smu.current_vclk1 << '\n';
|
||||
std::cout << std::dec << "current_dclk1="
|
||||
<< smu.current_dclk1 << '\n';
|
||||
std::cout << std::dec << "throttle_status="
|
||||
<< smu.throttle_status << '\n';
|
||||
std::cout << std::dec << "current_fan_speed="
|
||||
<< smu.current_fan_speed << '\n';
|
||||
std::cout << "pcie_link_width="
|
||||
<< std::to_string(smu.pcie_link_width) << '\n';
|
||||
std::cout << "pcie_link_width="
|
||||
<< std::to_string(smu.pcie_link_speed) << '\n';
|
||||
std::cout << "gfx_activity_acc="
|
||||
<< std::dec << smu.gfx_activity_acc << '\n';
|
||||
std::cout << "mem_actvity_acc="
|
||||
<< std::dec << smu.mem_actvity_acc << '\n';
|
||||
|
||||
for (int i = 0; i < RSMI_NUM_HBM_INSTANCES; ++i) {
|
||||
std::cout << "temperature_hbm[" << i << "]=" << std::dec <<
|
||||
smu.temperature_hbm[i] << '\n';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_gpu_metrics_info_get(i, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2020, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_ROCM_SMI_TEST_FUNCTIONAL_GPU_METRICS_READ_H_
|
||||
#define TESTS_ROCM_SMI_TEST_FUNCTIONAL_GPU_METRICS_READ_H_
|
||||
|
||||
#include "../test_base.h"
|
||||
|
||||
class TestGpuMetricsRead : public TestBase {
|
||||
public:
|
||||
TestGpuMetricsRead();
|
||||
|
||||
// @Brief: Destructor for test case of TestVOltRead
|
||||
virtual ~TestGpuMetricsRead();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_ROCM_SMI_TEST_FUNCTIONAL_GPU_METRICS_READ_H_
|
||||
@@ -1,304 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2020, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
#include "hw_topology_read.h"
|
||||
#include "../test_common.h"
|
||||
|
||||
typedef struct {
|
||||
std::string type;
|
||||
uint64_t hops;
|
||||
uint64_t weight;
|
||||
bool accessible;
|
||||
} gpu_link_t;
|
||||
|
||||
TestHWTopologyRead::TestHWTopologyRead() : TestBase() {
|
||||
set_title("RSMI Hardware Topology Read Test");
|
||||
set_description(
|
||||
"This test verifies that Hardware Topology can be read properly.");
|
||||
}
|
||||
|
||||
TestHWTopologyRead::~TestHWTopologyRead(void) {
|
||||
}
|
||||
|
||||
void TestHWTopologyRead::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestHWTopologyRead::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestHWTopologyRead::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestHWTopologyRead::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// rsmi_shut_down(), so it should be done after other cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
void TestHWTopologyRead::Run(void) {
|
||||
rsmi_status_t err;
|
||||
uint32_t i, j;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t num_devices;
|
||||
err = rsmi_num_monitor_devices(&num_devices);
|
||||
CHK_ERR_ASRT(err)
|
||||
|
||||
// gpu_link_t gpu_links[num_devices][num_devices];
|
||||
std::vector<std::vector<gpu_link_t>> gpu_links(num_devices,
|
||||
std::vector<gpu_link_t>(num_devices));
|
||||
// uint32_t numa_numbers[num_devices];
|
||||
std::vector<uint32_t> numa_numbers(num_devices);
|
||||
|
||||
for (uint32_t dv_ind = 0; dv_ind < num_devices; ++dv_ind) {
|
||||
err = rsmi_topo_get_numa_node_number(dv_ind, &numa_numbers[dv_ind]);
|
||||
if (err != RSMI_STATUS_SUCCESS) {
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout <<
|
||||
"\t**Numa Node Number. read: Not supported on this machine" <<
|
||||
std::endl;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (uint32_t dv_ind_src = 0; dv_ind_src < num_devices; dv_ind_src++) {
|
||||
for (uint32_t dv_ind_dst = 0; dv_ind_dst < num_devices; dv_ind_dst++) {
|
||||
if (dv_ind_src == dv_ind_dst) {
|
||||
gpu_links[dv_ind_src][dv_ind_dst].type = "X";
|
||||
gpu_links[dv_ind_src][dv_ind_dst].hops = 0;
|
||||
gpu_links[dv_ind_src][dv_ind_dst].weight = 0;
|
||||
gpu_links[dv_ind_src][dv_ind_dst].accessible = true;
|
||||
} else {
|
||||
RSMI_IO_LINK_TYPE type;
|
||||
err = rsmi_topo_get_link_type(dv_ind_src, dv_ind_dst,
|
||||
&gpu_links[dv_ind_src][dv_ind_dst].hops, &type);
|
||||
if (err != RSMI_STATUS_SUCCESS) {
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout <<
|
||||
"\t**Link Type. read: Not supported on this machine"
|
||||
<< std::endl;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
} else {
|
||||
switch (type) {
|
||||
case RSMI_IOLINK_TYPE_PCIEXPRESS:
|
||||
gpu_links[dv_ind_src][dv_ind_dst].type = "PCIE";
|
||||
break;
|
||||
|
||||
case RSMI_IOLINK_TYPE_XGMI:
|
||||
gpu_links[dv_ind_src][dv_ind_dst].type = "XGMI";
|
||||
break;
|
||||
|
||||
default:
|
||||
gpu_links[dv_ind_src][dv_ind_dst].type = "XXXX";
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Invalid IO LINK type. type=" << type <<
|
||||
std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
err = rsmi_topo_get_link_weight(dv_ind_src, dv_ind_dst,
|
||||
&gpu_links[dv_ind_src][dv_ind_dst].weight);
|
||||
if (err != RSMI_STATUS_SUCCESS) {
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout <<
|
||||
"\t**Link Weight. read: Not supported on this machine"
|
||||
<< std::endl;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
}
|
||||
err = rsmi_is_P2P_accessible(dv_ind_src, dv_ind_dst,
|
||||
&gpu_links[dv_ind_src][dv_ind_dst].accessible);
|
||||
if (err != RSMI_STATUS_SUCCESS) {
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout <<
|
||||
"\t**P2P Access. check: Not supported on this machine"
|
||||
<< std::endl;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IF_NVERB(STANDARD) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::cout << "**NUMA node number of GPUs**" << std::endl;
|
||||
std::cout << std::setw(12) << std::left <<"GPU#";
|
||||
std::cout <<"NUMA node number";
|
||||
std::cout << std::endl;
|
||||
for (i = 0; i < num_devices; ++i) {
|
||||
std::cout << std::setw(12) << std::left << i;
|
||||
std::cout << numa_numbers[i];
|
||||
std::cout << std::endl;
|
||||
}
|
||||
std::cout << std::endl;
|
||||
std::cout << std::endl;
|
||||
|
||||
std::string tmp;
|
||||
std::cout << "**Type between two GPUs**" << std::endl;
|
||||
std::cout << " ";
|
||||
for (i = 0; i < num_devices; ++i) {
|
||||
tmp = "GPU" + std::to_string(i);
|
||||
std::cout << std::setw(12) << std::left << tmp;
|
||||
}
|
||||
std::cout << std::endl;
|
||||
|
||||
for (i = 0; i < num_devices; i++) {
|
||||
tmp = "GPU" + std::to_string(i);
|
||||
std::cout << std::setw(6) << std::left << tmp;
|
||||
for (j = 0; j < num_devices; j++) {
|
||||
if (i == j) {
|
||||
std::cout << std::setw(12) << std::left << "X";
|
||||
} else {
|
||||
std::cout << std::setw(12) << std::left << gpu_links[i][j].type;
|
||||
}
|
||||
}
|
||||
std::cout << std::endl;
|
||||
}
|
||||
std::cout << std::endl;
|
||||
|
||||
std::cout << "**Hops between two GPUs**" << std::endl;
|
||||
std::cout << " ";
|
||||
for (i = 0; i < num_devices; ++i) {
|
||||
tmp = "GPU" + std::to_string(i);
|
||||
std::cout << std::setw(12) << std::left << tmp;
|
||||
}
|
||||
std::cout << std::endl;
|
||||
|
||||
for (i = 0; i < num_devices; i++) {
|
||||
tmp = "GPU" + std::to_string(i);
|
||||
std::cout << std::setw(6) << std::left << tmp;
|
||||
for (j = 0; j < num_devices; j++) {
|
||||
if (i == j) {
|
||||
std::cout << std::setw(12) << std::left << "X";
|
||||
} else {
|
||||
std::cout << std::setw(12) << std::left << gpu_links[i][j].hops;
|
||||
}
|
||||
}
|
||||
std::cout << std::endl;
|
||||
}
|
||||
std::cout << std::endl;
|
||||
|
||||
std::cout << "**Weight between two GPUs**" << std::endl;
|
||||
std::cout << " ";
|
||||
for (i = 0; i < num_devices; ++i) {
|
||||
tmp = "GPU" + std::to_string(i);
|
||||
std::cout << std::setw(12) << std::left << tmp;
|
||||
}
|
||||
std::cout << std::endl;
|
||||
|
||||
for (i = 0; i < num_devices; i++) {
|
||||
tmp = "GPU" + std::to_string(i);
|
||||
std::cout << std::setw(6) << std::left << tmp;
|
||||
for (j = 0; j < num_devices; j++) {
|
||||
if (i == j) {
|
||||
std::cout << std::setw(12) << std::left << "X";
|
||||
} else {
|
||||
std::cout << std::setw(12) << std::left << gpu_links[i][j].weight;
|
||||
}
|
||||
}
|
||||
std::cout << std::endl;
|
||||
}
|
||||
std::cout << std::endl;
|
||||
std::cout << "**Access between two GPUs**" << std::endl;
|
||||
std::cout << " ";
|
||||
for (i = 0; i < num_devices; ++i) {
|
||||
tmp = "GPU" + std::to_string(i);
|
||||
std::cout << std::setw(12) << std::left << tmp;
|
||||
}
|
||||
std::cout << std::endl;
|
||||
for (i = 0; i < num_devices; i++) {
|
||||
tmp = "GPU" + std::to_string(i);
|
||||
std::cout << std::setw(6) << std::left << tmp;
|
||||
for (j = 0; j < num_devices; j++) {
|
||||
std::cout << std::boolalpha;
|
||||
std::cout << std::setw(12) << std::left << gpu_links[i][j].accessible;
|
||||
}
|
||||
std::cout << std::endl;
|
||||
}
|
||||
std::cout << std::endl;
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2020, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_ROCM_SMI_TEST_FUNCTIONAL_HW_TOPOLOGY_READ_H_
|
||||
#define TESTS_ROCM_SMI_TEST_FUNCTIONAL_HW_TOPOLOGY_READ_H_
|
||||
|
||||
#include "../test_base.h"
|
||||
|
||||
class TestHWTopologyRead : public TestBase {
|
||||
public:
|
||||
TestHWTopologyRead();
|
||||
|
||||
// @Brief: Destructor for test case of TestHWTopologyRead
|
||||
virtual ~TestHWTopologyRead();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrieve the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_ROCM_SMI_TEST_FUNCTIONAL_HW_TOPOLOGY_READ_H_
|
||||
@@ -1,307 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
#include "id_info_read.h"
|
||||
#include "../test_common.h"
|
||||
|
||||
TestIdInfoRead::TestIdInfoRead() : TestBase() {
|
||||
set_title("RSMI ID Info Read Test");
|
||||
set_description("This test verifies that ID information such as the "
|
||||
"device, subsystem and vendor IDs can be read properly.");
|
||||
}
|
||||
|
||||
TestIdInfoRead::~TestIdInfoRead(void) {
|
||||
}
|
||||
|
||||
void TestIdInfoRead::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestIdInfoRead::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestIdInfoRead::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestIdInfoRead::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// rsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
static const uint32_t kBufferLen = 80;
|
||||
|
||||
void TestIdInfoRead::Run(void) {
|
||||
rsmi_status_t err;
|
||||
uint16_t id;
|
||||
uint64_t val_ui64;
|
||||
uint32_t drm_render_minor;
|
||||
|
||||
char buffer[kBufferLen];
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t*************************" << std::endl;
|
||||
std::cout << "\t**Device index: " << i << std::endl;
|
||||
}
|
||||
|
||||
// Get the device ID, name, vendor ID and vendor name for the device
|
||||
err = rsmi_dev_id_get(i, &id);
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
rsmi_status_t ret;
|
||||
// Verify api support checking functionality is working
|
||||
ret = rsmi_dev_id_get(i, nullptr);
|
||||
ASSERT_EQ(ret, RSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Device ID: 0x" << std::hex << id << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_id_get(i, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
}
|
||||
err = rsmi_dev_name_get(i, buffer, kBufferLen);
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout << "\t**Device Marketing name not found on this system." <<
|
||||
std::endl;
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_name_get(i, nullptr, kBufferLen);
|
||||
ASSERT_EQ(err, RSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Device Marketing name: " << buffer << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_name_get(i, nullptr, kBufferLen);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
}
|
||||
err = rsmi_dev_brand_get(i, buffer, kBufferLen);
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_brand_get(i, nullptr, kBufferLen);
|
||||
ASSERT_EQ(err, RSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Device Brand name: " << buffer << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_brand_get(i, nullptr, kBufferLen);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
}
|
||||
err = rsmi_dev_vram_vendor_get(i, buffer, kBufferLen);
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout <<
|
||||
"\t**Vram Vendor string not supported on this system." << std::endl;
|
||||
err = rsmi_dev_vram_vendor_get(i, nullptr, kBufferLen);
|
||||
ASSERT_EQ(err, RSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Device Vram Vendor name: " << buffer << std::endl;
|
||||
}
|
||||
err = rsmi_dev_brand_get(i, nullptr, kBufferLen);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
}
|
||||
err = rsmi_dev_vendor_id_get(i, &id);
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_vendor_id_get(i, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Vendor ID: 0x" << std::hex << id << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_vendor_id_get(i, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
}
|
||||
err = rsmi_dev_drm_render_minor_get(i, &drm_render_minor);
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_drm_render_minor_get(i, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**DRM Render Minor: " << drm_render_minor << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_drm_render_minor_get(i, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
}
|
||||
err = rsmi_dev_vendor_name_get(i, buffer, kBufferLen);
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout << "\t**Device Vendor name string not found on this system." <<
|
||||
std::endl;
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_vendor_name_get(i, nullptr, kBufferLen);
|
||||
ASSERT_EQ(err, RSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Device Vendor name: " << buffer << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_vendor_name_get(i, nullptr, kBufferLen);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
}
|
||||
|
||||
// Get the device ID, name, vendor ID and vendor name for the sub-device
|
||||
err = rsmi_dev_subsystem_id_get(i, &id);
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_subsystem_id_get(i, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Subsystem ID: 0x" << std::hex << id << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_subsystem_id_get(i, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
}
|
||||
err = rsmi_dev_subsystem_name_get(i, buffer, kBufferLen);
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout << "\t**Subsystem name string not found on this system." <<
|
||||
std::endl;
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_subsystem_name_get(i, nullptr, kBufferLen);
|
||||
ASSERT_EQ(err, RSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Subsystem name: " << buffer << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_subsystem_name_get(i, nullptr, kBufferLen);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
}
|
||||
err = rsmi_dev_subsystem_vendor_id_get(i, &id);
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_subsystem_vendor_id_get(i, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Sub-system Vendor ID: 0x" << std::hex <<
|
||||
id << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_subsystem_vendor_id_get(i, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
}
|
||||
err = rsmi_dev_vendor_name_get(i, buffer, kBufferLen);
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout <<
|
||||
"\t**Subsystem Vendor name string not found on this system." <<
|
||||
std::endl;
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_vendor_name_get(i, nullptr, kBufferLen);
|
||||
ASSERT_EQ(err, RSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Subsystem Vendor name: " << buffer << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_vendor_name_get(i, nullptr, kBufferLen);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
}
|
||||
|
||||
err = rsmi_dev_pci_id_get(i, &val_ui64);
|
||||
// Don't check for RSMI_STATUS_NOT_SUPPORTED since this should always be
|
||||
// supported. It is not based on a sysfs file.
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**PCI ID (BDFID): 0x" << std::hex << val_ui64;
|
||||
std::cout << " (" << std::dec << val_ui64 << ")" << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_pci_id_get(i, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
|
||||
err = rsmi_dev_serial_number_get(i, buffer, kBufferLen);
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_serial_number_get(i, nullptr, kBufferLen);
|
||||
ASSERT_EQ(err, RSMI_STATUS_NOT_SUPPORTED);
|
||||
|
||||
std::cout <<
|
||||
"\t**Serial Number string not supported on this system." << std::endl;
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Device Serial Number:" << buffer << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_serial_number_get(i, nullptr, kBufferLen);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_ROCM_SMI_TEST_FUNCTIONAL_ID_INFO_READ_H_
|
||||
#define TESTS_ROCM_SMI_TEST_FUNCTIONAL_ID_INFO_READ_H_
|
||||
|
||||
#include "../test_base.h"
|
||||
|
||||
class TestIdInfoRead : public TestBase {
|
||||
public:
|
||||
TestIdInfoRead();
|
||||
|
||||
// @Brief: Destructor for test case of TestIdInfoRead
|
||||
virtual ~TestIdInfoRead();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_ROCM_SMI_TEST_FUNCTIONAL_ID_INFO_READ_H_
|
||||
@@ -1,240 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2020, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <thread> // NOLINT
|
||||
#include <random>
|
||||
#include <chrono> // NOLINT
|
||||
|
||||
#include "init_shutdown_refcount.h"
|
||||
#include <gtest/gtest.h>
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
#include "../test_common.h"
|
||||
|
||||
extern int32_t
|
||||
rsmi_test_refcount(uint64_t refcnt_type);
|
||||
|
||||
static void rand_sleep_mod(int msec) {
|
||||
assert(msec > 10);
|
||||
unsigned int seed = time(NULL);
|
||||
std::mt19937_64 eng{seed};
|
||||
std::uniform_int_distribution<> dist{10, msec};
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds{dist(eng)});
|
||||
}
|
||||
|
||||
static void* RSMIInitFunction(void* args) {
|
||||
rsmi_status_t status;
|
||||
|
||||
(void)args;
|
||||
rand_sleep_mod(100);
|
||||
status = rsmi_init(0);
|
||||
EXPECT_EQ(RSMI_STATUS_SUCCESS, status);
|
||||
pthread_exit(nullptr);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static void* RSMIShutDownFunction(void* args) {
|
||||
rsmi_status_t status;
|
||||
|
||||
(void)args;
|
||||
rand_sleep_mod(100);
|
||||
status = rsmi_shut_down();
|
||||
EXPECT_EQ(RSMI_STATUS_SUCCESS, status);
|
||||
pthread_exit(nullptr);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static void *RSMIInitShutDownFunction(void* args) {
|
||||
rsmi_status_t status;
|
||||
|
||||
(void)args;
|
||||
rand_sleep_mod(100);
|
||||
status = rsmi_init(0);
|
||||
EXPECT_EQ(RSMI_STATUS_SUCCESS, status);
|
||||
|
||||
rand_sleep_mod(100);
|
||||
|
||||
status = rsmi_shut_down();
|
||||
EXPECT_EQ(RSMI_STATUS_SUCCESS, status);
|
||||
pthread_exit(nullptr);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static const int NumOfThreads = 100;
|
||||
|
||||
TestConcurrentInit::TestConcurrentInit(void) : TestBase() {
|
||||
set_title("RSMI Concurrent Init Test");
|
||||
set_description("This test initializes RSMI concurrently to verify "
|
||||
"reference counting functionality.");
|
||||
}
|
||||
|
||||
TestConcurrentInit::~TestConcurrentInit(void) {
|
||||
}
|
||||
|
||||
void TestConcurrentInit::SetUp(void) {
|
||||
// TestBase::SetUp(); // Skip usual SetUp to avoid doing the usual rsmi_init
|
||||
return;
|
||||
}
|
||||
|
||||
// Compare required profile for this test case with what we're actually
|
||||
// running on
|
||||
void TestConcurrentInit::DisplayTestInfo(void) {
|
||||
IF_VERB(STANDARD) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void TestConcurrentInit::DisplayResults(void) const {
|
||||
IF_VERB(STANDARD) {
|
||||
TestBase::DisplayResults();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void TestConcurrentInit::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// rsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
// Compare required profile for this test case with what we're actually
|
||||
// running on
|
||||
void TestConcurrentInit::Run(void) {
|
||||
if (setup_failed_) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
pthread_t ThreadId[NumOfThreads];
|
||||
pthread_attr_t attr;
|
||||
pthread_attr_init(&attr);
|
||||
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Testing concurrent rsmi_init()..." << std::endl;
|
||||
}
|
||||
for (int Id = 0; Id < NumOfThreads; ++Id) {
|
||||
int ThreadStatus = pthread_create(&ThreadId[Id], &attr,
|
||||
RSMIInitFunction, nullptr);
|
||||
ASSERT_EQ(0, ThreadStatus) << "pthead_create failed.";
|
||||
}
|
||||
|
||||
for (int Id = 0; Id < NumOfThreads; ++Id) {
|
||||
int err = pthread_join(ThreadId[Id], nullptr);
|
||||
ASSERT_EQ(0, err) << "pthread_join failed.";
|
||||
}
|
||||
|
||||
// Invoke hsa_shut_down and verify that all the hsa_init's were counted.
|
||||
// HSA should be exactly closed after NumOfThreads calls.
|
||||
for (int Id = 0; Id < NumOfThreads; ++Id) {
|
||||
rsmi_status_t err = rsmi_shut_down();
|
||||
ASSERT_EQ(RSMI_STATUS_SUCCESS, err) << "An rsmi_init was missed.";
|
||||
}
|
||||
|
||||
rsmi_status_t err = rsmi_shut_down();
|
||||
ASSERT_EQ(RSMI_INITIALIZATION_ERROR, err) <<
|
||||
"rsmi_init reference count was too high.";
|
||||
|
||||
int32_t refcnt = rsmi_test_refcount(0);
|
||||
ASSERT_EQ(0, refcnt);
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Concurrent rsmi_init() test passed." <<
|
||||
std::endl << std::endl;
|
||||
std::cout << "Testing concurrent rsmi_shut_down()..." << std::endl;
|
||||
}
|
||||
// Invoke hsa_shut_down and verify that all the hsa_init's were counted.
|
||||
// HSA should be exactly closed after NumOfThreads calls.
|
||||
for (int Id = 0; Id < NumOfThreads; ++Id) {
|
||||
rsmi_status_t err = rsmi_init(0);
|
||||
ASSERT_EQ(RSMI_STATUS_SUCCESS, err);
|
||||
}
|
||||
|
||||
for (int Id = 0; Id < NumOfThreads; ++Id) {
|
||||
int ThreadStatus =
|
||||
pthread_create(&ThreadId[Id], &attr, RSMIShutDownFunction, nullptr);
|
||||
ASSERT_EQ(0, ThreadStatus) << "pthead_create failed.";
|
||||
}
|
||||
|
||||
for (int Id = 0; Id < NumOfThreads; ++Id) {
|
||||
int err = pthread_join(ThreadId[Id], nullptr);
|
||||
ASSERT_EQ(0, err) << "pthread_join failed.";
|
||||
}
|
||||
|
||||
refcnt = rsmi_test_refcount(0);
|
||||
ASSERT_EQ(0, refcnt);
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Concurrent rsmi_shut_down() passed." << std::endl;
|
||||
std::cout <<
|
||||
"Testing concurrent rsmi_init() followed by rsmi_shut_down()..." <<
|
||||
std::endl;
|
||||
}
|
||||
for (int Id = 0; Id < NumOfThreads; ++Id) {
|
||||
int ThreadStatus =
|
||||
pthread_create(&ThreadId[Id], &attr, RSMIInitShutDownFunction, nullptr);
|
||||
ASSERT_EQ(0, ThreadStatus) << "pthead_create failed.";
|
||||
}
|
||||
|
||||
for (int Id = 0; Id < NumOfThreads; ++Id) {
|
||||
int err = pthread_join(ThreadId[Id], nullptr);
|
||||
ASSERT_EQ(0, err) << "pthread_join failed.";
|
||||
}
|
||||
|
||||
refcnt = rsmi_test_refcount(0);
|
||||
ASSERT_EQ(0, refcnt);
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout <<
|
||||
"Concurrent rsmi_init() followed by rsmi_shut_down() passed." <<
|
||||
std::endl;
|
||||
}
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2020, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TESTS_ROCM_SMI_TEST_FUNCTIONAL_INIT_SHUTDOWN_REFCOUNT_H_
|
||||
#define TESTS_ROCM_SMI_TEST_FUNCTIONAL_INIT_SHUTDOWN_REFCOUNT_H_
|
||||
|
||||
#include "../test_base.h"
|
||||
|
||||
class TestConcurrentInit : public TestBase {
|
||||
public:
|
||||
TestConcurrentInit();
|
||||
|
||||
// @Brief: Destructor for the TestConcurrentInit class
|
||||
virtual ~TestConcurrentInit();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_ROCM_SMI_TEST_FUNCTIONAL_INIT_SHUTDOWN_REFCOUNT_H_
|
||||
@@ -1,169 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
#include "mem_page_info_read.h"
|
||||
#include "../test_common.h"
|
||||
|
||||
TestMemPageInfoRead::TestMemPageInfoRead() : TestBase() {
|
||||
set_title("RSMI Memory Page Info Test");
|
||||
set_description("The Memory Page Info. test verifies that we can read "
|
||||
"memory page information, and then displays the information read");
|
||||
}
|
||||
|
||||
TestMemPageInfoRead::~TestMemPageInfoRead(void) {
|
||||
}
|
||||
|
||||
void TestMemPageInfoRead::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestMemPageInfoRead::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestMemPageInfoRead::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestMemPageInfoRead::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// rsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
void TestMemPageInfoRead::Run(void) {
|
||||
rsmi_status_t err;
|
||||
rsmi_retired_page_record_t *records;
|
||||
uint32_t num_pages;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(i);
|
||||
|
||||
err = rsmi_dev_memory_reserved_pages_get(i, &num_pages, nullptr);
|
||||
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout <<
|
||||
"\t**Memory page information is not supported for this device"
|
||||
<< std::endl;
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_memory_reserved_pages_get(i, nullptr, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_NOT_SUPPORTED);
|
||||
|
||||
continue;
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\tNumber of memory page records: " << num_pages <<
|
||||
std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_memory_reserved_pages_get(i, nullptr, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
}
|
||||
|
||||
if (num_pages > 0) {
|
||||
records = new rsmi_retired_page_record_t[num_pages];
|
||||
|
||||
assert(records != nullptr);
|
||||
|
||||
err = rsmi_dev_memory_reserved_pages_get(i, &num_pages, records);
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout << "\t**Getting Memory Page Retirement Status not "
|
||||
"supported for this device" << std::endl;
|
||||
continue;
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout.setf(std::ios::hex, std::ios::basefield);
|
||||
std::string page_state;
|
||||
|
||||
for (uint32_t p = 0; p < num_pages; ++p) {
|
||||
std::cout << "\t\tAddress: 0x" << records[p].page_address;
|
||||
std::cout << " Size: " << records[p].page_size;
|
||||
|
||||
switch (records[p].status) {
|
||||
case RSMI_MEM_PAGE_STATUS_RESERVED:
|
||||
page_state = "Retired";
|
||||
break;
|
||||
|
||||
case RSMI_MEM_PAGE_STATUS_PENDING:
|
||||
page_state = "Pending";
|
||||
break;
|
||||
|
||||
case RSMI_MEM_PAGE_STATUS_UNRESERVABLE:
|
||||
page_state = "Unreservable";
|
||||
break;
|
||||
|
||||
default:
|
||||
ASSERT_EQ(0, 1) << "Unexpected memory page status";
|
||||
}
|
||||
std::cout << " Status: " << page_state << std::endl;
|
||||
}
|
||||
std::cout.setf(std::ios::dec, std::ios::basefield);
|
||||
}
|
||||
delete []records;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_ROCM_SMI_TEST_FUNCTIONAL_MEM_PAGE_INFO_READ_H_
|
||||
#define TESTS_ROCM_SMI_TEST_FUNCTIONAL_MEM_PAGE_INFO_READ_H_
|
||||
|
||||
#include "../test_base.h"
|
||||
|
||||
class TestMemPageInfoRead : public TestBase {
|
||||
public:
|
||||
TestMemPageInfoRead();
|
||||
|
||||
// @Brief: Destructor for test case of TestMemPageInfoRead
|
||||
virtual ~TestMemPageInfoRead();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_ROCM_SMI_TEST_FUNCTIONAL_MEM_PAGE_INFO_READ_H_
|
||||
@@ -1,158 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
#include "mem_util_read.h"
|
||||
#include "../test_common.h"
|
||||
|
||||
TestMemUtilRead::TestMemUtilRead() : TestBase() {
|
||||
set_title("Memory Utilization Read Test");
|
||||
set_description("The Memory Utilization Read tests verifies that "
|
||||
"memory busy percent, size and amount used can be read properly.");
|
||||
}
|
||||
|
||||
TestMemUtilRead::~TestMemUtilRead(void) {
|
||||
}
|
||||
|
||||
void TestMemUtilRead::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestMemUtilRead::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestMemUtilRead::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestMemUtilRead::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// rsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
static const std::map<rsmi_memory_type_t, const char *>
|
||||
kDevMemoryTypeNameMap = {
|
||||
{RSMI_MEM_TYPE_VRAM, "VRAM memory"},
|
||||
{RSMI_MEM_TYPE_VIS_VRAM, "Visible VRAM memory"},
|
||||
{RSMI_MEM_TYPE_GTT, "GTT memory"},
|
||||
};
|
||||
|
||||
void TestMemUtilRead::Run(void) {
|
||||
rsmi_status_t err;
|
||||
uint64_t total;
|
||||
uint64_t usage;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
auto err_chk = [&](const char *str) {
|
||||
if (err != RSMI_STATUS_SUCCESS) {
|
||||
if (err == RSMI_STATUS_FILE_ERROR) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t** " << str << ": Not supported on this machine"
|
||||
<< std::endl;
|
||||
}
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
for (uint32_t x = 0; x < num_iterations(); ++x) {
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(i);
|
||||
|
||||
#if 0
|
||||
err = rsmi_dev_memory_busy_percent_get(i, &mem_busy_percent);
|
||||
err_chk("rsmi_dev_memory_busy_percent_get()");
|
||||
if (err != RSMI_STATUS_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**" << "GPU Memory Busy %: " << mem_busy_percent <<
|
||||
std::endl;
|
||||
}
|
||||
#endif
|
||||
for (uint32_t mem_type = RSMI_MEM_TYPE_FIRST;
|
||||
mem_type <= RSMI_MEM_TYPE_LAST; ++mem_type) {
|
||||
err = rsmi_dev_memory_total_get(i,
|
||||
static_cast<rsmi_memory_type_t>(mem_type), &total);
|
||||
err_chk("rsmi_dev_memory_total_get()");
|
||||
if (err != RSMI_STATUS_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
|
||||
err = rsmi_dev_memory_usage_get(i,
|
||||
static_cast<rsmi_memory_type_t>(mem_type), &usage);
|
||||
err_chk("rsmi_dev_memory_usage_get()");
|
||||
if (err != RSMI_STATUS_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**" <<
|
||||
kDevMemoryTypeNameMap.at(static_cast<rsmi_memory_type_t>(mem_type))
|
||||
<< " Calculated Utilization: " <<
|
||||
(static_cast<float>(usage)*100)/total << "% ("<< usage <<
|
||||
"/" << total << ")" << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_ROCM_SMI_TEST_FUNCTIONAL_MEM_UTIL_READ_H_
|
||||
#define TESTS_ROCM_SMI_TEST_FUNCTIONAL_MEM_UTIL_READ_H_
|
||||
|
||||
#include "../test_base.h"
|
||||
|
||||
class TestMemUtilRead : public TestBase {
|
||||
public:
|
||||
TestMemUtilRead();
|
||||
|
||||
// @Brief: Destructor for test case of TestMemUtilRead
|
||||
virtual ~TestMemUtilRead();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_ROCM_SMI_TEST_FUNCTIONAL_MEM_UTIL_READ_H_
|
||||
@@ -1,165 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2021, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
#include "metrics_counter_read.h"
|
||||
#include "../test_common.h"
|
||||
|
||||
|
||||
TestMetricsCounterRead::TestMetricsCounterRead() : TestBase() {
|
||||
set_title("RSMI GPU Metrics Counter Read Test");
|
||||
set_description("The GPU Metrics Counter tests verifies that "
|
||||
"the gpu metrics counter info can be read properly.");
|
||||
}
|
||||
|
||||
TestMetricsCounterRead::~TestMetricsCounterRead(void) {
|
||||
}
|
||||
|
||||
void TestMetricsCounterRead::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestMetricsCounterRead::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestMetricsCounterRead::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestMetricsCounterRead::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// rsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
|
||||
void TestMetricsCounterRead::Run(void) {
|
||||
rsmi_status_t err;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(i);
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**GPU METRICS ENERGY COUNTER:\n";
|
||||
}
|
||||
|
||||
uint64_t power;
|
||||
uint64_t timestamp;
|
||||
float counter_resolution;
|
||||
err = rsmi_dev_energy_count_get(i, &power, &counter_resolution, ×tamp);
|
||||
if (err != RSMI_STATUS_SUCCESS) {
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**" <<
|
||||
"Not supported on this machine" << std::endl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
CHK_ERR_ASRT(err);
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << std::dec << "power counter="
|
||||
<< power << '\n';
|
||||
std::cout << "power in uJ="
|
||||
<< (double)(power * counter_resolution) << '\n';
|
||||
std::cout << std::dec << "timestamp="
|
||||
<< timestamp << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_energy_count_get(i, nullptr, nullptr, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
|
||||
// Coarse Grain counters
|
||||
rsmi_utilization_counter_t utilization_counters[2];
|
||||
utilization_counters[0].type = RSMI_COARSE_GRAIN_GFX_ACTIVITY;
|
||||
utilization_counters[1].type = RSMI_COARSE_GRAIN_MEM_ACTIVITY;
|
||||
err = rsmi_utilization_count_get(i, utilization_counters,
|
||||
2, ×tamp);
|
||||
if (err != RSMI_STATUS_SUCCESS) {
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**" <<
|
||||
"Not supported on this machine" << std::endl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
CHK_ERR_ASRT(err);
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << std::dec << "gfx_activity="
|
||||
<< utilization_counters[0].value << '\n';
|
||||
std::cout << std::dec << "mem_activity="
|
||||
<< utilization_counters[1].value << '\n';
|
||||
std::cout << std::dec << "timestamp="
|
||||
<< timestamp << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_utilization_count_get(i, nullptr,
|
||||
1 , nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
} // end for
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2021, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_ROCM_SMI_TEST_FUNCTIONAL_METRICS_COUNTER_READ_H_
|
||||
#define TESTS_ROCM_SMI_TEST_FUNCTIONAL_METRICS_COUNTER_READ_H_
|
||||
|
||||
#include "../test_base.h"
|
||||
|
||||
class TestMetricsCounterRead : public TestBase {
|
||||
public:
|
||||
TestMetricsCounterRead();
|
||||
|
||||
// @Brief: Destructor for test case of TestVOltRead
|
||||
virtual ~TestMetricsCounterRead();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_ROCM_SMI_TEST_FUNCTIONAL_METRICS_COUNTER_READ_H_
|
||||
@@ -1,324 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2020, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
#include "mutual_exclusion.h"
|
||||
#include "../test_common.h"
|
||||
|
||||
|
||||
TestMutualExclusion::TestMutualExclusion() : TestBase() {
|
||||
set_title("Mutual Exclusion Test");
|
||||
set_description("Verify that RSMI only allows 1 process at a time"
|
||||
" to access RSMI resources (primarily sysfs files). This test has one "
|
||||
"process that obtains the mutex that ensures only 1 process accesses a "
|
||||
"device's sysfs files at a time, and another process that attempts "
|
||||
"to access the device's sysfs files. The second process should fail "
|
||||
"in these attempts.");
|
||||
}
|
||||
|
||||
TestMutualExclusion::~TestMutualExclusion(void) {
|
||||
}
|
||||
|
||||
extern rsmi_status_t rsmi_test_sleep(uint32_t dv_ind, uint32_t seconds);
|
||||
|
||||
void TestMutualExclusion::SetUp(void) {
|
||||
std::string label;
|
||||
rsmi_status_t ret;
|
||||
|
||||
// TestBase::SetUp(RSMI_INIT_FLAG_RESRV_TEST1);
|
||||
IF_VERB(STANDARD) {
|
||||
MakeHeaderStr(kSetupLabel, &label);
|
||||
printf("\n\t%s\n", label.c_str());
|
||||
}
|
||||
|
||||
sleeper_process_ = false;
|
||||
child_ = 0;
|
||||
child_ = fork();
|
||||
|
||||
if (child_ != 0) {
|
||||
sleeper_process_ = true; // sleeper_process is parent
|
||||
|
||||
// RSMI_INIT_FLAG_RESRV_TEST1 tells rsmi to fail immediately
|
||||
// if it can't get the mutex instead of waiting.
|
||||
ret = rsmi_init(RSMI_INIT_FLAG_RESRV_TEST1);
|
||||
if (ret != RSMI_STATUS_SUCCESS) {
|
||||
setup_failed_ = true;
|
||||
}
|
||||
ASSERT_EQ(ret, RSMI_STATUS_SUCCESS);
|
||||
|
||||
sleep(2); // Let both processes get through rsmi_init
|
||||
} else {
|
||||
sleep(1); // Let the sleeper process get through rsmi_init() before
|
||||
// this one goes, so it doesn't fail.
|
||||
ret = rsmi_init(RSMI_INIT_FLAG_RESRV_TEST1);
|
||||
if (ret != RSMI_STATUS_SUCCESS) {
|
||||
setup_failed_ = true;
|
||||
}
|
||||
ASSERT_EQ(ret, RSMI_STATUS_SUCCESS);
|
||||
|
||||
sleep(2); // Let both processes get through rsmi_init;
|
||||
}
|
||||
|
||||
ret = rsmi_num_monitor_devices(&num_monitor_devs_);
|
||||
if (ret != RSMI_STATUS_SUCCESS) {
|
||||
setup_failed_ = true;
|
||||
}
|
||||
ASSERT_EQ(ret, RSMI_STATUS_SUCCESS);
|
||||
|
||||
if (num_monitor_devs_ == 0) {
|
||||
std::cout << "No monitor devices found on this machine." << std::endl;
|
||||
std::cout << "No ROCm SMI tests can be run." << std::endl;
|
||||
setup_failed_ = true;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestMutualExclusion::DisplayTestInfo(void) {
|
||||
IF_VERB(STANDARD) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
}
|
||||
|
||||
void TestMutualExclusion::DisplayResults(void) const {
|
||||
IF_VERB(STANDARD) {
|
||||
TestBase::DisplayResults();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void TestMutualExclusion::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// rsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
extern rsmi_status_t
|
||||
rsmi_test_sleep(uint32_t dv_ind, uint32_t seconds);
|
||||
|
||||
void TestMutualExclusion::Run(void) {
|
||||
rsmi_status_t ret;
|
||||
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (sleeper_process_) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "MUTEX_HOLDER process: started sleeping for 10 seconds..." <<
|
||||
std::endl;
|
||||
}
|
||||
ret = rsmi_test_sleep(0, 10);
|
||||
ASSERT_EQ(ret, RSMI_STATUS_SUCCESS);
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "MUTEX_HOLDER process: Sleep process woke up." << std::endl;
|
||||
}
|
||||
pid_t cpid = wait(nullptr);
|
||||
ASSERT_EQ(cpid, child_);
|
||||
} else {
|
||||
// Both processes should have completed rsmi_init().
|
||||
// let the other process get started on rsmi_test_sleep().
|
||||
sleep(2);
|
||||
TestBase::Run();
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "TESTER process: verifing that all rsmi_dev_* functions "
|
||||
"return RSMI_STATUS_BUSY because MUTEX_HOLDER process "
|
||||
"holds the mutex" << std::endl;
|
||||
}
|
||||
// Try all the device related rsmi calls. They should all fail with
|
||||
// RSMI_STATUS_BUSY
|
||||
// Set dummy values should to working, deterministic values.
|
||||
uint16_t dmy_ui16 = 0;
|
||||
uint32_t dmy_ui32 = 1;
|
||||
int32_t dmy_i32 = 0;
|
||||
uint64_t dmy_ui64 = 0;
|
||||
int64_t dmy_i64 = 0;
|
||||
char dmy_str[10];
|
||||
rsmi_dev_perf_level_t dmy_perf_lvl;
|
||||
rsmi_frequencies_t dmy_freqs;
|
||||
rsmi_od_volt_freq_data_t dmy_od_volt;
|
||||
rsmi_freq_volt_region_t dmy_vlt_reg;
|
||||
rsmi_error_count_t dmy_err_cnt;
|
||||
rsmi_ras_err_state_t dmy_ras_err_st;
|
||||
|
||||
// This can be replaced with ASSERT_EQ() once env. stabilizes
|
||||
#define CHECK_RET(A, B) { \
|
||||
if ((A) != (B)) { \
|
||||
std::cout << "Expected return value of " << B << \
|
||||
" but got " << A << std::endl; \
|
||||
std::cout << "at " << __FILE__ << ":" << __LINE__ << std::endl; \
|
||||
} \
|
||||
}
|
||||
ret = rsmi_dev_id_get(0, &dmy_ui16);
|
||||
CHECK_RET(ret, RSMI_STATUS_BUSY);
|
||||
ret = rsmi_dev_vendor_id_get(0, &dmy_ui16);
|
||||
CHECK_RET(ret, RSMI_STATUS_BUSY);
|
||||
ret = rsmi_dev_name_get(0, dmy_str, 10);
|
||||
CHECK_RET(ret, RSMI_STATUS_BUSY);
|
||||
ret = rsmi_dev_brand_get(0, dmy_str, 10);
|
||||
CHECK_RET(ret, RSMI_STATUS_BUSY);
|
||||
ret = rsmi_dev_vendor_name_get(0, dmy_str, 10);
|
||||
CHECK_RET(ret, RSMI_STATUS_BUSY);
|
||||
ret = rsmi_dev_vram_vendor_get(0, dmy_str, 10);
|
||||
CHECK_RET(ret, RSMI_STATUS_BUSY);
|
||||
ret = rsmi_dev_serial_number_get(0, dmy_str, 10);
|
||||
CHECK_RET(ret, RSMI_STATUS_BUSY);
|
||||
ret = rsmi_dev_subsystem_id_get(0, &dmy_ui16);
|
||||
CHECK_RET(ret, RSMI_STATUS_BUSY);
|
||||
ret = rsmi_dev_subsystem_vendor_id_get(0, &dmy_ui16);
|
||||
CHECK_RET(ret, RSMI_STATUS_BUSY);
|
||||
ret = rsmi_dev_unique_id_get(0, &dmy_ui64);
|
||||
CHECK_RET(ret, RSMI_STATUS_BUSY);
|
||||
ret = rsmi_dev_pci_id_get(0, &dmy_ui64);
|
||||
CHECK_RET(ret, RSMI_STATUS_BUSY);
|
||||
ret = rsmi_dev_pci_throughput_get(0, &dmy_ui64, &dmy_ui64, &dmy_ui64);
|
||||
CHECK_RET(ret, RSMI_STATUS_BUSY);
|
||||
ret = rsmi_dev_pci_replay_counter_get(0, &dmy_ui64);
|
||||
CHECK_RET(ret, RSMI_STATUS_BUSY);
|
||||
ret = rsmi_dev_pci_bandwidth_set(0, 0);
|
||||
CHECK_RET(ret, RSMI_STATUS_BUSY);
|
||||
ret = rsmi_dev_fan_rpms_get(0, dmy_ui32, &dmy_i64);
|
||||
CHECK_RET(ret, RSMI_STATUS_BUSY);
|
||||
ret = rsmi_dev_fan_speed_get(0, 0, &dmy_i64);
|
||||
CHECK_RET(ret, RSMI_STATUS_BUSY);
|
||||
ret = rsmi_dev_fan_speed_max_get(0, 0, &dmy_ui64);
|
||||
CHECK_RET(ret, RSMI_STATUS_BUSY);
|
||||
ret = rsmi_dev_temp_metric_get(0, dmy_ui32, RSMI_TEMP_CURRENT, &dmy_i64);
|
||||
CHECK_RET(ret, RSMI_STATUS_BUSY);
|
||||
ret = rsmi_dev_fan_reset(0, 0);
|
||||
CHECK_RET(ret, RSMI_STATUS_BUSY);
|
||||
ret = rsmi_dev_fan_speed_set(0, dmy_ui32, 0);
|
||||
CHECK_RET(ret, RSMI_STATUS_BUSY);
|
||||
ret = rsmi_dev_perf_level_get(0, &dmy_perf_lvl);
|
||||
CHECK_RET(ret, RSMI_STATUS_BUSY);
|
||||
ret = rsmi_dev_overdrive_level_get(0, &dmy_ui32);
|
||||
CHECK_RET(ret, RSMI_STATUS_BUSY);
|
||||
ret = rsmi_dev_gpu_clk_freq_get(0, RSMI_CLK_TYPE_SYS, &dmy_freqs);
|
||||
CHECK_RET(ret, RSMI_STATUS_BUSY);
|
||||
ret = rsmi_dev_od_volt_info_get(0, &dmy_od_volt);
|
||||
CHECK_RET(ret, RSMI_STATUS_BUSY);
|
||||
ret = rsmi_dev_od_volt_curve_regions_get(0, &dmy_ui32, &dmy_vlt_reg);
|
||||
CHECK_RET(ret, RSMI_STATUS_BUSY);
|
||||
ret = rsmi_dev_overdrive_level_set_v1(dmy_i32, 0);
|
||||
CHECK_RET(ret, RSMI_STATUS_BUSY);
|
||||
ret = rsmi_dev_gpu_clk_freq_set(0, RSMI_CLK_TYPE_SYS, 0);
|
||||
CHECK_RET(ret, RSMI_STATUS_BUSY);
|
||||
ret = rsmi_dev_ecc_count_get(0, RSMI_GPU_BLOCK_UMC, &dmy_err_cnt);
|
||||
CHECK_RET(ret, RSMI_STATUS_BUSY);
|
||||
ret = rsmi_dev_ecc_enabled_get(0, &dmy_ui64);
|
||||
CHECK_RET(ret, RSMI_STATUS_BUSY);
|
||||
ret = rsmi_dev_ecc_status_get(0, RSMI_GPU_BLOCK_UMC, &dmy_ras_err_st);
|
||||
CHECK_RET(ret, RSMI_STATUS_BUSY);
|
||||
|
||||
/* Other functions holding device mutexes. Listed for reference.
|
||||
rsmi_dev_sku_get
|
||||
rsmi_dev_perf_level_set_v1
|
||||
rsmi_dev_od_clk_info_set
|
||||
rsmi_dev_od_volt_info_set
|
||||
rsmi_dev_firmware_version_get
|
||||
rsmi_dev_firmware_version_get
|
||||
rsmi_dev_name_get
|
||||
rsmi_dev_brand_get
|
||||
rsmi_dev_vram_vendor_get
|
||||
rsmi_dev_subsystem_name_get
|
||||
rsmi_dev_drm_render_minor_get
|
||||
rsmi_dev_vendor_name_get
|
||||
rsmi_dev_pci_bandwidth_get
|
||||
rsmi_dev_pci_bandwidth_set
|
||||
rsmi_dev_pci_throughput_get
|
||||
rsmi_dev_temp_metric_get
|
||||
rsmi_dev_volt_metric_get
|
||||
rsmi_dev_fan_speed_get
|
||||
rsmi_dev_fan_rpms_get
|
||||
rsmi_dev_fan_reset
|
||||
rsmi_dev_fan_speed_set
|
||||
rsmi_dev_fan_speed_max_get
|
||||
rsmi_dev_od_volt_info_get
|
||||
rsmi_dev_gpu_metrics_info_get
|
||||
rsmi_dev_od_volt_curve_regions_get
|
||||
rsmi_dev_power_max_get
|
||||
rsmi_dev_power_ave_get
|
||||
rsmi_dev_power_cap_get
|
||||
rsmi_dev_power_cap_range_get
|
||||
rsmi_dev_power_cap_set
|
||||
rsmi_dev_power_profile_presets_get
|
||||
rsmi_dev_power_profile_set
|
||||
rsmi_dev_memory_total_get
|
||||
rsmi_dev_memory_usage_get
|
||||
rsmi_dev_memory_busy_percent_get
|
||||
rsmi_dev_busy_percent_get
|
||||
rsmi_dev_vbios_version_get
|
||||
rsmi_dev_serial_number_get
|
||||
rsmi_dev_pci_replay_counter_get
|
||||
rsmi_dev_unique_id_get
|
||||
rsmi_dev_counter_create
|
||||
rsmi_counter_available_counters_get
|
||||
rsmi_dev_counter_group_supported
|
||||
rsmi_dev_memory_reserved_pages_get
|
||||
rsmi_dev_xgmi_error_status
|
||||
rsmi_dev_xgmi_error_reset
|
||||
rsmi_dev_xgmi_hive_id_get
|
||||
rsmi_topo_get_link_weight
|
||||
rsmi_event_notification_mask_set
|
||||
rsmi_event_notification_init
|
||||
rsmi_event_notification_stop
|
||||
*/
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "TESTER process: Finished verifying that all "
|
||||
"rsmi_dev_* functions returned RSMI_STATUS_BUSY" << std::endl;
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2020, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_ROCM_SMI_TEST_FUNCTIONAL_MUTUAL_EXCLUSION_H_
|
||||
#define TESTS_ROCM_SMI_TEST_FUNCTIONAL_MUTUAL_EXCLUSION_H_
|
||||
|
||||
#include "../test_base.h"
|
||||
|
||||
class TestMutualExclusion : public TestBase {
|
||||
public:
|
||||
TestMutualExclusion();
|
||||
|
||||
// @Brief: Destructor for test case of TestMutualExclusion
|
||||
virtual ~TestMutualExclusion();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
|
||||
private:
|
||||
bool sleeper_process_;
|
||||
int child_;
|
||||
};
|
||||
|
||||
#endif // TESTS_ROCM_SMI_TEST_FUNCTIONAL_MUTUAL_EXCLUSION_H_
|
||||
@@ -1,110 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
#include "overdrive_read.h"
|
||||
#include "../test_common.h"
|
||||
|
||||
TestOverdriveRead::TestOverdriveRead() : TestBase() {
|
||||
set_title("RSMI Overdrive Read Test");
|
||||
set_description("The Overdrive Read tests verifies that the "
|
||||
"current overdrive level can be read properly.");
|
||||
}
|
||||
|
||||
TestOverdriveRead::~TestOverdriveRead(void) {
|
||||
}
|
||||
|
||||
void TestOverdriveRead::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestOverdriveRead::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestOverdriveRead::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestOverdriveRead::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// rsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
|
||||
void TestOverdriveRead::Run(void) {
|
||||
rsmi_status_t err;
|
||||
uint32_t val_ui32;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(i);
|
||||
|
||||
err = rsmi_dev_overdrive_level_get(i, &val_ui32);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**OverDrive Level:" << val_ui32 << std::endl;
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_overdrive_level_get(i, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_ROCM_SMI_TEST_FUNCTIONAL_OVERDRIVE_READ_H_
|
||||
#define TESTS_ROCM_SMI_TEST_FUNCTIONAL_OVERDRIVE_READ_H_
|
||||
|
||||
#include "../test_base.h"
|
||||
|
||||
class TestOverdriveRead : public TestBase {
|
||||
public:
|
||||
TestOverdriveRead();
|
||||
|
||||
// @Brief: Destructor for test case of TestOverdriveRead
|
||||
virtual ~TestOverdriveRead();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_ROCM_SMI_TEST_FUNCTIONAL_OVERDRIVE_READ_H_
|
||||
@@ -1,124 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
#include "overdrive_read_write.h"
|
||||
#include "../test_common.h"
|
||||
|
||||
TestOverdriveReadWrite::TestOverdriveReadWrite() : TestBase() {
|
||||
set_title("RSMI Overdrive Read/Write Test");
|
||||
set_description("The Fan Read tests verifies that the overdrive settings "
|
||||
"can be read and controlled properly.");
|
||||
}
|
||||
|
||||
TestOverdriveReadWrite::~TestOverdriveReadWrite(void) {
|
||||
}
|
||||
|
||||
void TestOverdriveReadWrite::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestOverdriveReadWrite::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestOverdriveReadWrite::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestOverdriveReadWrite::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// rsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
|
||||
void TestOverdriveReadWrite::Run(void) {
|
||||
rsmi_status_t ret;
|
||||
uint32_t val;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) {
|
||||
PrintDeviceHeader(dv_ind);
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Set Overdrive level to 0%..." << std::endl;
|
||||
}
|
||||
ret = rsmi_dev_overdrive_level_set(dv_ind, 0);
|
||||
CHK_ERR_ASRT(ret)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Set Overdrive level to 10%..." << std::endl;
|
||||
}
|
||||
ret = rsmi_dev_overdrive_level_set(dv_ind, 10);
|
||||
CHK_ERR_ASRT(ret)
|
||||
ret = rsmi_dev_overdrive_level_get(dv_ind, &val);
|
||||
CHK_ERR_ASRT(ret)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**New OverDrive Level:" << val << std::endl;
|
||||
std::cout << "Reset Overdrive level to 0%..." << std::endl;
|
||||
}
|
||||
ret = rsmi_dev_overdrive_level_set(dv_ind, 0);
|
||||
CHK_ERR_ASRT(ret)
|
||||
ret = rsmi_dev_overdrive_level_get(dv_ind, &val);
|
||||
CHK_ERR_ASRT(ret)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**New OverDrive Level:" << val << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_ROCM_SMI_TEST_FUNCTIONAL_OVERDRIVE_READ_WRITE_H_
|
||||
#define TESTS_ROCM_SMI_TEST_FUNCTIONAL_OVERDRIVE_READ_WRITE_H_
|
||||
|
||||
#include "../test_base.h"
|
||||
|
||||
class TestOverdriveReadWrite : public TestBase {
|
||||
public:
|
||||
TestOverdriveReadWrite();
|
||||
|
||||
// @Brief: Destructor for test case of TestOverdriveReadWrite
|
||||
virtual ~TestOverdriveReadWrite();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_ROCM_SMI_TEST_FUNCTIONAL_OVERDRIVE_READ_WRITE_H_
|
||||
@@ -1,199 +0,0 @@
|
||||
/*
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <bitset>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
#include "pci_read_write.h"
|
||||
#include "../test_common.h"
|
||||
|
||||
|
||||
TestPciReadWrite::TestPciReadWrite() : TestBase() {
|
||||
set_title("RSMI PCIe Bandwidth Read/Write Test");
|
||||
set_description("The PCIe Bandwidth tests verify that the PCIe bandwidth "
|
||||
"settings can be read and controlled properly.");
|
||||
}
|
||||
|
||||
TestPciReadWrite::~TestPciReadWrite(void) {
|
||||
}
|
||||
|
||||
void TestPciReadWrite::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestPciReadWrite::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestPciReadWrite::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestPciReadWrite::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// rsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
|
||||
void TestPciReadWrite::Run(void) {
|
||||
rsmi_status_t ret;
|
||||
rsmi_pcie_bandwidth_t bw;
|
||||
uint32_t freq_bitmask;
|
||||
uint64_t sent, received, max_pkt_sz, u64int;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) {
|
||||
PrintDeviceHeader(dv_ind);
|
||||
|
||||
ret = rsmi_dev_pci_replay_counter_get(dv_ind, &u64int);
|
||||
|
||||
if (ret == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout <<
|
||||
"\t**rsmi_dev_pci_replay_counter_get() is not supported"
|
||||
" on this machine" << std::endl;
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
ret = rsmi_dev_pci_replay_counter_get(dv_ind, nullptr);
|
||||
ASSERT_EQ(ret, RSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
CHK_ERR_ASRT(ret)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\tPCIe Replay Counter: " << u64int << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
ret = rsmi_dev_pci_replay_counter_get(dv_ind, nullptr);
|
||||
ASSERT_EQ(ret, RSMI_STATUS_INVALID_ARGS);
|
||||
}
|
||||
|
||||
ret = rsmi_dev_pci_throughput_get(dv_ind, &sent, &received, &max_pkt_sz);
|
||||
if (ret == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout << "TEST FAILURE: Current PCIe throughput is not detected. "
|
||||
"This is likely because it is not indicated in the pcie_bw sysfs "
|
||||
"file. Aborting test." << std::endl;
|
||||
|
||||
// We don't need to verify api support checking functionality is working
|
||||
// as the user may choose to have any of the input parameters as 0.
|
||||
return;
|
||||
}
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\tPCIe Throughput (1 sec.): " << std::endl;
|
||||
std::cout << "\t\tSent: " << sent << " bytes" << std::endl;
|
||||
std::cout << "\t\tReceived: " << received << " bytes" << std::endl;
|
||||
std::cout << "\t\tMax Packet Size: " << max_pkt_sz << " bytes" <<
|
||||
std::endl;
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
ret = rsmi_dev_pci_bandwidth_get(dv_ind, &bw);
|
||||
|
||||
if (ret == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout << "TEST FAILURE: Current PCIe bandwidth is not detected. "
|
||||
"This is likely because it is not indicated in the pp_dpm_pcie sysfs "
|
||||
"file. Aborting test." << std::endl;
|
||||
// Verify api support checking functionality is working
|
||||
ret = rsmi_dev_pci_bandwidth_get(dv_ind, nullptr);
|
||||
ASSERT_EQ(ret, RSMI_STATUS_NOT_SUPPORTED);
|
||||
|
||||
return;
|
||||
}
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\tInitial PCIe BW index is " << bw.transfer_rate.current <<
|
||||
std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
ret = rsmi_dev_pci_bandwidth_get(dv_ind, nullptr);
|
||||
ASSERT_EQ(ret, RSMI_STATUS_INVALID_ARGS);
|
||||
|
||||
// First set the bitmask to all supported bandwidths
|
||||
freq_bitmask = ~(~0u << bw.transfer_rate.num_supported);
|
||||
|
||||
// Then, set the bitmask to all bandwidths besides the initial BW
|
||||
freq_bitmask ^= (1 << bw.transfer_rate.current);
|
||||
|
||||
std::string freq_bm_str =
|
||||
std::bitset<RSMI_MAX_NUM_FREQUENCIES>(freq_bitmask).to_string();
|
||||
|
||||
freq_bm_str.erase(0, std::min(freq_bm_str.find_first_not_of('0'),
|
||||
freq_bm_str.size()-1));
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\tSetting bandwidth mask to " << "0b" << freq_bm_str <<
|
||||
" ..." << std::endl;
|
||||
}
|
||||
ret = rsmi_dev_pci_bandwidth_set(dv_ind, freq_bitmask);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
ret = rsmi_dev_pci_bandwidth_get(dv_ind, &bw);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\tBandwidth is now index " << bw.transfer_rate.current <<
|
||||
std::endl;
|
||||
std::cout << "\tResetting mask to all bandwidths." << std::endl;
|
||||
}
|
||||
ret = rsmi_dev_pci_bandwidth_set(dv_ind, 0xFFFFFFFF);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
ret = rsmi_dev_perf_level_set(dv_ind, RSMI_DEV_PERF_LEVEL_AUTO);
|
||||
CHK_ERR_ASRT(ret)
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_ROCM_SMI_TEST_FUNCTIONAL_PCI_READ_WRITE_H_
|
||||
#define TESTS_ROCM_SMI_TEST_FUNCTIONAL_PCI_READ_WRITE_H_
|
||||
|
||||
#include "../test_base.h"
|
||||
|
||||
class TestPciReadWrite : public TestBase {
|
||||
public:
|
||||
TestPciReadWrite();
|
||||
|
||||
// @Brief: Destructor for test case of TestPciReadWrite
|
||||
virtual ~TestPciReadWrite();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_ROCM_SMI_TEST_FUNCTIONAL_PCI_READ_WRITE_H_
|
||||
@@ -1,374 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <bitset>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
#include "perf_cntr_read_write.h"
|
||||
#include "../test_common.h"
|
||||
|
||||
PerfCntrEvtGrp::PerfCntrEvtGrp(rsmi_event_group_t grp, uint32_t first,
|
||||
uint32_t last, std::string name) : grp_(grp), first_evt_(first),
|
||||
last_evt_(last), name_(name) {
|
||||
num_events_ = last_evt_ - first_evt_ + 1;
|
||||
}
|
||||
|
||||
PerfCntrEvtGrp::~PerfCntrEvtGrp() {}
|
||||
|
||||
// Add new event groups to test here
|
||||
#define PC_EVT_GRP(SHRT, NAME) \
|
||||
PerfCntrEvtGrp(RSMI_EVNT_GRP_##SHRT, RSMI_EVNT_##SHRT##_FIRST, \
|
||||
RSMI_EVNT_##SHRT##_LAST, NAME)
|
||||
static const std::vector<PerfCntrEvtGrp> s_event_groups = {
|
||||
PC_EVT_GRP(XGMI, "XGMI"),
|
||||
PC_EVT_GRP(XGMI_DATA_OUT, "XGMI_DATA_OUT")
|
||||
};
|
||||
|
||||
TestPerfCntrReadWrite::TestPerfCntrReadWrite() : TestBase() {
|
||||
set_title("RSMI Performance Counter Read/Write Test");
|
||||
set_description("The Performance counter tests verify that performance"
|
||||
" counters can be controlled and read properly.");
|
||||
}
|
||||
|
||||
TestPerfCntrReadWrite::~TestPerfCntrReadWrite(void) {
|
||||
}
|
||||
|
||||
void TestPerfCntrReadWrite::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestPerfCntrReadWrite::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestPerfCntrReadWrite::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestPerfCntrReadWrite::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// rsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
#define RSMI_EVNT_ENUM_FIRST(GRP_NAME) RSMI_EVNT_##GRP_NAME##_FIRST
|
||||
#define RSMI_EVNT_ENUM_LAST(GRP_NAME) RSMI_EVNT_##GRP_NAME##_LAST
|
||||
|
||||
// Refactor this to handle different event groups once we have > 1 event group
|
||||
|
||||
void TestPerfCntrReadWrite::CountEvents(uint32_t dv_ind,
|
||||
rsmi_event_type_t evnt, rsmi_counter_value_t *val, int32_t sleep_sec) {
|
||||
rsmi_event_handle_t evt_handle;
|
||||
rsmi_status_t ret;
|
||||
|
||||
ret = rsmi_dev_counter_create(dv_ind,
|
||||
static_cast<rsmi_event_type_t>(evnt), &evt_handle);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
// Note that rsmi_dev_counter_create() should never return
|
||||
// RSMI_STATUS_NOT_SUPPORTED. It will return RSMI_STATUS_OUT_OF_RESOURCES
|
||||
// if it is unable to create a counter.
|
||||
ret = rsmi_dev_counter_create(dv_ind,
|
||||
static_cast<rsmi_event_type_t>(evnt), nullptr);
|
||||
ASSERT_EQ(ret, RSMI_STATUS_INVALID_ARGS);
|
||||
|
||||
ret = rsmi_counter_control(evt_handle, RSMI_CNTR_CMD_START, nullptr);
|
||||
if (ret == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout << "rsmi_counter_control() returned "
|
||||
"RSMI_STATUS_NOT_SUPPORTED" << std::endl;
|
||||
throw RSMI_STATUS_NOT_SUPPORTED;
|
||||
} else {
|
||||
CHK_ERR_ASRT(ret)
|
||||
}
|
||||
sleep(sleep_sec);
|
||||
|
||||
ret = rsmi_counter_read(evt_handle, val);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t\t\tValue: " << val->value << std::endl;
|
||||
std::cout << "\t\t\tTime Enabled (nS): " << val->time_enabled << std::endl;
|
||||
std::cout << "\t\t\tTime Running (nS): " << val->time_running << std::endl;
|
||||
std::cout << "\t\t\tEvents/Second Running: " <<
|
||||
val->value/static_cast<float>(val->time_running) << std::endl;
|
||||
}
|
||||
ret = rsmi_dev_counter_destroy(evt_handle);
|
||||
CHK_ERR_ASRT(ret)
|
||||
}
|
||||
|
||||
static const uint64_t kGigByte = 1073741824; // 1024^3
|
||||
static const uint64_t kGig = 1000000000;
|
||||
|
||||
static const uint64_t kVg20Level1Bandwidth = 23; // 23 GB/sec
|
||||
|
||||
|
||||
void
|
||||
TestPerfCntrReadWrite::testEventsIndividually(uint32_t dv_ind) {
|
||||
rsmi_status_t ret;
|
||||
rsmi_counter_value_t val;
|
||||
uint64_t throughput;
|
||||
|
||||
std::cout << "Test events sequentially (device " <<
|
||||
dv_ind << ")" << std::endl;
|
||||
|
||||
auto utiliz = [&](rsmi_event_type_t evt, uint32_t chan) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "****************************" << std::endl;
|
||||
std::cout << "Test XGMI Link Utilization (channel " <<
|
||||
chan << ")" << std::endl;
|
||||
std::cout << "****************************" << std::endl;
|
||||
std::cout << "Assumed Level 1 Bandwidth: " <<
|
||||
kVg20Level1Bandwidth << "GB/sec" << std::endl;
|
||||
}
|
||||
uint32_t tmp_verbosity = verbosity();
|
||||
set_verbosity(0);
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
std::cout << "\t\tPass " << i << ":" << std::endl;
|
||||
|
||||
CountEvents(dv_ind, evt, &val, 1);
|
||||
double coll_time_sec = static_cast<double>(val.time_running)/kGig;
|
||||
throughput = (val.value * 32)/coll_time_sec;
|
||||
std::cout << "\t\t\tCollected events for " << coll_time_sec <<
|
||||
" seconds" << std::endl;
|
||||
std::cout << "\t\t\tEvents collected: " << val.value << std::endl;
|
||||
std::cout << "\t\t\tXGMI throughput: " << throughput <<
|
||||
" bytes/second" << std::endl;
|
||||
std::cout << "\t\t\tXGMI Channel Utilization: " <<
|
||||
100*throughput/static_cast<double>(kVg20Level1Bandwidth*kGigByte) <<
|
||||
"%" << std::endl;
|
||||
std::cout << "\t\t\t****" << std::endl;
|
||||
}
|
||||
set_verbosity(tmp_verbosity);
|
||||
};
|
||||
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "****************************" << std::endl;
|
||||
std::cout << "Test each event individually" << std::endl;
|
||||
std::cout << "****************************" << std::endl;
|
||||
}
|
||||
for (PerfCntrEvtGrp grp : s_event_groups) {
|
||||
ret = rsmi_dev_counter_group_supported(dv_ind, grp.group());
|
||||
if (ret == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
continue;
|
||||
}
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Testing Event Group " << grp.name() << std::endl;
|
||||
}
|
||||
if (grp.group() == RSMI_EVNT_GRP_XGMI_DATA_OUT) {
|
||||
utiliz(RSMI_EVNT_XGMI_DATA_OUT_0, 0);
|
||||
utiliz(RSMI_EVNT_XGMI_DATA_OUT_1, 1);
|
||||
utiliz(RSMI_EVNT_XGMI_DATA_OUT_2, 2);
|
||||
utiliz(RSMI_EVNT_XGMI_DATA_OUT_3, 3);
|
||||
utiliz(RSMI_EVNT_XGMI_DATA_OUT_4, 4);
|
||||
utiliz(RSMI_EVNT_XGMI_DATA_OUT_5, 5);
|
||||
} else if (grp.group() == RSMI_EVNT_GRP_XGMI) {
|
||||
utiliz(RSMI_EVNT_XGMI_1_BEATS_TX, 1);
|
||||
utiliz(RSMI_EVNT_XGMI_0_BEATS_TX, 0);
|
||||
}
|
||||
for (uint32_t evnt = grp.first_evt(); evnt <= grp.last_evt(); ++evnt) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\tTesting Event Type " << evnt << std::endl;
|
||||
}
|
||||
CountEvents(dv_ind, static_cast<rsmi_event_type_t>(evnt), &val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
TestPerfCntrReadWrite::testEventsSimultaneously(uint32_t dv_ind) {
|
||||
rsmi_status_t ret;
|
||||
rsmi_counter_value_t val;
|
||||
uint32_t avail_counters;
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "****************************" << std::endl;
|
||||
std::cout << "Test events simultaneously (device " <<
|
||||
dv_ind << ")" << std::endl;
|
||||
std::cout << "****************************" << std::endl;
|
||||
}
|
||||
|
||||
/* This code is a little convoluted. The reason is that it is meant to test
|
||||
* having multiple events being used at one time, rather than sequentially
|
||||
* handling 1 event at a time.
|
||||
*/
|
||||
for (PerfCntrEvtGrp grp : s_event_groups) {
|
||||
ret = rsmi_dev_counter_group_supported(dv_ind, grp.group());
|
||||
if (ret == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\tEvent Group " << grp.name() <<
|
||||
" is not supported. Skipping." << std::endl;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Testing Event Group " << grp.name() << std::endl;
|
||||
}
|
||||
|
||||
ret = rsmi_counter_available_counters_get(dv_ind, grp.group(),
|
||||
&avail_counters);
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Available Counters: " << avail_counters << std::endl;
|
||||
}
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
std::shared_ptr<rsmi_event_handle_t> evt_handle =
|
||||
std::shared_ptr<rsmi_event_handle_t>(
|
||||
new rsmi_event_handle_t[avail_counters]);
|
||||
|
||||
uint32_t tmp, j;
|
||||
uint32_t num_created = 0;
|
||||
|
||||
for (uint32_t evnt = grp.first_evt(); evnt <= grp.last_evt();
|
||||
evnt += avail_counters) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\tTesting Event Type " << evnt << std::endl;
|
||||
}
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\tCreating events..." << std::endl;
|
||||
}
|
||||
for (j = 0; j < avail_counters; ++j) {
|
||||
tmp = static_cast<rsmi_event_type_t>(evnt + j);
|
||||
|
||||
if (tmp > grp.last_evt()) {
|
||||
break;
|
||||
}
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\tEvent Type " << tmp << std::endl;
|
||||
}
|
||||
|
||||
ret = rsmi_dev_counter_create(dv_ind,
|
||||
static_cast<rsmi_event_type_t>(tmp), &evt_handle.get()[j]);
|
||||
CHK_ERR_ASRT(ret)
|
||||
}
|
||||
num_created = j;
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\tStart Counters..." << std::endl;
|
||||
}
|
||||
uint32_t tmp_cntrs;
|
||||
|
||||
for (j = 0; j < num_created; ++j) {
|
||||
tmp = static_cast<rsmi_event_type_t>(evnt + j);
|
||||
|
||||
ret = rsmi_counter_control(evt_handle.get()[j], RSMI_CNTR_CMD_START,
|
||||
nullptr);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
ret = rsmi_counter_available_counters_get(dv_ind, grp.group(),
|
||||
&tmp_cntrs);
|
||||
CHK_ERR_ASRT(ret)
|
||||
ASSERT_EQ(tmp_cntrs, (avail_counters - j - 1));
|
||||
}
|
||||
|
||||
sleep(1);
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\tRead Counters..." << std::endl;
|
||||
}
|
||||
for (j = 0; j < num_created; ++j) {
|
||||
tmp = static_cast<rsmi_event_type_t>(evnt + j);
|
||||
|
||||
ret = rsmi_counter_read(evt_handle.get()[j], &val);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\tCounter: " << tmp << std::endl;
|
||||
std::cout << "\tSuccessfully read value: " << std::endl;
|
||||
std::cout << "\t\tValue: " << val.value << std::endl;
|
||||
std::cout << "\t\tTime Enabled: " << val.time_enabled << std::endl;
|
||||
std::cout << "\t\tTime Running: " << val.time_running << std::endl;
|
||||
}
|
||||
}
|
||||
for (j = 0; j < num_created; ++j) {
|
||||
ret = rsmi_dev_counter_destroy(evt_handle.get()[j]);
|
||||
CHK_ERR_ASRT(ret)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TestPerfCntrReadWrite::Run(void) {
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) {
|
||||
PrintDeviceHeader(dv_ind);
|
||||
try {
|
||||
testEventsIndividually(dv_ind);
|
||||
testEventsSimultaneously(dv_ind);
|
||||
} catch(rsmi_status_t r) {
|
||||
switch (r) {
|
||||
case RSMI_STATUS_NOT_SUPPORTED:
|
||||
std::cout << "The performance counter event tried is not "
|
||||
"supported for this device" << std::endl;
|
||||
break;
|
||||
|
||||
default:
|
||||
std::cout << "Unexpected exception caught with rsmi "
|
||||
"return value of " << r << std::endl;
|
||||
}
|
||||
} catch(...) {
|
||||
ASSERT_FALSE("Unexpected exception caught");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_ROCM_SMI_TEST_FUNCTIONAL_PERF_CNTR_READ_WRITE_H_
|
||||
#define TESTS_ROCM_SMI_TEST_FUNCTIONAL_PERF_CNTR_READ_WRITE_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "../test_base.h"
|
||||
|
||||
class TestPerfCntrReadWrite : public TestBase {
|
||||
public:
|
||||
TestPerfCntrReadWrite();
|
||||
|
||||
// @Brief: Destructor for test case of TestPerfCntrReadWrite
|
||||
virtual ~TestPerfCntrReadWrite();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
|
||||
private:
|
||||
void CountEvents(uint32_t dv_ind,
|
||||
rsmi_event_type_t evnt, rsmi_counter_value_t *val,
|
||||
int32_t sleep_sec = 1);
|
||||
void testEventsIndividually(uint32_t dv_ind);
|
||||
void testEventsSimultaneously(uint32_t dv_ind);
|
||||
};
|
||||
|
||||
class PerfCntrEvtGrp {
|
||||
public:
|
||||
explicit PerfCntrEvtGrp(rsmi_event_group_t grp,
|
||||
uint32_t first, uint32_t last, std::string name);
|
||||
~PerfCntrEvtGrp();
|
||||
|
||||
rsmi_event_group_t group(void) const { return grp_;}
|
||||
uint32_t first_evt(void) const {return first_evt_;}
|
||||
uint32_t last_evt(void) const {return last_evt_;}
|
||||
uint32_t num_events(void) const {return num_events_;}
|
||||
std::string name(void) const { return name_;}
|
||||
private:
|
||||
rsmi_event_group_t grp_;
|
||||
uint32_t first_evt_;
|
||||
uint32_t last_evt_;
|
||||
uint32_t num_events_;
|
||||
std::string name_;
|
||||
};
|
||||
|
||||
#endif // TESTS_ROCM_SMI_TEST_FUNCTIONAL_PERF_CNTR_READ_WRITE_H_
|
||||
@@ -1,144 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2020, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <bitset>
|
||||
#include <algorithm>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
#include "perf_determinism.h"
|
||||
#include "../test_common.h"
|
||||
|
||||
|
||||
TestPerfDeterminism::TestPerfDeterminism() : TestBase() {
|
||||
set_title("RSMI Performance Determinism Test");
|
||||
set_description("The Performance Determinism tests verifies "
|
||||
"Enabling/Disabling performance determinism mode.");
|
||||
}
|
||||
|
||||
TestPerfDeterminism::~TestPerfDeterminism(void) {
|
||||
}
|
||||
|
||||
void TestPerfDeterminism::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestPerfDeterminism::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestPerfDeterminism::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestPerfDeterminism::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// rsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
|
||||
void TestPerfDeterminism::Run(void) {
|
||||
rsmi_status_t err;
|
||||
rsmi_dev_perf_level_t pfl;
|
||||
rsmi_od_volt_freq_data_t odv;
|
||||
rsmi_status_t ret;
|
||||
uint64_t clkvalue;
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(i);
|
||||
err = rsmi_dev_od_volt_info_get(i, &odv);
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t** Not supported on this machine" << std::endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else{
|
||||
clkvalue = (odv.curr_sclk_range.lower_bound/1000000) + 50;
|
||||
}
|
||||
|
||||
err = rsmi_perf_determinism_mode_set(i, clkvalue);
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Not supported on this machine" << std::endl;
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
ret = rsmi_dev_perf_level_get(i, &pfl);
|
||||
CHK_ERR_ASRT(ret)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**New Perf Level:" << GetPerfLevelStr(pfl) <<
|
||||
std::endl;
|
||||
std::cout << "\t**SCLK is now set to " << clkvalue << std::endl;
|
||||
}
|
||||
|
||||
std::cout << "\t**Resetting performance determinism" << std::endl;
|
||||
err = rsmi_dev_perf_level_set(i, RSMI_DEV_PERF_LEVEL_AUTO);;
|
||||
CHK_ERR_ASRT(err)
|
||||
ret = rsmi_dev_perf_level_get(i, &pfl);
|
||||
CHK_ERR_ASRT(ret)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**New Perf Level:" << GetPerfLevelStr(pfl) <<
|
||||
std::endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2020, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_ROCM_SMI_TEST_FUNCTIONAL_PERF_DETERMINISM_H_
|
||||
#define TESTS_ROCM_SMI_TEST_FUNCTIONAL_PERF_DETERMINISM_H_
|
||||
|
||||
#include "../test_base.h"
|
||||
|
||||
class TestPerfDeterminism : public TestBase {
|
||||
public:
|
||||
TestPerfDeterminism();
|
||||
|
||||
// @Brief: Destructor for test case of TestVOltRead
|
||||
virtual ~TestPerfDeterminism();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_ROCM_SMI_TEST_FUNCTIONAL_PERF_DETERMINISM_H_
|
||||
@@ -1,111 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
#include "perf_level_read.h"
|
||||
#include "../test_common.h"
|
||||
|
||||
TestPerfLevelRead::TestPerfLevelRead() : TestBase() {
|
||||
set_title("RSMI Performance Level Read Test");
|
||||
set_description("The Performance Level Read tests verifies that the "
|
||||
"performance level monitors can be read properly.");
|
||||
}
|
||||
|
||||
TestPerfLevelRead::~TestPerfLevelRead(void) {
|
||||
}
|
||||
|
||||
void TestPerfLevelRead::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestPerfLevelRead::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestPerfLevelRead::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestPerfLevelRead::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// rsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
|
||||
void TestPerfLevelRead::Run(void) {
|
||||
rsmi_status_t err;
|
||||
rsmi_dev_perf_level_t pfl;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(i);
|
||||
|
||||
err = rsmi_dev_perf_level_get(i, &pfl);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Performance Level:" << std::dec << (uint32_t)pfl <<
|
||||
std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_perf_level_get(i, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_ROCM_SMI_TEST_FUNCTIONAL_PERF_LEVEL_READ_H_
|
||||
#define TESTS_ROCM_SMI_TEST_FUNCTIONAL_PERF_LEVEL_READ_H_
|
||||
|
||||
#include "../test_base.h"
|
||||
|
||||
class TestPerfLevelRead : public TestBase {
|
||||
public:
|
||||
TestPerfLevelRead();
|
||||
|
||||
// @Brief: Destructor for test case of TestPerfLevelRead
|
||||
virtual ~TestPerfLevelRead();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_ROCM_SMI_TEST_FUNCTIONAL_PERF_LEVEL_READ_H_
|
||||
@@ -1,152 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
#include "perf_level_read_write.h"
|
||||
#include "../test_common.h"
|
||||
|
||||
|
||||
TestPerfLevelReadWrite::TestPerfLevelReadWrite() : TestBase() {
|
||||
set_title("RSMI Performance Level Read/Write Test");
|
||||
set_description("The Performance Level tests verify that the performance "
|
||||
"level settings can be read and controlled properly.");
|
||||
}
|
||||
|
||||
TestPerfLevelReadWrite::~TestPerfLevelReadWrite(void) {
|
||||
}
|
||||
|
||||
void TestPerfLevelReadWrite::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestPerfLevelReadWrite::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestPerfLevelReadWrite::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestPerfLevelReadWrite::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// rsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
|
||||
void TestPerfLevelReadWrite::Run(void) {
|
||||
rsmi_status_t ret;
|
||||
rsmi_dev_perf_level_t pfl, orig_pfl;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) {
|
||||
PrintDeviceHeader(dv_ind);
|
||||
|
||||
ret = rsmi_dev_perf_level_get(dv_ind, &orig_pfl);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Original Perf Level:" <<
|
||||
GetPerfLevelStr(orig_pfl) << std::endl;
|
||||
}
|
||||
|
||||
uint32_t pfl_i = static_cast<uint32_t>(RSMI_DEV_PERF_LEVEL_FIRST);
|
||||
for (; pfl_i <= static_cast<uint32_t>(RSMI_DEV_PERF_LEVEL_LAST); pfl_i++) {
|
||||
if (pfl_i == static_cast<uint32_t>(orig_pfl)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Set Performance Level to " <<
|
||||
GetPerfLevelStr(static_cast<rsmi_dev_perf_level_t>(pfl_i)) <<
|
||||
" ..." << std::endl;
|
||||
}
|
||||
ret = rsmi_dev_perf_level_set(dv_ind,
|
||||
static_cast<rsmi_dev_perf_level_t>(pfl_i));
|
||||
if (ret == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout << "\t**" << GetPerfLevelStr(static_cast<rsmi_dev_perf_level_t>(pfl_i))
|
||||
<< " returned RSMI_STATUS_NOT_SUPPORTED" << std::endl;
|
||||
} else {
|
||||
CHK_ERR_ASRT(ret)
|
||||
ret = rsmi_dev_perf_level_get(dv_ind, &pfl);
|
||||
CHK_ERR_ASRT(ret)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**New Perf Level:" << GetPerfLevelStr(pfl) <<
|
||||
std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Reset Perf level to " << GetPerfLevelStr(orig_pfl) <<
|
||||
" ..." << std::endl;
|
||||
}
|
||||
ret = rsmi_dev_perf_level_set(dv_ind, orig_pfl);
|
||||
CHK_ERR_ASRT(ret)
|
||||
ret = rsmi_dev_perf_level_get(dv_ind, &pfl);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**New Perf Level:" << GetPerfLevelStr(pfl) <<
|
||||
std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_ROCM_SMI_TEST_FUNCTIONAL_PERF_LEVEL_READ_WRITE_H_
|
||||
#define TESTS_ROCM_SMI_TEST_FUNCTIONAL_PERF_LEVEL_READ_WRITE_H_
|
||||
|
||||
#include "../test_base.h"
|
||||
|
||||
class TestPerfLevelReadWrite : public TestBase {
|
||||
public:
|
||||
TestPerfLevelReadWrite();
|
||||
|
||||
// @Brief: Destructor for test case of TestPerfLevelReadWrite
|
||||
virtual ~TestPerfLevelReadWrite();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_ROCM_SMI_TEST_FUNCTIONAL_PERF_LEVEL_READ_WRITE_H_
|
||||
@@ -1,153 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <bitset>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
#include "power_cap_read_write.h"
|
||||
#include "../test_common.h"
|
||||
|
||||
|
||||
TestPowerCapReadWrite::TestPowerCapReadWrite() : TestBase() {
|
||||
set_title("RSMI Power Cap Read/Write Test");
|
||||
set_description("The Power Cap tests verify that the power profile "
|
||||
"settings can be read and written properly.");
|
||||
}
|
||||
|
||||
TestPowerCapReadWrite::~TestPowerCapReadWrite(void) {
|
||||
}
|
||||
|
||||
void TestPowerCapReadWrite::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestPowerCapReadWrite::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestPowerCapReadWrite::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestPowerCapReadWrite::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// rsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
void TestPowerCapReadWrite::Run(void) {
|
||||
rsmi_status_t ret;
|
||||
uint64_t orig, min, max, new_cap;
|
||||
clock_t start, end;
|
||||
double cpu_time_used;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) {
|
||||
PrintDeviceHeader(dv_ind);
|
||||
|
||||
ret = rsmi_dev_power_cap_range_get(dv_ind, 0, &max, &min);
|
||||
CHK_ERR_ASRT(ret)
|
||||
// Verify api support checking functionality is working
|
||||
ret = rsmi_dev_power_cap_range_get(dv_ind, 0, nullptr, nullptr);
|
||||
ASSERT_EQ(ret, RSMI_STATUS_INVALID_ARGS);
|
||||
|
||||
ret = rsmi_dev_power_cap_get(dv_ind, 0, &orig);
|
||||
CHK_ERR_ASRT(ret)
|
||||
// Verify api support checking functionality is working
|
||||
ret = rsmi_dev_power_cap_get(dv_ind, 0, nullptr);
|
||||
ASSERT_EQ(ret, RSMI_STATUS_INVALID_ARGS);
|
||||
|
||||
new_cap = (max + min)/2;
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Original Power Cap: " << orig << " uW" << std::endl;
|
||||
std::cout << "Power Cap Range: " << max << " uW to " << min <<
|
||||
" uW" << std::endl;
|
||||
std::cout << "Setting new cap to " << new_cap << "..." << std::endl;
|
||||
}
|
||||
start = clock();
|
||||
ret = rsmi_dev_power_cap_set(dv_ind, 0, new_cap);
|
||||
end = clock();
|
||||
cpu_time_used = ((double) (end - start)) * 1000000UL / CLOCKS_PER_SEC;
|
||||
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
ret = rsmi_dev_power_cap_get(dv_ind, 0, &new_cap);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
// TODO(cfreehil) add some kind of assertion to verify new_cap is correct
|
||||
// (or within a range)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Time spent: " << cpu_time_used << " uS" << std::endl;
|
||||
std::cout << "New Power Cap: " << new_cap << " uW" << std::endl;
|
||||
std::cout << "Resetting cap to " << orig << "..." << std::endl;
|
||||
}
|
||||
|
||||
ret = rsmi_dev_power_cap_set(dv_ind, 0, orig);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
ret = rsmi_dev_power_cap_get(dv_ind, 0, &new_cap);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Current Power Cap: " << new_cap << " uW" << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_ROCM_SMI_TEST_FUNCTIONAL_POWER_CAP_READ_WRITE_H_
|
||||
#define TESTS_ROCM_SMI_TEST_FUNCTIONAL_POWER_CAP_READ_WRITE_H_
|
||||
|
||||
#include "../test_base.h"
|
||||
|
||||
class TestPowerCapReadWrite : public TestBase {
|
||||
public:
|
||||
TestPowerCapReadWrite();
|
||||
|
||||
// @Brief: Destructor for test case of TestPowerCapReadWrite
|
||||
virtual ~TestPowerCapReadWrite();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_ROCM_SMI_TEST_FUNCTIONAL_POWER_CAP_READ_WRITE_H_
|
||||
@@ -1,132 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
#include "power_read.h"
|
||||
#include "../test_common.h"
|
||||
|
||||
TestPowerRead::TestPowerRead() : TestBase() {
|
||||
set_title("RSMI Power Read Test");
|
||||
set_description("The Power Read tests verifies that "
|
||||
"power related values can be read properly.");
|
||||
}
|
||||
|
||||
TestPowerRead::~TestPowerRead(void) {
|
||||
}
|
||||
|
||||
void TestPowerRead::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestPowerRead::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestPowerRead::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestPowerRead::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// rsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
|
||||
void TestPowerRead::Run(void) {
|
||||
rsmi_status_t err;
|
||||
uint64_t val_ui64, val2_ui64;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t x = 0; x < num_iterations(); ++x) {
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(i);
|
||||
|
||||
err = rsmi_dev_power_cap_get(i, 0, &val_ui64);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Current Power Cap: " << val_ui64 << "uW" <<std::endl;
|
||||
}
|
||||
err = rsmi_dev_power_cap_default_get(i, &val_ui64);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Default Power Cap: " << val_ui64 << "uW" <<std::endl;
|
||||
}
|
||||
err = rsmi_dev_power_cap_range_get(i, 0, &val_ui64, &val2_ui64);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Power Cap Range: " << val2_ui64 << " to " <<
|
||||
val_ui64 << " uW" << std::endl;
|
||||
}
|
||||
|
||||
err = rsmi_dev_power_ave_get(i, 0, &val_ui64);
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Averge Power Usage: ";
|
||||
CHK_RSMI_PERM_ERR(err)
|
||||
if (err == RSMI_STATUS_SUCCESS) {
|
||||
std::cout << static_cast<float>(val_ui64)/1000 << " mW" << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_power_ave_get(i, 0, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_ROCM_SMI_TEST_FUNCTIONAL_POWER_READ_H_
|
||||
#define TESTS_ROCM_SMI_TEST_FUNCTIONAL_POWER_READ_H_
|
||||
|
||||
#include "../test_base.h"
|
||||
|
||||
class TestPowerRead : public TestBase {
|
||||
public:
|
||||
TestPowerRead();
|
||||
|
||||
// @Brief: Destructor for test case of TestPowerRead
|
||||
virtual ~TestPowerRead();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_ROCM_SMI_TEST_FUNCTIONAL_POWER_READ_H_
|
||||
@@ -1,195 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <bitset>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
#include "power_read_write.h"
|
||||
#include "../test_common.h"
|
||||
|
||||
|
||||
TestPowerReadWrite::TestPowerReadWrite() : TestBase() {
|
||||
set_title("RSMI Power Profiles Read/Write Test");
|
||||
set_description("The Power Profiles tests verify that the power profile "
|
||||
"settings can be read and controlled properly.");
|
||||
}
|
||||
|
||||
TestPowerReadWrite::~TestPowerReadWrite(void) {
|
||||
}
|
||||
|
||||
void TestPowerReadWrite::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestPowerReadWrite::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestPowerReadWrite::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestPowerReadWrite::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// rsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
static const char *
|
||||
power_profile_string(rsmi_power_profile_preset_masks_t profile) {
|
||||
switch (profile) {
|
||||
case RSMI_PWR_PROF_PRST_CUSTOM_MASK:
|
||||
return "CUSTOM";
|
||||
case RSMI_PWR_PROF_PRST_VIDEO_MASK:
|
||||
return "VIDEO";
|
||||
case RSMI_PWR_PROF_PRST_POWER_SAVING_MASK:
|
||||
return "POWER SAVING";
|
||||
case RSMI_PWR_PROF_PRST_COMPUTE_MASK:
|
||||
return "COMPUTE";
|
||||
case RSMI_PWR_PROF_PRST_VR_MASK:
|
||||
return "VR";
|
||||
case RSMI_PWR_PROF_PRST_3D_FULL_SCR_MASK:
|
||||
return "3D FULL SCREEN";
|
||||
case RSMI_PWR_PROF_PRST_BOOTUP_DEFAULT:
|
||||
return "BOOTUP DEFAULT";
|
||||
default:
|
||||
return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
|
||||
void TestPowerReadWrite::Run(void) {
|
||||
rsmi_status_t ret;
|
||||
rsmi_power_profile_status_t status;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) {
|
||||
PrintDeviceHeader(dv_ind);
|
||||
|
||||
ret = rsmi_dev_power_profile_presets_get(dv_ind, 0, &status);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
ret = rsmi_dev_power_profile_presets_get(dv_ind, 0, nullptr);
|
||||
ASSERT_EQ(ret, RSMI_STATUS_INVALID_ARGS);
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "The available power profiles are:" << std::endl;
|
||||
uint64_t tmp = 1;
|
||||
while (tmp <= RSMI_PWR_PROF_PRST_LAST) {
|
||||
if ((tmp & status.available_profiles) == tmp) {
|
||||
std::cout << "\t" <<
|
||||
power_profile_string((rsmi_power_profile_preset_masks_t)tmp) <<
|
||||
std::endl;
|
||||
}
|
||||
tmp = tmp << 1;
|
||||
}
|
||||
std::cout << "The current power profile is: " <<
|
||||
power_profile_string(status.current) << std::endl;
|
||||
}
|
||||
|
||||
rsmi_power_profile_preset_masks_t orig_profile = status.current;
|
||||
|
||||
// Try setting the profile to a different power profile
|
||||
rsmi_bit_field_t diff_profiles;
|
||||
rsmi_power_profile_preset_masks_t new_prof;
|
||||
diff_profiles = status.available_profiles & (~status.current);
|
||||
|
||||
if (diff_profiles & RSMI_PWR_PROF_PRST_COMPUTE_MASK) {
|
||||
new_prof = RSMI_PWR_PROF_PRST_COMPUTE_MASK;
|
||||
} else if (diff_profiles & RSMI_PWR_PROF_PRST_VIDEO_MASK) {
|
||||
new_prof = RSMI_PWR_PROF_PRST_VIDEO_MASK;
|
||||
} else if (diff_profiles & RSMI_PWR_PROF_PRST_VR_MASK) {
|
||||
new_prof = RSMI_PWR_PROF_PRST_VR_MASK;
|
||||
} else if (diff_profiles & RSMI_PWR_PROF_PRST_POWER_SAVING_MASK) {
|
||||
new_prof = RSMI_PWR_PROF_PRST_POWER_SAVING_MASK;
|
||||
} else if (diff_profiles & RSMI_PWR_PROF_PRST_3D_FULL_SCR_MASK) {
|
||||
new_prof = RSMI_PWR_PROF_PRST_3D_FULL_SCR_MASK;
|
||||
} else {
|
||||
std::cout <<
|
||||
"No other non-custom power profiles to set to. Exiting." << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
ret = rsmi_dev_power_profile_set(dv_ind, 0, new_prof);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
rsmi_dev_perf_level_t pfl;
|
||||
ret = rsmi_dev_perf_level_get(dv_ind, &pfl);
|
||||
CHK_ERR_ASRT(ret)
|
||||
ASSERT_EQ(pfl, RSMI_DEV_PERF_LEVEL_MANUAL);
|
||||
|
||||
ret = rsmi_dev_power_profile_presets_get(dv_ind, 0, &status);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
ASSERT_EQ(status.current, new_prof);
|
||||
|
||||
ret = rsmi_dev_perf_level_set(dv_ind, RSMI_DEV_PERF_LEVEL_AUTO);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
ret = rsmi_dev_perf_level_get(dv_ind, &pfl);
|
||||
CHK_ERR_ASRT(ret)
|
||||
ASSERT_EQ(pfl, RSMI_DEV_PERF_LEVEL_AUTO);
|
||||
|
||||
ret = rsmi_dev_power_profile_presets_get(dv_ind, 0, &status);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
ASSERT_EQ(status.current, orig_profile);
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_ROCM_SMI_TEST_FUNCTIONAL_POWER_READ_WRITE_H_
|
||||
#define TESTS_ROCM_SMI_TEST_FUNCTIONAL_POWER_READ_WRITE_H_
|
||||
|
||||
#include "../test_base.h"
|
||||
|
||||
class TestPowerReadWrite : public TestBase {
|
||||
public:
|
||||
TestPowerReadWrite();
|
||||
|
||||
// @Brief: Destructor for test case of TestPowerReadWrite
|
||||
virtual ~TestPowerReadWrite();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_ROCM_SMI_TEST_FUNCTIONAL_POWER_READ_WRITE_H_
|
||||
@@ -1,231 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
#include "process_info_read.h"
|
||||
#include "../test_common.h"
|
||||
|
||||
TestProcInfoRead::TestProcInfoRead() : TestBase() {
|
||||
set_title("RSMI Process Info Read Test");
|
||||
set_description("This test verifies that process information such as the "
|
||||
"process ID, PASID, etc. can be read properly.");
|
||||
}
|
||||
|
||||
TestProcInfoRead::~TestProcInfoRead(void) {
|
||||
}
|
||||
|
||||
void TestProcInfoRead::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestProcInfoRead::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestProcInfoRead::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestProcInfoRead::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// rsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
static void dumpProcess(rsmi_process_info_t *p) {
|
||||
assert(p != nullptr);
|
||||
std::cout << "\t** ProcessID: " << p->process_id << " ";
|
||||
std::cout << "PASID: " << p->pasid << " ";
|
||||
std::cout << std::endl;
|
||||
}
|
||||
void TestProcInfoRead::Run(void) {
|
||||
rsmi_status_t err;
|
||||
uint32_t num_proc_found;
|
||||
uint32_t val_ui32;
|
||||
rsmi_process_info_t *procs = nullptr;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t num_devices;
|
||||
err = rsmi_num_monitor_devices(&num_devices);
|
||||
CHK_ERR_ASRT(err)
|
||||
|
||||
err = rsmi_compute_process_info_get(nullptr, &num_proc_found);
|
||||
if (err != RSMI_STATUS_SUCCESS) {
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Process info. read: Not supported on this machine"
|
||||
<< std::endl;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
} else {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t** " << std::dec << num_proc_found <<
|
||||
" GPU processes found" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (num_proc_found == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
procs = new rsmi_process_info_t[num_proc_found];
|
||||
|
||||
val_ui32 = num_proc_found;
|
||||
err = rsmi_compute_process_info_get(procs, &val_ui32);
|
||||
if (err != RSMI_STATUS_SUCCESS) {
|
||||
if (err == RSMI_STATUS_INSUFFICIENT_SIZE) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t** " << val_ui32 <<
|
||||
" processes were read, but more became available that were unread."
|
||||
<< std::endl;
|
||||
for (uint32_t i = 0; i < val_ui32; ++i) {
|
||||
dumpProcess(&procs[i]);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
} else {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t** Processes currently using GPU: " << std::endl;
|
||||
for (uint32_t i = 0; i < val_ui32; ++i) {
|
||||
dumpProcess(&procs[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Reset to the number we actually read
|
||||
num_proc_found = val_ui32;
|
||||
if (num_proc_found) {
|
||||
// Allocate the max we expect to get
|
||||
uint32_t *dev_inds = new uint32_t[num_devices];
|
||||
uint32_t amt_allocd = num_devices;
|
||||
|
||||
for (uint32_t j = 0; j < num_proc_found; j++) {
|
||||
err = rsmi_compute_process_gpus_get(procs[j].process_id, dev_inds,
|
||||
&amt_allocd);
|
||||
if (err == RSMI_STATUS_NOT_FOUND) {
|
||||
std::cout << "\t** Process " << procs[j].process_id <<
|
||||
" is no longer present.";
|
||||
continue;
|
||||
} else {
|
||||
CHK_ERR_ASRT(err);
|
||||
ASSERT_LE(amt_allocd, num_devices);
|
||||
}
|
||||
std::cout << "\t** Process " << procs[j].process_id <<
|
||||
" is using devices with indices: ";
|
||||
uint32_t i;
|
||||
if (amt_allocd > 0) {
|
||||
for (i = 0; i < amt_allocd - 1; ++i) {
|
||||
std::cout << dev_inds[i] << ", ";
|
||||
}
|
||||
std::cout << dev_inds[i];
|
||||
}
|
||||
std::cout << std::endl;
|
||||
// Reset amt_allocd back to the amount acutally allocated
|
||||
amt_allocd = num_devices;
|
||||
}
|
||||
|
||||
delete []dev_inds;
|
||||
|
||||
rsmi_process_info_t proc_info;
|
||||
for (uint32_t j = 0; j < num_proc_found; j++) {
|
||||
memset(&proc_info, 0x0, sizeof(rsmi_process_info_t));
|
||||
err = rsmi_compute_process_info_by_pid_get(procs[j].process_id,
|
||||
&proc_info);
|
||||
if (err == RSMI_STATUS_NOT_FOUND) {
|
||||
std::cout <<
|
||||
"\t** WARNING: rsmi_compute_process_info_get() found process " <<
|
||||
procs[j].process_id << ", but subsequently, "
|
||||
"rsmi_compute_process_info_by_pid_get() did not"
|
||||
" find this same process." << std::endl;
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
ASSERT_EQ(proc_info.process_id, procs[j].process_id);
|
||||
ASSERT_EQ(proc_info.pasid, procs[j].pasid);
|
||||
std::cout << "\t** Process ID: " <<
|
||||
procs[j].process_id << " VRAM Usage: " <<
|
||||
proc_info.vram_usage <<
|
||||
" SDMA Usage: " <<
|
||||
proc_info.sdma_usage <<
|
||||
" Compute Unit Usage: " <<
|
||||
proc_info.cu_occupancy <<
|
||||
std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (num_proc_found > 1) {
|
||||
rsmi_process_info_t tmp_proc;
|
||||
val_ui32 = 1;
|
||||
err = rsmi_compute_process_info_get(&tmp_proc, &val_ui32);
|
||||
|
||||
if (err != RSMI_STATUS_INSUFFICIENT_SIZE) {
|
||||
std::cout << "Expected rsmi_compute_process_info_get() to tell us"
|
||||
" there are more processes available, but instead go return code " <<
|
||||
err << std::endl;
|
||||
}
|
||||
}
|
||||
delete []procs;
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_ROCM_SMI_TEST_FUNCTIONAL_PROCESS_INFO_READ_H_
|
||||
#define TESTS_ROCM_SMI_TEST_FUNCTIONAL_PROCESS_INFO_READ_H_
|
||||
|
||||
#include "../test_base.h"
|
||||
|
||||
class TestProcInfoRead : public TestBase {
|
||||
public:
|
||||
TestProcInfoRead();
|
||||
|
||||
// @Brief: Destructor for test case of TestProcInfoRead
|
||||
virtual ~TestProcInfoRead();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_ROCM_SMI_TEST_FUNCTIONAL_PROCESS_INFO_READ_H_
|
||||
@@ -1,205 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
#include "sys_info_read.h"
|
||||
#include "../test_common.h"
|
||||
#include "../test_utils.h"
|
||||
|
||||
TestSysInfoRead::TestSysInfoRead() : TestBase() {
|
||||
set_title("RSMI System Info Read Test");
|
||||
set_description("This test verifies that system information such as the "
|
||||
"BDFID, RSMI version, VBIOS version, etc. can be read properly.");
|
||||
}
|
||||
|
||||
TestSysInfoRead::~TestSysInfoRead(void) {
|
||||
}
|
||||
|
||||
void TestSysInfoRead::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestSysInfoRead::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestSysInfoRead::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestSysInfoRead::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// rsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
|
||||
void TestSysInfoRead::Run(void) {
|
||||
rsmi_status_t err;
|
||||
uint64_t val_ui64;
|
||||
uint32_t val_ui32;
|
||||
char buffer[80];
|
||||
rsmi_version_t ver = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, nullptr};
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(i);
|
||||
|
||||
err = rsmi_dev_vbios_version_get(i, buffer, 80);
|
||||
|
||||
if (err != RSMI_STATUS_SUCCESS) {
|
||||
if (err == RSMI_STATUS_FILE_ERROR) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**VBIOS read: Not supported on this machine"
|
||||
<< std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_vbios_version_get(i, nullptr, 80);
|
||||
ASSERT_EQ(err, RSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_vbios_version_get(i, nullptr, 80);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
} else {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**VBIOS Version: " << std::hex << buffer << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
err = rsmi_dev_pci_id_get(i, &val_ui64);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**PCI ID (BDFID): 0x" << std::hex << val_ui64;
|
||||
std::cout << " (" << std::dec << val_ui64 << ")" << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_pci_id_get(i, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
|
||||
err = rsmi_topo_numa_affinity_get(i, &val_ui32);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**NUMA NODE: 0x" << std::hex << val_ui32;
|
||||
std::cout << " (" << std::dec << val_ui32 << ")" << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_topo_numa_affinity_get(i, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
|
||||
err = rsmi_dev_unique_id_get(i, &val_ui64);
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout <<
|
||||
"\t**rsmi_dev_unique_id() is not supported"
|
||||
" on this machine" << std::endl;
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_unique_id_get(i, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
if (err == RSMI_STATUS_SUCCESS) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**GPU Unique ID : " << std::hex << val_ui64 <<
|
||||
std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_unique_id_get(i, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
} else {
|
||||
std::cout << "rsmi_dev_unique_id_get() failed with error " <<
|
||||
err << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
err = rsmi_version_get(&ver);
|
||||
CHK_ERR_ASRT(err)
|
||||
|
||||
ASSERT_TRUE(ver.major != 0xFFFFFFFF && ver.minor != 0xFFFFFFFF &&
|
||||
ver.patch != 0xFFFFFFFF && ver.build != nullptr);
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**RocM SMI Library version: " << ver.major << "." <<
|
||||
ver.minor << "." << ver.patch << " (" << ver.build << ")" << std::endl;
|
||||
}
|
||||
|
||||
std::cout << std::setbase(10);
|
||||
for (int x = RSMI_FW_BLOCK_FIRST; x <= RSMI_FW_BLOCK_LAST; ++x) {
|
||||
rsmi_fw_block_t block = static_cast<rsmi_fw_block_t>(x);
|
||||
err = rsmi_dev_firmware_version_get(i, block, &val_ui64);
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout << "\t**No FW block " << NameFromFWEnum(block) <<
|
||||
" available on this system" << std::endl;
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_firmware_version_get(i, block, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_NOT_SUPPORTED);
|
||||
continue;
|
||||
}
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**FW VERSION for " << NameFromFWEnum(block) <<
|
||||
": " << val_ui64 << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_firmware_version_get(i, block, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_ROCM_SMI_TEST_FUNCTIONAL_SYS_INFO_READ_H_
|
||||
#define TESTS_ROCM_SMI_TEST_FUNCTIONAL_SYS_INFO_READ_H_
|
||||
|
||||
#include "../test_base.h"
|
||||
|
||||
class TestSysInfoRead : public TestBase {
|
||||
public:
|
||||
TestSysInfoRead();
|
||||
|
||||
// @Brief: Destructor for test case of TestSysInfoRead
|
||||
virtual ~TestSysInfoRead();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_ROCM_SMI_TEST_FUNCTIONAL_SYS_INFO_READ_H_
|
||||
@@ -1,170 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
#include "temp_read.h"
|
||||
#include "../test_common.h"
|
||||
|
||||
|
||||
static const std::map<uint32_t, std::string> kTempSensorNameMap = {
|
||||
{RSMI_TEMP_TYPE_MEMORY, "Memory"},
|
||||
{RSMI_TEMP_TYPE_JUNCTION, "Junction"},
|
||||
{RSMI_TEMP_TYPE_EDGE, "Edge"},
|
||||
{RSMI_TEMP_TYPE_HBM_0, "HBM_0"},
|
||||
{RSMI_TEMP_TYPE_HBM_1, "HBM_1"},
|
||||
{RSMI_TEMP_TYPE_HBM_2, "HBM_2"},
|
||||
{RSMI_TEMP_TYPE_HBM_3, "HBM_3"},
|
||||
};
|
||||
TestTempRead::TestTempRead() : TestBase() {
|
||||
set_title("RSMI Temp Read Test");
|
||||
set_description("The Temperature Read tests verifies that the temperature "
|
||||
"monitors can be read properly.");
|
||||
}
|
||||
|
||||
TestTempRead::~TestTempRead(void) {
|
||||
}
|
||||
|
||||
void TestTempRead::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestTempRead::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestTempRead::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestTempRead::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// rsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
|
||||
void TestTempRead::Run(void) {
|
||||
rsmi_status_t err;
|
||||
int64_t val_i64;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t type;
|
||||
for (uint32_t x = 0; x < num_iterations(); ++x) {
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(i);
|
||||
|
||||
auto print_temp_metric = [&](rsmi_temperature_metric_t met,
|
||||
std::string label) {
|
||||
err = rsmi_dev_temp_metric_get(i, type, met, &val_i64);
|
||||
|
||||
if (err != RSMI_STATUS_SUCCESS) {
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**" << label << ": " <<
|
||||
"Not supported on this machine" << std::endl;
|
||||
}
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_temp_metric_get(i, type, met, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
return;
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_temp_metric_get(i, type, met, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**" << label << ": " << val_i64/1000 <<
|
||||
"C" << std::endl;
|
||||
}
|
||||
};
|
||||
for (type = RSMI_TEMP_TYPE_FIRST; type <= RSMI_TEMP_TYPE_LAST; ++type) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t** **********" << kTempSensorNameMap.at(type) <<
|
||||
" Temperatures **********" << std::endl;
|
||||
}
|
||||
print_temp_metric(RSMI_TEMP_CURRENT, "Current Temp.");
|
||||
print_temp_metric(RSMI_TEMP_MAX, "Temperature max value");
|
||||
print_temp_metric(RSMI_TEMP_MIN, "Temperature min value");
|
||||
print_temp_metric(RSMI_TEMP_MAX_HYST,
|
||||
"Temperature hysteresis value for max limit");
|
||||
print_temp_metric(RSMI_TEMP_MIN_HYST,
|
||||
"Temperature hysteresis value for min limit");
|
||||
print_temp_metric(RSMI_TEMP_CRITICAL, "Temperature critical max value");
|
||||
print_temp_metric(RSMI_TEMP_CRITICAL_HYST,
|
||||
"Temperature hysteresis value for critical limit");
|
||||
print_temp_metric(RSMI_TEMP_EMERGENCY,
|
||||
"Temperature emergency max value");
|
||||
print_temp_metric(RSMI_TEMP_EMERGENCY_HYST,
|
||||
"Temperature hysteresis value for emergency limit");
|
||||
print_temp_metric(RSMI_TEMP_CRIT_MIN, "Temperature critical min value");
|
||||
print_temp_metric(RSMI_TEMP_CRIT_MIN_HYST,
|
||||
"Temperature hysteresis value for critical min value");
|
||||
print_temp_metric(RSMI_TEMP_OFFSET, "Temperature offset");
|
||||
print_temp_metric(RSMI_TEMP_LOWEST, "Historical minimum temperature");
|
||||
print_temp_metric(RSMI_TEMP_HIGHEST, "Historical maximum temperature");
|
||||
}
|
||||
}
|
||||
} // x
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_ROCM_SMI_TEST_FUNCTIONAL_TEMP_READ_H_
|
||||
#define TESTS_ROCM_SMI_TEST_FUNCTIONAL_TEMP_READ_H_
|
||||
|
||||
#include "../test_base.h"
|
||||
|
||||
class TestTempRead : public TestBase {
|
||||
public:
|
||||
TestTempRead();
|
||||
|
||||
// @Brief: Destructor for test case of TestTempRead
|
||||
virtual ~TestTempRead();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_ROCM_SMI_TEST_FUNCTIONAL_TEMP_READ_H_
|
||||
@@ -1,126 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
#include "version_read.h"
|
||||
#include "../test_common.h"
|
||||
|
||||
TestVersionRead::TestVersionRead() : TestBase() {
|
||||
set_title("RSMI Version Read Test");
|
||||
set_description("The Version Read tests verifies that the RSMI library "
|
||||
"version can be read properly.");
|
||||
}
|
||||
|
||||
TestVersionRead::~TestVersionRead(void) {
|
||||
}
|
||||
|
||||
void TestVersionRead::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestVersionRead::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestVersionRead::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestVersionRead::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// rsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
static const uint32_t kVerMaxStrLen = 80;
|
||||
|
||||
static const std::map<uint32_t, const char *>
|
||||
kComponentNameMap = {
|
||||
{RSMI_SW_COMP_DRIVER, "Driver Version"},
|
||||
};
|
||||
|
||||
void TestVersionRead::Run(void) {
|
||||
rsmi_status_t err;
|
||||
rsmi_version_t ver = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, nullptr};
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
err = rsmi_version_get(&ver);
|
||||
CHK_ERR_ASRT(err)
|
||||
|
||||
ASSERT_TRUE(ver.major != 0xFFFFFFFF && ver.minor != 0xFFFFFFFF &&
|
||||
ver.patch != 0xFFFFFFFF && ver.build != nullptr);
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**RocM SMI Library version: " << ver.major << "." <<
|
||||
ver.minor << "." << ver.patch << " (" << ver.build << ")" << std::endl;
|
||||
}
|
||||
|
||||
char ver_str[kVerMaxStrLen];
|
||||
|
||||
for (uint32_t cmp = RSMI_SW_COMP_FIRST; cmp <= RSMI_SW_COMP_LAST; ++cmp) {
|
||||
err = rsmi_version_str_get(static_cast<rsmi_sw_component_t>(cmp),
|
||||
ver_str, kVerMaxStrLen);
|
||||
CHK_ERR_ASRT(err)
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**" << kComponentNameMap.at(cmp) << ": " <<
|
||||
ver_str << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_ROCM_SMI_TEST_FUNCTIONAL_VERSION_READ_H_
|
||||
#define TESTS_ROCM_SMI_TEST_FUNCTIONAL_VERSION_READ_H_
|
||||
|
||||
#include "../test_base.h"
|
||||
|
||||
class TestVersionRead : public TestBase {
|
||||
public:
|
||||
TestVersionRead();
|
||||
|
||||
// @Brief: Destructor for test case of TestVersionRead
|
||||
virtual ~TestVersionRead();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_ROCM_SMI_TEST_FUNCTIONAL_VERSION_READ_H_
|
||||
@@ -1,197 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
#include "volt_freq_curv_read.h"
|
||||
#include "../test_common.h"
|
||||
|
||||
TestVoltCurvRead::TestVoltCurvRead() : TestBase() {
|
||||
set_title("RSMI Voltage-Frequency Curve Read Test");
|
||||
set_description("The Voltage-Frequency Read tests verifies that the voltage"
|
||||
" frequency curve information can be read properly.");
|
||||
}
|
||||
|
||||
TestVoltCurvRead::~TestVoltCurvRead(void) {
|
||||
}
|
||||
|
||||
void TestVoltCurvRead::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestVoltCurvRead::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestVoltCurvRead::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestVoltCurvRead::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// rsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
static void pt_rng_Mhz(std::string title, rsmi_range *r) {
|
||||
assert(r != nullptr);
|
||||
|
||||
std::cout << title << std::endl;
|
||||
std::cout << "\t\t** " << r->lower_bound/1000000 << " to " <<
|
||||
r->upper_bound/1000000 << " MHz" << std::endl;
|
||||
}
|
||||
|
||||
static void pt_rng_mV(std::string title, rsmi_range *r) {
|
||||
assert(r != nullptr);
|
||||
|
||||
std::cout << title << std::endl;
|
||||
std::cout << "\t\t** " << r->lower_bound << " to " << r->upper_bound <<
|
||||
" mV" << std::endl;
|
||||
}
|
||||
|
||||
static void print_pnt(rsmi_od_vddc_point_t *pt) {
|
||||
std::cout << "\t\t** Frequency: " << pt->frequency/1000000 << "MHz" <<
|
||||
std::endl;
|
||||
std::cout << "\t\t** Voltage: " << pt->voltage << "mV" << std::endl;
|
||||
}
|
||||
static void pt_vddc_curve(rsmi_od_volt_curve *c) {
|
||||
assert(c != nullptr);
|
||||
|
||||
for (uint32_t i = 0; i < RSMI_NUM_VOLTAGE_CURVE_POINTS; ++i) {
|
||||
print_pnt(&c->vc_points[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static void print_rsmi_od_volt_freq_data_t(rsmi_od_volt_freq_data_t *odv) {
|
||||
assert(odv != nullptr);
|
||||
|
||||
std::cout.setf(std::ios::dec, std::ios::basefield);
|
||||
pt_rng_Mhz("\t\tCurrent SCLK frequency range:", &odv->curr_sclk_range);
|
||||
pt_rng_Mhz("\t\tCurrent MCLK frequency range:", &odv->curr_mclk_range);
|
||||
pt_rng_Mhz("\t\tMin/Max Possible SCLK frequency range:",
|
||||
&odv->sclk_freq_limits);
|
||||
pt_rng_Mhz("\t\tMin/Max Possible MCLK frequency range:",
|
||||
&odv->mclk_freq_limits);
|
||||
|
||||
std::cout << "\t\tCurrent Freq/Volt. curve:" << std::endl;
|
||||
pt_vddc_curve(&odv->curve);
|
||||
|
||||
std::cout << "\tNumber of Freq./Volt. regions: " <<
|
||||
odv->num_regions << std::endl;
|
||||
}
|
||||
|
||||
static void print_odv_region(rsmi_freq_volt_region_t *region) {
|
||||
pt_rng_Mhz("\t\tFrequency range:", ®ion->freq_range);
|
||||
pt_rng_mV("\t\tVoltage range:", ®ion->volt_range);
|
||||
}
|
||||
|
||||
static void print_rsmi_od_volt_freq_regions(uint32_t num_regions,
|
||||
rsmi_freq_volt_region_t *regions) {
|
||||
for (uint32_t i = 0; i < num_regions; ++i) {
|
||||
std::cout << "\tRegion " << i << ":" << std::endl;
|
||||
print_odv_region(®ions[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void TestVoltCurvRead::Run(void) {
|
||||
rsmi_status_t err;
|
||||
rsmi_od_volt_freq_data_t odv;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(i);
|
||||
|
||||
err = rsmi_dev_od_volt_info_get(i, &odv);
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout <<
|
||||
"\t**rsmi_dev_od_volt_info_get: Not supported on this machine"
|
||||
<< std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_od_volt_info_get(i, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_od_volt_info_get(i, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
if (err == RSMI_STATUS_SUCCESS) {
|
||||
std::cout << "\t**Frequency-voltage curve data:" << std::endl;
|
||||
print_rsmi_od_volt_freq_data_t(&odv);
|
||||
|
||||
rsmi_freq_volt_region_t *regions;
|
||||
uint32_t num_regions;
|
||||
regions = new rsmi_freq_volt_region_t[odv.num_regions];
|
||||
ASSERT_TRUE(regions != nullptr);
|
||||
|
||||
num_regions = odv.num_regions;
|
||||
err = rsmi_dev_od_volt_curve_regions_get(i, &num_regions, regions);
|
||||
CHK_ERR_ASRT(err)
|
||||
ASSERT_TRUE(num_regions == odv.num_regions);
|
||||
|
||||
std::cout << "\t**Frequency-voltage curve regions:" << std::endl;
|
||||
print_rsmi_od_volt_freq_regions(num_regions, regions);
|
||||
|
||||
delete []regions;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_ROCM_SMI_TEST_FUNCTIONAL_VOLT_FREQ_CURV_READ_H_
|
||||
#define TESTS_ROCM_SMI_TEST_FUNCTIONAL_VOLT_FREQ_CURV_READ_H_
|
||||
|
||||
#include "../test_base.h"
|
||||
|
||||
class TestVoltCurvRead : public TestBase {
|
||||
public:
|
||||
TestVoltCurvRead();
|
||||
|
||||
// @Brief: Destructor for test case of TestVoltCurvRead
|
||||
virtual ~TestVoltCurvRead();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_ROCM_SMI_TEST_FUNCTIONAL_VOLT_FREQ_CURV_READ_H_
|
||||
@@ -1,151 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
#include "volt_read.h"
|
||||
#include "../test_common.h"
|
||||
|
||||
|
||||
TestVoltRead::TestVoltRead() : TestBase() {
|
||||
set_title("RSMI Volt Read Test");
|
||||
set_description("The Voltage Read tests verifies that the voltage "
|
||||
"monitors can be read properly.");
|
||||
}
|
||||
|
||||
TestVoltRead::~TestVoltRead(void) {
|
||||
}
|
||||
|
||||
void TestVoltRead::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestVoltRead::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestVoltRead::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestVoltRead::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// rsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
|
||||
void TestVoltRead::Run(void) {
|
||||
rsmi_status_t err;
|
||||
int64_t val_i64;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
rsmi_voltage_type_t type = RSMI_VOLT_TYPE_VDDGFX;
|
||||
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(i);
|
||||
|
||||
auto print_volt_metric = [&](rsmi_voltage_metric_t met,
|
||||
std::string label) {
|
||||
err = rsmi_dev_volt_metric_get(i, type, met, &val_i64);
|
||||
|
||||
if (err != RSMI_STATUS_SUCCESS) {
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**" << label << ": " <<
|
||||
"Not supported on this machine" << std::endl;
|
||||
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_volt_metric_get(i, type, met, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_NOT_SUPPORTED);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_volt_metric_get(i, type, met, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**" << label << ": " << val_i64 <<
|
||||
"mV" << std::endl;
|
||||
}
|
||||
};
|
||||
for (uint32_t i = RSMI_VOLT_TYPE_FIRST; i <= RSMI_VOLT_TYPE_LAST; ++i) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t** **********" <<
|
||||
GetVoltSensorNameStr(static_cast<rsmi_voltage_type_t>(i)) <<
|
||||
" Voltage **********" << std::endl;
|
||||
}
|
||||
print_volt_metric(RSMI_VOLT_CURRENT, "Current Voltage");
|
||||
print_volt_metric(RSMI_VOLT_MAX, "Voltage max value");
|
||||
print_volt_metric(RSMI_VOLT_MIN, "Voltage min value");
|
||||
print_volt_metric(RSMI_VOLT_MAX_CRIT,
|
||||
"Voltage critical max value");
|
||||
print_volt_metric(RSMI_VOLT_MIN_CRIT,
|
||||
"Voltage critical min value");
|
||||
print_volt_metric(RSMI_VOLT_AVERAGE, "Voltage critical max value");
|
||||
print_volt_metric(RSMI_VOLT_LOWEST, "Historical minimum temperature");
|
||||
print_volt_metric(RSMI_VOLT_HIGHEST, "Historical maximum temperature");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_ROCM_SMI_TEST_FUNCTIONAL_VOLT_READ_H_
|
||||
#define TESTS_ROCM_SMI_TEST_FUNCTIONAL_VOLT_READ_H_
|
||||
|
||||
#include "../test_base.h"
|
||||
|
||||
class TestVoltRead : public TestBase {
|
||||
public:
|
||||
TestVoltRead();
|
||||
|
||||
// @Brief: Destructor for test case of TestVOltRead
|
||||
virtual ~TestVoltRead();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_ROCM_SMI_TEST_FUNCTIONAL_VOLT_READ_H_
|
||||
@@ -1,154 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
#include "xgmi_read_write.h"
|
||||
#include "../test_common.h"
|
||||
|
||||
TestXGMIReadWrite::TestXGMIReadWrite() : TestBase() {
|
||||
set_title("RSMI XGMI Read/Write Test");
|
||||
set_description("This test verifies that XGMI error counts can be read"
|
||||
" properly, and that the count can be reset.");
|
||||
}
|
||||
|
||||
TestXGMIReadWrite::~TestXGMIReadWrite(void) {
|
||||
}
|
||||
|
||||
void TestXGMIReadWrite::SetUp(void) {
|
||||
TestBase::SetUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestXGMIReadWrite::DisplayTestInfo(void) {
|
||||
TestBase::DisplayTestInfo();
|
||||
}
|
||||
|
||||
void TestXGMIReadWrite::DisplayResults(void) const {
|
||||
TestBase::DisplayResults();
|
||||
return;
|
||||
}
|
||||
|
||||
void TestXGMIReadWrite::Close() {
|
||||
// This will close handles opened within rsmitst utility calls and call
|
||||
// rsmi_shut_down(), so it should be done after other hsa cleanup
|
||||
TestBase::Close();
|
||||
}
|
||||
|
||||
|
||||
void TestXGMIReadWrite::Run(void) {
|
||||
rsmi_status_t err;
|
||||
rsmi_xgmi_status_t err_stat;
|
||||
uint64_t hive_id;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) {
|
||||
PrintDeviceHeader(dv_ind);
|
||||
|
||||
err = rsmi_dev_xgmi_hive_id_get(dv_ind, &hive_id);
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout <<
|
||||
"\t**rsmi_dev_xgmi_hive_id_get() is not supported"
|
||||
" on this machine" << std::endl;
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_xgmi_hive_id_get(dv_ind, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_NOT_SUPPORTED);
|
||||
|
||||
continue;
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**XGMI Hive ID : " << std::hex << hive_id <<
|
||||
std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_xgmi_hive_id_get(dv_ind, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
}
|
||||
|
||||
err = rsmi_dev_xgmi_error_status(dv_ind, &err_stat);
|
||||
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**XGMI Error Status: Not supported on this machine"
|
||||
<< std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_xgmi_error_status(dv_ind, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_NOT_SUPPORTED);
|
||||
|
||||
continue;
|
||||
}
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**XGMI Error Status: " <<
|
||||
static_cast<uint32_t>(err_stat) << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_xgmi_error_status(dv_ind, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
|
||||
// TODO(cfree) We need to find a way to generate xgmi errors so this
|
||||
// test won't be meaningless
|
||||
err = rsmi_dev_xgmi_error_reset(dv_ind);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Successfully reset XGMI Error Status: " << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_ROCM_SMI_TEST_FUNCTIONAL_XGMI_READ_WRITE_H_
|
||||
#define TESTS_ROCM_SMI_TEST_FUNCTIONAL_XGMI_READ_WRITE_H_
|
||||
|
||||
#include "../test_base.h"
|
||||
|
||||
class TestXGMIReadWrite : public TestBase {
|
||||
public:
|
||||
TestXGMIReadWrite();
|
||||
|
||||
// @Brief: Destructor for test case of TestXGMIReadWrite
|
||||
virtual ~TestXGMIReadWrite();
|
||||
|
||||
// @Brief: Setup the environment for measurement
|
||||
virtual void SetUp();
|
||||
|
||||
// @Brief: Core measurement execution
|
||||
virtual void Run();
|
||||
|
||||
// @Brief: Clean up and retrive the resource
|
||||
virtual void Close();
|
||||
|
||||
// @Brief: Display results
|
||||
virtual void DisplayResults() const;
|
||||
|
||||
// @Brief: Display information about what this test does
|
||||
virtual void DisplayTestInfo(void);
|
||||
};
|
||||
|
||||
#endif // TESTS_ROCM_SMI_TEST_FUNCTIONAL_XGMI_READ_WRITE_H_
|
||||
@@ -1,298 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2018, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <iostream>
|
||||
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
#include <gtest/gtest.h>
|
||||
#include "test_common.h"
|
||||
#include "test_base.h"
|
||||
#include "functional/fan_read.h"
|
||||
#include "functional/fan_read_write.h"
|
||||
#include "functional/temp_read.h"
|
||||
#include "functional/volt_read.h"
|
||||
#include "functional/volt_freq_curv_read.h"
|
||||
#include "functional/perf_level_read.h"
|
||||
#include "functional/overdrive_read.h"
|
||||
#include "functional/frequencies_read.h"
|
||||
#include "functional/sys_info_read.h"
|
||||
#include "functional/gpu_busy_read.h"
|
||||
#include "functional/power_read.h"
|
||||
#include "functional/overdrive_read_write.h"
|
||||
#include "functional/perf_level_read_write.h"
|
||||
#include "functional/frequencies_read_write.h"
|
||||
#include "functional/pci_read_write.h"
|
||||
#include "functional/power_read_write.h"
|
||||
#include "functional/power_cap_read_write.h"
|
||||
#include "functional/version_read.h"
|
||||
#include "functional/err_cnt_read.h"
|
||||
#include "functional/mem_util_read.h"
|
||||
#include "functional/id_info_read.h"
|
||||
#include "functional/perf_cntr_read_write.h"
|
||||
#include "functional/process_info_read.h"
|
||||
#include "functional/xgmi_read_write.h"
|
||||
#include "functional/mem_page_info_read.h"
|
||||
#include "functional/api_support_read.h"
|
||||
#include "functional/mutual_exclusion.h"
|
||||
#include "functional/evt_notif_read_write.h"
|
||||
#include "functional/init_shutdown_refcount.h"
|
||||
#include "functional/hw_topology_read.h"
|
||||
#include "functional/gpu_metrics_read.h"
|
||||
#include "functional/metrics_counter_read.h"
|
||||
#include "functional/perf_determinism.h"
|
||||
|
||||
static RSMITstGlobals *sRSMIGlvalues = nullptr;
|
||||
|
||||
static void SetFlags(TestBase *test) {
|
||||
assert(sRSMIGlvalues != nullptr);
|
||||
|
||||
test->set_verbosity(sRSMIGlvalues->verbosity);
|
||||
test->set_dont_fail(sRSMIGlvalues->dont_fail);
|
||||
test->set_init_options(sRSMIGlvalues->init_options);
|
||||
test->set_num_iterations(sRSMIGlvalues->num_iterations);
|
||||
}
|
||||
|
||||
static void RunCustomTestProlog(TestBase *test) {
|
||||
SetFlags(test);
|
||||
|
||||
if (sRSMIGlvalues->verbosity >= TestBase::VERBOSE_STANDARD) {
|
||||
test->DisplayTestInfo();
|
||||
}
|
||||
test->SetUp();
|
||||
test->Run();
|
||||
return;
|
||||
}
|
||||
static void RunCustomTestEpilog(TestBase *tst) {
|
||||
if (sRSMIGlvalues->verbosity >= TestBase::VERBOSE_STANDARD) {
|
||||
tst->DisplayResults();
|
||||
}
|
||||
tst->Close();
|
||||
return;
|
||||
}
|
||||
|
||||
// If the test case one big test, you should use RunGenericTest()
|
||||
// to run the test case. OTOH, if the test case consists of multiple
|
||||
// functions to be run as separate tests, follow this pattern:
|
||||
// * RunCustomTestProlog(test) // Run() should contain minimal code
|
||||
// * <insert call to actual test function within test case>
|
||||
// * RunCustomTestEpilog(test)
|
||||
static void RunGenericTest(TestBase *test) {
|
||||
RunCustomTestProlog(test);
|
||||
RunCustomTestEpilog(test);
|
||||
return;
|
||||
}
|
||||
|
||||
// TEST ENTRY TEMPLATE:
|
||||
// TEST(rocrtst, Perf_<test name>) {
|
||||
// <Test Implementation class> <test_obj>;
|
||||
//
|
||||
// // Copy and modify implementation of RunGenericTest() if you need to deviate
|
||||
// // from the standard pattern implemented there.
|
||||
// RunGenericTest(&<test_obj>);
|
||||
// }
|
||||
TEST(rsmitstReadOnly, TestVersionRead) {
|
||||
TestVersionRead tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(rsmitstReadOnly, FanRead) {
|
||||
TestFanRead tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(rsmitstReadWrite, FanReadWrite) {
|
||||
TestFanReadWrite tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(rsmitstReadOnly, TempRead) {
|
||||
TestTempRead tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(rsmitstReadOnly, VoltRead) {
|
||||
TestVoltRead tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(rsmitstReadOnly, TestVoltCurvRead) {
|
||||
TestVoltCurvRead tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(rsmitstReadOnly, TestPerfLevelRead) {
|
||||
TestPerfLevelRead tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(rsmitstReadWrite, TestPerfLevelReadWrite) {
|
||||
TestPerfLevelReadWrite tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(rsmitstReadOnly, TestOverdriveRead) {
|
||||
TestOverdriveRead tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(rsmitstReadWrite, TestOverdriveReadWrite) {
|
||||
TestOverdriveReadWrite tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(rsmitstReadOnly, TestFrequenciesRead) {
|
||||
TestFrequenciesRead tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(rsmitstReadWrite, TestFrequenciesReadWrite) {
|
||||
TestFrequenciesReadWrite tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(rsmitstReadWrite, TestPciReadWrite) {
|
||||
TestPciReadWrite tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(rsmitstReadOnly, TestSysInfoRead) {
|
||||
TestSysInfoRead tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(rsmitstReadOnly, TestGPUBusyRead) {
|
||||
TestGPUBusyRead tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(rsmitstReadOnly, TestPowerRead) {
|
||||
TestPowerRead tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(rsmitstReadWrite, TestPowerReadWrite) {
|
||||
TestPowerReadWrite tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(rsmitstReadWrite, TestPowerCapReadWrite) {
|
||||
TestPowerCapReadWrite tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(rsmitstReadOnly, TestErrCntRead) {
|
||||
TestErrCntRead tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(rsmitstReadOnly, TestMemUtilRead) {
|
||||
TestMemUtilRead tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(rsmitstReadOnly, TestIdInfoRead) {
|
||||
TestIdInfoRead tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(rsmitstReadWrite, TestPerfCntrReadWrite) {
|
||||
TestPerfCntrReadWrite tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(rsmitstReadOnly, TestProcInfoRead) {
|
||||
TestProcInfoRead tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(rsmitstReadOnly, TestHWTopologyRead) {
|
||||
TestHWTopologyRead tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(rsmitstReadOnly, TestGpuMetricsRead) {
|
||||
TestGpuMetricsRead tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(rsmitstReadOnly, TestMetricsCounterRead) {
|
||||
TestMetricsCounterRead tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(rsmitstReadWrite, TestPerfDeterminism) {
|
||||
TestPerfDeterminism tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(rsmitstReadWrite, TestXGMIReadWrite) {
|
||||
TestXGMIReadWrite tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(rsmitstReadOnly, TestMemPageInfoRead) {
|
||||
TestMemPageInfoRead tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(rsmitstReadOnly, TestAPISupportRead) {
|
||||
TestAPISupportRead tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(rsmitstReadOnly, TestMutualExclusion) {
|
||||
TestMutualExclusion tst;
|
||||
SetFlags(&tst);
|
||||
tst.DisplayTestInfo();
|
||||
tst.SetUp();
|
||||
tst.Run();
|
||||
RunCustomTestEpilog(&tst);
|
||||
}
|
||||
TEST(rsmitstReadWrite, TestEvtNotifReadWrite) {
|
||||
TestEvtNotifReadWrite tst;
|
||||
RunGenericTest(&tst);
|
||||
}
|
||||
TEST(rsmitstReadOnly, TestConcurrentInit) {
|
||||
TestConcurrentInit tst;
|
||||
SetFlags(&tst);
|
||||
tst.DisplayTestInfo();
|
||||
// tst.SetUp(); // Avoid extra rsmi_init
|
||||
tst.Run();
|
||||
// RunCustomTestEpilog(&tst); // Avoid extra rsmi_shut_down
|
||||
tst.DisplayResults();
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
|
||||
RSMITstGlobals settings;
|
||||
|
||||
// Set some default values
|
||||
settings.verbosity = 1;
|
||||
settings.monitor_verbosity = 1;
|
||||
settings.num_iterations = 1;
|
||||
settings.dont_fail = false;
|
||||
settings.init_options = 0;
|
||||
|
||||
if (ProcessCmdline(&settings, argc, argv)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
sRSMIGlvalues = &settings;
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
declare -A FILTER
|
||||
|
||||
# FILTER is meant to be used with a negative gtest filter
|
||||
|
||||
# Designate the tests to be excluded from all test runs first,
|
||||
# followed by tests that should be excluded by device.
|
||||
|
||||
# Permanent exclusions
|
||||
# These tests are included for debugging, but are not executed in normal
|
||||
# execution on any ASIC:
|
||||
PERMANENT_BLACKLIST_ALL_ASICS=
|
||||
|
||||
# This is the temporary blacklist for all ASICs. This is to be used when a test
|
||||
# is failing consistently
|
||||
TEMPORARY_BLACKLIST_ALL_ASICS=
|
||||
|
||||
if [ -z $PERMANENT_BLACKLIST_ALL_ASICS -a -z $TEMPORARY_BLACKLIST_ALL_ASICS ]; then
|
||||
BLACKLIST_ALL_ASICS=
|
||||
else
|
||||
BLACKLIST_ALL_ASICS=\
|
||||
"$PERMANENT_BLACKLIST_ALL_ASICS:"\
|
||||
"$TEMPORARY_BLACKLIST_ALL_ASICS"
|
||||
fi
|
||||
|
||||
# Device specific blacklists
|
||||
FILTER[vega10]=\
|
||||
$BLACKLIST_ALL_ASICS
|
||||
|
||||
# SWDEV-207510
|
||||
FILTER[vega20]=\
|
||||
$BLACKLIST_ALL_ASICS\
|
||||
"rsmitstReadOnly.TestFrequenciesRead:"\
|
||||
"rsmitstReadOnly.TestProcInfoRead"
|
||||
|
||||
# SWDEV-207510
|
||||
FILTER[arcturus]=\
|
||||
$BLACKLIST_ALL_ASICS\
|
||||
"rsmitstReadOnly.TestFrequenciesRead:"\
|
||||
"rsmitstReadWrite.TestFrequenciesReadWrite:"\
|
||||
"rsmitstReadOnly.TestProcInfoRead"
|
||||
|
||||
# SWDEV-306889
|
||||
FILTER[aldebaran]=\
|
||||
$BLACKLIST_ALL_ASICS\
|
||||
"rsmitstReadOnly.FanRead:"\
|
||||
"rsmitstReadOnly.TestVoltCurvRead:"\
|
||||
"rsmitstReadOnly.TestFrequenciesRead:"\
|
||||
"rsmitstReadWrite.FanReadWrite:"\
|
||||
"rsmitstReadWrite.TestFrequenciesReadWrite:"\
|
||||
"rsmitstReadWrite.TestPciReadWrite:"\
|
||||
"rsmitstReadWrite.TestPowerReadWrite"
|
||||
|
||||
# SWDEV-319795
|
||||
FILTER[sienna_cichlid]=\
|
||||
$BLACKLIST_ALL_ASICS\
|
||||
"rsmitstReadWrite.TestPerfLevelReadWrite"
|
||||
|
||||
# SWDEV-321166
|
||||
FILTER[virtualization]=\
|
||||
$BLACKLIST_ALL_ASICS\
|
||||
"rsmitstReadOnly.TestOverdriveRead:"\
|
||||
"rsmitstReadOnly.TestGPUBusyRead:"\
|
||||
"rsmitstReadWrite.FanReadWrite:"\
|
||||
"rsmitstReadWrite.TestOverdriveReadWrite:"\
|
||||
"rsmitstReadWrite.TestPowerReadWrite:"\
|
||||
"rsmitstReadWrite.TestPowerCapReadWrite"
|
||||
@@ -1,215 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2017, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
#include "test_base.h"
|
||||
#include "test_common.h"
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
static const int kOutputLineLength = 80;
|
||||
static const char kLabelDelimiter[] = "####";
|
||||
static const char kDescriptionLabel[] = "TEST DESCRIPTION";
|
||||
static const char kTitleLabel[] = "TEST NAME";
|
||||
static const char kRunLabel[] = "TEST EXECUTION";
|
||||
static const char kCloseLabel[] = "TEST CLEAN UP";
|
||||
static const char kResultsLabel[] = "TEST RESULTS";
|
||||
|
||||
// This one is used outside this file
|
||||
const char kSetupLabel[] = "TEST SETUP";
|
||||
|
||||
TestBase::TestBase() : setup_failed_(false), description_("") {
|
||||
}
|
||||
TestBase::~TestBase() {
|
||||
}
|
||||
|
||||
void TestBase::MakeHeaderStr(const char *inStr,
|
||||
std::string *outStr) const {
|
||||
assert(outStr != nullptr);
|
||||
assert(inStr != nullptr);
|
||||
outStr->clear();
|
||||
IF_VERB(STANDARD) {
|
||||
*outStr = kLabelDelimiter;
|
||||
*outStr += " ";
|
||||
*outStr += inStr;
|
||||
*outStr += " ";
|
||||
*outStr += kLabelDelimiter;
|
||||
}
|
||||
}
|
||||
|
||||
void TestBase::SetUp(void) {
|
||||
SetUp(0);
|
||||
}
|
||||
|
||||
void TestBase::SetUp(uint64_t init_flags) {
|
||||
std::string label;
|
||||
rsmi_status_t err;
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
MakeHeaderStr(kSetupLabel, &label);
|
||||
printf("\n\t%s\n", label.c_str());
|
||||
}
|
||||
|
||||
if (init_flags) {
|
||||
err = rsmi_init(init_flags);
|
||||
} else {
|
||||
err = rsmi_init(init_options());
|
||||
}
|
||||
|
||||
if (err != RSMI_STATUS_SUCCESS) {
|
||||
setup_failed_ = true;
|
||||
}
|
||||
ASSERT_EQ(err, RSMI_STATUS_SUCCESS);
|
||||
|
||||
err = rsmi_num_monitor_devices(&num_monitor_devs_);
|
||||
if (err != RSMI_STATUS_SUCCESS) {
|
||||
setup_failed_ = true;
|
||||
}
|
||||
ASSERT_EQ(err, RSMI_STATUS_SUCCESS);
|
||||
|
||||
if (num_monitor_devs_ == 0) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "No monitor devices found on this machine." << std::endl;
|
||||
std::cout << "No ROCm SMI tests can be run." << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestBase::PrintDeviceHeader(uint32_t dv_ind) {
|
||||
rsmi_status_t err;
|
||||
uint16_t val_ui16;
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Device index: " << dv_ind << std::endl;
|
||||
}
|
||||
err = rsmi_dev_id_get(dv_ind, &val_ui16);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Device ID: 0x" << std::hex << val_ui16 << std::endl;
|
||||
}
|
||||
char name[128];
|
||||
err = rsmi_dev_name_get(dv_ind, name, 128);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Device name: " << name << std::endl;
|
||||
}
|
||||
err = rsmi_dev_vendor_id_get(dv_ind, &val_ui16);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Device Vendor ID: 0x" << std::hex << val_ui16 <<
|
||||
std::endl;
|
||||
}
|
||||
err = rsmi_dev_subsystem_id_get(dv_ind, &val_ui16);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Subsystem ID: 0x" << std::hex << val_ui16 << std::endl;
|
||||
}
|
||||
err = rsmi_dev_subsystem_vendor_id_get(dv_ind, &val_ui16);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Subsystem Vendor ID: 0x" << std::hex << val_ui16 <<
|
||||
std::endl;
|
||||
}
|
||||
std::cout << std::setbase(10);
|
||||
}
|
||||
void TestBase::Run(void) {
|
||||
std::string label;
|
||||
IF_VERB(STANDARD) {
|
||||
MakeHeaderStr(kRunLabel, &label);
|
||||
printf("\n\t%s\n", label.c_str());
|
||||
}
|
||||
ASSERT_TRUE(!setup_failed_);
|
||||
}
|
||||
|
||||
void TestBase::Close(void) {
|
||||
std::string label;
|
||||
IF_VERB(STANDARD) {
|
||||
MakeHeaderStr(kCloseLabel, &label);
|
||||
printf("\n\t%s\n", label.c_str());
|
||||
}
|
||||
rsmi_status_t err = rsmi_shut_down();
|
||||
ASSERT_EQ(err, RSMI_STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
void TestBase::DisplayResults(void) const {
|
||||
std::string label;
|
||||
IF_VERB(STANDARD) {
|
||||
MakeHeaderStr(kResultsLabel, &label);
|
||||
printf("\n\t%s\n", label.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void TestBase::DisplayTestInfo(void) {
|
||||
IF_VERB(STANDARD) {
|
||||
printf("#########################################"
|
||||
"######################################\n");
|
||||
|
||||
std::string label;
|
||||
MakeHeaderStr(kTitleLabel, &label);
|
||||
printf("\n\t%s\n%s\n", label.c_str(), title().c_str());
|
||||
|
||||
if (verbosity() >= VERBOSE_STANDARD) {
|
||||
MakeHeaderStr(kDescriptionLabel, &label);
|
||||
printf("\n\t%s\n%s\n", label.c_str(), description().c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TestBase::set_description(std::string d) {
|
||||
int le = kOutputLineLength - 4;
|
||||
|
||||
description_ = d;
|
||||
size_t endlptr;
|
||||
|
||||
for (size_t i = le; i < description_.size(); i += le) {
|
||||
endlptr = description_.find_last_of(" ", i);
|
||||
description_.replace(endlptr, 1, "\n");
|
||||
i = endlptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,153 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2018, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
#ifndef TESTS_ROCM_SMI_TEST_TEST_BASE_H_
|
||||
#define TESTS_ROCM_SMI_TEST_TEST_BASE_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
class TestBase {
|
||||
public:
|
||||
TestBase(void);
|
||||
|
||||
virtual ~TestBase(void);
|
||||
|
||||
enum VerboseLevel {VERBOSE_MIN = 0, VERBOSE_STANDARD, VERBOSE_PROGRESS};
|
||||
|
||||
// @Brief: Before run the core measure codes, do something to set up
|
||||
// i.e. init runtime, prepare packet...
|
||||
// The init_flags option will override any flags set for the whole test
|
||||
// suite
|
||||
void SetUp(uint64_t init_flags);
|
||||
virtual void SetUp(void);
|
||||
|
||||
// @Brief: Core measurement codes executing here
|
||||
virtual void Run(void);
|
||||
|
||||
// @Brief: Do something clean up
|
||||
virtual void Close(void);
|
||||
|
||||
// @Brief: Display the results
|
||||
virtual void DisplayResults(void) const;
|
||||
|
||||
// @Brief: Display information about the test
|
||||
virtual void DisplayTestInfo(void);
|
||||
|
||||
const std::string & description(void) const {return description_;}
|
||||
|
||||
void set_description(std::string d);
|
||||
|
||||
void set_title(std::string name) {
|
||||
title_ = name;
|
||||
}
|
||||
std::string title(void) const {
|
||||
return title_;
|
||||
}
|
||||
void set_verbosity(uint32_t v) {
|
||||
verbosity_ = v;
|
||||
}
|
||||
uint32_t verbosity(void) const {
|
||||
return verbosity_;
|
||||
}
|
||||
void set_dont_fail(bool f) {
|
||||
dont_fail_ = f;
|
||||
}
|
||||
bool dont_fail(void) const {
|
||||
return dont_fail_;
|
||||
}
|
||||
void set_num_monitor_devs(uint32_t i) {
|
||||
num_monitor_devs_ = i;
|
||||
}
|
||||
uint32_t num_monitor_devs(void) const {
|
||||
return num_monitor_devs_;
|
||||
}
|
||||
void set_init_options(uint64_t x) {
|
||||
init_options_ = x;
|
||||
}
|
||||
uint64_t init_options(void) const {
|
||||
return init_options_;
|
||||
}
|
||||
void set_num_iterations(uint32_t x) {
|
||||
num_iterations_ = x;
|
||||
}
|
||||
uint32_t num_iterations(void) const {
|
||||
return num_iterations_;
|
||||
}
|
||||
|
||||
protected:
|
||||
void MakeHeaderStr(const char *inStr, std::string *outStr) const;
|
||||
void PrintDeviceHeader(uint32_t dv_ind);
|
||||
bool setup_failed_; ///< Record that setup failed to return ierr in Run
|
||||
uint32_t num_monitor_devs_; ///< Number of monitor devices found
|
||||
|
||||
private:
|
||||
std::string description_;
|
||||
std::string title_; ///< Displayed title of test
|
||||
uint32_t verbosity_; ///< How much additional output to produce
|
||||
bool dont_fail_; ///< Don't quit test on individual failure if true
|
||||
uint64_t init_options_; ///< rsmi initialization options
|
||||
uint32_t num_iterations_;
|
||||
};
|
||||
|
||||
#define IF_VERB(VB) if (verbosity() && verbosity() >= (TestBase::VERBOSE_##VB))
|
||||
#define IF_NVERB(VB) if (verbosity() < (TestBase::VERBOSE_##VB))
|
||||
|
||||
// Macros to be used within TestBase classes
|
||||
#define CHK_ERR_ASRT(RET) { \
|
||||
if (dont_fail() && ((RET) != RSMI_STATUS_SUCCESS)) { \
|
||||
std::cout << std::endl << "\t===> TEST FAILURE." << std::endl; \
|
||||
DISPLAY_RSMI_ERR(RET); \
|
||||
std::cout << \
|
||||
"\t===> Abort is over-ridden due to dont_fail command line option." \
|
||||
<< std::endl; \
|
||||
return; \
|
||||
} else { \
|
||||
ASSERT_EQ(RSMI_STATUS_SUCCESS, (RET)); \
|
||||
} \
|
||||
}
|
||||
|
||||
void MakeHeaderStr(const char *inStr, std::string *outStr);
|
||||
extern const char kSetupLabel[];
|
||||
|
||||
#endif // TESTS_ROCM_SMI_TEST_TEST_BASE_H_
|
||||
@@ -1,314 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2017, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
#include <getopt.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#include "test_base.h"
|
||||
#include "test_common.h"
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
|
||||
static const std::map<rsmi_dev_perf_level_t, const char *>
|
||||
kDevPerfLvlNameMap = {
|
||||
{RSMI_DEV_PERF_LEVEL_AUTO, "RSMI_DEV_PERF_LEVEL_AUTO"},
|
||||
{RSMI_DEV_PERF_LEVEL_LOW, "RSMI_DEV_PERF_LEVEL_LOW"},
|
||||
{RSMI_DEV_PERF_LEVEL_HIGH, "RSMI_DEV_PERF_LEVEL_HIGH"},
|
||||
{RSMI_DEV_PERF_LEVEL_MANUAL, "RSMI_DEV_PERF_LEVEL_MANUAL"},
|
||||
{RSMI_DEV_PERF_LEVEL_STABLE_STD, "RSMI_DEV_PERF_LEVEL_STABLE_STD"},
|
||||
{RSMI_DEV_PERF_LEVEL_STABLE_PEAK, "RSMI_DEV_PERF_LEVEL_STABLE_PEAK"},
|
||||
{RSMI_DEV_PERF_LEVEL_STABLE_MIN_MCLK,
|
||||
"RSMI_DEV_PERF_LEVEL_STABLE_MIN_MCLK"},
|
||||
{RSMI_DEV_PERF_LEVEL_STABLE_MIN_SCLK,
|
||||
"RSMI_DEV_PERF_LEVEL_STABLE_MIN_SCLK"},
|
||||
{RSMI_DEV_PERF_LEVEL_DETERMINISM, "RSMI_DEV_PERF_LEVEL_DETERMINISM"},
|
||||
|
||||
{RSMI_DEV_PERF_LEVEL_UNKNOWN, "RSMI_DEV_PERF_LEVEL_UNKNOWN"},
|
||||
};
|
||||
// If the assert below fails, the map above needs to be updated to match
|
||||
// rsmi_dev_perf_level_t.
|
||||
static_assert(RSMI_DEV_PERF_LEVEL_LAST == RSMI_DEV_PERF_LEVEL_DETERMINISM,
|
||||
"kDevPerfLvlNameMap needs to be updated");
|
||||
|
||||
static const std::map<rsmi_gpu_block_t, const char *> kBlockNameMap = {
|
||||
{RSMI_GPU_BLOCK_UMC, "UMC"},
|
||||
{RSMI_GPU_BLOCK_SDMA, "SDMA"},
|
||||
{RSMI_GPU_BLOCK_GFX, "GFX"},
|
||||
{RSMI_GPU_BLOCK_MMHUB, "MMHUB"},
|
||||
{RSMI_GPU_BLOCK_ATHUB, "ATHUB"},
|
||||
{RSMI_GPU_BLOCK_PCIE_BIF, "PCIE_BIF"},
|
||||
{RSMI_GPU_BLOCK_HDP, "HDP"},
|
||||
{RSMI_GPU_BLOCK_XGMI_WAFL, "XGMI_WAFL"},
|
||||
{RSMI_GPU_BLOCK_DF, "DF"},
|
||||
{RSMI_GPU_BLOCK_SMN, "SMN"},
|
||||
{RSMI_GPU_BLOCK_SEM, "SEM"},
|
||||
{RSMI_GPU_BLOCK_MP0, "MP0"},
|
||||
{RSMI_GPU_BLOCK_MP1, "MP1"},
|
||||
{RSMI_GPU_BLOCK_FUSE, "FUSE"},
|
||||
};
|
||||
static_assert(RSMI_GPU_BLOCK_LAST == RSMI_GPU_BLOCK_FUSE,
|
||||
"kBlockNameMap needs to be updated");
|
||||
|
||||
static const char * kRasErrStateStrings[] = {
|
||||
"None", // RSMI_RAS_ERR_STATE_NONE
|
||||
"Disabled", // RSMI_RAS_ERR_STATE_DISABLED
|
||||
"Error Unknown", // RSMI_RAS_ERR_STATE_PARITY
|
||||
"Single, Correctable", // RSMI_RAS_ERR_STATE_SING_C
|
||||
"Multiple, Uncorrectable", // RSMI_RAS_ERR_STATE_MULT_UC
|
||||
"Poison", // RSMI_RAS_ERR_STATE_POISON
|
||||
"Enabled", // RSMI_RAS_ERR_STATE_ENABLED
|
||||
};
|
||||
static_assert(
|
||||
sizeof(kRasErrStateStrings)/sizeof(char *) == (RSMI_RAS_ERR_STATE_LAST + 1),
|
||||
"kErrStateNameMap needs to be updated");
|
||||
|
||||
|
||||
static const std::map<rsmi_ras_err_state_t, const char *> kErrStateNameMap = {
|
||||
{RSMI_RAS_ERR_STATE_NONE,
|
||||
kRasErrStateStrings[RSMI_RAS_ERR_STATE_NONE]},
|
||||
{RSMI_RAS_ERR_STATE_DISABLED,
|
||||
kRasErrStateStrings[RSMI_RAS_ERR_STATE_DISABLED]},
|
||||
{RSMI_RAS_ERR_STATE_PARITY,
|
||||
kRasErrStateStrings[RSMI_RAS_ERR_STATE_PARITY]},
|
||||
{RSMI_RAS_ERR_STATE_SING_C,
|
||||
kRasErrStateStrings[RSMI_RAS_ERR_STATE_SING_C]},
|
||||
{RSMI_RAS_ERR_STATE_MULT_UC,
|
||||
kRasErrStateStrings[RSMI_RAS_ERR_STATE_MULT_UC]},
|
||||
{RSMI_RAS_ERR_STATE_POISON,
|
||||
kRasErrStateStrings[RSMI_RAS_ERR_STATE_POISON]},
|
||||
{RSMI_RAS_ERR_STATE_ENABLED,
|
||||
kRasErrStateStrings[RSMI_RAS_ERR_STATE_ENABLED]},
|
||||
};
|
||||
static_assert(RSMI_RAS_ERR_STATE_LAST == RSMI_RAS_ERR_STATE_ENABLED,
|
||||
"kErrStateNameMap needs to be updated");
|
||||
|
||||
static const struct option long_options[] = {
|
||||
{"iterations", required_argument, nullptr, 'i'},
|
||||
{"verbose", required_argument, nullptr, 'v'},
|
||||
{"monitor_verbose", required_argument, nullptr, 'm'},
|
||||
{"dont_fail", no_argument, nullptr, 'f'},
|
||||
{"rsmitst_help", no_argument, nullptr, 'r'},
|
||||
|
||||
{nullptr, 0, nullptr, 0}
|
||||
};
|
||||
static const char* short_options = "i:v:m:fr";
|
||||
|
||||
static const std::map<uint32_t, std::string> kVoltSensorNameMap = {
|
||||
{RSMI_VOLT_TYPE_VDDGFX, "Vddgfx"},
|
||||
};
|
||||
|
||||
static void PrintHelp(void) {
|
||||
std::cout <<
|
||||
"Optional rsmitst Arguments:\n"
|
||||
"--dont_fail, -f if set, don't fail test when individual test fails; "
|
||||
"default is to fail when an individual test fails\n"
|
||||
"--rsmitst_help, -r print this help message\n"
|
||||
"--verbosity, -v <verbosity level>\n"
|
||||
" Verbosity levels:\n"
|
||||
" 0 -- minimal; just summary information\n"
|
||||
" 1 -- intermediate; show intermediate values such as intermediate "
|
||||
"perf. data\n"
|
||||
" 2 -- progress; show progress displays\n"
|
||||
" >= 3 -- more debug output\n";
|
||||
}
|
||||
|
||||
uint32_t ProcessCmdline(RSMITstGlobals* test, int arg_cnt, char** arg_list) {
|
||||
int a;
|
||||
int ind = -1;
|
||||
|
||||
assert(test != nullptr);
|
||||
|
||||
while (true) {
|
||||
a = getopt_long(arg_cnt, arg_list, short_options, long_options, &ind);
|
||||
|
||||
if (a == -1) {
|
||||
break;
|
||||
}
|
||||
|
||||
switch (a) {
|
||||
case 'i':
|
||||
test->num_iterations = std::stoi(optarg);
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
test->verbosity = std::stoi(optarg);
|
||||
break;
|
||||
|
||||
case 'm':
|
||||
test->monitor_verbosity = std::stoi(optarg);
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
PrintHelp();
|
||||
return 1;
|
||||
|
||||
case 'f':
|
||||
test->dont_fail = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
std::cout << "Unknown command line option: \"" << a <<
|
||||
"\". Ignoring..." << std::endl;
|
||||
PrintHelp();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char *GetPerfLevelStr(rsmi_dev_perf_level_t lvl) {
|
||||
return kDevPerfLvlNameMap.at(lvl);
|
||||
}
|
||||
const char *GetBlockNameStr(rsmi_gpu_block_t id) {
|
||||
return kBlockNameMap.at(id);
|
||||
}
|
||||
const char *GetErrStateNameStr(rsmi_ras_err_state_t st) {
|
||||
return kErrStateNameMap.at(st);
|
||||
}
|
||||
const std::string GetVoltSensorNameStr(rsmi_voltage_type_t st) {
|
||||
return kVoltSensorNameMap.at(st);
|
||||
}
|
||||
const char *FreqEnumToStr(rsmi_clk_type rsmi_clk) {
|
||||
static_assert(RSMI_CLK_TYPE_LAST == RSMI_CLK_TYPE_MEM,
|
||||
"FreqEnumToStr() needs to be updated");
|
||||
switch (rsmi_clk) {
|
||||
case RSMI_CLK_TYPE_SYS: return "System clock";
|
||||
case RSMI_CLK_TYPE_DF: return "Data Fabric clock";
|
||||
case RSMI_CLK_TYPE_DCEF: return "Display Controller Engine clock";
|
||||
case RSMI_CLK_TYPE_SOC: return "SOC clock";
|
||||
case RSMI_CLK_TYPE_MEM: return "Memory clock";
|
||||
default: return "Invalid Clock ID";
|
||||
}
|
||||
}
|
||||
|
||||
#if ENABLE_SMI
|
||||
void DumpMonitorInfo(const TestBase *test) {
|
||||
int ret = 0;
|
||||
uint32_t value;
|
||||
uint32_t value2;
|
||||
std::string val_str;
|
||||
std::vector<std::string> val_vec;
|
||||
|
||||
assert(test != nullptr);
|
||||
assert(test->monitor_devices() != nullptr &&
|
||||
"Make sure to call test->set_monitor_devices()");
|
||||
auto print_attr_label =
|
||||
[&](std::string attrib) -> bool {
|
||||
std::cout << "\t** " << attrib;
|
||||
if (ret == -1) {
|
||||
std::cout << "not available" << std::endl;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
auto delim = "\t***********************************";
|
||||
|
||||
std::cout << "\t***** Hardware monitor values *****" << std::endl;
|
||||
std::cout << delim << std::endl;
|
||||
std::cout.setf(std::ios::dec, std::ios::basefield);
|
||||
for (auto dev : *test->monitor_devices()) {
|
||||
auto print_vector =
|
||||
[&](amd::smi::DevInfoTypes type, std::string label) {
|
||||
ret = dev->readDevInfo(type, &val_vec);
|
||||
if (print_attr_label(label)) {
|
||||
for (auto vs : val_vec) {
|
||||
std::cout << "\t** " << vs << std::endl;
|
||||
}
|
||||
val_vec.clear();
|
||||
}
|
||||
};
|
||||
auto print_val_str =
|
||||
[&](amd::smi::DevInfoTypes type, std::string label) {
|
||||
ret = dev->readDevInfo(type, &val_str);
|
||||
|
||||
std::cout << "\t** " << label;
|
||||
if (ret == -1) {
|
||||
std::cout << "not available";
|
||||
} else {
|
||||
std::cout << val_str;
|
||||
}
|
||||
std::cout << std:: endl;
|
||||
};
|
||||
|
||||
print_val_str(amd::smi::kDevDevID, "Device ID: ");
|
||||
print_val_str(amd::smi::kDevPerfLevel, "Performance Level: ");
|
||||
print_val_str(amd::smi::kDevOverDriveLevel, "OverDrive Level: ");
|
||||
print_vector(amd::smi::kDevGPUMClk,
|
||||
"Supported GPU Memory clock frequencies:\n");
|
||||
print_vector(amd::smi::kDevGPUSClk,
|
||||
"Supported GPU clock frequencies:\n");
|
||||
|
||||
if (dev->monitor() != nullptr) {
|
||||
ret = dev->monitor()->readMonitor(amd::smi::kMonName, &val_str);
|
||||
if (print_attr_label("Monitor name: ")) {
|
||||
std::cout << val_str << std::endl;
|
||||
}
|
||||
|
||||
ret = dev->monitor()->readMonitor(amd::smi::kMonTemp, &value);
|
||||
if (print_attr_label("Temperature: ")) {
|
||||
std::cout << static_cast<float>(value)/1000.0 << "C" << std::endl;
|
||||
}
|
||||
|
||||
std::cout.setf(std::ios::dec, std::ios::basefield);
|
||||
|
||||
ret = dev->monitor()->readMonitor(amd::smi::kMonMaxFanSpeed, &value);
|
||||
if (ret == 0) {
|
||||
ret = dev->monitor()->readMonitor(amd::smi::kMonFanSpeed, &value2);
|
||||
}
|
||||
if (print_attr_label("Current Fan Speed: ")) {
|
||||
std::cout << value2/static_cast<float>(value) * 100 << "% (" <<
|
||||
value2 << "/" << value << ")" << std::endl;
|
||||
}
|
||||
}
|
||||
std::cout << "\t=======" << std::endl;
|
||||
}
|
||||
std::cout << delim << std::endl;
|
||||
}
|
||||
#endif
|
||||
@@ -1,101 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2018, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TESTS_ROCM_SMI_TEST_TEST_COMMON_H_
|
||||
#define TESTS_ROCM_SMI_TEST_TEST_COMMON_H_
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
|
||||
struct RSMITstGlobals {
|
||||
uint32_t verbosity;
|
||||
uint32_t monitor_verbosity;
|
||||
uint32_t num_iterations;
|
||||
uint64_t init_options;
|
||||
bool dont_fail;
|
||||
};
|
||||
|
||||
uint32_t ProcessCmdline(RSMITstGlobals* test, int arg_cnt, char** arg_list);
|
||||
|
||||
void PrintTestHeader(uint32_t dv_ind);
|
||||
const char *GetPerfLevelStr(rsmi_dev_perf_level_t lvl);
|
||||
const char *GetBlockNameStr(rsmi_gpu_block_t id);
|
||||
const char *GetErrStateNameStr(rsmi_ras_err_state_t st);
|
||||
const char *FreqEnumToStr(rsmi_clk_type rsmi_clk);
|
||||
const std::string GetVoltSensorNameStr(rsmi_voltage_type_t st);
|
||||
|
||||
#if ENABLE_SMI
|
||||
void DumpMonitorInfo(const TestBase *test);
|
||||
#endif
|
||||
|
||||
#define DISPLAY_RSMI_ERR(RET) { \
|
||||
if (RET != RSMI_STATUS_SUCCESS) { \
|
||||
const char *err_str; \
|
||||
std::cout << "\t===> ERROR: RSMI call returned " << (RET) << std::endl; \
|
||||
rsmi_status_string((RET), &err_str); \
|
||||
std::cout << "\t===> (" << err_str << ")" << std::endl; \
|
||||
std::cout << "\t===> at " << __FILE__ << ":" << std::dec << __LINE__ << \
|
||||
std::endl; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define CHK_ERR_RET(RET) { \
|
||||
DISPLAY_RSMI_ERR(RET) \
|
||||
if ((RET) != RSMI_STATUS_SUCCESS) { \
|
||||
return (RET); \
|
||||
} \
|
||||
}
|
||||
#define CHK_RSMI_PERM_ERR(RET) { \
|
||||
if (RET == RSMI_STATUS_PERMISSION) { \
|
||||
std::cout << "This command requires root access." << std::endl; \
|
||||
} else { \
|
||||
DISPLAY_RSMI_ERR(RET) \
|
||||
} \
|
||||
}
|
||||
|
||||
#endif // TESTS_ROCM_SMI_TEST_TEST_COMMON_H_
|
||||
@@ -1,90 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <map>
|
||||
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
#include "test_utils.h"
|
||||
|
||||
static const std::map<rsmi_fw_block_t, const char *> kDevFWNameMap = {
|
||||
{RSMI_FW_BLOCK_ASD, "asd"},
|
||||
{RSMI_FW_BLOCK_CE, "ce"},
|
||||
{RSMI_FW_BLOCK_DMCU, "dmcu"},
|
||||
{RSMI_FW_BLOCK_MC, "mc"},
|
||||
{RSMI_FW_BLOCK_ME, "me"},
|
||||
{RSMI_FW_BLOCK_MEC, "mec"},
|
||||
{RSMI_FW_BLOCK_MEC2, "mec2"},
|
||||
{RSMI_FW_BLOCK_PFP, "pfp"},
|
||||
{RSMI_FW_BLOCK_RLC, "rlc"},
|
||||
{RSMI_FW_BLOCK_RLC_SRLC, "rlc_srlc"},
|
||||
{RSMI_FW_BLOCK_RLC_SRLG, "rlc_srlg"},
|
||||
{RSMI_FW_BLOCK_RLC_SRLS, "rlc_srls"},
|
||||
{RSMI_FW_BLOCK_SDMA, "sdma"},
|
||||
{RSMI_FW_BLOCK_SDMA2, "sdma2"},
|
||||
{RSMI_FW_BLOCK_SMC, "smc"},
|
||||
{RSMI_FW_BLOCK_SOS, "sos"},
|
||||
{RSMI_FW_BLOCK_TA_RAS, "ta_ras"},
|
||||
{RSMI_FW_BLOCK_TA_XGMI, "ta_xgmi"},
|
||||
{RSMI_FW_BLOCK_UVD, "uvd"},
|
||||
{RSMI_FW_BLOCK_VCE, "vce"},
|
||||
{RSMI_FW_BLOCK_VCN, "vcn"},
|
||||
};
|
||||
|
||||
const char *
|
||||
NameFromFWEnum(rsmi_fw_block_t blk) {
|
||||
return kDevFWNameMap.at(blk);
|
||||
}
|
||||
|
||||
static const std::map<rsmi_evt_notification_type_t, const char *>
|
||||
kEvtNotifEvntNameMap = {
|
||||
{RSMI_EVT_NOTIF_VMFAULT, "RSMI_EVT_NOTIF_VMFAULT"},
|
||||
{RSMI_EVT_NOTIF_THERMAL_THROTTLE, "RSMI_EVT_NOTIF_THERMAL_THROTTLE"},
|
||||
{RSMI_EVT_NOTIF_GPU_PRE_RESET, "RSMI_EVT_NOTIF_GPU_PRE_RESET"},
|
||||
{RSMI_EVT_NOTIF_GPU_POST_RESET, "RSMI_EVT_NOTIF_GPU_POST_RESET"},
|
||||
};
|
||||
const char *
|
||||
NameFromEvtNotifType(rsmi_evt_notification_type_t evt) {
|
||||
return kEvtNotifEvntNameMap.at(evt);
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* ROC Runtime Conformance Release License
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TESTS_ROCM_SMI_TEST_TEST_UTILS_H_
|
||||
#define TESTS_ROCM_SMI_TEST_TEST_UTILS_H_
|
||||
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
|
||||
const char *
|
||||
NameFromFWEnum(rsmi_fw_block_t blk);
|
||||
const char *
|
||||
NameFromEvtNotifType(rsmi_evt_notification_type_t evt);
|
||||
|
||||
#endif // TESTS_ROCM_SMI_TEST_TEST_UTILS_H_
|
||||
Reference in New Issue
Block a user