Add xgmi error_status and error_reset functions

Also, comment corrections and added check for invalid arguments

Change-Id: I891cbf9b37bfda629914a008811b840323872c02


[ROCm/amdsmi commit: 557e1f5704]
Bu işleme şunda yer alıyor:
Chris Freehill
2019-07-09 08:46:08 -05:00
ebeveyn df93edbbc0
işleme 64f22d2749
8 değiştirilmiş dosya ile 320 ekleme ve 1 silme
+123
Dosyayı Görüntüle
@@ -0,0 +1,123 @@
/*
* =============================================================================
* 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 "rocm_smi_test/functional/xgmi_read_write.h"
#include "rocm_smi_test/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;
TestBase::Run();
for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) {
PrintDeviceHeader(dv_ind);
err = rsmi_dev_xgmi_error_status(dv_ind, &err_stat);
if (err != RSMI_STATUS_SUCCESS) {
if (err == RSMI_STATUS_NOT_SUPPORTED) {
IF_VERB(STANDARD) {
std::cout << "\t**XGMI Error Status: Not supported on this machine"
<< std::endl;
return;
}
} else {
CHK_ERR_ASRT(err)
}
} else {
IF_VERB(STANDARD) {
std::cout << "\t**XGMI Error Status: " <<
static_cast<uint32_t>(err_stat) << std::endl;
}
}
// 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;
}
}
}
+73
Dosyayı Görüntüle
@@ -0,0 +1,73 @@
/*
* =============================================================================
* 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 "rocm_smi_test/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_
+5
Dosyayı Görüntüle
@@ -74,6 +74,7 @@
#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"
static RSMITstGlobals *sRSMIGlvalues = nullptr;
@@ -208,6 +209,10 @@ TEST(rsmitstReadOnly, TestProcInfoRead) {
TestProcInfoRead tst;
RunGenericTest(&tst);
}
TEST(rsmitstReadWrite, TestXGMIReadWrite) {
TestXGMIReadWrite tst;
RunGenericTest(&tst);
}
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);