feature: introduce release helper

Related-To: NEO-7786
Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
Kamil Kopryk
2023-04-13 14:16:49 +00:00
committed by Compute-Runtime-Automation
parent 80f1e0e413
commit 171e97e71a
38 changed files with 342 additions and 52 deletions

View File

@@ -50,6 +50,10 @@ const RootDeviceEnvironment &ClDeviceFixture::getRootDeviceEnvironment() const {
return pClDevice->getRootDeviceEnvironment();
}
RootDeviceEnvironment &ClDeviceFixture::getMutableRootDeviceEnvironment() {
return pClDevice->getDevice().getRootDeviceEnvironmentRef();
}
template <typename HelperType>
HelperType &ClDeviceFixture::getHelper() const {
auto &helper = pClDevice->getRootDeviceEnvironment().getHelper<HelperType>();

View File

@@ -36,6 +36,7 @@ struct ClDeviceFixture {
MockClExecutionEnvironment *pClExecutionEnvironment = nullptr;
const RootDeviceEnvironment &getRootDeviceEnvironment() const;
RootDeviceEnvironment &getMutableRootDeviceEnvironment();
};
} // namespace NEO

View File

@@ -10,6 +10,7 @@
#include "shared/source/helpers/hw_info.h"
#include "shared/source/helpers/string.h"
#include "shared/source/os_interface/device_factory.h"
#include "shared/source/release_helper/release_helper.h"
#include "shared/test/common/fixtures/mock_aub_center_fixture.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/gtest_helpers.h"
@@ -41,6 +42,7 @@ struct PlatformTest : public ::testing::Test {
pPlatform.reset(new MockPlatform());
compilerProductHelper = CompilerProductHelper::create(defaultHwInfo->platform.eProductFamily);
releaseHelper = ReleaseHelper::create(defaultHwInfo->ipVersion);
}
void TearDown() override {
MockSipData::clearUseFlags();
@@ -48,6 +50,7 @@ struct PlatformTest : public ::testing::Test {
std::unique_ptr<MockPlatform> pPlatform;
std::unique_ptr<VariableBackup<bool>> backupSipInitType;
std::unique_ptr<CompilerProductHelper> compilerProductHelper;
std::unique_ptr<ReleaseHelper> releaseHelper;
cl_int retVal = CL_SUCCESS;
};
@@ -262,7 +265,7 @@ class PlatformFailingTest : public PlatformTest {
VariableBackup<UltHwConfig> backup{&ultHwConfig};
CommandStreamReceiverCreateFunc commandStreamReceiverCreateFunc;
const HardwareInfo *hwInfo;
const HardwareInfo *hwInfo{};
};
TEST_F(PlatformFailingTest, givenPlatformInitializationWhenIncorrectHwInfoThenInitializationFails) {
@@ -276,7 +279,7 @@ TEST_F(PlatformFailingTest, givenPlatformInitializationWhenIncorrectHwInfoThenIn
TEST_F(PlatformTest, givenSupportingCl21WhenPlatformSupportsFp64ThenFillMatchingSubstringsAndMandatoryTrailingSpace) {
const HardwareInfo *hwInfo;
hwInfo = defaultHwInfo.get();
std::string extensionsList = compilerProductHelper->getDeviceExtensions(*hwInfo);
std::string extensionsList = compilerProductHelper->getDeviceExtensions(*hwInfo, releaseHelper.get());
OpenClCFeaturesContainer features;
getOpenclCFeaturesList(*hwInfo, features, *compilerProductHelper.get());
@@ -315,7 +318,7 @@ TEST_F(PlatformTest, givenNotSupportingCl21WhenPlatformNotSupportFp64ThenNotFill
testHwInfo.capabilityTable.clVersionSupport = 10;
testHwInfo.capabilityTable.supportsOcl21Features = false;
std::string extensionsList = compilerProductHelper->getDeviceExtensions(testHwInfo);
std::string extensionsList = compilerProductHelper->getDeviceExtensions(testHwInfo, releaseHelper.get());
OpenClCFeaturesContainer features;
getOpenclCFeaturesList(*defaultHwInfo, features, *compilerProductHelper.get());
if (testHwInfo.capabilityTable.supportsImages) {
@@ -333,7 +336,7 @@ TEST_F(PlatformTest, givenNotSupportingCl21WhenPlatformNotSupportFp64ThenNotFill
TEST_F(PlatformTest, givenFtrSupportAtomicsWhenCreateExtentionsListThenGetMatchingSubstrings) {
const HardwareInfo *hwInfo;
hwInfo = defaultHwInfo.get();
std::string extensionsList = compilerProductHelper->getDeviceExtensions(*hwInfo);
std::string extensionsList = compilerProductHelper->getDeviceExtensions(*hwInfo, releaseHelper.get());
OpenClCFeaturesContainer features;
getOpenclCFeaturesList(*hwInfo, features, *compilerProductHelper.get());
std::string compilerExtensions = convertEnabledExtensionsToCompilerInternalOptions(extensionsList.c_str(), features);
@@ -352,7 +355,7 @@ TEST_F(PlatformTest, givenSupportedMediaBlockAndClVersion21WhenCreateExtentionsL
hwInfo.capabilityTable.supportsMediaBlock = true;
hwInfo.capabilityTable.clVersionSupport = 21;
hwInfo.capabilityTable.supportsOcl21Features = true;
std::string extensionsList = compilerProductHelper->getDeviceExtensions(hwInfo);
std::string extensionsList = compilerProductHelper->getDeviceExtensions(hwInfo, releaseHelper.get());
OpenClCFeaturesContainer features;
getOpenclCFeaturesList(*defaultHwInfo, features, *compilerProductHelper.get());
std::string compilerExtensions = convertEnabledExtensionsToCompilerInternalOptions(extensionsList.c_str(), features);
@@ -364,7 +367,7 @@ TEST_F(PlatformTest, givenNotSupportedMediaBlockAndClVersion21WhenCreateExtentio
HardwareInfo hwInfo = *defaultHwInfo;
hwInfo.capabilityTable.supportsMediaBlock = false;
hwInfo.capabilityTable.clVersionSupport = 21;
std::string extensionsList = compilerProductHelper->getDeviceExtensions(hwInfo);
std::string extensionsList = compilerProductHelper->getDeviceExtensions(hwInfo, releaseHelper.get());
OpenClCFeaturesContainer features;
getOpenclCFeaturesList(*defaultHwInfo, features, *compilerProductHelper.get());
std::string compilerExtensions = convertEnabledExtensionsToCompilerInternalOptions(extensionsList.c_str(), features);
@@ -375,7 +378,7 @@ TEST_F(PlatformTest, givenNotSupportedMediaBlockAndClVersion21WhenCreateExtentio
TEST_F(PlatformTest, givenSupportedImagesWhenCreateExtentionsListThenDeviceNotReportsKhr3DImageWritesExtension) {
HardwareInfo hwInfo = *defaultHwInfo;
hwInfo.capabilityTable.supportsImages = true;
std::string extensionsList = compilerProductHelper->getDeviceExtensions(hwInfo);
std::string extensionsList = compilerProductHelper->getDeviceExtensions(hwInfo, releaseHelper.get());
OpenClCFeaturesContainer features;
getOpenclCFeaturesList(*defaultHwInfo, features, *compilerProductHelper.get());
std::string compilerExtensions = convertEnabledExtensionsToCompilerInternalOptions(extensionsList.c_str(), features);
@@ -386,7 +389,7 @@ TEST_F(PlatformTest, givenSupportedImagesWhenCreateExtentionsListThenDeviceNotRe
TEST_F(PlatformTest, givenNotSupportedImagesWhenCreateExtentionsListThenDeviceNotReportsKhr3DImageWritesExtension) {
HardwareInfo hwInfo = *defaultHwInfo;
hwInfo.capabilityTable.supportsImages = false;
std::string extensionsList = compilerProductHelper->getDeviceExtensions(hwInfo);
std::string extensionsList = compilerProductHelper->getDeviceExtensions(hwInfo, releaseHelper.get());
OpenClCFeaturesContainer features;
getOpenclCFeaturesList(*defaultHwInfo, features, *compilerProductHelper.get());
std::string compilerExtensions = convertEnabledExtensionsToCompilerInternalOptions(extensionsList.c_str(), features);

View File

@@ -6,6 +6,7 @@
*/
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/source/release_helper/release_helper.h"
#include "shared/source/xe_hpg_core/hw_cmds_mtl.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/helpers/variable_backup.h"
@@ -22,7 +23,7 @@ using ClGfxCoreHelperTestsMtl = Test<ClDeviceFixture>;
MTLTEST_F(ClGfxCoreHelperTestsMtl, givenVariousMtlReleasesWhenGettingSupportedDeviceFeatureCapabilitiesThenReturnCorrectValue) {
auto &hwInfo = *getRootDeviceEnvironment().getMutableHardwareInfo();
unsigned int releases[] = {70, 71, 72, 73};
unsigned int releases[] = {70, 71};
hwInfo.ipVersion.architecture = 12;
cl_device_feature_capabilities_intel expectedCapabilitiesIfNotLpg = CL_DEVICE_FEATURE_FLAG_DPAS_INTEL | CL_DEVICE_FEATURE_FLAG_DP4A_INTEL;
@@ -31,12 +32,7 @@ MTLTEST_F(ClGfxCoreHelperTestsMtl, givenVariousMtlReleasesWhenGettingSupportedDe
for (auto release : releases) {
hwInfo.ipVersion.release = release;
getMutableRootDeviceEnvironment().releaseHelper = ReleaseHelper::create(hwInfo.ipVersion);
EXPECT_EQ(MTL::isLpg(hwInfo) ? expectedgCapabilitiesIfLpg : expectedCapabilitiesIfNotLpg, clGfxCoreHelper.getSupportedDeviceFeatureCapabilities(getRootDeviceEnvironment()));
}
hwInfo.ipVersion.architecture = 13;
for (auto gmdRelease : releases) {
hwInfo.ipVersion.release = gmdRelease;
EXPECT_EQ(expectedCapabilitiesIfNotLpg, clGfxCoreHelper.getSupportedDeviceFeatureCapabilities(getRootDeviceEnvironment()));
}
}

View File

@@ -28,12 +28,13 @@ XE_HPG_CORETEST_F(XeHpgCoreClDeviceCaps, givenXeHpgCoreWhenCheckExtensionsThenDe
XE_HPG_CORETEST_F(XeHpgCoreClDeviceCaps, giveDeviceExtensionsWhenDeviceCapsInitializedThenAddProperExtensions) {
const auto &compilerProductHelper = getHelper<CompilerProductHelper>();
const auto &caps = pClDevice->getDeviceInfo();
auto releaseHelper = pClDevice->getDevice().getReleaseHelper();
EXPECT_TRUE(hasSubstr(caps.deviceExtensions, std::string("cl_intel_create_buffer_with_properties")));
EXPECT_TRUE(hasSubstr(caps.deviceExtensions, std::string("cl_intel_dot_accumulate")));
EXPECT_TRUE(hasSubstr(caps.deviceExtensions, std::string("cl_intel_subgroup_local_block_io")));
bool expectMatrixMultiplyAccumulateExtensions = compilerProductHelper.isMatrixMultiplyAccumulateSupported(pClDevice->getHardwareInfo());
bool expectMatrixMultiplyAccumulateExtensions = compilerProductHelper.isMatrixMultiplyAccumulateSupported(releaseHelper);
EXPECT_EQ(expectMatrixMultiplyAccumulateExtensions, hasSubstr(caps.deviceExtensions, std::string("cl_intel_subgroup_matrix_multiply_accumulate")));
EXPECT_EQ(expectMatrixMultiplyAccumulateExtensions, hasSubstr(caps.deviceExtensions, std::string("cl_intel_subgroup_split_matrix_multiply_accumulate")));