Check supportsMediaBlock capability in ocloc

Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
Kamil Kopryk
2021-05-13 14:58:26 +00:00
committed by Compute-Runtime-Automation
parent ed9290e650
commit 86f63bb2ed
25 changed files with 82 additions and 65 deletions

View File

@ -146,7 +146,7 @@ void ClDevice::initializeCaps() {
if (supportsVme) {
deviceExtensions += "cl_intel_spirv_device_side_avc_motion_estimation ";
}
if (hwHelper.isMediaBlockIOSupported(hwInfo)) {
if (hwInfo.capabilityTable.supportsMediaBlock) {
deviceExtensions += "cl_intel_spirv_media_block_io ";
}
deviceExtensions += "cl_intel_spirv_subgroups ";
@ -193,7 +193,7 @@ void ClDevice::initializeCaps() {
deviceExtensions += "cl_khr_3d_image_writes ";
}
if (hwHelper.isMediaBlockIOSupported(hwInfo)) {
if (hwInfo.capabilityTable.supportsMediaBlock) {
deviceExtensions += "cl_intel_media_block_io ";
}
@ -203,7 +203,6 @@ void ClDevice::initializeCaps() {
}
deviceExtensions += hwHelper.getExtensions();
deviceInfo.deviceExtensions = deviceExtensions.c_str();
std::vector<std::string> exposedBuiltinKernelsVector;

View File

@ -78,7 +78,8 @@ const RuntimeCapabilityTable EHL::capabilityTable{
false, // supportsIndependentForwardProgress
true, // hostPtrTrackingEnabled
false, // levelZeroSupported
true // isIntegratedDevice
true, // isIntegratedDevice
true // supportsMediaBlock
};
WorkaroundTable EHL::workaroundTable = {};

View File

@ -80,6 +80,7 @@ const RuntimeCapabilityTable ICLLP::capabilityTable{
true, // hostPtrTrackingEnabled
true, // levelZeroSupported
true, // isIntegratedDevice
true // supportsMediaBlock
};
WorkaroundTable ICLLP::workaroundTable = {};

View File

@ -78,7 +78,8 @@ const RuntimeCapabilityTable LKF::capabilityTable{
false, // supportsIndependentForwardProgress
true, // hostPtrTrackingEnabled
false, // levelZeroSupported
true // isIntegratedDevice
true, // isIntegratedDevice
true // supportsMediaBlock
};
WorkaroundTable LKF::workaroundTable = {};

View File

@ -80,7 +80,8 @@ const RuntimeCapabilityTable ADLS::capabilityTable{
false, // supportsIndependentForwardProgress
false, // hostPtrTrackingEnabled
true, // levelZeroSupported
true // isIntegratedDevice
true, // isIntegratedDevice
true // supportsMediaBlock
};
WorkaroundTable ADLS::workaroundTable = {};

View File

@ -84,7 +84,8 @@ const RuntimeCapabilityTable DG1::capabilityTable{
false, // supportsIndependentForwardProgress
false, // hostPtrTrackingEnabled
true, // levelZeroSupported
false // isIntegratedDevice
false, // isIntegratedDevice
true // supportsMediaBlock
};
WorkaroundTable DG1::workaroundTable = {};

View File

@ -76,7 +76,8 @@ const RuntimeCapabilityTable RKL::capabilityTable{
false, // supportsIndependentForwardProgress
false, // hostPtrTrackingEnabled
true, // levelZeroSupported
true // isIntegratedDevice
true, // isIntegratedDevice
true // supportsMediaBlock
};
WorkaroundTable RKL::workaroundTable = {};

View File

@ -80,7 +80,8 @@ const RuntimeCapabilityTable TGLLP::capabilityTable{
false, // supportsIndependentForwardProgress
false, // hostPtrTrackingEnabled
true, // levelZeroSupported
true // isIntegratedDevice
true, // isIntegratedDevice
true // supportsMediaBlock
};
WorkaroundTable TGLLP::workaroundTable = {};

View File

@ -83,7 +83,8 @@ const RuntimeCapabilityTable BDW::capabilityTable{
true, // supportsIndependentForwardProgress
true, // hostPtrTrackingEnabled
false, // levelZeroSupported
true // isIntegratedDevice
true, // isIntegratedDevice
true // supportsMediaBlock
};
WorkaroundTable BDW::workaroundTable = {};

View File

@ -80,7 +80,8 @@ const RuntimeCapabilityTable BXT::capabilityTable{
false, // supportsIndependentForwardProgress
true, // hostPtrTrackingEnabled
false, // levelZeroSupported
true // isIntegratedDevice
true, // isIntegratedDevice
true // supportsMediaBlock
};
WorkaroundTable BXT::workaroundTable = {};

View File

@ -75,7 +75,8 @@ const RuntimeCapabilityTable CFL::capabilityTable{
true, // supportsIndependentForwardProgress
true, // hostPtrTrackingEnabled
true, // levelZeroSupported
true // isIntegratedDevice
true, // isIntegratedDevice
true // supportsMediaBlock
};
WorkaroundTable CFL::workaroundTable = {};

View File

@ -75,7 +75,8 @@ const RuntimeCapabilityTable GLK::capabilityTable{
false, // supportsIndependentForwardProgress
true, // hostPtrTrackingEnabled
false, // levelZeroSupported
true // isIntegratedDevice
true, // isIntegratedDevice
true // supportsMediaBlock
};
WorkaroundTable GLK::workaroundTable = {};

View File

@ -75,7 +75,8 @@ const RuntimeCapabilityTable KBL::capabilityTable{
true, // supportsIndependentForwardProgress
true, // hostPtrTrackingEnabled
true, // levelZeroSupported
true // isIntegratedDevice
true, // isIntegratedDevice
true // supportsMediaBlock
};
WorkaroundTable KBL::workaroundTable = {};

View File

@ -83,7 +83,8 @@ const RuntimeCapabilityTable SKL::capabilityTable{
true, // supportsIndependentForwardProgress
true, // hostPtrTrackingEnabled
true, // levelZeroSupported
true // isIntegratedDevice
true, // isIntegratedDevice
true // supportsMediaBlock
};
WorkaroundTable SKL::workaroundTable = {};

View File

@ -55,7 +55,7 @@ std::string getExtensionsList(const HardwareInfo &hwInfo) {
if (hwInfo.capabilityTable.supportsVme) {
allExtensionsList += "cl_intel_spirv_device_side_avc_motion_estimation ";
}
if (hwInfo.capabilityTable.supportsImages) {
if (hwInfo.capabilityTable.supportsMediaBlock) {
allExtensionsList += "cl_intel_spirv_media_block_io ";
}
allExtensionsList += "cl_intel_spirv_subgroups ";

View File

@ -569,7 +569,6 @@ TEST_F(DeviceGetCapsTest, givenOpenCLVersion21WhenCapsAreCreatedThenDeviceReport
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
const auto &caps = device->getDeviceInfo();
const HardwareInfo *hwInfo = defaultHwInfo.get();
auto &hwHelper = HwHelper::get(hwInfo->platform.eRenderCoreFamily);
{
if (hwInfo->capabilityTable.supportsVme) {
EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_intel_spirv_device_side_avc_motion_estimation")));
@ -581,7 +580,7 @@ TEST_F(DeviceGetCapsTest, givenOpenCLVersion21WhenCapsAreCreatedThenDeviceReport
} else {
EXPECT_THAT(caps.deviceExtensions, testing::Not(std::string("cl_khr_3d_image_writes")));
}
if (hwHelper.isMediaBlockIOSupported(*hwInfo)) {
if (hwInfo->capabilityTable.supportsMediaBlock) {
EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_intel_spirv_media_block_io")));
} else {
EXPECT_THAT(caps.deviceExtensions, testing::Not(testing::HasSubstr(std::string("cl_intel_spirv_media_block_io"))));
@ -592,25 +591,21 @@ TEST_F(DeviceGetCapsTest, givenOpenCLVersion21WhenCapsAreCreatedThenDeviceReport
}
}
TEST_F(DeviceGetCapsTest, givenSupportImagesWhenCapsAreCreatedThenDeviceReportsClIntelSpirvMediaBlockIoExtensions) {
TEST_F(DeviceGetCapsTest, givenSupportMediaBlockWhenCapsAreCreatedThenDeviceReportsClIntelSpirvMediaBlockIoExtensions) {
DebugManagerStateRestore dbgRestorer;
DebugManager.flags.ForceOCLVersion.set(21);
HardwareInfo hwInfo = *defaultHwInfo;
hwInfo.capabilityTable.supportsImages = true;
hwInfo.capabilityTable.supportsMediaBlock = true;
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo));
const auto &caps = device->getDeviceInfo();
auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
if (hwHelper.isMediaBlockIOSupported(hwInfo)) {
EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_intel_spirv_media_block_io")));
}
EXPECT_THAT(caps.deviceExtensions, testing::HasSubstr(std::string("cl_intel_spirv_media_block_io")));
}
TEST_F(DeviceGetCapsTest, givenNotSupportImagesWhenCapsAreCreatedThenDeviceNotReportsClIntelSpirvMediaBlockIoExtensions) {
TEST_F(DeviceGetCapsTest, givenNotMediaBlockWhenCapsAreCreatedThenDeviceNotReportsClIntelSpirvMediaBlockIoExtensions) {
DebugManagerStateRestore dbgRestorer;
DebugManager.flags.ForceOCLVersion.set(21);
HardwareInfo hwInfo = *defaultHwInfo;
hwInfo.capabilityTable.supportsImages = false;
hwInfo.capabilityTable.supportsMediaBlock = false;
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo));
const auto &caps = device->getDeviceInfo();
EXPECT_THAT(caps.deviceExtensions, testing::Not(testing::HasSubstr(std::string("cl_intel_spirv_media_block_io"))));
@ -994,13 +989,6 @@ TEST_F(DeviceGetCapsTest, givenSupportImagesWhenCreateExtentionsListThenDeviceRe
EXPECT_THAT(extensions, testing::HasSubstr(std::string("cl_khr_image2d_from_buffer")));
EXPECT_THAT(extensions, testing::HasSubstr(std::string("cl_khr_depth_images")));
auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
if (hwHelper.isMediaBlockIOSupported(hwInfo)) {
EXPECT_THAT(extensions, testing::HasSubstr(std::string("cl_intel_media_block_io")));
} else {
EXPECT_THAT(extensions, testing::Not(testing::HasSubstr(std::string("cl_intel_media_block_io"))));
}
}
TEST_F(DeviceGetCapsTest, givenNotSupporteImagesWhenCreateExtentionsListThenDeviceNotReportsImagesExtensions) {
@ -1013,7 +1001,6 @@ TEST_F(DeviceGetCapsTest, givenNotSupporteImagesWhenCreateExtentionsListThenDevi
EXPECT_THAT(extensions, testing::Not(testing::HasSubstr(std::string("cl_khr_image2d_from_buffer"))));
EXPECT_THAT(extensions, testing::Not(testing::HasSubstr(std::string("cl_khr_depth_images"))));
EXPECT_THAT(extensions, testing::Not(testing::HasSubstr(std::string("cl_intel_media_block_io"))));
}
TEST_F(DeviceGetCapsTest, givenDeviceWhenGettingHostUnifiedMemoryCapThenItDependsOnLocalMemory) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2020 Intel Corporation
* Copyright (C) 2018-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -65,6 +65,10 @@ GEN11TEST_F(Gen11DeviceCaps, givenGen11WhenCheckingImageSupportThenReturnTrue) {
EXPECT_TRUE(pDevice->getHardwareInfo().capabilityTable.supportsImages);
}
GEN11TEST_F(Gen11DeviceCaps, givenGen11WhenCheckingMediaBlockSupportThenReturnTrue) {
EXPECT_TRUE(pDevice->getHardwareInfo().capabilityTable.supportsMediaBlock);
}
GEN11TEST_F(Gen11DeviceCaps, givenGen11WhenCheckingCoherencySupportThenReturnFalse) {
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.ftrSupportsCoherency);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -90,6 +90,10 @@ GEN12LPTEST_F(Gen12LpDeviceCaps, givenGen12LpWhenCheckingImageSupportThenReturnT
EXPECT_TRUE(pDevice->getHardwareInfo().capabilityTable.supportsImages);
}
GEN12LPTEST_F(Gen12LpDeviceCaps, givenGen12LpWhenCheckingMediaBlockSupportThenReturnTrue) {
EXPECT_TRUE(pDevice->getHardwareInfo().capabilityTable.supportsMediaBlock);
}
GEN12LPTEST_F(Gen12LpDeviceCaps, givenGen12LpWhenCheckingCoherencySupportThenReturnFalse) {
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.ftrSupportsCoherency);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2020 Intel Corporation
* Copyright (C) 2017-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -78,3 +78,7 @@ GEN8TEST_F(Gen8DeviceCaps, givenGen8WhenCheckFtrSupportsInteger64BitAtomicsThenR
GEN8TEST_F(Gen8DeviceCaps, givenGen8WhenCheckingImageSupportThenReturnTrue) {
EXPECT_TRUE(pDevice->getHardwareInfo().capabilityTable.supportsImages);
}
GEN8TEST_F(Gen8DeviceCaps, givenGen8WhenCheckingMediaBlockSupportThenReturnTrue) {
EXPECT_TRUE(pDevice->getHardwareInfo().capabilityTable.supportsMediaBlock);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2020 Intel Corporation
* Copyright (C) 2017-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -91,3 +91,7 @@ GEN9TEST_F(Gen9DeviceCaps, givenGen9WhenCheckBlitterOperationsSupportThenReturnF
GEN9TEST_F(Gen9DeviceCaps, givenGen9WhenCheckingImageSupportThenReturnTrue) {
EXPECT_TRUE(pDevice->getHardwareInfo().capabilityTable.supportsImages);
}
GEN9TEST_F(Gen9DeviceCaps, givenGen9WhenCheckingMediaBlockSupportThenReturnTrue) {
EXPECT_TRUE(pDevice->getHardwareInfo().capabilityTable.supportsMediaBlock);
}

View File

@ -1013,19 +1013,6 @@ HWTEST_F(HwHelperTest, givenVariousDebugKeyValuesWhenGettingLocalMemoryAccessMod
EXPECT_EQ(LocalMemoryAccessMode::CpuAccessDisallowed, hwHelper.getLocalMemoryAccessMode(*defaultHwInfo));
}
HWTEST_F(HwHelperTest, WhenIsMediaBlockIOSupportedThenReturnCorrectResult) {
auto &helper = HwHelper::get(renderCoreFamily);
HardwareInfo hwInfo = *defaultHwInfo;
{
hwInfo.capabilityTable.supportsImages = true;
EXPECT_TRUE(helper.isMediaBlockIOSupported(hwInfo));
}
{
hwInfo.capabilityTable.supportsImages = false;
EXPECT_FALSE(helper.isMediaBlockIOSupported(hwInfo));
}
}
HWTEST2_F(HwHelperTest, givenDefaultHwHelperHwWhenGettingIsBlitCopyRequiredForLocalMemoryThenFalseIsReturned, IsAtMostGen11) {
auto &helper = HwHelper::get(renderCoreFamily);
MockGraphicsAllocation graphicsAllocation;

View File

@ -288,7 +288,7 @@ TEST_F(PlatformTest, givenSupportingCl21WhenPlatformSupportsFp64ThenFillMatching
} else {
EXPECT_THAT(compilerExtensions, testing::Not(::testing::HasSubstr(std::string("cl_intel_spirv_device_side_avc_motion_estimation"))));
}
if (hwInfo->capabilityTable.supportsImages) {
if (hwInfo->capabilityTable.supportsMediaBlock) {
EXPECT_THAT(compilerExtensions, ::testing::HasSubstr(std::string("cl_intel_spirv_media_block_io")));
} else {
EXPECT_THAT(compilerExtensions, testing::Not(::testing::HasSubstr(std::string("cl_intel_spirv_media_block_io"))));
@ -347,9 +347,9 @@ TEST_F(PlatformTest, givenFtrSupportAtomicsWhenCreateExtentionsListThenGetMatchi
}
}
TEST_F(PlatformTest, givenSupporteImagesAndClVersion21WhenCreateExtentionsListThenDeviceReportsSpritvMediaBlockIoExtension) {
TEST_F(PlatformTest, givenSupportedMediaBlockAndClVersion21WhenCreateExtentionsListThenDeviceReportsSpritvMediaBlockIoExtension) {
HardwareInfo hwInfo = *defaultHwInfo;
hwInfo.capabilityTable.supportsImages = true;
hwInfo.capabilityTable.supportsMediaBlock = true;
hwInfo.capabilityTable.clVersionSupport = 21;
hwInfo.capabilityTable.supportsOcl21Features = true;
std::string extensionsList = getExtensionsList(hwInfo);
@ -360,9 +360,9 @@ TEST_F(PlatformTest, givenSupporteImagesAndClVersion21WhenCreateExtentionsListTh
EXPECT_THAT(compilerExtensions, testing::HasSubstr(std::string("cl_intel_spirv_media_block_io")));
}
TEST_F(PlatformTest, givenNotSupporteImagesAndClVersion21WhenCreateExtentionsListThenDeviceNotReportsSpritvMediaBlockIoExtension) {
TEST_F(PlatformTest, givenNotSupportedMediaBlockAndClVersion21WhenCreateExtentionsListThenDeviceNotReportsSpritvMediaBlockIoExtension) {
HardwareInfo hwInfo = *defaultHwInfo;
hwInfo.capabilityTable.supportsImages = false;
hwInfo.capabilityTable.supportsMediaBlock = false;
hwInfo.capabilityTable.clVersionSupport = 21;
std::string extensionsList = getExtensionsList(hwInfo);
OpenClCFeaturesContainer features;
@ -372,6 +372,28 @@ TEST_F(PlatformTest, givenNotSupporteImagesAndClVersion21WhenCreateExtentionsLis
EXPECT_THAT(compilerExtensions, testing::Not(testing::HasSubstr(std::string("cl_intel_spirv_media_block_io"))));
}
TEST_F(PlatformTest, givenSupportedImagesWhenCreateExtentionsListThenDeviceNotReportsKhr3DImageWritesExtension) {
HardwareInfo hwInfo = *defaultHwInfo;
hwInfo.capabilityTable.supportsImages = true;
std::string extensionsList = getExtensionsList(hwInfo);
OpenClCFeaturesContainer features;
getOpenclCFeaturesList(*defaultHwInfo, features);
std::string compilerExtensions = convertEnabledExtensionsToCompilerInternalOptions(extensionsList.c_str(), features);
EXPECT_THAT(compilerExtensions, testing::HasSubstr(std::string("cl_khr_3d_image_writes")));
}
TEST_F(PlatformTest, givenNotSupportedImagesWhenCreateExtentionsListThenDeviceNotReportsKhr3DImageWritesExtension) {
HardwareInfo hwInfo = *defaultHwInfo;
hwInfo.capabilityTable.supportsImages = false;
std::string extensionsList = getExtensionsList(hwInfo);
OpenClCFeaturesContainer features;
getOpenclCFeaturesList(*defaultHwInfo, features);
std::string compilerExtensions = convertEnabledExtensionsToCompilerInternalOptions(extensionsList.c_str(), features);
EXPECT_THAT(compilerExtensions, testing::Not(testing::HasSubstr(std::string("cl_khr_3d_image_writes"))));
}
TEST(PlatformConstructionTest, givenPlatformConstructorWhenItIsCalledTwiceThenTheSamePlatformIsReturned) {
platformsImpl->clear();
auto platform1 = constructPlatform();

View File

@ -132,7 +132,6 @@ class HwHelper {
virtual bool packedFormatsSupported() const = 0;
virtual bool isCooperativeDispatchSupported(const EngineGroupType engineGroupType, const PRODUCT_FAMILY productFamily) const = 0;
virtual size_t getMaxFillPaternSizeForCopyEngine() const = 0;
virtual bool isMediaBlockIOSupported(const HardwareInfo &hwInfo) const = 0;
virtual bool isCopyOnlyEngineType(EngineGroupType type) const = 0;
virtual void adjustAddressWidthForCanonize(uint32_t &addressWidth) const = 0;
virtual bool isSipWANeeded(const HardwareInfo &hwInfo) const = 0;
@ -341,8 +340,6 @@ class HwHelperHw : public HwHelper {
size_t getMaxFillPaternSizeForCopyEngine() const override;
bool isMediaBlockIOSupported(const HardwareInfo &hwInfo) const override;
bool isKmdMigrationSupported(const HardwareInfo &hwInfo) const override;
bool isNewResidencyModelSupported() const override;

View File

@ -549,11 +549,6 @@ bool HwHelperHw<GfxFamily>::isCooperativeDispatchSupported(const EngineGroupType
return true;
}
template <typename GfxFamily>
bool HwHelperHw<GfxFamily>::isMediaBlockIOSupported(const HardwareInfo &hwInfo) const {
return hwInfo.capabilityTable.supportsImages;
}
template <typename GfxFamily>
bool HwHelperHw<GfxFamily>::isKmdMigrationSupported(const HardwareInfo &hwInfo) const {
return false;

View File

@ -64,6 +64,7 @@ struct RuntimeCapabilityTable {
bool hostPtrTrackingEnabled;
bool levelZeroSupported;
bool isIntegratedDevice;
bool supportsMediaBlock;
};
struct HardwareCapabilities {