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

@@ -17,6 +17,7 @@
#include "shared/source/helpers/debug_helpers.h"
#include "shared/source/helpers/get_info.h"
#include "shared/source/helpers/hw_info.h"
#include "shared/source/pin/pin.h"
#include "shared/source/source_level_debugger/source_level_debugger.h"
#include "opencl/source/api/api.h"
@@ -185,6 +186,17 @@ bool Platform::initialize(std::vector<std::unique_ptr<Device>> devices) {
return true;
}
bool Platform::notifyGtpinInit() {
bool res = false;
auto notifyGTPin = [](bool &res) {
const std::string gtpinFuncName{"OpenGTPinOCL"};
res = PinContext::init(gtpinFuncName);
return;
};
std::call_once(this->oclInitGTPinOnce, notifyGTPin, res);
return res;
}
void Platform::fillGlobalDispatchTable() {
sharingFactory.fillGlobalDispatchTable();
}

View File

@@ -48,6 +48,7 @@ class Platform : public BaseObject<_cl_platform_id> {
MOCKABLE_VIRTUAL bool initialize(std::vector<std::unique_ptr<Device>> devices);
bool isInitialized();
bool notifyGtpinInit();
size_t getNumDevices() const;
ClDevice **getClDevices();
@@ -71,6 +72,7 @@ class Platform : public BaseObject<_cl_platform_id> {
ClDeviceVector clDevices;
ExecutionEnvironment &executionEnvironment;
std::once_flag initializeExtensionsWithVersionOnce;
std::once_flag oclInitGTPinOnce;
};
extern std::vector<std::unique_ptr<Platform>> *platformsImpl;