Support GPU memory test and compute queue test using Rocr

A new diagnostic module librdc_rocr.so is created. The
module uses Rocr to test the memory allocation, memory access
and compute queue ready status.

Change-Id: I9098f4fc3209bf381b7cb3658a4e94c2e22f2fe9
Cette révision appartient à :
Bill(Shuzhou) Liu
2021-09-16 15:38:37 -04:00
révisé par Shuzhou Liu
Parent 6ab71e1a4a
révision 78e2f2486b
74 fichiers modifiés avec 4811 ajouts et 25 suppressions
+88
Voir le fichier
@@ -0,0 +1,88 @@
/*
Copyright (c) 2021 - present Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in 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:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
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
AUTHORS 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 IN
THE SOFTWARE.
*/
#ifndef INCLUDE_RDC_LIB_RDCRdcPerfTimer_H_
#define INCLUDE_RDC_LIB_RDCRdcPerfTimer_H_
#include <stdint.h>
#include <iostream>
#include <vector>
#include <string>
/// \file
/// Timer related class.
namespace amd {
namespace rdc {
class RdcPerfTimer {
private:
struct Timer {
std::string name; /* < name name of time object*/
uint64_t _freq; /* < _freq frequency*/
uint64_t _clocks; /* < _clocks number of ticks at end*/
uint64_t _start; /* < _start start point ticks*/
};
std::vector<Timer*> _timers; /*< _timers vector to Timer objects */
double freq_in_100mhz;
public:
RdcPerfTimer(void);
~RdcPerfTimer(void);
/// Create a new timer.
/// \returns A new timer instance index
int CreateTimer(void);
/// Start the timer associated with the given index
/// \param[in] index Index of the timer to start
/// \returns int 0 for success, non-zero otherwise
int StartTimer(int index);
/// Stop the timer associated with the given index
/// \param[in] Index Index of the timer to stop
/// \returns int 0 for success, non-zero otherwise
int StopTimer(int index);
/// Reset the timer to 0
/// param[in] Index of the timer to reset
/// \returns void
void ResetTimer(int index);
/// Read the time value of the timer associated with the provided index.
/// Units are seconds
/// \param[in] index Index of the timer to read
/// \returns double Value of the timer
double ReadTimer(int index);
private:
void Error(std::string str);
uint64_t CoarseTimestampUs();
uint64_t MeasureTSCFreqHz();
};
} // namespace rdc
} // namespace amd
#endif // INCLUDE_RDC_LIB_RDCRdcPerfTimer_H_
+3 -1
Voir le fichier
@@ -29,6 +29,7 @@ THE SOFTWARE.
#include "rdc_lib/RdcDiagnostic.h"
#include "rdc_lib/impl/RdcRasLib.h"
#include "rdc_lib/impl/RdcSmiLib.h"
#include "rdc_lib/impl/RdcRocrLib.h"
namespace amd {
namespace rdc {
@@ -55,7 +56,8 @@ class RdcDiagnosticModule : public RdcDiagnostic {
rdc_status_t rdc_diag_destroy() override;
explicit RdcDiagnosticModule(const RdcSmiLibPtr& smi_lib,
const RdcRasLibPtr& ras_module);
const RdcRasLibPtr& ras_module,
const RdcRocrLibPtr& rocr_module);
private:
//< Helper function to dispatch fields to module
+2
Voir le fichier
@@ -28,6 +28,7 @@ THE SOFTWARE.
#include "rdc_lib/RdcTelemetry.h"
#include "rdc_lib/impl/RdcRasLib.h"
#include "rdc_lib/impl/RdcSmiLib.h"
#include "rdc_lib/impl/RdcRocrLib.h"
namespace amd {
namespace rdc {
@@ -46,6 +47,7 @@ class RdcModuleMgrImpl: public RdcModuleMgr {
RdcRasLibPtr ras_lib_;
RdcSmiLibPtr smi_lib_;
RdcMetricFetcherPtr fetcher_;
RdcRocrLibPtr rocr_lib_;
};
} // namespace rdc
+74
Voir le fichier
@@ -0,0 +1,74 @@
/*
Copyright (c) 2021 - present Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in 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:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
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
AUTHORS 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 IN
THE SOFTWARE.
*/
#ifndef INCLUDE_RDC_LIB_IMPL_RDCROCRLIB_H_
#define INCLUDE_RDC_LIB_IMPL_RDCROCRLIB_H_
#include <vector>
#include <memory>
#include "rdc_lib/RdcLibraryLoader.h"
#include "rdc_lib/RdcDiagnostic.h"
namespace amd {
namespace rdc {
class RdcRocrLib : public RdcDiagnostic {
public:
rdc_status_t rdc_diag_test_cases_query(
rdc_diag_test_cases_t test_cases[MAX_TEST_CASES],
uint32_t* test_case_count) override;
// Run a specific test case
rdc_status_t rdc_test_case_run(
rdc_diag_test_cases_t test_case,
uint32_t gpu_index[RDC_MAX_NUM_DEVICES],
uint32_t gpu_count,
rdc_diag_test_result_t* result) override;
rdc_status_t rdc_diagnostic_run(
const rdc_group_info_t& gpus,
rdc_diag_level_t level,
rdc_diag_response_t* response) override;
rdc_status_t rdc_diag_init(uint64_t flags) override;
rdc_status_t rdc_diag_destroy() override;
explicit RdcRocrLib(const char* lib_name);
~RdcRocrLib();
private:
RdcLibraryLoader lib_loader_;
rdc_status_t (*test_case_run_)(rdc_diag_test_cases_t,
uint32_t[RDC_MAX_NUM_DEVICES], uint32_t,
rdc_diag_test_result_t*);
rdc_status_t (*diag_test_cases_query_)(
rdc_diag_test_cases_t[MAX_TEST_CASES], uint32_t*);
rdc_status_t (*diag_init_)(uint64_t);
rdc_status_t (*diag_destroy_)();
};
typedef std::shared_ptr<RdcRocrLib> RdcRocrLibPtr;
} // namespace rdc
} // namespace amd
#endif // INCLUDE_RDC_LIB_IMPL_RDCROCRLIB_H_