2021-10-05 21:14:08 +08:00
|
|
|
/*
|
2024-03-08 00:50:57 +08:00
|
|
|
* Copyright (C) 2021-2024 Intel Corporation
|
2021-10-05 21:14:08 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2023-02-07 20:53:53 +08:00
|
|
|
#include "shared/source/helpers/hw_mapper.h"
|
2022-06-14 07:13:43 +08:00
|
|
|
#include "shared/source/helpers/product_config_helper.h"
|
2023-11-17 00:48:56 +08:00
|
|
|
#include "shared/source/utilities/stackvec.h"
|
2021-10-05 21:14:08 +08:00
|
|
|
|
|
|
|
#include "igfxfmid.h"
|
|
|
|
|
2023-01-31 20:34:59 +08:00
|
|
|
#include <memory>
|
|
|
|
|
2021-10-05 21:14:08 +08:00
|
|
|
namespace NEO {
|
|
|
|
|
2022-11-30 22:28:39 +08:00
|
|
|
class CompilerProductHelper;
|
2021-10-05 21:14:08 +08:00
|
|
|
struct HardwareInfo;
|
2023-04-13 22:16:49 +08:00
|
|
|
class ReleaseHelper;
|
2023-01-31 20:34:59 +08:00
|
|
|
|
2023-11-17 00:48:56 +08:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2023-01-31 20:34:59 +08:00
|
|
|
using CompilerProductHelperCreateFunctionType = std::unique_ptr<CompilerProductHelper> (*)();
|
|
|
|
extern CompilerProductHelperCreateFunctionType compilerProductHelperFactory[IGFX_MAX_PRODUCT];
|
2021-10-05 21:14:08 +08:00
|
|
|
|
2022-11-30 22:28:39 +08:00
|
|
|
class CompilerProductHelper {
|
2021-10-05 21:14:08 +08:00
|
|
|
public:
|
2023-01-31 20:34:59 +08:00
|
|
|
static std::unique_ptr<CompilerProductHelper> create(PRODUCT_FAMILY product) {
|
2023-02-02 17:50:31 +08:00
|
|
|
auto createFunction = compilerProductHelperFactory[product];
|
|
|
|
if (createFunction == nullptr) {
|
2023-01-31 20:34:59 +08:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
auto compilerProductHelper = createFunction();
|
|
|
|
return compilerProductHelper;
|
2021-10-05 21:14:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
virtual bool isMidThreadPreemptionSupported(const HardwareInfo &hwInfo) const = 0;
|
2021-10-26 23:25:20 +08:00
|
|
|
virtual bool isForceEmuInt32DivRemSPRequired() const = 0;
|
|
|
|
virtual bool isStatelessToStatefulBufferOffsetSupported() const = 0;
|
2023-04-13 22:16:49 +08:00
|
|
|
virtual bool isMatrixMultiplyAccumulateSupported(const ReleaseHelper *releaseHelper) const = 0;
|
2023-08-01 23:03:43 +08:00
|
|
|
virtual bool isSplitMatrixMultiplyAccumulateSupported(const ReleaseHelper *releaseHelper) const = 0;
|
|
|
|
virtual bool isBFloat16ConversionSupported(const ReleaseHelper *releaseHelper) const = 0;
|
2023-03-14 18:30:15 +08:00
|
|
|
virtual bool isSubgroupLocalBlockIoSupported() const = 0;
|
|
|
|
virtual bool isDotAccumulateSupported() const = 0;
|
2023-12-19 14:28:01 +08:00
|
|
|
virtual bool isDotProductAccumulateSystolicSupported(const ReleaseHelper *releaseHelper) const = 0;
|
2023-03-14 18:30:15 +08:00
|
|
|
virtual bool isCreateBufferWithPropertiesSupported() const = 0;
|
|
|
|
virtual bool isSubgroupNamedBarrierSupported() const = 0;
|
|
|
|
virtual bool isSubgroupExtendedBlockReadSupported() const = 0;
|
2021-12-29 06:17:46 +08:00
|
|
|
virtual bool isForceToStatelessRequired() const = 0;
|
2023-02-08 21:41:50 +08:00
|
|
|
virtual bool failBuildProgramWithStatefulAccessPreference() const = 0;
|
2022-07-04 20:03:50 +08:00
|
|
|
virtual bool isDotIntegerProductExtensionSupported() const = 0;
|
2023-09-07 21:31:57 +08:00
|
|
|
virtual bool oclocEnforceZebinFormat() const = 0;
|
2022-12-06 23:59:36 +08:00
|
|
|
virtual void setProductConfigForHwInfo(HardwareInfo &hwInfo, HardwareIpVersion config) const = 0;
|
2022-08-23 19:48:18 +08:00
|
|
|
virtual const char *getCachingPolicyOptions(bool isDebuggerActive) const = 0;
|
2023-02-28 21:26:21 +08:00
|
|
|
virtual uint64_t getHwInfoConfig(const HardwareInfo &hwInfo) const = 0;
|
2023-05-31 19:29:22 +08:00
|
|
|
virtual uint32_t getDefaultHwIpVersion() const = 0;
|
2023-04-24 22:08:59 +08:00
|
|
|
virtual uint32_t matchRevisionIdWithProductConfig(HardwareIpVersion ipVersion, uint32_t revisionID) const = 0;
|
2023-04-13 22:16:49 +08:00
|
|
|
virtual std::string getDeviceExtensions(const HardwareInfo &hwInfo, const ReleaseHelper *releaseHelper) const = 0;
|
2023-11-17 00:48:56 +08:00
|
|
|
virtual StackVec<OclCVersion, 5> getDeviceOpenCLCVersions(const HardwareInfo &hwInfo, OclCVersion max) const = 0;
|
2023-07-27 17:38:15 +08:00
|
|
|
virtual void adjustHwInfoForIgc(HardwareInfo &hwInfo) const = 0;
|
2023-11-03 14:55:35 +08:00
|
|
|
virtual bool isHeaplessModeEnabled() const = 0;
|
2024-03-08 00:50:57 +08:00
|
|
|
virtual bool isHeaplessStateInitEnabled() const = 0;
|
2024-03-28 21:47:16 +08:00
|
|
|
virtual void getKernelFp16AtomicCapabilities(const ReleaseHelper *releaseHelper, uint32_t &fp16Caps) const = 0;
|
|
|
|
virtual void getKernelFp32AtomicCapabilities(uint32_t &fp32Caps) const = 0;
|
|
|
|
virtual void getKernelFp64AtomicCapabilities(uint32_t &fp64Caps) const = 0;
|
|
|
|
virtual void getKernelCapabilitiesExtra(const ReleaseHelper *releaseHelper, uint32_t &extraCaps) const = 0;
|
2023-01-31 20:34:59 +08:00
|
|
|
|
|
|
|
virtual ~CompilerProductHelper() = default;
|
2023-04-18 16:54:04 +08:00
|
|
|
uint32_t getHwIpVersion(const HardwareInfo &hwInfo) const;
|
2023-01-31 20:34:59 +08:00
|
|
|
|
|
|
|
protected:
|
2023-04-18 16:54:04 +08:00
|
|
|
virtual uint32_t getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const = 0;
|
2023-01-31 20:34:59 +08:00
|
|
|
CompilerProductHelper() = default;
|
2021-10-05 21:14:08 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
template <PRODUCT_FAMILY gfxProduct>
|
2022-11-30 22:28:39 +08:00
|
|
|
class CompilerProductHelperHw : public CompilerProductHelper {
|
2021-10-05 21:14:08 +08:00
|
|
|
public:
|
2023-01-31 20:34:59 +08:00
|
|
|
static std::unique_ptr<CompilerProductHelper> create() {
|
|
|
|
auto compilerProductHelper = std::unique_ptr<CompilerProductHelper>(new CompilerProductHelperHw());
|
|
|
|
return compilerProductHelper;
|
2021-10-05 21:14:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool isMidThreadPreemptionSupported(const HardwareInfo &hwInfo) const override;
|
2021-10-26 23:25:20 +08:00
|
|
|
bool isForceEmuInt32DivRemSPRequired() const override;
|
|
|
|
bool isStatelessToStatefulBufferOffsetSupported() const override;
|
2023-04-13 22:16:49 +08:00
|
|
|
bool isMatrixMultiplyAccumulateSupported(const ReleaseHelper *releaseHelper) const override;
|
2023-08-01 23:03:43 +08:00
|
|
|
bool isSplitMatrixMultiplyAccumulateSupported(const ReleaseHelper *releaseHelper) const override;
|
|
|
|
bool isBFloat16ConversionSupported(const ReleaseHelper *releaseHelper) const override;
|
2023-03-14 18:30:15 +08:00
|
|
|
bool isSubgroupLocalBlockIoSupported() const override;
|
|
|
|
bool isDotAccumulateSupported() const override;
|
2023-12-19 14:28:01 +08:00
|
|
|
bool isDotProductAccumulateSystolicSupported(const ReleaseHelper *releaseHelper) const override;
|
2023-03-14 18:30:15 +08:00
|
|
|
bool isCreateBufferWithPropertiesSupported() const override;
|
|
|
|
bool isSubgroupNamedBarrierSupported() const override;
|
|
|
|
bool isSubgroupExtendedBlockReadSupported() const override;
|
2021-12-29 06:17:46 +08:00
|
|
|
bool isForceToStatelessRequired() const override;
|
2023-02-08 21:41:50 +08:00
|
|
|
bool failBuildProgramWithStatefulAccessPreference() const override;
|
2022-07-04 20:03:50 +08:00
|
|
|
bool isDotIntegerProductExtensionSupported() const override;
|
2023-09-07 21:31:57 +08:00
|
|
|
bool oclocEnforceZebinFormat() const override;
|
2022-12-06 23:59:36 +08:00
|
|
|
void setProductConfigForHwInfo(HardwareInfo &hwInfo, HardwareIpVersion config) const override;
|
2022-08-23 19:48:18 +08:00
|
|
|
const char *getCachingPolicyOptions(bool isDebuggerActive) const override;
|
2023-02-28 21:26:21 +08:00
|
|
|
uint64_t getHwInfoConfig(const HardwareInfo &hwInfo) const override;
|
2023-05-31 19:29:22 +08:00
|
|
|
uint32_t getDefaultHwIpVersion() const override;
|
2023-04-24 22:08:59 +08:00
|
|
|
uint32_t matchRevisionIdWithProductConfig(HardwareIpVersion ipVersion, uint32_t revisionID) const override;
|
2023-04-13 22:16:49 +08:00
|
|
|
std::string getDeviceExtensions(const HardwareInfo &hwInfo, const ReleaseHelper *releaseHelper) const override;
|
2023-11-17 00:48:56 +08:00
|
|
|
StackVec<OclCVersion, 5> getDeviceOpenCLCVersions(const HardwareInfo &hwInfo, OclCVersion max) const override;
|
2023-07-27 17:38:15 +08:00
|
|
|
void adjustHwInfoForIgc(HardwareInfo &hwInfo) const override;
|
2023-11-03 14:55:35 +08:00
|
|
|
bool isHeaplessModeEnabled() const override;
|
2024-03-08 00:50:57 +08:00
|
|
|
bool isHeaplessStateInitEnabled() const override;
|
2024-03-28 21:47:16 +08:00
|
|
|
void getKernelFp16AtomicCapabilities(const ReleaseHelper *releaseHelper, uint32_t &fp16Caps) const override;
|
|
|
|
void getKernelFp32AtomicCapabilities(uint32_t &fp32Caps) const override;
|
|
|
|
void getKernelFp64AtomicCapabilities(uint32_t &fp64Caps) const override;
|
|
|
|
void getKernelCapabilitiesExtra(const ReleaseHelper *releaseHelper, uint32_t &extraCaps) const override;
|
2021-10-05 21:14:08 +08:00
|
|
|
|
2023-01-31 20:34:59 +08:00
|
|
|
~CompilerProductHelperHw() override = default;
|
|
|
|
|
2021-10-05 21:14:08 +08:00
|
|
|
protected:
|
2023-04-18 16:54:04 +08:00
|
|
|
uint32_t getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const override;
|
2022-11-30 22:28:39 +08:00
|
|
|
CompilerProductHelperHw() = default;
|
2021-10-05 21:14:08 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
template <PRODUCT_FAMILY gfxProduct>
|
2022-11-30 22:28:39 +08:00
|
|
|
struct EnableCompilerProductHelper {
|
2021-10-05 21:14:08 +08:00
|
|
|
|
2022-11-30 22:28:39 +08:00
|
|
|
EnableCompilerProductHelper() {
|
2023-01-31 20:34:59 +08:00
|
|
|
auto compilerProductHelperCreateFunction = CompilerProductHelperHw<gfxProduct>::create;
|
|
|
|
compilerProductHelperFactory[gfxProduct] = compilerProductHelperCreateFunction;
|
2021-10-05 21:14:08 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace NEO
|