Skip to content

Commit

Permalink
MDAPI Event Based Sampling for Linux (#133)
Browse files Browse the repository at this point in the history
* add check for OGL4_X counters until mdapi library is updated

* updated docs, enabled OGL counters only for Linux
  • Loading branch information
bashbaug authored Apr 10, 2020
1 parent c20b64b commit ad31f5f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 3 additions & 4 deletions docs/mdapi.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ MDAPI performance counters for each event.
MDAPI event-based sampling has been supported for some time and is the most robust
mechanism to collect MDAPI performance metrics, however it has some limitations:

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

```sh
Expand Down
6 changes: 6 additions & 0 deletions intercept/mdapi/MetricsDiscoveryHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,13 @@ MDHelper* MDHelper::CreateEBS(
const std::string& metricsFileName,
const bool includeMaxValues )
{
#if defined(__linux__)
// This is a temporary workaround until the Linux MDAPI is updated
// to expose metrics for OpenCL.
MDHelper* pMDHelper = new MDHelper(API_TYPE_OCL|API_TYPE_OGL4_X);
#else
MDHelper* pMDHelper = new MDHelper(API_TYPE_OCL);
#endif
if( pMDHelper )
{
if( pMDHelper->InitMetricsDiscovery(
Expand Down

0 comments on commit ad31f5f

Please sign in to comment.