Skip to content

Commit ad31f5f

Browse files
authored
MDAPI Event Based Sampling for Linux (#133)
* add check for OGL4_X counters until mdapi library is updated * updated docs, enabled OGL counters only for Linux
1 parent c20b64b commit ad31f5f

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

docs/mdapi.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ MDAPI performance counters for each event.
2929
MDAPI event-based sampling has been supported for some time and is the most robust
3030
mechanism to collect MDAPI performance metrics, however it has some limitations:
3131

32-
* MDAPI event-based sampling is currently only available on Windows.
33-
* MDAPI event-based sampling on Linux is tracked here: [intel/compute-runtime #182](https://github.com/intel/compute-runtime/issues/182).
32+
* MDAPI event-based sampling is only available on Windows and newer Linux drivers.
3433
* MDAPI event-based sampling is unlikely to be supported on OSX.
3534
* The API to create an OpenCL command queue that supports MDAPI event-based
3635
sampling currently does not support newer OpenCL command queue properties such
@@ -88,9 +87,9 @@ it usually resides under `/System/Library/Extensions/AppleIntel<CPU NAME>Graphic
8887
where `<CPU NAME>` is a short name of your CPU generation. For example, on Kaby
8988
Lake machines `<CPU NAME>` is `KBL`. You can also add path to `libigdmd.dylib`
9089
library to `DYLD_LIBRARY_PATH` environment library, so that it can be found system-wide.
91-
* MDAPI time-based sampling currently requires elevated privileges
90+
* Collecting MDAPI metrics currently requires elevated privileges
9291
because metrics are collected system-wide.
93-
* On Linux, MDAPI time-based sampling may be enabled for non-root users
92+
* On Linux, MDAPI metrics may be enabled for non-root users
9493
by setting `/proc/sys/dev/i915/perf_stream_paranoid` to `0`:
9594

9695
```sh

intercept/mdapi/MetricsDiscoveryHelper.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,13 @@ MDHelper* MDHelper::CreateEBS(
139139
const std::string& metricsFileName,
140140
const bool includeMaxValues )
141141
{
142+
#if defined(__linux__)
143+
// This is a temporary workaround until the Linux MDAPI is updated
144+
// to expose metrics for OpenCL.
145+
MDHelper* pMDHelper = new MDHelper(API_TYPE_OCL|API_TYPE_OGL4_X);
146+
#else
142147
MDHelper* pMDHelper = new MDHelper(API_TYPE_OCL);
148+
#endif
143149
if( pMDHelper )
144150
{
145151
if( pMDHelper->InitMetricsDiscovery(

0 commit comments

Comments
 (0)