Add isBlitterForImagesSupported helper

Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
Kamil Kopryk 2021-04-22 13:11:33 +00:00 committed by Compute-Runtime-Automation
parent 52301e6a40
commit 7a5e0e13a5
6 changed files with 27 additions and 8 deletions

View File

@ -746,13 +746,15 @@ bool CommandQueue::blitEnqueuePreferred(cl_command_type cmdType, const BuiltinOp
}
bool CommandQueue::blitEnqueueImageAllowed(const size_t *origin, const size_t *region) {
auto blitEnqueuImageAllowed = false;
const auto &hwInfo = device->getHardwareInfo();
const auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
auto blitEnqueuImageAllowed = hwHelper.isBlitterForImagesSupported(hwInfo);
if (DebugManager.flags.EnableBlitterForReadWriteImage.get() != -1) {
blitEnqueuImageAllowed = DebugManager.flags.EnableBlitterForReadWriteImage.get();
blitEnqueuImageAllowed &= (origin[0] + region[0] <= BlitterConstants::maxBlitWidth) && (origin[1] + region[1] <= BlitterConstants::maxBlitHeight);
}
blitEnqueuImageAllowed &= (origin[0] + region[0] <= BlitterConstants::maxBlitWidth) && (origin[1] + region[1] <= BlitterConstants::maxBlitHeight);
return blitEnqueuImageAllowed;
}

View File

@ -438,8 +438,9 @@ HWTEST_F(EnqueueReadImageTest, givenDeviceWithBlitterSupportWhenEnqueueReadImage
DebugManager.flags.EnableBlitterForEnqueueOperations.set(1);
DebugManager.flags.EnableBlitterForReadWriteImage.set(1);
auto &capabilityTable = pClDevice->getRootDeviceEnvironment().getMutableHardwareInfo()->capabilityTable;
capabilityTable.blitterOperationsSupported = true;
auto hwInfo = pClDevice->getRootDeviceEnvironment().getMutableHardwareInfo();
auto &hwHelper = HwHelper::get(hwInfo->platform.eRenderCoreFamily);
hwInfo->capabilityTable.blitterOperationsSupported = true;
size_t origin[] = {0, 0, 0};
auto mockCmdQ = std::make_unique<MockCommandQueueHw<FamilyType>>(context, pClDevice, nullptr);
std::unique_ptr<Image> image(Image2dHelper<>::create(context));
@ -457,7 +458,8 @@ HWTEST_F(EnqueueReadImageTest, givenDeviceWithBlitterSupportWhenEnqueueReadImage
DebugManager.flags.EnableBlitterForReadWriteImage.set(-1);
size_t region[] = {BlitterConstants::maxBlitWidth, BlitterConstants::maxBlitHeight, 1};
EnqueueReadImageHelper<>::enqueueReadImage(mockCmdQ.get(), image.get(), CL_TRUE, origin, region);
EXPECT_FALSE(mockCmdQ->isBlitEnqueueImageAllowed);
auto supportExpected = hwHelper.isBlitterForImagesSupported(*hwInfo);
EXPECT_EQ(supportExpected, mockCmdQ->isBlitEnqueueImageAllowed);
}
{
DebugManager.flags.EnableBlitterForReadWriteImage.set(0);

View File

@ -213,8 +213,9 @@ HWTEST_F(EnqueueWriteImageTest, givenDeviceWithBlitterSupportWhenEnqueueWriteIma
DebugManager.flags.EnableBlitterForEnqueueOperations.set(1);
DebugManager.flags.EnableBlitterForReadWriteImage.set(1);
auto &capabilityTable = pClDevice->getRootDeviceEnvironment().getMutableHardwareInfo()->capabilityTable;
capabilityTable.blitterOperationsSupported = true;
auto hwInfo = pClDevice->getRootDeviceEnvironment().getMutableHardwareInfo();
auto &hwHelper = HwHelper::get(hwInfo->platform.eRenderCoreFamily);
hwInfo->capabilityTable.blitterOperationsSupported = true;
size_t origin[] = {0, 0, 0};
auto mockCmdQ = std::make_unique<MockCommandQueueHw<FamilyType>>(context, pClDevice, nullptr);
std::unique_ptr<Image> image(Image2dHelper<>::create(context));
@ -232,7 +233,8 @@ HWTEST_F(EnqueueWriteImageTest, givenDeviceWithBlitterSupportWhenEnqueueWriteIma
DebugManager.flags.EnableBlitterForReadWriteImage.set(-1);
size_t region[] = {BlitterConstants::maxBlitWidth, BlitterConstants::maxBlitHeight, 1};
EnqueueWriteImageHelper<>::enqueueWriteImage(mockCmdQ.get(), image.get(), CL_FALSE, origin, region);
EXPECT_FALSE(mockCmdQ->isBlitEnqueueImageAllowed);
auto supportExpected = hwHelper.isBlitterForImagesSupported(*hwInfo);
EXPECT_EQ(supportExpected, mockCmdQ->isBlitEnqueueImageAllowed);
}
{
DebugManager.flags.EnableBlitterForReadWriteImage.set(0);

View File

@ -1203,6 +1203,11 @@ HWCMDTEST_F(IGFX_GEN8_CORE, HwHelperTest, givenHwHelperWhenGettingPlanarYuvHeigh
EXPECT_EQ(helper.getPlanarYuvMaxHeight(), 16352u);
}
HWTEST_F(HwHelperTest, givenHwHelperWhenIsBlitterForImagesSupportedIsCalledThenFalseIsReturned) {
auto &helper = HwHelper::get(renderCoreFamily);
EXPECT_FALSE(helper.isBlitterForImagesSupported(*defaultHwInfo));
}
HWCMDTEST_F(IGFX_GEN8_CORE, HwHelperTest, givenHwHelperWhenAdditionalKernelExecInfoSupportCheckedThenReturnFalse) {
auto &helper = HwHelper::get(renderCoreFamily);

View File

@ -139,6 +139,7 @@ class HwHelper {
virtual uint32_t getNumCacheRegions(const HardwareInfo &hwInfo) const = 0;
virtual bool isSubDeviceEngineSupported(const HardwareInfo &hwInfo, const DeviceBitfield &deviceBitfield, aub_stream::EngineType engineType) const = 0;
virtual uint32_t getPlanarYuvMaxHeight() const = 0;
virtual bool isBlitterForImagesSupported(const HardwareInfo &hwInfo) const = 0;
static uint32_t getSubDevicesCount(const HardwareInfo *pHwInfo);
static uint32_t getEnginesCount(const HardwareInfo &hwInfo);
@ -356,6 +357,8 @@ class HwHelperHw : public HwHelper {
uint32_t getPlanarYuvMaxHeight() const override;
bool isBlitterForImagesSupported(const HardwareInfo &hwInfo) const override;
protected:
LocalMemoryAccessMode getDefaultLocalMemoryAccessMode(const HardwareInfo &hwInfo) const override;

View File

@ -599,4 +599,9 @@ bool HwHelperHw<GfxFamily>::isSubDeviceEngineSupported(const HardwareInfo &hwInf
return true;
}
template <typename GfxFamily>
bool HwHelperHw<GfxFamily>::isBlitterForImagesSupported(const HardwareInfo &hwInfo) const {
return false;
}
} // namespace NEO