mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-07 21:27:04 +08:00
feature: Adding support for OCL C support queries to ocloc
Feature needed for automated OCL C compilation with ocloc as backend. Added queries : * CL_DEVICE_EXTENSIONS * CL_DEVICE_EXTENSIONS_WITH_VERSION * CL_DEVICE_PROFILE * CL_DEVICE_OPENCL_C_ALL_VERSIONS * CL_DEVICE_OPENCL_C_FEATURES Sample command line: ocloc query -device skl CL_DEVICE_OPENCL_C_FEATURES Related-To: GSD-7420 Signed-off-by: Chodor, Jaroslaw <jaroslaw.chodor@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
d99104d5bf
commit
7e795cd3c1
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "shared/source/helpers/hw_mapper.h"
|
||||
#include "shared/source/helpers/product_config_helper.h"
|
||||
#include "shared/source/utilities/stackvec.h"
|
||||
|
||||
#include "igfxfmid.h"
|
||||
|
||||
@@ -20,6 +21,23 @@ class CompilerProductHelper;
|
||||
struct HardwareInfo;
|
||||
class ReleaseHelper;
|
||||
|
||||
struct OclCVersion {
|
||||
unsigned short major = 0;
|
||||
unsigned short minor = 0;
|
||||
};
|
||||
|
||||
constexpr bool operator>(OclCVersion lhs, OclCVersion rhs) {
|
||||
return (lhs.major > rhs.major) || ((lhs.major == rhs.major) && (lhs.minor >= rhs.minor));
|
||||
}
|
||||
|
||||
constexpr bool operator==(OclCVersion lhs, OclCVersion rhs) {
|
||||
return (lhs.major == rhs.major) && (lhs.minor == rhs.minor);
|
||||
}
|
||||
|
||||
constexpr bool operator>=(OclCVersion lhs, OclCVersion rhs) {
|
||||
return (lhs > rhs) || (lhs == rhs);
|
||||
}
|
||||
|
||||
using CompilerProductHelperCreateFunctionType = std::unique_ptr<CompilerProductHelper> (*)();
|
||||
extern CompilerProductHelperCreateFunctionType compilerProductHelperFactory[IGFX_MAX_PRODUCT];
|
||||
|
||||
@@ -55,6 +73,7 @@ class CompilerProductHelper {
|
||||
virtual uint32_t getDefaultHwIpVersion() const = 0;
|
||||
virtual uint32_t matchRevisionIdWithProductConfig(HardwareIpVersion ipVersion, uint32_t revisionID) const = 0;
|
||||
virtual std::string getDeviceExtensions(const HardwareInfo &hwInfo, const ReleaseHelper *releaseHelper) const = 0;
|
||||
virtual StackVec<OclCVersion, 5> getDeviceOpenCLCVersions(const HardwareInfo &hwInfo, OclCVersion max) const = 0;
|
||||
virtual void adjustHwInfoForIgc(HardwareInfo &hwInfo) const = 0;
|
||||
virtual bool isHeaplessModeEnabled() const = 0;
|
||||
|
||||
@@ -95,6 +114,7 @@ class CompilerProductHelperHw : public CompilerProductHelper {
|
||||
uint32_t getDefaultHwIpVersion() const override;
|
||||
uint32_t matchRevisionIdWithProductConfig(HardwareIpVersion ipVersion, uint32_t revisionID) const override;
|
||||
std::string getDeviceExtensions(const HardwareInfo &hwInfo, const ReleaseHelper *releaseHelper) const override;
|
||||
StackVec<OclCVersion, 5> getDeviceOpenCLCVersions(const HardwareInfo &hwInfo, OclCVersion max) const override;
|
||||
void adjustHwInfoForIgc(HardwareInfo &hwInfo) const override;
|
||||
bool isHeaplessModeEnabled() const override;
|
||||
|
||||
|
||||
@@ -203,6 +203,32 @@ std::string CompilerProductHelperHw<gfxProduct>::getDeviceExtensions(const Hardw
|
||||
return extensions;
|
||||
}
|
||||
|
||||
template <PRODUCT_FAMILY gfxProduct>
|
||||
StackVec<OclCVersion, 5> CompilerProductHelperHw<gfxProduct>::getDeviceOpenCLCVersions(const HardwareInfo &hwInfo, OclCVersion max) const {
|
||||
if ((max.major == 0) && (max.minor != 0)) {
|
||||
max.major = 1;
|
||||
max.minor = 2;
|
||||
}
|
||||
|
||||
struct {
|
||||
OclCVersion num;
|
||||
bool supported;
|
||||
} supportedVersionsMatrix[] = {
|
||||
{OclCVersion{1, 0}, true},
|
||||
{OclCVersion{1, 1}, true},
|
||||
{OclCVersion{1, 2}, true},
|
||||
{OclCVersion{3, 0}, hwInfo.capabilityTable.clVersionSupport == 30}};
|
||||
|
||||
StackVec<OclCVersion, 5> ret;
|
||||
for (const auto &version : supportedVersionsMatrix) {
|
||||
if (version.supported && ((0 == max.major) || (max >= version.num))) {
|
||||
ret.push_back(version.num);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
template <PRODUCT_FAMILY gfxProduct>
|
||||
bool CompilerProductHelperHw<gfxProduct>::isHeaplessModeEnabled() const {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user