mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-09 22:43:00 +08:00
Move compiler extensions to cl device
Related-To: NEO-4207 Change-Id: Ia220085260fbafb062e0e0aedca863eb64b079bd Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
0a0b1ce1d8
commit
0e3ab96298
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "core/program/sync_buffer_handler.h"
|
||||
#include "runtime/device/device.h"
|
||||
#include "runtime/platform/extensions.h"
|
||||
#include "runtime/platform/platform.h"
|
||||
|
||||
namespace NEO {
|
||||
@@ -16,6 +17,7 @@ namespace NEO {
|
||||
ClDevice::ClDevice(Device &device, Platform *platform) : device(device), platformId(platform) {
|
||||
device.incRefInternal();
|
||||
initializeCaps();
|
||||
compilerExtensions = convertEnabledExtensionsToCompilerInternalOptions(getDeviceInfo().deviceExtensions);
|
||||
|
||||
auto numAvailableDevices = device.getNumAvailableDevices();
|
||||
if (numAvailableDevices > 1) {
|
||||
@@ -108,5 +110,8 @@ void ClDeviceVector::toDeviceIDs(std::vector<cl_device_id> &devIDs) {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
const std::string &ClDevice::peekCompilerExtensions() const {
|
||||
return compilerExtensions;
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -102,6 +102,7 @@ class ClDevice : public BaseObject<_cl_device_id> {
|
||||
Device &getDevice() const noexcept { return device; }
|
||||
ClDevice *getDeviceById(uint32_t deviceId);
|
||||
void initializeCaps();
|
||||
const std::string &peekCompilerExtensions() const;
|
||||
std::unique_ptr<SyncBufferHandler> syncBufferHandler;
|
||||
|
||||
protected:
|
||||
@@ -111,6 +112,7 @@ class ClDevice : public BaseObject<_cl_device_id> {
|
||||
|
||||
std::vector<unsigned int> simultaneousInterops = {0};
|
||||
void appendOSExtensions(std::string &deviceExtensions);
|
||||
std::string compilerExtensions;
|
||||
};
|
||||
|
||||
template <cl_device_info Param>
|
||||
|
||||
@@ -120,10 +120,6 @@ cl_int Platform::getInfo(cl_platform_info paramName,
|
||||
return retVal;
|
||||
}
|
||||
|
||||
const std::string &Platform::peekCompilerExtensions() const {
|
||||
return compilerExtensions;
|
||||
}
|
||||
|
||||
bool Platform::initialize() {
|
||||
size_t numDevicesReturned = 0;
|
||||
|
||||
@@ -180,8 +176,6 @@ bool Platform::initialize() {
|
||||
this->platformInfo->version = "OpenCL 1.2 ";
|
||||
break;
|
||||
}
|
||||
|
||||
compilerExtensions = convertEnabledExtensionsToCompilerInternalOptions(pDevice->getDeviceInfo().deviceExtensions);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -47,8 +47,6 @@ class Platform : public BaseObject<_cl_platform_id> {
|
||||
void *paramValue,
|
||||
size_t *paramValueSizeRet);
|
||||
|
||||
const std::string &peekCompilerExtensions() const;
|
||||
|
||||
bool initialize();
|
||||
bool isInitialized();
|
||||
|
||||
@@ -77,7 +75,6 @@ class Platform : public BaseObject<_cl_platform_id> {
|
||||
MOCKABLE_VIRTUAL RootDevice *createRootDevice(uint32_t rootDeviceIndex) const;
|
||||
std::unique_ptr<PlatformInfo> platformInfo;
|
||||
ClDeviceVector clDevices;
|
||||
std::string compilerExtensions;
|
||||
std::unique_ptr<AsyncEventsHandler> asyncEventsHandler;
|
||||
ExecutionEnvironment *executionEnvironment = nullptr;
|
||||
};
|
||||
|
||||
@@ -96,7 +96,7 @@ cl_int Program::build(
|
||||
}
|
||||
}
|
||||
|
||||
auto compilerExtensionsOptions = platform()->peekCompilerExtensions();
|
||||
auto compilerExtensionsOptions = this->pDevice->peekCompilerExtensions();
|
||||
if (internalOptions.find(compilerExtensionsOptions) == std::string::npos) {
|
||||
CompilerOptions::concatenateAppend(internalOptions, compilerExtensionsOptions);
|
||||
}
|
||||
|
||||
@@ -136,10 +136,8 @@ cl_int Program::compile(
|
||||
TranslationInput inputArgs = {IGC::CodeType::elf, IGC::CodeType::undefined};
|
||||
|
||||
// set parameters for compilation
|
||||
auto compilerExtensionsOptions = platform()->peekCompilerExtensions();
|
||||
if (internalOptions.find(compilerExtensionsOptions) == std::string::npos) {
|
||||
CompilerOptions::concatenateAppend(internalOptions, compilerExtensionsOptions);
|
||||
}
|
||||
auto compilerExtensionsOptions = this->pDevice->peekCompilerExtensions();
|
||||
CompilerOptions::concatenateAppend(internalOptions, compilerExtensionsOptions);
|
||||
|
||||
if (isKernelDebugEnabled()) {
|
||||
std::string filename;
|
||||
|
||||
Reference in New Issue
Block a user