refactor: Unify GTPin initialization logic between APIs

Add support for new GTPin loading logic in OCL path, similar to existing
in L0 - invoking exposed, dedicated API call (OpenGTPinOCL).
- Move logic to shared, including unit tests
- Check whether instrumentation is required on
  clGetPlatformIDs API call, and if yes,
  make a call to OpenGTPinOCL function.
Signed-off-by: Kacper Nowak <kacper.nowak@intel.com>
This commit is contained in:
Kacper Nowak
2023-08-02 19:33:48 +02:00
committed by Compute-Runtime-Automation
parent 05fb8e9c00
commit 68a5108e05
18 changed files with 162 additions and 106 deletions

View File

@@ -297,6 +297,7 @@ cl_int CL_API_CALL clGetDeviceIDs(cl_platform_id platform,
/* If no suitable device, set a error. */
if (retNum == 0)
retVal = CL_DEVICE_NOT_FOUND;
} while (false);
TRACING_EXIT(ClGetDeviceIDs, &retVal);
return retVal;
@@ -438,6 +439,13 @@ cl_context CL_API_CALL clCreateContext(const cl_context_properties *properties,
break;
}
}
/* At this point we can safely notify GTPin to allow initialization */
EnvironmentVariableReader envReader;
if (envReader.getSetting("ZET_ENABLE_PROGRAM_INSTRUMENTATION", false)) {
if (false == pPlatform->notifyGtpinInit()) {
retVal = CL_INVALID_OPERATION;
}
}
if (CL_SUCCESS != retVal) {
break;
}