Enable Performance Counters for OCL and L0.

Change-Id: I1920b9d406c092fbc26fc6ca27766db297a1958b
This commit is contained in:
Piotr Maciejewski
2020-03-13 15:38:23 +01:00
committed by sys_ocldev
parent 9b14911f8b
commit c6cd582f78
32 changed files with 2053 additions and 464 deletions

View File

@ -211,6 +211,24 @@ if(DISABLE_AUB_STREAM)
unset(AUB_STREAM_DIR)
endif()
# Metrics Library
get_filename_component(METRICS_LIBRARY_HEADERS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party${BRANCH_DIR_SUFFIX}/metrics_library" ABSOLUTE)
if(IS_DIRECTORY ${METRICS_LIBRARY_HEADERS_DIR})
message(STATUS "Metrics Library dir: ${METRICS_LIBRARY_HEADERS_DIR}")
include_directories(${NEO_SOURCE_DIR}/third_party${BRANCH_DIR_SUFFIX}/metrics_library)
else()
message(FATAL_ERROR "Metrics Library headers not available!")
endif()
# Metrics Discovery
get_filename_component(METRICS_DISCOVERY_HEADERS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party${BRANCH_DIR_SUFFIX}/metrics_discovery" ABSOLUTE)
if(IS_DIRECTORY ${METRICS_DISCOVERY_HEADERS_DIR})
message(STATUS "Metrics Discovery dir: ${METRICS_DISCOVERY_HEADERS_DIR}")
include_directories(${NEO_SOURCE_DIR}/third_party${BRANCH_DIR_SUFFIX}/metrics_discovery)
else()
message(FATAL_ERROR "Metrics Discovery headers not available!")
endif()
get_filename_component(I915_INCLUDES_DIR "${NEO_SOURCE_DIR}/third_party${BRANCH_DIR_SUFFIX}/uapi" ABSOLUTE)
message(STATUS "i915 includes dir: ${I915_INCLUDES_DIR}")
@ -486,33 +504,6 @@ endmacro()
link_directories(${NEO__GMM_LIBRARY_PATH})
# Instrumentation detection
if(NOT DEFINED INSTRUMENTATION_LIB_NAME)
if(DEFINED INSTRUMENTATION_SOURCE_DIR)
get_filename_component(INSTRUMENTATION_SOURCE_DIR "${INSTRUMENTATION_SOURCE_DIR}" ABSOLUTE)
else()
get_filename_component(INSTRUMENTATION_SOURCE_DIR_tmp "${NEO_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 "Instrumentation source dir is: ${INSTRUMENTATION_SOURCE_DIR}")
set(INSTRUMENTATION_INCLUDE_PATHS ${INSTRUMENTATION_SOURCE_DIR}/inc)
set(HAVE_INSTRUMENTATION TRUE)
else()
message(STATUS "Instrumentation source dir not found")
set(HAVE_INSTRUMENTATION FALSE)
endif()
else()
if(TARGET ${INSTRUMENTATION_LIB_NAME})
set(INSTRUMENTATION_INCLUDE_PATHS $<TARGET_PROPERTY:${INSTRUMENTATION_LIB_NAME},INTERFACE_INCLUDE_DIRECTORIES>)
set(HAVE_INSTRUMENTATION TRUE)
else()
message(STATUS "Instrumentation target not found. ${INSTRUMENTATION_LIB_NAME} is not a valid target")
set(HAVE_INSTRUMENTATION FALSE)
endif()
endif()
if(NOT DISABLE_LIBVA)
# LibVA detection
@ -822,15 +813,6 @@ if (MSVC)
include_directories(${NEO_SOURCE_DIR}/opencl/source/sharings/gl/windows/include)
endif()
if(HAVE_INSTRUMENTATION)
set(NEO__INSTRUMENTATION_DIR_SUFFIX ${BRANCH_DIR_SUFFIX})
message(STATUS "Instrumentation include dirs: ${INSTRUMENTATION_INCLUDE_PATHS}")
include_directories(${INSTRUMENTATION_INCLUDE_PATHS})
else()
set(NEO__INSTRUMENTATION_DIR_SUFFIX "/")
endif()
include_directories(${NEO_SOURCE_DIR}/opencl/source/instrumentation${NEO__INSTRUMENTATION_DIR_SUFFIX})
# Define where to put binaries
set(TargetDir ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
if(MSVC)

2
Jenkinsfile vendored
View File

@ -1,5 +1,5 @@
#!groovy
dependenciesRevision='3232e5d67b5c3dd2323f13bede3ab1558b5aa4b9-1401'
strategy='EQUAL'
allowedCD=221
allowedCD=220
allowedF=11

View File

@ -74,6 +74,10 @@ Directly linking to the runtime library is not supported:
* GmmLib - https://github.com/intel/gmmlib
* Intel Graphics Compiler - https://github.com/intel/intel-graphics-compiler
In addition, to enable performance counters support, the following packages are needed:
* Intel Metrics Discovery - https://github.com/intel/metrics-discovery
* Intel Metrics Library for MDAPI - https://github.com/intel/metrics-library
## How to provide feedback
By default, please submit an issue using native github.com [interface](https://github.com/intel/compute-runtime/issues).

View File

@ -192,7 +192,6 @@ if(BUILD_WITH_L0 AND "${NEO_BITS}" STREQUAL "64")
${COMPUTE_RUNTIME_DIR}/opencl/source/dll/get_devices.cpp
${COMPUTE_RUNTIME_DIR}/opencl/source/dll/source_level_debugger.cpp
${COMPUTE_RUNTIME_DIR}/opencl/source/helpers/built_ins_helper.cpp
${COMPUTE_RUNTIME_DIR}/opencl/source/instrumentation/instrumentation.cpp
)
if(WIN32)
@ -400,14 +399,6 @@ if(UNIX)
)
endif()
if(HAVE_INSTRUMENTATION)
target_link_libraries(${TARGET_NAME_L0}
${INSTRUMENTATION_LIB_NAME})
target_include_directories(${TARGET_NAME_L0} BEFORE PRIVATE
${INSTRUMENTATION_INCLUDE_PATH}
)
endif()
create_source_tree(${TARGET_NAME_L0} ${L0_ROOT_DIR}/..)
set_property(TARGET ${TARGET_NAME_L0} APPEND_STRING PROPERTY COMPILE_FLAGS ${ASAN_FLAGS})

View File

@ -7,16 +7,11 @@
set(L0_SRCS_TOOLS_METRICS
)
if(HAVE_INSTRUMENTATION)
list(APPEND L0_SRCS_TOOLS_METRICS
${CMAKE_CURRENT_SOURCE_DIR}/metric.cpp
${CMAKE_CURRENT_SOURCE_DIR}/metric_enumeration_imp.cpp
${CMAKE_CURRENT_SOURCE_DIR}/metric_tracer_imp.cpp
${CMAKE_CURRENT_SOURCE_DIR}/metric_query_imp.cpp)
else()
list(APPEND L0_SRCS_TOOLS_METRICS
${CMAKE_CURRENT_SOURCE_DIR}/metric_stubs.cpp)
endif()
list(APPEND L0_SRCS_TOOLS_METRICS
${CMAKE_CURRENT_SOURCE_DIR}/metric.cpp
${CMAKE_CURRENT_SOURCE_DIR}/metric_enumeration_imp.cpp
${CMAKE_CURRENT_SOURCE_DIR}/metric_tracer_imp.cpp
${CMAKE_CURRENT_SOURCE_DIR}/metric_query_imp.cpp)
if(UNIX)
add_subdirectory(linux)

View File

@ -4,18 +4,16 @@
# SPDX-License-Identifier: MIT
#
if(HAVE_INSTRUMENTATION)
set(L0_SRCS_TOOLS_LINUX
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/os_metric_query_imp_linux.cpp
${CMAKE_CURRENT_SOURCE_DIR}/os_metric_enumeration_imp_linux.cpp)
set(L0_SRCS_TOOLS_LINUX
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/os_metric_query_imp_linux.cpp
${CMAKE_CURRENT_SOURCE_DIR}/os_metric_enumeration_imp_linux.cpp)
if(UNIX)
target_sources(${L0_STATIC_LIB_NAME}
PRIVATE
${L0_SRCS_TOOLS_LINUX}
)
endif()
if(UNIX)
target_sources(${L0_STATIC_LIB_NAME}
PRIVATE
${L0_SRCS_TOOLS_LINUX}
)
# Make our source files visible to parent
set_property(GLOBAL PROPERTY L0_SRCS_TOOLS_LINUX ${L0_SRCS_TOOLS_LINUX})

View File

@ -16,8 +16,6 @@
#include "level_zero/tools/source/metrics/metric_enumeration_imp.h"
#include "level_zero/tools/source/metrics/metric_query_imp.h"
#include "instrumentation.h"
#include <map>
#include <utility>

View File

@ -7,24 +7,12 @@
#pragma once
#include "level_zero/tools/source/metrics/metric.h"
// Ignore function-overload warning in clang
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Woverloaded-virtual"
#elif defined(__linux__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Woverloaded-virtual"
#endif
#include "common/instrumentation/api/metrics_discovery_api.h"
#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__linux__)
#pragma GCC diagnostic pop
#endif
#include "shared/source/os_interface/os_library.h"
#include "level_zero/tools/source/metrics/metric.h"
#include "metrics_discovery_api.h"
#include <vector>
namespace L0 {
@ -44,7 +32,7 @@ struct MetricEnumeration {
ze_result_t initialize();
virtual ze_result_t openMetricsDiscovery();
virtual ze_result_t cleanupMetricsDiscovery();
ze_result_t cleanupMetricsDiscovery();
ze_result_t cacheMetricInformation();
ze_result_t cacheMetricGroup(MetricsDiscovery::IMetricSet_1_5 &metricSet,

View File

@ -8,8 +8,6 @@
#pragma once
#include "level_zero/tools/source/metrics/metric.h"
#include "instrumentation.h"
#include <map>
#include <vector>

View File

@ -1,73 +0,0 @@
/*
* Copyright (C) 2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/os_interface/os_library.h"
#include "level_zero/core/source/device/device.h"
#include "level_zero/core/source/driver/driver.h"
#include "level_zero/core/source/driver/driver_handle_imp.h"
#include "level_zero/source/inc/ze_intel_gpu.h"
#include "level_zero/tools/source/metrics/metric.h"
#include "level_zero/tools/source/metrics/metric_query_imp.h"
#include "instrumentation.h"
#include <map>
#include <utility>
namespace L0 {
MetricQueryPool *MetricQueryPool::create(zet_device_handle_t hDevice, zet_metric_group_handle_t hMetricGroup, const zet_metric_query_pool_desc_t &desc) { return nullptr; }
MetricQueryPool *MetricQueryPool::fromHandle(zet_metric_query_pool_handle_t handle) { return nullptr; }
ze_result_t metricQueryPoolCreate(zet_device_handle_t hDevice, zet_metric_group_handle_t hMetricGroup, const zet_metric_query_pool_desc_t *pDesc,
zet_metric_query_pool_handle_t *phMetricQueryPool) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
ze_result_t metricQueryPoolDestroy(zet_metric_query_pool_handle_t hMetricQueryPool) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
ze_result_t MetricQuery::appendMemoryBarrier(CommandList &commandList) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
ze_result_t MetricQuery::appendTracerMarker(CommandList &commandList,
zet_metric_tracer_handle_t hMetricTracer, uint32_t value) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
MetricQuery *MetricQuery::fromHandle(zet_metric_query_handle_t handle) { return nullptr; }
void MetricContext::enableMetricApi(ze_result_t &result) {
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
return;
}
std::unique_ptr<MetricContext> MetricContext::create(Device &device) {
return nullptr;
}
bool MetricContext::isMetricApiAvailable() {
return false;
}
ze_result_t metricGroupGet(zet_device_handle_t hDevice, uint32_t *pCount, zet_metric_group_handle_t *phMetricGroups) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
ze_result_t metricGet(zet_metric_group_handle_t hMetricGroup, uint32_t *pCount, zet_metric_handle_t *phMetrics) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
ze_result_t metricTracerOpen(zet_device_handle_t hDevice, zet_metric_group_handle_t hMetricGroup,
zet_metric_tracer_desc_t *pDesc, ze_event_handle_t hNotificationEvent,
zet_metric_tracer_handle_t *phMetricTracer) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
} // namespace L0

View File

@ -4,18 +4,16 @@
# SPDX-License-Identifier: MIT
#
if(HAVE_INSTRUMENTATION)
set(L0_SRCS_TOOLS_WINDOWS
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/os_metric_query_imp_windows.cpp
${CMAKE_CURRENT_SOURCE_DIR}/os_metric_enumeration_imp_windows.cpp)
set(L0_SRCS_TOOLS_WINDOWS
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/os_metric_query_imp_windows.cpp
${CMAKE_CURRENT_SOURCE_DIR}/os_metric_enumeration_imp_windows.cpp)
if(WIN32)
target_sources(${L0_STATIC_LIB_NAME}
PRIVATE
${L0_SRCS_TOOLS_WINDOWS}
)
endif()
if(WIN32)
target_sources(${L0_STATIC_LIB_NAME}
PRIVATE
${L0_SRCS_TOOLS_WINDOWS}
)
# Make our source files visible to parent
set_property(GLOBAL PROPERTY L0_SRCS_TOOLS_WINDOWS ${L0_SRCS_TOOLS_WINDOWS})

View File

@ -22,7 +22,6 @@ endif()
hide_subdir(builtin_kernels_simulation)
hide_subdir(dll)
hide_subdir(instrumentation)
add_library(${NEO_STATIC_LIB_NAME} STATIC EXCLUDE_FROM_ALL
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
@ -31,7 +30,6 @@ add_library(${NEO_STATIC_LIB_NAME} STATIC EXCLUDE_FROM_ALL
)
add_subdirectories()
add_subdirectory(instrumentation${NEO__INSTRUMENTATION_DIR_SUFFIX})
include(enable_gens.cmake)
# Enable SSE4/AVX2 options for files that need them

View File

@ -12,9 +12,6 @@
#include "opencl/source/command_stream/tbx_command_stream_receiver_hw.h"
#include "opencl/source/device_queue/device_queue_hw.h"
#ifdef HAVE_INSTRUMENTATION
#include "opencl/source/event/perf_counter.h"
#endif
#include "opencl/source/mem_obj/buffer.h"
#include "opencl/source/mem_obj/image.h"
#include "opencl/source/sampler/sampler.h"

View File

@ -1,40 +0,0 @@
---
Checks: 'clang-diagnostic-*,clang-analyzer-*,google-default-arguments,readability-identifier-naming,modernize-use-override,modernize-use-default-member-init,-clang-analyzer-alpha*'
# WarningsAsErrors: '.*'
HeaderFilterRegex: '/runtime/|/core/|/offline_compiler/'
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'
...

View File

@ -1,13 +0,0 @@
#
# Copyright (C) 2018-2020 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
set(RUNTIME_SRCS_INSTRUMENTATION
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/instrumentation.cpp
${CMAKE_CURRENT_SOURCE_DIR}/instrumentation.h
)
target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_INSTRUMENTATION})
set_property(GLOBAL PROPERTY RUNTIME_SRCS_INSTRUMENTATION ${RUNTIME_SRCS_INSTRUMENTATION})

View File

@ -1,12 +0,0 @@
/*
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "instrumentation.h"
namespace NEO {
const bool haveInstrumentation = false;
} // namespace NEO

View File

@ -1,203 +0,0 @@
/*
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include <cstdint>
namespace NEO {
extern const bool haveInstrumentation;
} // namespace NEO
namespace MetricsLibraryApi {
// Dummy macros.
#define ML_STDCALL
#define METRICS_LIBRARY_CONTEXT_CREATE_1_0 "create"
#define METRICS_LIBRARY_CONTEXT_DELETE_1_0 "delete"
// Dummy enumerators.
enum class ClientApi : uint32_t { OpenCL };
enum class ClientGen : uint32_t { Unknown,
Gen9,
Gen11,
Gen12 };
enum class ValueType : uint32_t { Uint32,
Last };
enum class GpuConfigurationActivationType : uint32_t { Tbs,
EscapeCode };
enum class ObjectType : uint32_t { QueryHwCounters,
MarkerStreamUser,
OverrideFlushCaches,
ConfigurationHwCountersUser,
ConfigurationHwCountersOa };
enum class ParameterType : uint32_t { QueryHwCountersReportApiSize,
QueryHwCountersReportGpuSize };
enum class StatusCode : uint32_t { Failed,
IncorrectObject,
Success };
enum class GpuCommandBufferType : uint32_t { Render,
Compute };
enum class ClientOptionsType : uint32_t {
Compute
};
// Dummy handles.
struct Handle {
void *data;
bool IsValid() const { return data != nullptr; } // NOLINT
};
struct QueryHandle_1_0 : Handle {};
struct ConfigurationHandle_1_0 : Handle {};
struct ContextHandle_1_0 : Handle {};
// Dummy structures.
struct ClientCallbacks_1_0 {};
struct ClientDataWindows_1_0 {
void *Device;
void *Adapter;
void *Escape;
bool KmdInstrumentationEnabled;
};
struct ClientDataLinux_1_0 {
void *Reserved;
};
struct ClientOptionsComputeData_1_0 {
bool Asynchronous;
};
struct ClientOptionsData_1_0 {
ClientOptionsType Type;
ClientOptionsComputeData_1_0 Compute;
};
struct ClientData_1_0 {
union {
ClientDataWindows_1_0 Windows;
ClientDataLinux_1_0 Linux;
};
ClientOptionsData_1_0 *ClientOptions;
uint32_t ClientOptionsCount;
};
struct ConfigurationActivateData_1_0 {
GpuConfigurationActivationType Type;
};
struct ClientType_1_0 {
ClientApi Api;
ClientGen Gen;
};
struct TypedValue_1_0 {
uint32_t ValueUInt32;
ValueType Type;
};
struct GpuMemory_1_0 {
uint64_t GpuAddress;
void *CpuAddress;
};
struct CommandBufferQueryHwCounters_1_0 {
QueryHandle_1_0 Handle;
ConfigurationHandle_1_0 HandleUserConfiguration;
bool Begin;
uint32_t Slot;
};
struct CommandBufferMarkerStreamUser_1_0 {
uint32_t Value;
};
struct CommandBufferOverride_1_0 {
bool Enable;
};
struct CommandBufferSize_1_0 {
uint32_t GpuMemorySize;
};
struct ConfigurationCreateData_1_0 {
ContextHandle_1_0 HandleContext;
ObjectType Type;
};
struct CommandBufferData_1_0 {
ContextHandle_1_0 HandleContext;
ObjectType CommandsType;
GpuCommandBufferType Type;
GpuMemory_1_0 Allocation;
void *Data;
uint32_t Size;
CommandBufferQueryHwCounters_1_0 QueryHwCounters;
CommandBufferMarkerStreamUser_1_0 MarkerStreamUser;
CommandBufferOverride_1_0 Override;
};
struct QueryCreateData_1_0 {
ContextHandle_1_0 HandleContext;
ObjectType Type;
uint32_t Slots;
};
struct GetReportQuery_1_0 {
QueryHandle_1_0 Handle;
uint32_t Slot;
uint32_t SlotsCount;
uint32_t DataSize;
void *Data;
};
struct GetReportData_1_0 {
ObjectType Type;
GetReportQuery_1_0 Query;
};
struct ContextCreateData_1_0 {
ClientData_1_0 *ClientData;
ClientCallbacks_1_0 *ClientCallbacks;
struct Interface_1_0 *Api;
};
// Dummy functions.
using ContextCreateFunction_1_0 = StatusCode(ML_STDCALL *)(ClientType_1_0 clientType, struct ContextCreateData_1_0 *createData, ContextHandle_1_0 *handle);
using ContextDeleteFunction_1_0 = StatusCode(ML_STDCALL *)(const ContextHandle_1_0 handle);
using GetParameterFunction_1_0 = StatusCode(ML_STDCALL *)(const ParameterType parameter, ValueType *type, TypedValue_1_0 *value);
using CommandBufferGetFunction_1_0 = StatusCode(ML_STDCALL *)(const CommandBufferData_1_0 *data);
using CommandBufferGetSizeFunction_1_0 = StatusCode(ML_STDCALL *)(const CommandBufferData_1_0 *data, CommandBufferSize_1_0 *size);
using QueryCreateFunction_1_0 = StatusCode(ML_STDCALL *)(const QueryCreateData_1_0 *createData, QueryHandle_1_0 *handle);
using QueryDeleteFunction_1_0 = StatusCode(ML_STDCALL *)(const QueryHandle_1_0 handle);
using ConfigurationCreateFunction_1_0 = StatusCode(ML_STDCALL *)(const ConfigurationCreateData_1_0 *createData, ConfigurationHandle_1_0 *handle);
using ConfigurationActivateFunction_1_0 = StatusCode(ML_STDCALL *)(const ConfigurationHandle_1_0 handle, const ConfigurationActivateData_1_0 *activateData);
using ConfigurationDeactivateFunction_1_0 = StatusCode(ML_STDCALL *)(const ConfigurationHandle_1_0 handle);
using ConfigurationDeleteFunction_1_0 = StatusCode(ML_STDCALL *)(const ConfigurationHandle_1_0 handle);
using GetDataFunction_1_0 = StatusCode(ML_STDCALL *)(GetReportData_1_0 *data);
// Dummy interface.
struct Interface_1_0 {
GetParameterFunction_1_0 GetParameter;
CommandBufferGetFunction_1_0 CommandBufferGet;
CommandBufferGetSizeFunction_1_0 CommandBufferGetSize;
QueryCreateFunction_1_0 QueryCreate;
QueryDeleteFunction_1_0 QueryDelete;
ConfigurationCreateFunction_1_0 ConfigurationCreate;
ConfigurationActivateFunction_1_0 ConfigurationActivate;
ConfigurationDeactivateFunction_1_0 ConfigurationDeactivate;
ConfigurationDeleteFunction_1_0 ConfigurationDelete;
GetDataFunction_1_0 GetData;
};
}; // namespace MetricsLibraryApi

View File

@ -9,7 +9,7 @@
#include "shared/source/os_interface/os_library.h"
#include "instrumentation.h"
#include "metrics_library_api_1_0.h"
#include <memory>

View File

@ -435,7 +435,7 @@ TEST_F(HwInfoConfigTestLinuxDummy, givenInstrumentationForHardwareIsEnabledOrDis
pInHwInfo.capabilityTable.instrumentationEnabled = true;
ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface);
ASSERT_EQ(0, ret);
EXPECT_TRUE(outHwInfo.capabilityTable.instrumentationEnabled == haveInstrumentation);
EXPECT_TRUE(outHwInfo.capabilityTable.instrumentationEnabled);
}
TEST_F(HwInfoConfigTestLinuxDummy, givenGttSizeReturnedWhenInitializingHwInfoThenSetSvmFtr) {

View File

@ -14,8 +14,6 @@
#include "opencl/test/unit_test/mocks/mock_context.h"
#include "opencl/test/unit_test/mocks/mock_device.h"
#include "instrumentation.h"
namespace NEO {
//////////////////////////////////////////////////////

View File

@ -16,8 +16,6 @@
#include "opencl/test/unit_test/mocks/mock_execution_environment.h"
#include "test.h"
#include "instrumentation.h"
namespace NEO {
template <>
@ -101,7 +99,7 @@ TEST_F(HwInfoConfigTestWindows, givenInstrumentationForHardwareIsEnabledOrDisabl
outHwInfo.capabilityTable.instrumentationEnabled = true;
ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface.get());
ASSERT_EQ(0, ret);
EXPECT_TRUE(outHwInfo.capabilityTable.instrumentationEnabled == haveInstrumentation);
EXPECT_TRUE(outHwInfo.capabilityTable.instrumentationEnabled);
}
HWTEST_F(HwInfoConfigTestWindows, givenFtrIaCoherencyFlagWhenConfiguringHwInfoThenSetCoherencySupportCorrectly) {

View File

@ -20,8 +20,6 @@
#include "opencl/source/helpers/dispatch_info.h"
#include "opencl/source/helpers/hardware_commands_helper.h"
#include "instrumentation.h"
namespace NEO {
template <typename Family>

View File

@ -17,8 +17,6 @@
#include "shared/source/os_interface/linux/os_interface.h"
#include "shared/source/utilities/cpu_info.h"
#include "instrumentation.h"
#include <cstring>
namespace NEO {
@ -155,9 +153,6 @@ int HwInfoConfig::configureHwInfo(const HardwareInfo *inHwInfo, HardwareInfo *ou
hwHelper.adjustDefaultEngineType(outHwInfo);
outHwInfo->capabilityTable.defaultEngineType = getChosenEngineType(*outHwInfo);
outHwInfo->capabilityTable.instrumentationEnabled =
(outHwInfo->capabilityTable.instrumentationEnabled && haveInstrumentation);
outHwInfo->capabilityTable.ftrRenderCompressedBuffers = false;
outHwInfo->capabilityTable.ftrRenderCompressedImages = false;
drm->checkQueueSliceSupport();

View File

@ -14,8 +14,6 @@
#include "shared/source/helpers/hw_info.h"
#include "shared/source/memory_manager/memory_constants.h"
#include "instrumentation.h"
namespace NEO {
HwInfoConfig *hwInfoConfigFactory[IGFX_MAX_PRODUCT] = {};
@ -37,9 +35,6 @@ int HwInfoConfig::configureHwInfo(const HardwareInfo *inHwInfo, HardwareInfo *ou
static_cast<bool>(outHwInfo->featureTable.ftrGpGpuMidBatchPreempt));
outHwInfo->capabilityTable.requiredPreemptionSurfaceSize = outHwInfo->gtSystemInfo.CsrSizeInMb * MemoryConstants::megaByte;
outHwInfo->capabilityTable.instrumentationEnabled =
(outHwInfo->capabilityTable.instrumentationEnabled && haveInstrumentation);
auto &kmdNotifyProperties = outHwInfo->capabilityTable.kmdNotifyProperties;
KmdNotifyHelper::overrideFromDebugVariable(DebugManager.flags.OverrideEnableKmdNotify.get(), kmdNotifyProperties.enableKmdNotify);
KmdNotifyHelper::overrideFromDebugVariable(DebugManager.flags.OverrideKmdNotifyDelayMicroseconds.get(), kmdNotifyProperties.delayKmdNotifyMicroseconds);

View File

@ -0,0 +1 @@
0928b82f6242217637c3a89d01eb630c55a52ce7

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019, Intel Corporation
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.

68
third_party/metrics_discovery/README.md vendored Normal file
View File

@ -0,0 +1,68 @@
# Intel(R) Metrics Discovery Application Programming Interface
## Introduction
This software is a user mode library that provides access to GPU performance data.
The library has OS abstraction layer that allows for interoperability in different environments.
## License
Intel(R) Metrics Discovery Application Programming Interface is distributed under the MIT License.
You may obtain a copy of the License at:
https://opensource.org/licenses/MIT
## Supported Platforms
- Intel(R) Processors with Gen11 graphics devices (formerly Ice Lake, Elkhart Lake),
- Intel(R) Processors with Gen9 graphics devices (formerly Skylake, Kaby Lake, Apollo Lake/Broxton, Gemini Lake, Coffee Lake),
- Intel(R) Processors with Gen8 graphics devices (formerly Broadwell),
- Intel(R) Processors with Gen7.5 graphics devices (formerly Haswell).
## Supported Operating Systems
Intel(R) Metrics Discovery Application Programming Interface is supported on Linux family operating systems with minimum kernel version 4.14.
Event based measurements require minimum Mesa version 18.2.
### Detailed minimum version requirements
| Platform | Code Name | Minimum Linux Kernel Version | Minimum Mesa Version |
|--|--|--|--|
| Gen11 | Elkhart Lake | 5.3 | 19.1 |
| Gen11 | Ice Lake | 4.18 | 19.1 |
| Gen9, Gen8 | * | 4.14 | 18.2 |
| Gen7.5 | Haswell | 4.17 | 18.2 |
## Build and Install
1\. Download sources.
2\. Run CMake generation:
```shell
cmake .
```
3\. Build:
```shell
make -j$(nproc)
```
4\. Built library will be here (for 64-bit Linux):
```shell
(project_root)/dump/linux64/release/md/libmd.so
```
5\. Install:
```shell
sudo make install
```
*Note: To clear CMake params remove CMakeCache.txt, then regenerate.*
##
___(*) Other names and brands my be claimed as property of others.___

File diff suppressed because it is too large Load Diff

1
third_party/metrics_library/.revision vendored Normal file
View File

@ -0,0 +1 @@
608dcb5b626317e1e7550eedc84ff6e542a3b31b

21
third_party/metrics_library/LICENSE.md vendored Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020, Intel Corporation
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.

63
third_party/metrics_library/README.md vendored Normal file
View File

@ -0,0 +1,63 @@
# Intel(R) Metrics Library for MDAPI
## Introduction
This software is a user mode driver helper library that provides access to GPU performance counters.
## License
Intel(R) Metrics Library for MDAPI is distributed under the MIT License.
You may obtain a copy of the License at:
https://opensource.org/licenses/MIT
## Supported Platforms
- Intel(R) Processors with Gen12 graphics devices
- Intel(R) Processors with Gen11 graphics devices
- Intel(R) Processors with Gen9 graphics devices
## Supported Operating Systems
Intel(R) Metrics Library for MDAPI is supported on Linux family operating systems with minimum kernel version 4.14.
## Build and Install
Not a stand alone software component. Serves as a helper library for particular Intel drivers.
There is no need to build the library as long as it is an integrated part of those Intel drivers.
1\. Download sources.
2\. Run CMake generation:
```shell
cmake .
```
3\. Build:
```shell
make -j$(nproc)
```
4\. Built library will be here (for 64-bit Linux):
```shell
(project_root)/dump/linux64/metrics_library/libigdml64.so
```
5\. To prepare an installation package:
```shell
make package
```
6\. Install:
```shell
sudo dpkg -i intel-metrics-library*.deb
```
*Note: To clear CMake parameters remove CMakeCache.txt, then regenerate.*
##
___(*) Other names and brands my be claimed as property of others.___

View File

@ -0,0 +1,653 @@
/******************************************************************************\
Copyright © 2020, Intel Corporation
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.
File Name: metrics_library_api_1_0.h
Abstract: Interface for Metrics Library umd dll.
Notes:
\******************************************************************************/
#pragma once
#include <stdint.h>
#ifdef _MSC_VER
#define ML_STDCALL __stdcall
#else
#define ML_STDCALL
#endif
namespace MetricsLibraryApi
{
//////////////////////////////////////////////////////////////////////////
/// @brief Metrics Library handles.
//////////////////////////////////////////////////////////////////////////
#define METRICS_LIBRARY_HANDLE(Object) typedef struct Object##Handle_1_0 \
{ \
void* data; \
Object##Handle_1_0( void ) { data = nullptr; } \
Object##Handle_1_0( void* handle ) { data = handle; } \
bool IsValid( void ) const { return data != nullptr; } \
} Object##Handle_1_0;
METRICS_LIBRARY_HANDLE( Client )
METRICS_LIBRARY_HANDLE( ClientMemory )
METRICS_LIBRARY_HANDLE( Configuration )
METRICS_LIBRARY_HANDLE( Context )
METRICS_LIBRARY_HANDLE( Marker )
METRICS_LIBRARY_HANDLE( Override )
METRICS_LIBRARY_HANDLE( Query )
//////////////////////////////////////////////////////////////////////////
/// @brief Client api types.
//////////////////////////////////////////////////////////////////////////
enum class ClientApi : uint32_t
{
Unknown = 0,
// 1-5 reserved.
OpenCL = 6,
// 7-8 reserved.
OneApi = 9,
// 10 reserved.
// ...
Last
};
//////////////////////////////////////////////////////////////////////////
/// @brief Client gpu generation types.
//////////////////////////////////////////////////////////////////////////
enum class ClientGen : uint32_t
{
Unknown = 0,
Gen9,
Gen9LP,
Gen10,
Gen11,
Gen11LP,
Gen12,
// ...
Last
};
//////////////////////////////////////////////////////////////////////////
/// @brief Library object types.
//////////////////////////////////////////////////////////////////////////
enum class ObjectType : uint32_t
{
Unknown = 0,
// Context objects:
Context = 10000,
// Query objects:
QueryHwCounters = 20000,
QueryPipelineTimestamps = 20001,
// Configuration objects:
ConfigurationHwCountersOa = 30000,
ConfigurationHwCountersUser,
// Override objects:
OverrideUser = 40000,
OverrideNullHardware,
OverrideFlushCaches,
OverridePoshQuery,
OverrideDisablePoshPrimitives,
// Markers:
MarkerStreamUser = 50000,
MarkerStreamUserExtended = 50001,
// ...
Last
};
//////////////////////////////////////////////////////////////////////////
/// @brief Client options types.
//////////////////////////////////////////////////////////////////////////
enum class ClientOptionsType : uint32_t
{
Posh = 0,
Ptbr,
Compute,
// ...
Last
};
//////////////////////////////////////////////////////////////////////////
/// @brief Status code types.
//////////////////////////////////////////////////////////////////////////
enum class StatusCode : uint32_t
{
Success = 0,
Failed,
IncorrectVersion,
IncorrectParameter,
IncorrectSlot,
IncorrectObject,
InsufficientSpace,
NotInitialized,
NotSupported,
NotImplemented,
NullPointer,
OutOfMemory,
UnknownGen,
TbsUnableToEnable,
TbsUnableToRead,
ReportNotReady,
ReportLost,
ReportInconsistent,
// ...
Last
};
//////////////////////////////////////////////////////////////////////////
/// @brief Value types.
//////////////////////////////////////////////////////////////////////////
enum class ValueType : uint8_t
{
Uint8 = 0,
Int8,
Uint16,
Int16,
Uint32,
Int32,
Uint64,
Int64,
Float,
Double,
Bool,
String,
// ...
Last
};
//////////////////////////////////////////////////////////////////////////
/// @brief Gpu configuration activation types.
//////////////////////////////////////////////////////////////////////////
enum class GpuConfigurationActivationType : uint32_t
{
EscapeCode = 0,
Tbs,
// ...
Last
};
//////////////////////////////////////////////////////////////////////////
/// @brief Gpu command buffer types.
//////////////////////////////////////////////////////////////////////////
enum class GpuCommandBufferType : uint32_t
{
Render = 0,
Posh,
Tile,
Compute,
// ...
Last
};
//////////////////////////////////////////////////////////////////////////
/// @brief Memory types.
//////////////////////////////////////////////////////////////////////////
enum class MemoryType : uint32_t
{
Query = 0,
CommandBuffer,
Cpu,
// ...
Last
};
//////////////////////////////////////////////////////////////////////////
/// @brief Memory flags.
//////////////////////////////////////////////////////////////////////////
enum class MemoryFlags : uint32_t
{
Linear = 1 << 0,
Cachable = 1 << 1
};
//////////////////////////////////////////////////////////////////////////
/// @brief Parameter types.
//////////////////////////////////////////////////////////////////////////
enum class ParameterType : uint32_t
{
QueryHwCountersReportApiSize = 0,
QueryHwCountersReportGpuSize,
QueryPipelineTimestampsReportApiSize,
QueryPipelineTimestampsReportGpuSize,
LibraryBuildNumber,
// ...
Last
};
//////////////////////////////////////////////////////////////////////////
/// @brief Client type.
//////////////////////////////////////////////////////////////////////////
struct ClientType_1_0
{
ClientApi Api;
ClientGen Gen;
};
//////////////////////////////////////////////////////////////////////////
/// @brief Typed value.
//////////////////////////////////////////////////////////////////////////
struct TypedValue_1_0
{
ValueType Type;
union
{
int8_t ValueInt8;
uint8_t ValueUInt8;
int16_t ValueInt16;
uint16_t ValueUInt16;
int32_t ValueInt32;
uint32_t ValueUInt32;
int64_t ValueInt64;
uint64_t ValueUInt64;
float ValueFloat;
bool ValueBool;
const char* ValueString;
};
};
//////////////////////////////////////////////////////////////////////////
/// @brief Gpu memory data.
//////////////////////////////////////////////////////////////////////////
struct GpuMemory_1_0
{
uint64_t GpuAddress; // Virtual gpu address.
void* CpuAddress; // Locked cpu address.
ClientMemoryHandle_1_0 HandleMemory; // Driver's handle.
};
//////////////////////////////////////////////////////////////////////////
/// @brief Query creation data.
//////////////////////////////////////////////////////////////////////////
struct QueryCreateData_1_0
{
ContextHandle_1_0 HandleContext;
ObjectType Type;
uint32_t Slots;
};
//////////////////////////////////////////////////////////////////////////
/// @brief Query hw counters command buffer data.
//////////////////////////////////////////////////////////////////////////
struct CommandBufferQueryHwCounters_1_0
{
QueryHandle_1_0 Handle;
ConfigurationHandle_1_0 HandleUserConfiguration;
uint32_t Slot;
uint64_t MarkerUser;
uint64_t MarkerDriver;
uint64_t EndTag;
bool Begin;
};
//////////////////////////////////////////////////////////////////////////
/// @brief Query pipeline timestamps command buffer data.
//////////////////////////////////////////////////////////////////////////
struct CommandBufferQueryPipelineTimestamps_1_0
{
QueryHandle_1_0 Handle;
uint64_t EndTag;
bool Begin;
};
//////////////////////////////////////////////////////////////////////////
/// @brief Overrides commands data.
//////////////////////////////////////////////////////////////////////////
struct CommandBufferOverride_1_0
{
OverrideHandle_1_0 Handle;
bool Enable;
};
//////////////////////////////////////////////////////////////////////////
/// @brief Marker stream user commands data.
//////////////////////////////////////////////////////////////////////////
struct CommandBufferMarkerStreamUser_1_0
{
uint32_t Reserved : 7;
uint32_t Value : 25;
};
//////////////////////////////////////////////////////////////////////////
/// @brief Marker stream user extended commands data.
//////////////////////////////////////////////////////////////////////////
struct CommandBufferMarkerStreamUserExtended_1_0
{
};
//////////////////////////////////////////////////////////////////////////
/// @brief Command buffer data.
//////////////////////////////////////////////////////////////////////////
struct CommandBufferData_1_0
{
ContextHandle_1_0 HandleContext; // Context handle.
ObjectType CommandsType; // Commands type related to library object.
GpuCommandBufferType Type; // Gpu command buffer type.
GpuMemory_1_0 Allocation; // Gpu memory allocation.
void* Data; // Gpu command buffer data.
uint32_t Size; // Gpu command buffer size.
uint32_t Offset; // Gpu command buffer offset from beginning.
union
{
CommandBufferQueryHwCounters_1_0 QueryHwCounters;
CommandBufferQueryPipelineTimestamps_1_0 QueryPipelineTimestamps;
CommandBufferOverride_1_0 Override;
CommandBufferMarkerStreamUser_1_0 MarkerStreamUser;
CommandBufferMarkerStreamUserExtended_1_0 MarkerStreamUserExtended;
};
};
//////////////////////////////////////////////////////////////////////////
/// @brief Command buffer size.
//////////////////////////////////////////////////////////////////////////
struct CommandBufferSize_1_0
{
uint32_t GpuMemorySize;
uint32_t GpuMemoryPatchesCount;
};
//////////////////////////////////////////////////////////////////////////
/// @brief Override create data.
//////////////////////////////////////////////////////////////////////////
struct OverrideCreateData_1_0
{
ContextHandle_1_0 HandleContext;
ObjectType Type;
};
//////////////////////////////////////////////////////////////////////////
/// @brief Marker creation data.
//////////////////////////////////////////////////////////////////////////
struct MarkerCreateData_1_0
{
ContextHandle_1_0 HandleContext;
ObjectType Type;
};
//////////////////////////////////////////////////////////////////////////
/// @brief Configuration creation data.
//////////////////////////////////////////////////////////////////////////
struct ConfigurationCreateData_1_0
{
ContextHandle_1_0 HandleContext;
ObjectType Type;
};
//////////////////////////////////////////////////////////////////////////
/// @brief Configuration activate data.
//////////////////////////////////////////////////////////////////////////
struct ConfigurationActivateData_1_0
{
GpuConfigurationActivationType Type;
};
//////////////////////////////////////////////////////////////////////////
/// @brief Get query report.
//////////////////////////////////////////////////////////////////////////
struct GetReportQuery_1_0
{
QueryHandle_1_0 Handle; // Input.
uint32_t Slot; // Input.
uint32_t SlotsCount; // Input.
uint32_t DataSize; // Input.
void* Data; // Input / output.
};
//////////////////////////////////////////////////////////////////////////
/// @brief Get override report.
//////////////////////////////////////////////////////////////////////////
struct GetReportOverride_1_0
{
OverrideHandle_1_0 Handle; // Input.
uint32_t DataSize; // Input.
void* Data; // Output.
};
//////////////////////////////////////////////////////////////////////////
/// @brief Get data.
//////////////////////////////////////////////////////////////////////////
struct GetReportData_1_0
{
ObjectType Type;
union
{
GetReportQuery_1_0 Query;
GetReportOverride_1_0 Override;
};
};
//////////////////////////////////////////////////////////////////////////
/// @brief Gpu memory allocate data.
//////////////////////////////////////////////////////////////////////////
struct GpuMemoryAllocateData_1_0
{
MemoryType Type; // Input.
MemoryFlags Flags; // Input.
uint32_t Size; // Input.
void* Data; // Output.
};
//////////////////////////////////////////////////////////////////////////
/// @brief Cpu memory allocate data.
//////////////////////////////////////////////////////////////////////////
struct CpuMemoryAllocateData_1_0
{
uint32_t Size; // Input.
void* Data; // Output.
};
//////////////////////////////////////////////////////////////////////////
/// @brief Metrics Library functions.
//////////////////////////////////////////////////////////////////////////
using GetParameterFunction_1_0 = StatusCode( ML_STDCALL* ) ( const ParameterType parameter, ValueType* type, TypedValue_1_0* value );
using CommandBufferGetFunction_1_0 = StatusCode( ML_STDCALL* ) ( const CommandBufferData_1_0* data );
using CommandBufferGetSizeFunction_1_0 = StatusCode( ML_STDCALL* ) ( const CommandBufferData_1_0* data, CommandBufferSize_1_0* size );
using QueryCreateFunction_1_0 = StatusCode( ML_STDCALL* ) ( const QueryCreateData_1_0* createData, QueryHandle_1_0* handle );
using QueryDeleteFunction_1_0 = StatusCode( ML_STDCALL* ) ( const QueryHandle_1_0 handle );
using OverrideCreateFunction_1_0 = StatusCode( ML_STDCALL* ) ( const OverrideCreateData_1_0* createData, OverrideHandle_1_0* handle );
using OverrideDeleteFunction_1_0 = StatusCode( ML_STDCALL* ) ( const OverrideHandle_1_0 handle );
using MarkerCreateFunction_1_0 = StatusCode( ML_STDCALL* ) ( const MarkerCreateData_1_0* createData, MarkerHandle_1_0* handle );
using MarkerDeleteFunction_1_0 = StatusCode( ML_STDCALL* ) ( const MarkerHandle_1_0 handle );
using ConfigurationCreateFunction_1_0 = StatusCode( ML_STDCALL* ) ( const ConfigurationCreateData_1_0* createData, ConfigurationHandle_1_0* handle );
using ConfigurationActivateFunction_1_0 = StatusCode( ML_STDCALL* ) ( const ConfigurationHandle_1_0 handle, const ConfigurationActivateData_1_0* activateData );
using ConfigurationDeactivateFunction_1_0 = StatusCode( ML_STDCALL* ) ( const ConfigurationHandle_1_0 handle );
using ConfigurationDeleteFunction_1_0 = StatusCode( ML_STDCALL* ) ( const ConfigurationHandle_1_0 handle );
using GetDataFunction_1_0 = StatusCode( ML_STDCALL* ) ( GetReportData_1_0* data );
//////////////////////////////////////////////////////////////////////////
/// @brief Metrics Library callbacks.
//////////////////////////////////////////////////////////////////////////
using CommandBufferFlushCallback_1_0 = StatusCode ( ML_STDCALL* ) ( const ClientHandle_1_0 handle );
using CommandBufferHasSpaceCallback_1_0 = StatusCode ( ML_STDCALL* ) ( const ClientHandle_1_0 handle );
using CommandBufferGetSpaceCallback_1_0 = StatusCode ( ML_STDCALL* ) ( const ClientHandle_1_0 handle );
using GpuMemoryAllocateCallback_1_0 = StatusCode ( ML_STDCALL* ) ( const ClientHandle_1_0 handle, GpuMemoryAllocateData_1_0* allocationData, ClientMemoryHandle_1_0* handleMemory );
using GpuMemoryPatchCallback_1_0 = StatusCode ( ML_STDCALL* ) ( const ClientHandle_1_0 handle, const ClientMemoryHandle_1_0 handleMemory, const uint64_t allocationOffset, const uint64_t buffer );
using GpuMemoryReleaseCallback_1_0 = StatusCode ( ML_STDCALL* ) ( const ClientHandle_1_0 handle );
using CpuMemoryAllocateCallback_1_0 = StatusCode ( ML_STDCALL* ) ( const ClientHandle_1_0 handle, CpuMemoryAllocateData_1_0* allocationData, ClientMemoryHandle_1_0* handleMemory );
using CpuMemoryReleaseCallback_1_0 = StatusCode ( ML_STDCALL* ) ( const ClientHandle_1_0 handle );
//////////////////////////////////////////////////////////////////////////
/// @brief Metrics Library interface.
//////////////////////////////////////////////////////////////////////////
struct Interface_1_0
{
GetParameterFunction_1_0 GetParameter;
CommandBufferGetFunction_1_0 CommandBufferGet;
CommandBufferGetSizeFunction_1_0 CommandBufferGetSize;
QueryCreateFunction_1_0 QueryCreate;
QueryDeleteFunction_1_0 QueryDelete;
OverrideCreateFunction_1_0 OverrideCreate;
OverrideDeleteFunction_1_0 OverrideDelete;
MarkerCreateFunction_1_0 MarkerCreate;
MarkerDeleteFunction_1_0 MarkerDelete;
ConfigurationCreateFunction_1_0 ConfigurationCreate;
ConfigurationActivateFunction_1_0 ConfigurationActivate;
ConfigurationDeactivateFunction_1_0 ConfigurationDeactivate;
ConfigurationDeleteFunction_1_0 ConfigurationDelete;
GetDataFunction_1_0 GetData;
};
//////////////////////////////////////////////////////////////////////////
/// @brief Metrics Library interface callbacks.
//////////////////////////////////////////////////////////////////////////
struct ClientCallbacks_1_0
{
CommandBufferFlushCallback_1_0 CommandBufferFlush;
CommandBufferHasSpaceCallback_1_0 CommandBufferHasSpace;
CommandBufferGetSpaceCallback_1_0 CommandBufferGetSpace;
GpuMemoryAllocateCallback_1_0 GpuMemoryAllocate;
GpuMemoryPatchCallback_1_0 GpuMemoryPatch;
GpuMemoryReleaseCallback_1_0 GpuMemoryRelease;
CpuMemoryAllocateCallback_1_0 CpuMemoryAllocate;
CpuMemoryReleaseCallback_1_0 CpuMemoryRelease;
};
//////////////////////////////////////////////////////////////////////////
/// @brief Windows client data.
//////////////////////////////////////////////////////////////////////////
struct ClientDataWindows_1_0
{
void* Device;
void* Adapter;
void* Escape;
bool KmdInstrumentationEnabled;
};
//////////////////////////////////////////////////////////////////////////
/// @brief Linux client data.
//////////////////////////////////////////////////////////////////////////
struct ClientDataLinux_1_0
{
void* Reserved;
};
//////////////////////////////////////////////////////////////////////////
/// @brief Client options posh data.
//////////////////////////////////////////////////////////////////////////
struct ClientOptionsPoshData_1_0
{
bool Enabled;
};
//////////////////////////////////////////////////////////////////////////
/// @brief Client options ptbr data.
//////////////////////////////////////////////////////////////////////////
struct ClientOptionsPtbrData_1_0
{
bool Enabled;
};
//////////////////////////////////////////////////////////////////////////
/// @brief Client options compute data.
//////////////////////////////////////////////////////////////////////////
struct ClientOptionsComputeData_1_0
{
bool Asynchronous;
};
//////////////////////////////////////////////////////////////////////////
/// @brief Client options data.
//////////////////////////////////////////////////////////////////////////
struct ClientOptionsData_1_0
{
ClientOptionsType Type;
union
{
ClientOptionsPoshData_1_0 Posh;
ClientOptionsPtbrData_1_0 Ptbr;
ClientOptionsComputeData_1_0 Compute;
};
};
//////////////////////////////////////////////////////////////////////////
/// @brief Client data.
//////////////////////////////////////////////////////////////////////////
struct ClientData_1_0
{
ClientHandle_1_0 Handle;
union
{
ClientDataWindows_1_0 Windows;
ClientDataLinux_1_0 Linux;
};
ClientOptionsData_1_0* ClientOptions;
uint32_t ClientOptionsCount;
};
//////////////////////////////////////////////////////////////////////////
/// @brief Context create data.
//////////////////////////////////////////////////////////////////////////
struct ContextCreateData_1_0
{
ClientData_1_0* ClientData;
ClientCallbacks_1_0* ClientCallbacks;
Interface_1_0* Api;
};
using ContextCreateFunction_1_0 = StatusCode ( ML_STDCALL* ) ( ClientType_1_0 clientType, ContextCreateData_1_0* createData, ContextHandle_1_0* handle );
using ContextDeleteFunction_1_0 = StatusCode ( ML_STDCALL* ) ( const ContextHandle_1_0 handle );
//////////////////////////////////////////////////////////////////////////
/// @brief Metrics Library initialize/destroy functions.
//////////////////////////////////////////////////////////////////////////
#define METRICS_LIBRARY_CONTEXT_CREATE_1_0 "ContextCreate_1_0"
#define METRICS_LIBRARY_CONTEXT_DELETE_1_0 "ContextDelete_1_0"
//////////////////////////////////////////////////////////////////////////
/// @brief Metrics Library current version.
//////////////////////////////////////////////////////////////////////////
#define METRICS_LIBRARY_MAJOR_NUMBER 1
#define METRICS_LIBRARY_MINOR_NUMBER 0
#define METRICS_LIBRARY_BUILD_NUMBER 1
} // namespace MetricsLibraryApi