mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-10 12:53:42 +08:00
Instrumentation refactoring
Use bool instead of int where it should be. Tweak naming. Removed unused members Change-Id: I468be28d78e9da7c7fa1632e362ed077929fb91a
This commit is contained in:

committed by
sys_ocldev

parent
dd601ff73a
commit
3883f790cc
@ -249,6 +249,20 @@ else(ARTIFACTS_DIR)
|
||||
endforeach(TARGET_tmp)
|
||||
message(STATUS "IGC Includes: ${IGDRCL__IGC_INCLUDE_DIR}")
|
||||
endif()
|
||||
|
||||
if(INSTRUMENTATION_SOURCE_DIR)
|
||||
get_filename_component(INSTRUMENTATION_SOURCE_DIR "${INSTRUMENTATION_SOURCE_DIR}" ABSOLUTE)
|
||||
else(INSTRUMENTATION_SOURCE_DIR)
|
||||
get_filename_component(INSTRUMENTATION_SOURCE_DIR_tmp "${CMAKE_SOURCE_DIR}/../instrumentation" ABSOLUTE)
|
||||
if(IS_DIRECTORY "${INSTRUMENTATION_SOURCE_DIR_tmp}")
|
||||
set(INSTRUMENTATION_SOURCE_DIR "${INSTRUMENTATION_SOURCE_DIR_tmp}")
|
||||
endif()
|
||||
endif()
|
||||
if(IS_DIRECTORY "${INSTRUMENTATION_SOURCE_DIR}")
|
||||
message(STATUS "Intrumentation source dir is: ${INSTRUMENTATION_SOURCE_DIR}")
|
||||
add_subdirectory("${INSTRUMENTATION_SOURCE_DIR}" "${IGDRCL_BUILD_DIR}/instrumentation")
|
||||
set(HAVE_INSTRUMENTATION TRUE)
|
||||
endif()
|
||||
endif(ARTIFACTS_DIR)
|
||||
|
||||
add_definitions(-DGMM_OCL)
|
||||
@ -469,6 +483,10 @@ set(SKU_INFO_SRCS_DIR_SUFFIX "/")
|
||||
include_directories(${IGDRCL_SOURCE_DIR})
|
||||
include_directories(${IGDRCL_BUILD_DIR})
|
||||
include_directories(${IGDRCL_SOURCE_DIR}/runtime/sku_info/definitions${SKU_INFO_SRCS_DIR_SUFFIX})
|
||||
include_directories(${IGDRCL_SOURCE_DIR}/runtime/instrumentation${SKU_INFO_SRCS_DIR_SUFFIX})
|
||||
if(HAVE_INSTRUMENTATION)
|
||||
include_directories($<TARGET_PROPERTY:instrumentation_umd,INTERFACE_INCLUDE_DIRECTORIES>)
|
||||
endif()
|
||||
|
||||
# Define where to put binaries
|
||||
if(MSVC)
|
||||
|
@ -336,8 +336,8 @@ set (RUNTIME_SRCS_INDIRECT_HEAP
|
||||
)
|
||||
|
||||
set (RUNTIME_SRCS_INSTRUMENTATION
|
||||
instrumentation/instrumentation.cpp
|
||||
instrumentation/instrumentation.h
|
||||
instrumentation${SKU_INFO_SRCS_DIR_SUFFIX}/instrumentation.cpp
|
||||
instrumentation${SKU_INFO_SRCS_DIR_SUFFIX}/instrumentation.h
|
||||
)
|
||||
|
||||
set (RUNTIME_SRCS_KERNEL
|
||||
@ -770,6 +770,10 @@ if(NOT GMMUMD_LIB_NAME)
|
||||
endif()
|
||||
target_link_libraries(${NEO_STATIC_LIB_NAME} ${GMMUMD_LIB_NAME})
|
||||
|
||||
if(HAVE_INSTRUMENTATION)
|
||||
target_link_libraries(${NEO_STATIC_LIB_NAME} instrumentation_umd)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
if(GTPIN_HEADERS_DIR)
|
||||
set( DEF_FILE "${CMAKE_CURRENT_SOURCE_DIR}/dll/windows/GTPinExports${IGDRCL_OPTION__BITS}.def" )
|
||||
|
@ -444,10 +444,10 @@ bool CommandQueue::setPerfCountersEnabled(bool perfCountersEnabled, cl_uint conf
|
||||
perfCounters->shutdown();
|
||||
return false;
|
||||
}
|
||||
InstrReadRegsCfg *pUserCounters = &perfConfigurationData->readRegs;
|
||||
for (uint32_t i = 0; i < pUserCounters->regsCount; ++i) {
|
||||
InstrReadRegsCfg *pUserCounters = &perfConfigurationData->ReadRegs;
|
||||
for (uint32_t i = 0; i < pUserCounters->RegsCount; ++i) {
|
||||
perfCountersUserRegistersNumber++;
|
||||
if (pUserCounters->reg[i].bitSize > 32) {
|
||||
if (pUserCounters->Reg[i].BitSize > 32) {
|
||||
perfCountersUserRegistersNumber++;
|
||||
}
|
||||
}
|
||||
|
@ -285,20 +285,20 @@ void dispatchPerfCountersUserCounterCommands(
|
||||
uint32_t cmdNum = 0;
|
||||
uint32_t regAddr = 0;
|
||||
auto configData = commandQueue.getPerfCountersConfigData();
|
||||
auto userRegs = &configData->readRegs;
|
||||
auto userRegs = &configData->ReadRegs;
|
||||
|
||||
for (uint32_t i = 0; i < userRegs->regsCount; i++) {
|
||||
for (uint32_t i = 0; i < userRegs->RegsCount; i++) {
|
||||
auto pRegister = (MI_STORE_REGISTER_MEM *)commandStream->getSpace(sizeof(MI_STORE_REGISTER_MEM));
|
||||
*pRegister = MI_STORE_REGISTER_MEM::sInit();
|
||||
|
||||
regAddr = userRegs->reg[i].offset;
|
||||
regAddr = userRegs->Reg[i].Offset;
|
||||
pRegister->setRegisterAddress(regAddr);
|
||||
//offset between base (low) registers is cl_ulong wide
|
||||
address = baseAddr + i * sizeof(cl_ulong);
|
||||
pRegister->setMemoryAddress(address);
|
||||
cmdNum++;
|
||||
|
||||
if (userRegs->reg[i].bitSize > 32) {
|
||||
if (userRegs->Reg[i].BitSize > 32) {
|
||||
pRegister = (MI_STORE_REGISTER_MEM *)commandStream->getSpace(sizeof(MI_STORE_REGISTER_MEM));
|
||||
*pRegister = MI_STORE_REGISTER_MEM::sInit();
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "runtime/event/hw_timestamps.h"
|
||||
#include "runtime/instrumentation/instrumentation.h"
|
||||
#include "instrumentation.h"
|
||||
|
||||
namespace OCLRT {
|
||||
|
||||
|
40
runtime/instrumentation/.clang-tidy
Normal file
40
runtime/instrumentation/.clang-tidy
Normal file
@ -0,0 +1,40 @@
|
||||
---
|
||||
Checks: 'clang-diagnostic-*,clang-analyzer-*,google-default-arguments,readability-identifier-naming,modernize-use-override,modernize-use-default-member-init,-clang-analyzer-alpha*,-clang-analyzer-core.StackAddressEscape,-clang-analyzer-optin.performance.Padding,-clang-analyzer-cplusplus.NewDeleteLeaks'
|
||||
# WarningsAsErrors: '.*'
|
||||
HeaderFilterRegex: 'runtime/'
|
||||
AnalyzeTemporaryDtors: false
|
||||
CheckOptions:
|
||||
- key: google-readability-braces-around-statements.ShortStatementLines
|
||||
value: '1'
|
||||
- key: google-readability-function-size.StatementThreshold
|
||||
value: '800'
|
||||
- key: google-readability-namespace-comments.ShortNamespaceLines
|
||||
value: '10'
|
||||
- key: google-readability-namespace-comments.SpacesBeforeComments
|
||||
value: '2'
|
||||
- key: readability-identifier-naming.MethodCase
|
||||
value: camelBack
|
||||
- key: readability-identifier-naming.ParameterCase
|
||||
value: camelBack
|
||||
- key: readability-identifier-naming.StructMemberCase
|
||||
value: CamelCase
|
||||
- key: readability-identifier-naming.ClassMemberCase
|
||||
value: CamelCase
|
||||
- key: readability-identifier-naming.ClassMethodCase
|
||||
value: camelBack
|
||||
- key: modernize-loop-convert.MaxCopySize
|
||||
value: '16'
|
||||
- key: modernize-loop-convert.MinConfidence
|
||||
value: reasonable
|
||||
- key: modernize-loop-convert.NamingStyle
|
||||
value: CamelCase
|
||||
- key: modernize-pass-by-value.IncludeStyle
|
||||
value: llvm
|
||||
- key: modernize-replace-auto-ptr.IncludeStyle
|
||||
value: llvm
|
||||
- key: modernize-use-nullptr.NullMacros
|
||||
value: 'NULL'
|
||||
- key: modernize-use-default-member-init.UseAssignment
|
||||
value: '1'
|
||||
...
|
||||
|
@ -20,26 +20,26 @@
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "runtime/instrumentation/instrumentation.h"
|
||||
#include "instrumentation.h"
|
||||
|
||||
namespace OCLRT {
|
||||
|
||||
int instrAutoSamplingStart(
|
||||
bool instrAutoSamplingStart(
|
||||
InstrEscCbData cbData,
|
||||
void **ppOAInterface) {
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
int instrAutoSamplingStop(
|
||||
bool instrAutoSamplingStop(
|
||||
void **ppOAInterface) {
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
int instrCheckPmRegsCfg(
|
||||
bool instrCheckPmRegsCfg(
|
||||
InstrPmRegsCfg *pQueryPmRegsCfg,
|
||||
uint32_t *pLastPmRegsCfgHandle,
|
||||
const void *pASInterface) {
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
void instrGetPerfCountersQueryData(
|
||||
@ -54,52 +54,52 @@ void instrGetPerfCountersQueryData(
|
||||
const InstrAllowedContexts *pAllowedContexts) {
|
||||
}
|
||||
|
||||
int instrEscGetPmRegsCfg(
|
||||
bool instrEscGetPmRegsCfg(
|
||||
InstrEscCbData cbData,
|
||||
uint32_t cfgId,
|
||||
InstrPmRegsCfg *pCfg,
|
||||
InstrAutoSamplingMode *pAutoSampling) {
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
int instrEscHwMetricsEnable(
|
||||
bool instrEscHwMetricsEnable(
|
||||
InstrEscCbData cbData,
|
||||
int enable) {
|
||||
return -1;
|
||||
bool enable) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int instrEscLoadPmRegsCfg(
|
||||
bool instrEscLoadPmRegsCfg(
|
||||
InstrEscCbData cbData,
|
||||
InstrPmRegsCfg *pCfg,
|
||||
int hardwareAccess) {
|
||||
return -1;
|
||||
bool hardwareAccess) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int instrEscSetPmRegsCfg(
|
||||
bool instrEscSetPmRegsCfg(
|
||||
InstrEscCbData cbData,
|
||||
uint32_t count,
|
||||
uint32_t *pOffsets,
|
||||
uint32_t *pValues) {
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
int instrEscSendReadRegsCfg(
|
||||
bool instrEscSendReadRegsCfg(
|
||||
InstrEscCbData cbData,
|
||||
uint32_t count,
|
||||
uint32_t *pOffsets,
|
||||
uint32_t *pBitSizes) {
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
int instrSetAvailable(int enabled) {
|
||||
return -1;
|
||||
bool instrSetAvailable(bool enabled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void instrEscVerifyEnable(
|
||||
InstrEscCbData cbData) {
|
||||
}
|
||||
|
||||
uint64_t instrSetPlatformInfo(
|
||||
uint32_t instrSetPlatformInfo(
|
||||
uint32_t productId,
|
||||
void *pSkuTable) {
|
||||
return 0;
|
||||
|
@ -129,40 +129,29 @@ typedef struct {
|
||||
} HwPerfCounters;
|
||||
|
||||
typedef struct {
|
||||
uint32_t offset;
|
||||
union {
|
||||
uint32_t value32;
|
||||
uint64_t value64;
|
||||
};
|
||||
uint32_t bitSize;
|
||||
uint32_t flags;
|
||||
uint32_t Offset;
|
||||
uint32_t BitSize;
|
||||
} InstrPmReg;
|
||||
|
||||
typedef struct {
|
||||
uint32_t handle;
|
||||
InstrPmReg reg[INSTR_MAX_PM_REGS];
|
||||
uint32_t regsCount;
|
||||
uint32_t pendingRegsCount;
|
||||
uint32_t Handle;
|
||||
uint32_t RegsCount;
|
||||
} InstrPmRegsOaCountersCfg;
|
||||
|
||||
typedef struct {
|
||||
uint32_t handle;
|
||||
InstrPmReg reg[INSTR_MAX_PM_REGS];
|
||||
uint32_t regsCount;
|
||||
uint32_t pendingRegsCount;
|
||||
uint32_t Handle;
|
||||
uint32_t RegsCount;
|
||||
} InstrPmRegsGpCountersCfg;
|
||||
|
||||
typedef struct {
|
||||
uint32_t handle;
|
||||
InstrPmReg reg[INSTR_MAX_READ_REGS];
|
||||
uint32_t regsCount;
|
||||
uint32_t srmsCount;
|
||||
InstrPmReg Reg[INSTR_MAX_READ_REGS];
|
||||
uint32_t RegsCount;
|
||||
} InstrReadRegsCfg;
|
||||
|
||||
typedef struct {
|
||||
InstrPmRegsOaCountersCfg oaCounters;
|
||||
InstrPmRegsGpCountersCfg gpCounters;
|
||||
InstrReadRegsCfg readRegs;
|
||||
InstrPmRegsOaCountersCfg OaCounters;
|
||||
InstrPmRegsGpCountersCfg GpCounters;
|
||||
InstrReadRegsCfg ReadRegs;
|
||||
} InstrPmRegsCfg;
|
||||
|
||||
typedef struct {
|
||||
@ -172,14 +161,14 @@ typedef struct {
|
||||
bool DDI;
|
||||
} InstrEscCbData;
|
||||
|
||||
int instrAutoSamplingStart(
|
||||
bool instrAutoSamplingStart(
|
||||
InstrEscCbData cbData,
|
||||
void **ppOAInterface);
|
||||
|
||||
int instrAutoSamplingStop(
|
||||
bool instrAutoSamplingStop(
|
||||
void **ppOAInterface);
|
||||
|
||||
int instrCheckPmRegsCfg(
|
||||
bool instrCheckPmRegsCfg(
|
||||
InstrPmRegsCfg *pQueryPmRegsCfg,
|
||||
uint32_t *pLastPmRegsCfgHandle,
|
||||
const void *pASInterface);
|
||||
@ -195,39 +184,39 @@ void instrGetPerfCountersQueryData(
|
||||
bool resetASData = false,
|
||||
const InstrAllowedContexts *pAllowedContexts = nullptr);
|
||||
|
||||
int instrEscGetPmRegsCfg(
|
||||
bool instrEscGetPmRegsCfg(
|
||||
InstrEscCbData cbData,
|
||||
uint32_t cfgId,
|
||||
InstrPmRegsCfg *pCfg,
|
||||
InstrAutoSamplingMode *pAutoSampling);
|
||||
|
||||
int instrEscHwMetricsEnable(
|
||||
bool instrEscHwMetricsEnable(
|
||||
InstrEscCbData cbData,
|
||||
int enable);
|
||||
bool enable);
|
||||
|
||||
int instrEscLoadPmRegsCfg(
|
||||
bool instrEscLoadPmRegsCfg(
|
||||
InstrEscCbData cbData,
|
||||
InstrPmRegsCfg *pCfg,
|
||||
int hardwareAccess = 1);
|
||||
bool hardwareAccess = 1);
|
||||
|
||||
int instrEscSetPmRegsCfg(
|
||||
bool instrEscSetPmRegsCfg(
|
||||
InstrEscCbData cbData,
|
||||
uint32_t count,
|
||||
uint32_t *pOffsets,
|
||||
uint32_t *pValues);
|
||||
|
||||
int instrEscSendReadRegsCfg(
|
||||
bool instrEscSendReadRegsCfg(
|
||||
InstrEscCbData cbData,
|
||||
uint32_t count,
|
||||
uint32_t *pOffsets,
|
||||
uint32_t *pBitSizes);
|
||||
|
||||
int instrSetAvailable(int enabled);
|
||||
bool instrSetAvailable(bool enabled);
|
||||
|
||||
void instrEscVerifyEnable(
|
||||
InstrEscCbData cbData);
|
||||
|
||||
uint64_t instrSetPlatformInfo(
|
||||
uint32_t instrSetPlatformInfo(
|
||||
uint32_t productId,
|
||||
void *pSkuTable);
|
||||
|
||||
|
@ -70,16 +70,16 @@ bool PerformanceCountersLinux::verifyPmRegsCfg(InstrPmRegsCfg *pCfg, uint32_t *p
|
||||
return false;
|
||||
}
|
||||
bool PerformanceCountersLinux::getPerfmonConfig(InstrPmRegsCfg *pCfg) {
|
||||
unsigned int oaCfgHandle = pCfg->oaCounters.handle;
|
||||
unsigned int gpCfgHandle = pCfg->gpCounters.handle;
|
||||
unsigned int oaCfgHandle = pCfg->OaCounters.Handle;
|
||||
unsigned int gpCfgHandle = pCfg->GpCounters.Handle;
|
||||
int fd = osInterface->get()->getDrm()->getFileDescriptor();
|
||||
if (perfmonLoadConfigFunc(fd, nullptr, &oaCfgHandle, &gpCfgHandle) != 0) {
|
||||
return false;
|
||||
}
|
||||
if (pCfg->oaCounters.handle != 0 && oaCfgHandle != pCfg->oaCounters.handle) {
|
||||
if (pCfg->OaCounters.Handle != 0 && oaCfgHandle != pCfg->OaCounters.Handle) {
|
||||
return false;
|
||||
}
|
||||
if (pCfg->gpCounters.handle != 0 && gpCfgHandle != pCfg->gpCounters.handle) {
|
||||
if (pCfg->GpCounters.Handle != 0 && gpCfgHandle != pCfg->GpCounters.Handle) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -68,7 +68,7 @@ void PerformanceCounters::initialize(const HardwareInfo *hwInfo) {
|
||||
gfxFamily = hwInfo->pPlatform->eRenderCoreFamily;
|
||||
}
|
||||
void PerformanceCounters::enableImpl() {
|
||||
hwMetricsEnabled = (hwMetricsEnableFunc(cbData, true) != 0) ? false : true;
|
||||
hwMetricsEnabled = hwMetricsEnableFunc(cbData, true);
|
||||
|
||||
if (!pAutoSamplingInterface && hwMetricsEnabled) {
|
||||
autoSamplingStartFunc(cbData, &pAutoSamplingInterface);
|
||||
@ -108,12 +108,12 @@ InstrPmRegsCfg *PerformanceCounters::getPmRegsCfg(uint32_t configuration) {
|
||||
}
|
||||
|
||||
InstrPmRegsCfg *pPmRegsCfg = new InstrPmRegsCfg();
|
||||
pPmRegsCfg->oaCounters.handle = INSTR_PM_REGS_CFG_INVALID;
|
||||
pPmRegsCfg->OaCounters.Handle = INSTR_PM_REGS_CFG_INVALID;
|
||||
|
||||
mutex.lock();
|
||||
std::lock_guard<std::mutex> lg(mutex, std::adopt_lock);
|
||||
|
||||
if (getPmRegsCfgFunc(cbData, configuration, pPmRegsCfg, nullptr) == 0) {
|
||||
if (getPmRegsCfgFunc(cbData, configuration, pPmRegsCfg, nullptr)) {
|
||||
return pPmRegsCfg;
|
||||
}
|
||||
delete pPmRegsCfg;
|
||||
@ -123,8 +123,8 @@ bool PerformanceCounters::verifyPmRegsCfg(InstrPmRegsCfg *pCfg, uint32_t *pLastP
|
||||
if (pCfg == nullptr || pLastPmRegsCfgHandle == nullptr || pLastPmRegsCfgPending == nullptr) {
|
||||
return false;
|
||||
}
|
||||
if (checkPmRegsCfgFunc(pCfg, pLastPmRegsCfgHandle, pAutoSamplingInterface) == 0) {
|
||||
if (loadPmRegsCfgFunc(cbData, pCfg, 1) == 0) {
|
||||
if (checkPmRegsCfgFunc(pCfg, pLastPmRegsCfgHandle, pAutoSamplingInterface)) {
|
||||
if (loadPmRegsCfgFunc(cbData, pCfg, 1)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -158,7 +158,7 @@ bool PerformanceCounters::processEventReport(size_t inputParamSize, void *inputP
|
||||
}
|
||||
|
||||
int PerformanceCounters::sendPerfConfiguration(uint32_t count, uint32_t *pOffsets, uint32_t *pValues) {
|
||||
int ret = -1;
|
||||
bool ret = false;
|
||||
|
||||
if (count == 0 || pOffsets == NULL || pValues == NULL) {
|
||||
return CL_INVALID_VALUE;
|
||||
@ -172,7 +172,7 @@ int PerformanceCounters::sendPerfConfiguration(uint32_t count, uint32_t *pOffset
|
||||
ret = sendReadRegsCfgFunc(cbData, count - 1, pOffsets + 1, pValues + 1);
|
||||
}
|
||||
|
||||
return ret != 0 ? CL_PROFILING_INFO_NOT_AVAILABLE : CL_SUCCESS;
|
||||
return ret ? CL_SUCCESS : CL_PROFILING_INFO_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
size_t PerformanceCounters::querySize() {
|
||||
|
@ -20,7 +20,7 @@
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "runtime/instrumentation/instrumentation.h"
|
||||
#include "instrumentation.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "gmock/gmock.h"
|
||||
|
||||
@ -46,6 +46,8 @@ TEST(InstrumentationTest, instrCheckPmRegsCfg) {
|
||||
uint32_t *pLastPmRegsCfgHandle = nullptr;
|
||||
const void *pASInterface = nullptr;
|
||||
instrCheckPmRegsCfg(pQueryPmRegsCfg, pLastPmRegsCfgHandle, pASInterface);
|
||||
InstrPmRegsCfg cfg;
|
||||
instrCheckPmRegsCfg(&cfg, pLastPmRegsCfgHandle, pASInterface);
|
||||
}
|
||||
|
||||
TEST(InstrumentationTest, instrGetPerfCountersQueryData) {
|
||||
@ -71,14 +73,14 @@ TEST(InstrumentationTest, instrEscGetPmRegsCfg) {
|
||||
|
||||
TEST(InstrumentationTest, instrEscHwMetricsEnable) {
|
||||
InstrEscCbData cbData = {0};
|
||||
int enable = 0;
|
||||
bool enable = false;
|
||||
instrEscHwMetricsEnable(cbData, enable);
|
||||
}
|
||||
|
||||
TEST(InstrumentationTest, instrEscLoadPmRegsCfg) {
|
||||
InstrEscCbData cbData = {0};
|
||||
InstrPmRegsCfg *pCfg = nullptr;
|
||||
int hardwareAccess = 0;
|
||||
bool hardwareAccess = false;
|
||||
instrEscLoadPmRegsCfg(cbData, pCfg, hardwareAccess);
|
||||
}
|
||||
|
||||
@ -99,7 +101,7 @@ TEST(InstrumentationTest, instrEscSendReadRegsCfg) {
|
||||
}
|
||||
|
||||
TEST(InstrumentationTest, instrSetAvailable) {
|
||||
int enabled = 0;
|
||||
bool enabled = false;
|
||||
instrSetAvailable(enabled);
|
||||
}
|
||||
|
||||
|
@ -97,6 +97,10 @@ target_include_directories(igdrcl_libult_cs PRIVATE
|
||||
target_include_directories(igdrcl_libult BEFORE PRIVATE ${HW_SRC_INCLUDES})
|
||||
target_include_directories(igdrcl_libult_cs BEFORE PRIVATE ${HW_SRC_INCLUDES})
|
||||
|
||||
# if(HAVE_INSTRUMENTATION)
|
||||
# target_include_directories(igdrcl_libult PRIVATE $<TARGET_PROPERTY:instrumentation_umd,INTERFACE_INCLUDE_DIRECTORIES>)
|
||||
# endif()
|
||||
|
||||
set_target_properties (igdrcl_libult PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||
set_target_properties (igdrcl_libult_cs PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||
target_compile_definitions(igdrcl_libult PUBLIC ${IGDRCL_LIB_FLAGS_DEFINITIONS} ${TESTED_GEN_FLAGS_DEFINITONS})
|
||||
|
@ -66,7 +66,7 @@ int dlcloseMock(void *handle) throw() {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
uint64_t setPlatformInfo(uint32_t productId, void *pSkuTable) {
|
||||
uint32_t setPlatformInfo(uint32_t productId, void *pSkuTable) {
|
||||
PerfCounterFlagsLinux::setPlatformInfoFuncCalled++;
|
||||
return 0;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ void *dlsymMockPassing(void *handle, const char *symbol) throw();
|
||||
void *dlsymMockFailing(void *handle, const char *symbol) throw();
|
||||
int getTimeFuncPassing(clockid_t clk_id, struct timespec *tp) throw();
|
||||
int dlcloseMock(void *handle) throw();
|
||||
uint64_t setPlatformInfo(uint32_t productId, void *pSkuTable);
|
||||
uint32_t setPlatformInfo(uint32_t productId, void *pSkuTable);
|
||||
int perfmonLoadConfigMock(int fd, drm_intel_context *ctx, uint32_t *oa_cfg_id, uint32_t *gp_cfg_id);
|
||||
|
||||
class PerfCounterFlagsLinux : public PerfCounterFlags {
|
||||
|
@ -418,9 +418,9 @@ TEST_P(PerformanceCountersLinuxGetPerfmonConfigTest, givenPassingPerfmonLoadConf
|
||||
performanceCountersLinux->setPerfmonLoadConfigFunc(perfmonLoadConfigChangingOa);
|
||||
}
|
||||
if (isZeroValue) {
|
||||
config.oaCounters.handle = 0;
|
||||
config.OaCounters.Handle = 0;
|
||||
} else {
|
||||
config.oaCounters.handle = 1;
|
||||
config.OaCounters.Handle = 1;
|
||||
}
|
||||
auto retVal = performanceCountersLinux->getPerfmonConfig(&config);
|
||||
EXPECT_EQ(1, PerfCounterFlagsLinux::perfmonLoadConfigCalled);
|
||||
@ -441,9 +441,9 @@ TEST_P(PerformanceCountersLinuxGetPerfmonConfigTest, givenPassingPerfmonLoadConf
|
||||
performanceCountersLinux->setPerfmonLoadConfigFunc(perfmonLoadConfigChangingGp);
|
||||
}
|
||||
if (isZeroValue) {
|
||||
config.gpCounters.handle = 0;
|
||||
config.GpCounters.Handle = 0;
|
||||
} else {
|
||||
config.gpCounters.handle = 1;
|
||||
config.GpCounters.Handle = 1;
|
||||
}
|
||||
auto retVal = performanceCountersLinux->getPerfmonConfig(&config);
|
||||
EXPECT_EQ(1, PerfCounterFlagsLinux::perfmonLoadConfigCalled);
|
||||
|
@ -54,83 +54,83 @@ int PerfCounterFlags::loadPmRegsCfgCalled;
|
||||
int PerfCounterFlags::setPmRegsCfgCalled;
|
||||
int PerfCounterFlags::sendReadRegsCfgCalled;
|
||||
|
||||
int hwMetricsEnableFuncFailing(InstrEscCbData cbData, int enable) {
|
||||
bool hwMetricsEnableFuncFailing(InstrEscCbData cbData, bool enable) {
|
||||
PerfCounterFlags::escHwMetricsCalled++;
|
||||
PerfCounterFlags::hwMetricsEnableStatus = enable;
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
int hwMetricsEnableFuncPassing(InstrEscCbData cbData, int enable) {
|
||||
bool hwMetricsEnableFuncPassing(InstrEscCbData cbData, bool enable) {
|
||||
PerfCounterFlags::escHwMetricsCalled++;
|
||||
PerfCounterFlags::hwMetricsEnableStatus = enable;
|
||||
return 0;
|
||||
return true;
|
||||
}
|
||||
int autoSamplingStart(InstrEscCbData cbData, void **ppOAInterface) {
|
||||
bool autoSamplingStart(InstrEscCbData cbData, void **ppOAInterface) {
|
||||
PerfCounterFlags::autoSamplingFuncCalled++;
|
||||
PerfCounterFlags::autoSamplingStarted++;
|
||||
ppOAInterface[0] = new char[1];
|
||||
return 0;
|
||||
return true;
|
||||
}
|
||||
int autoSamplingStartFailing(InstrEscCbData cbData, void **ppOAInterface) {
|
||||
bool autoSamplingStartFailing(InstrEscCbData cbData, void **ppOAInterface) {
|
||||
PerfCounterFlags::autoSamplingFuncCalled++;
|
||||
PerfCounterFlags::autoSamplingStarted++;
|
||||
ppOAInterface[0] = nullptr;
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
int autoSamplingStop(void **ppOAInterface) {
|
||||
bool autoSamplingStop(void **ppOAInterface) {
|
||||
PerfCounterFlags::autoSamplingFuncCalled++;
|
||||
PerfCounterFlags::autoSamplingStopped++;
|
||||
if (ppOAInterface[0]) {
|
||||
delete[] static_cast<char *>(ppOAInterface[0]);
|
||||
ppOAInterface[0] = nullptr;
|
||||
return 0;
|
||||
return true;
|
||||
}
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
int getPmRegsCfgPassing(InstrEscCbData cbData, uint32_t cfgId, InstrPmRegsCfg *pCfg, InstrAutoSamplingMode *pAutoSampling) {
|
||||
bool getPmRegsCfgPassing(InstrEscCbData cbData, uint32_t cfgId, InstrPmRegsCfg *pCfg, InstrAutoSamplingMode *pAutoSampling) {
|
||||
PerfCounterFlags::getPmRegsCfgCalled++;
|
||||
if (cfgId == 1) {
|
||||
pCfg->readRegs.regsCount = 2;
|
||||
pCfg->readRegs.reg[0].bitSize = 32;
|
||||
pCfg->readRegs.reg[1].bitSize = 64;
|
||||
pCfg->ReadRegs.RegsCount = 2;
|
||||
pCfg->ReadRegs.Reg[0].BitSize = 32;
|
||||
pCfg->ReadRegs.Reg[1].BitSize = 64;
|
||||
}
|
||||
return 0;
|
||||
return true;
|
||||
}
|
||||
int getPmRegsCfgFailing(InstrEscCbData cbData, uint32_t cfgId, InstrPmRegsCfg *pCfg, InstrAutoSamplingMode *pAutoSampling) {
|
||||
bool getPmRegsCfgFailing(InstrEscCbData cbData, uint32_t cfgId, InstrPmRegsCfg *pCfg, InstrAutoSamplingMode *pAutoSampling) {
|
||||
PerfCounterFlags::getPmRegsCfgCalled++;
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
int checkPmRegsCfgPassing(InstrPmRegsCfg *pQueryPmRegsCfg, uint32_t *pLastPmRegsCfgHandle, const void *pASInterface) {
|
||||
bool checkPmRegsCfgPassing(InstrPmRegsCfg *pQueryPmRegsCfg, uint32_t *pLastPmRegsCfgHandle, const void *pASInterface) {
|
||||
PerfCounterFlags::checkPmRegsCfgCalled++;
|
||||
return 0;
|
||||
return true;
|
||||
}
|
||||
int checkPmRegsCfgFailing(InstrPmRegsCfg *pQueryPmRegsCfg, uint32_t *pLastPmRegsCfgHandle, const void *pASInterface) {
|
||||
bool checkPmRegsCfgFailing(InstrPmRegsCfg *pQueryPmRegsCfg, uint32_t *pLastPmRegsCfgHandle, const void *pASInterface) {
|
||||
PerfCounterFlags::checkPmRegsCfgCalled++;
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
int loadPmRegsCfgPassing(InstrEscCbData cbData, InstrPmRegsCfg *pCfg, int hardwareAccess) {
|
||||
bool loadPmRegsCfgPassing(InstrEscCbData cbData, InstrPmRegsCfg *pCfg, bool hardwareAccess) {
|
||||
PerfCounterFlags::loadPmRegsCfgCalled++;
|
||||
return 0;
|
||||
return true;
|
||||
}
|
||||
int loadPmRegsCfgFailing(InstrEscCbData cbData, InstrPmRegsCfg *pCfg, int hardwareAccess) {
|
||||
bool loadPmRegsCfgFailing(InstrEscCbData cbData, InstrPmRegsCfg *pCfg, bool hardwareAccess) {
|
||||
PerfCounterFlags::loadPmRegsCfgCalled++;
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
int setPmRegsCfgFuncPassing(InstrEscCbData cbData, uint32_t count, uint32_t *pOffsets, uint32_t *pValues) {
|
||||
bool setPmRegsCfgFuncPassing(InstrEscCbData cbData, uint32_t count, uint32_t *pOffsets, uint32_t *pValues) {
|
||||
PerfCounterFlags::setPmRegsCfgCalled++;
|
||||
return 0;
|
||||
return true;
|
||||
}
|
||||
int setPmRegsCfgFuncFailing(InstrEscCbData cbData, uint32_t count, uint32_t *pOffsets, uint32_t *pValues) {
|
||||
bool setPmRegsCfgFuncFailing(InstrEscCbData cbData, uint32_t count, uint32_t *pOffsets, uint32_t *pValues) {
|
||||
PerfCounterFlags::setPmRegsCfgCalled++;
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
int sendReadRegsCfgFuncPassing(InstrEscCbData cbData, uint32_t count, uint32_t *pOffsets, uint32_t *pBitSizes) {
|
||||
bool sendReadRegsCfgFuncPassing(InstrEscCbData cbData, uint32_t count, uint32_t *pOffsets, uint32_t *pBitSizes) {
|
||||
PerfCounterFlags::sendReadRegsCfgCalled++;
|
||||
return 0;
|
||||
return true;
|
||||
}
|
||||
int sendReadRegsCfgFuncFailing(InstrEscCbData cbData, uint32_t count, uint32_t *pOffsets, uint32_t *pBitSizes) {
|
||||
bool sendReadRegsCfgFuncFailing(InstrEscCbData cbData, uint32_t count, uint32_t *pOffsets, uint32_t *pBitSizes) {
|
||||
PerfCounterFlags::sendReadRegsCfgCalled++;
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename GTDI_QUERY, typename HwPerfCountersLayout>
|
||||
|
@ -27,23 +27,23 @@
|
||||
namespace OCLRT {
|
||||
class OSInterface;
|
||||
|
||||
int hwMetricsEnableFuncPassing(InstrEscCbData cbData, int enable);
|
||||
int hwMetricsEnableFuncFailing(InstrEscCbData cbData, int enable);
|
||||
int autoSamplingStart(InstrEscCbData cbData, void **ppOAInterface);
|
||||
int autoSamplingStartFailing(InstrEscCbData cbData, void **ppOAInterface);
|
||||
int autoSamplingStop(void **ppOAInterface);
|
||||
int getPmRegsCfgPassing(InstrEscCbData cbData, uint32_t cfgId, InstrPmRegsCfg *pCfg, InstrAutoSamplingMode *pAutoSampling);
|
||||
int getPmRegsCfgFailing(InstrEscCbData cbData, uint32_t cfgId, InstrPmRegsCfg *pCfg, InstrAutoSamplingMode *pAutoSampling);
|
||||
int checkPmRegsCfgPassing(InstrPmRegsCfg *pQueryPmRegsCfg, uint32_t *pLastPmRegsCfgHandle, const void *pASInterface);
|
||||
int checkPmRegsCfgFailing(InstrPmRegsCfg *pQueryPmRegsCfg, uint32_t *pLastPmRegsCfgHandle, const void *pASInterface);
|
||||
int loadPmRegsCfgPassing(InstrEscCbData cbData, InstrPmRegsCfg *pCfg, int hardwareAccess);
|
||||
int loadPmRegsCfgFailing(InstrEscCbData cbData, InstrPmRegsCfg *pCfg, int hardwareAccess);
|
||||
bool hwMetricsEnableFuncPassing(InstrEscCbData cbData, bool enable);
|
||||
bool hwMetricsEnableFuncFailing(InstrEscCbData cbData, bool enable);
|
||||
bool autoSamplingStart(InstrEscCbData cbData, void **ppOAInterface);
|
||||
bool autoSamplingStartFailing(InstrEscCbData cbData, void **ppOAInterface);
|
||||
bool autoSamplingStop(void **ppOAInterface);
|
||||
bool getPmRegsCfgPassing(InstrEscCbData cbData, uint32_t cfgId, InstrPmRegsCfg *pCfg, InstrAutoSamplingMode *pAutoSampling);
|
||||
bool getPmRegsCfgFailing(InstrEscCbData cbData, uint32_t cfgId, InstrPmRegsCfg *pCfg, InstrAutoSamplingMode *pAutoSampling);
|
||||
bool checkPmRegsCfgPassing(InstrPmRegsCfg *pQueryPmRegsCfg, uint32_t *pLastPmRegsCfgHandle, const void *pASInterface);
|
||||
bool checkPmRegsCfgFailing(InstrPmRegsCfg *pQueryPmRegsCfg, uint32_t *pLastPmRegsCfgHandle, const void *pASInterface);
|
||||
bool loadPmRegsCfgPassing(InstrEscCbData cbData, InstrPmRegsCfg *pCfg, bool hardwareAccess);
|
||||
bool loadPmRegsCfgFailing(InstrEscCbData cbData, InstrPmRegsCfg *pCfg, bool hardwareAccess);
|
||||
template <typename GTDI_QUERY, typename HwPerfCountersLayout>
|
||||
void getPerfCountersQueryData(InstrEscCbData cbData, GTDI_QUERY *pData, HwPerfCountersLayout *pLayout, uint64_t cpuRawTimestamp, void *pASInterface, InstrPmRegsCfg *pPmRegsCfg, bool useMiRPC, bool resetASData = false, const InstrAllowedContexts *pAllowedContexts = NULL);
|
||||
int setPmRegsCfgFuncPassing(InstrEscCbData cbData, uint32_t count, uint32_t *pOffsets, uint32_t *pValues);
|
||||
int setPmRegsCfgFuncFailing(InstrEscCbData cbData, uint32_t count, uint32_t *pOffsets, uint32_t *pValues);
|
||||
int sendReadRegsCfgFuncPassing(InstrEscCbData cbData, uint32_t count, uint32_t *pOffsets, uint32_t *pBitSizes);
|
||||
int sendReadRegsCfgFuncFailing(InstrEscCbData cbData, uint32_t count, uint32_t *pOffsets, uint32_t *pBitSizes);
|
||||
bool setPmRegsCfgFuncPassing(InstrEscCbData cbData, uint32_t count, uint32_t *pOffsets, uint32_t *pValues);
|
||||
bool setPmRegsCfgFuncFailing(InstrEscCbData cbData, uint32_t count, uint32_t *pOffsets, uint32_t *pValues);
|
||||
bool sendReadRegsCfgFuncPassing(InstrEscCbData cbData, uint32_t count, uint32_t *pOffsets, uint32_t *pBitSizes);
|
||||
bool sendReadRegsCfgFuncFailing(InstrEscCbData cbData, uint32_t count, uint32_t *pOffsets, uint32_t *pBitSizes);
|
||||
|
||||
class PerfCounterFlags {
|
||||
public:
|
||||
|
@ -38,7 +38,7 @@ std::unique_ptr<PerformanceCounters> MockPerformanceCounters::create(OSTime *osT
|
||||
int PerfCounterFlagsWin::setAvailableFuncCalled;
|
||||
int PerfCounterFlagsWin::verifyEnableFuncCalled;
|
||||
|
||||
int setAvailable(int value) {
|
||||
bool setAvailable(bool value) {
|
||||
PerfCounterFlagsWin::setAvailableFuncCalled++;
|
||||
return value;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
namespace OCLRT {
|
||||
|
||||
int setAvailable(int value);
|
||||
bool setAvailable(bool value);
|
||||
void verifyEnable(InstrEscCbData cbData);
|
||||
|
||||
class PerfCounterFlagsWin : public PerfCounterFlags {
|
||||
|
Reference in New Issue
Block a user