fix: Abort for blit usage on depth image on ARL

Related-To: NEO-14344
Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
This commit is contained in:
Maciej Plewka
2025-05-08 15:45:44 +00:00
committed by Compute-Runtime-Automation
parent 094660cd63
commit a19fa245ab
21 changed files with 161 additions and 4 deletions

View File

@@ -8,6 +8,7 @@
#pragma once
#include "shared/source/command_stream/command_stream_receiver.h"
#include "shared/source/helpers/blit_properties.h"
#include "shared/source/release_helper/release_helper.h"
#include "opencl/source/built_ins/builtins_dispatch_builder.h"
#include "opencl/source/mem_obj/image.h"
@@ -24,7 +25,8 @@ struct ClBlitProperties {
auto rootDeviceIndex = commandStreamReceiver.getRootDeviceIndex();
auto clearColorAllocation = commandStreamReceiver.getClearColorAllocation();
BlitProperties blitProperties{};
auto releaseHelper = commandStreamReceiver.getReleaseHelper();
bool isBlitAllowedForDepthImage = releaseHelper ? releaseHelper->isBlitImageAllowedForDepthFormat() : true;
if (BlitterConstants::BlitDirection::bufferToBuffer == blitDirection ||
BlitterConstants::BlitDirection::imageToImage == blitDirection) {
auto dstOffset = builtinOpParams.dstOffset.x;
@@ -51,9 +53,9 @@ struct ClBlitProperties {
builtinOpParams.size,
builtinOpParams.srcRowPitch, builtinOpParams.srcSlicePitch,
builtinOpParams.dstRowPitch, builtinOpParams.dstSlicePitch, clearColorAllocation);
if (BlitterConstants::BlitDirection::imageToImage == blitDirection) {
blitProperties.blitDirection = blitDirection;
blitProperties.isBlitAllowedForDepthFormat = isBlitAllowedForDepthImage;
setBlitPropertiesForImage(blitProperties, builtinOpParams);
}
blitProperties.transform1DArrayTo2DArrayIfNeeded();
@@ -140,6 +142,7 @@ struct ClBlitProperties {
if (BlitterConstants::BlitDirection::hostPtrToImage == blitDirection ||
BlitterConstants::BlitDirection::imageToHostPtr == blitDirection) {
blitProperties.isBlitAllowedForDepthFormat = isBlitAllowedForDepthImage;
setBlitPropertiesForImage(blitProperties, builtinOpParams);
}
@@ -180,6 +183,7 @@ struct ClBlitProperties {
bool src1DBuffer = false, dst1DBuffer = false;
if (srcImage) {
UNRECOVERABLE_IF(!blitProperties.isBlitAllowedForDepthFormat && Image::isDepthFormat(srcImage->getImageFormat()));
const auto &imageDesc = srcImage->getImageDesc();
blitProperties.srcSize.x = imageDesc.image_width;
blitProperties.srcSize.y = std::max(imageDesc.image_height, size_t(1));
@@ -200,6 +204,7 @@ struct ClBlitProperties {
}
if (dstImage) {
UNRECOVERABLE_IF(!blitProperties.isBlitAllowedForDepthFormat && Image::isDepthFormat(dstImage->getImageFormat()));
const auto &imageDesc = dstImage->getImageDesc();
blitProperties.dstSize.x = imageDesc.image_width;
blitProperties.dstSize.y = std::max(imageDesc.image_height, size_t(1));

View File

@@ -25,6 +25,7 @@
#include "shared/test/common/mocks/mock_gmm_resource_info.h"
#include "shared/test/common/mocks/mock_internal_allocation_storage.h"
#include "shared/test/common/mocks/mock_memory_manager.h"
#include "shared/test/common/mocks/mock_release_helper.h"
#include "shared/test/common/mocks/mock_timestamp_container.h"
#include "shared/test/common/test_macros/test.h"
#include "shared/test/common/utilities/base_object_utils.h"
@@ -2206,6 +2207,83 @@ HWTEST_F(BcsTests, givenHostPtrToImageWhenBlitBufferIsCalledThenBlitCmdIsFound)
auto cmdIterator = find<typename FamilyType::XY_BLOCK_COPY_BLT *>(hwParser.cmdList.begin(), hwParser.cmdList.end());
EXPECT_NE(hwParser.cmdList.end(), cmdIterator);
}
HWTEST_F(BcsTests, givenSrcAndDstImageWhenDepthImageIsNotAllowedForBlitOperationThenAbortThrown) {
if (!pDevice->getHardwareInfo().capabilityTable.supportsImages) {
GTEST_SKIP();
}
auto releaseHelper = std::unique_ptr<MockReleaseHelper>(new MockReleaseHelper());
releaseHelper->isBlitImageAllowedForDepthFormatResult = false;
pDevice->getRootDeviceEnvironmentRef().releaseHelper.reset(releaseHelper.release());
cl_image_desc imgDesc = Image1dDefaults::imageDesc;
std::unique_ptr<Image> image(Image2dArrayHelper<>::create(context.get(), &imgDesc));
BlitProperties blitProperties{};
EXPECT_EQ(GMM_YUV_PLANE_ENUM::GMM_NO_PLANE, blitProperties.dstPlane);
EXPECT_EQ(GMM_YUV_PLANE_ENUM::GMM_NO_PLANE, blitProperties.srcPlane);
BuiltinOpParams builtinOpParams{};
builtinOpParams.srcMemObj = image.get();
builtinOpParams.dstMemObj = image.get();
reinterpret_cast<MockImageBase *>(image.get())->imageFormat = {CL_DEPTH, CL_UNSIGNED_INT8};
builtinOpParams.size = {1, 1, 1};
auto &csr = pDevice->getUltCommandStreamReceiver<FamilyType>();
EXPECT_THROW(ClBlitProperties::constructProperties(BlitterConstants::BlitDirection::imageToImage,
csr,
builtinOpParams),
std::exception);
}
HWTEST_F(BcsTests, givenDstImageAreDepthDepthImageIsNotAllowedForBlitOperationThenAbortThrown) {
if (!pDevice->getHardwareInfo().capabilityTable.supportsImages) {
GTEST_SKIP();
}
auto releaseHelper = std::unique_ptr<MockReleaseHelper>(new MockReleaseHelper());
releaseHelper->isBlitImageAllowedForDepthFormatResult = false;
pDevice->getRootDeviceEnvironmentRef().releaseHelper.reset(releaseHelper.release());
cl_image_desc imgDesc = Image1dDefaults::imageDesc;
std::unique_ptr<Image> image(Image2dArrayHelper<>::create(context.get(), &imgDesc));
BlitProperties blitProperties{};
EXPECT_EQ(GMM_YUV_PLANE_ENUM::GMM_NO_PLANE, blitProperties.dstPlane);
EXPECT_EQ(GMM_YUV_PLANE_ENUM::GMM_NO_PLANE, blitProperties.srcPlane);
BuiltinOpParams builtinOpParams{};
builtinOpParams.dstMemObj = image.get();
reinterpret_cast<MockImageBase *>(image.get())->imageFormat = {CL_DEPTH, CL_UNSIGNED_INT8};
builtinOpParams.size = {1, 1, 1};
auto &csr = pDevice->getUltCommandStreamReceiver<FamilyType>();
EXPECT_THROW(ClBlitProperties::constructProperties(BlitterConstants::BlitDirection::hostPtrToImage,
csr,
builtinOpParams),
std::exception);
}
HWTEST_F(BcsTests, givenSrcImageWhenDepthImageIsNotAllowedForBlitOperationThenAbortThrown) {
if (!pDevice->getHardwareInfo().capabilityTable.supportsImages) {
GTEST_SKIP();
}
auto releaseHelper = std::unique_ptr<MockReleaseHelper>(new MockReleaseHelper());
releaseHelper->isBlitImageAllowedForDepthFormatResult = false;
pDevice->getRootDeviceEnvironmentRef().releaseHelper.reset(releaseHelper.release());
cl_image_desc imgDesc = Image1dDefaults::imageDesc;
std::unique_ptr<Image> image(Image2dArrayHelper<>::create(context.get(), &imgDesc));
BlitProperties blitProperties{};
EXPECT_EQ(GMM_YUV_PLANE_ENUM::GMM_NO_PLANE, blitProperties.dstPlane);
EXPECT_EQ(GMM_YUV_PLANE_ENUM::GMM_NO_PLANE, blitProperties.srcPlane);
BuiltinOpParams builtinOpParams{};
builtinOpParams.srcMemObj = image.get();
reinterpret_cast<MockImageBase *>(image.get())->imageFormat = {CL_DEPTH, CL_UNSIGNED_INT8};
builtinOpParams.size = {1, 1, 1};
auto &csr = pDevice->getUltCommandStreamReceiver<FamilyType>();
EXPECT_THROW(ClBlitProperties::constructProperties(BlitterConstants::BlitDirection::imageToHostPtr,
csr,
builtinOpParams),
std::exception);
}
HWTEST_F(BcsTests, given1DTiledArrayImageWhenConstructPropertiesThenImageTransformedTo2DArray) {
if (!pDevice->getHardwareInfo().capabilityTable.supportsImages) {
GTEST_SKIP();

View File

@@ -105,6 +105,7 @@ struct BlitProperties {
GMM_YUV_PLANE_ENUM dstPlane = GMM_YUV_PLANE_ENUM::GMM_NO_PLANE;
GMM_YUV_PLANE_ENUM srcPlane = GMM_YUV_PLANE_ENUM::GMM_NO_PLANE;
bool isSystemMemoryPoolUsed = false;
bool isBlitAllowedForDepthFormat = true;
};
} // namespace NEO

View File

@@ -65,6 +65,7 @@ class ReleaseHelper {
virtual bool isNumRtStacksPerDssFixedValue() const = 0;
virtual bool getFtrXe2Compression() const = 0;
virtual uint32_t computeSlmValues(uint32_t slmSize, bool isHeapless) const = 0;
virtual bool isBlitImageAllowedForDepthFormat() const = 0;
protected:
ReleaseHelper(HardwareIpVersion hardwareIpVersion) : hardwareIpVersion(hardwareIpVersion) {}
@@ -109,6 +110,7 @@ class ReleaseHelperHw : public ReleaseHelper {
bool isNumRtStacksPerDssFixedValue() const override;
bool getFtrXe2Compression() const override;
uint32_t computeSlmValues(uint32_t slmSize, bool isHeapless) const override;
bool isBlitImageAllowedForDepthFormat() const override;
protected:
ReleaseHelperHw(HardwareIpVersion hardwareIpVersion) : ReleaseHelper(hardwareIpVersion) {}

View File

@@ -44,6 +44,11 @@ bool ReleaseHelperHw<release>::getFtrXe2Compression() const {
return false;
}
template <>
bool ReleaseHelperHw<release>::isBlitImageAllowedForDepthFormat() const {
return false;
}
template <>
const SizeToPreferredSlmValueArray &ReleaseHelperHw<release>::getSizeToPreferredSlmValue(bool isHeapless) const {
using PREFERRED_SLM_ALLOCATION_SIZE = typename XeHpgCoreFamily::INTERFACE_DESCRIPTOR_DATA::PREFERRED_SLM_ALLOCATION_SIZE;

View File

@@ -171,5 +171,9 @@ template <ReleaseType releaseType>
uint32_t ReleaseHelperHw<releaseType>::computeSlmValues(uint32_t slmSize, bool isHeapless) const {
return 0u;
}
template <ReleaseType releaseType>
bool ReleaseHelperHw<releaseType>::isBlitImageAllowedForDepthFormat() const {
return true;
}
} // namespace NEO

View File

@@ -39,6 +39,7 @@ class MockReleaseHelper : public ReleaseHelper {
ADDMETHOD_CONST_NOBASE(isLocalOnlyAllowed, bool, {}, ());
ADDMETHOD_CONST_NOBASE(isDummyBlitWaRequired, bool, false, ());
ADDMETHOD_CONST_NOBASE(isNumRtStacksPerDssFixedValue, bool, true, ());
ADDMETHOD_CONST_NOBASE(isBlitImageAllowedForDepthFormat, bool, true, ());
ADDMETHOD_CONST_NOBASE(getFtrXe2Compression, bool, false, ());
ADDMETHOD_CONST_NOBASE(isDirectSubmissionLightSupported, bool, false, ());
ADDMETHOD_CONST_NOBASE(computeSlmValues, uint32_t, {}, (uint32_t slmSize, bool isHeapless));

View File

@@ -73,6 +73,10 @@ TEST_F(ReleaseHelper1255Tests, whenIsDummyBlitWaRequiredCalledThenFalseReturned)
whenIsDummyBlitWaRequiredCalledThenFalseReturned();
}
TEST_F(ReleaseHelper1255Tests, whenIsBlitImageAllowedForDepthFormatCalledThenTrueReturned) {
whenIsBlitImageAllowedForDepthFormatCalledThenTrueReturned();
}
TEST_F(ReleaseHelper1255Tests, whenGettingPreferredSlmSizeThenAllEntriesHaveCorrectValues) {
for (auto &revision : getRevisions()) {
ipVersion.revision = revision;

View File

@@ -73,6 +73,10 @@ TEST_F(ReleaseHelper1256Tests, whenIsDummyBlitWaRequiredCalledThenFalseReturned)
whenIsDummyBlitWaRequiredCalledThenFalseReturned();
}
TEST_F(ReleaseHelper1256Tests, whenIsBlitImageAllowedForDepthFormatCalledThenTrueReturned) {
whenIsBlitImageAllowedForDepthFormatCalledThenTrueReturned();
}
TEST_F(ReleaseHelper1256Tests, whenGettingPreferredSlmSizeThenAllEntriesHaveCorrectValues) {
for (auto &revision : getRevisions()) {
ipVersion.revision = revision;

View File

@@ -73,6 +73,10 @@ TEST_F(ReleaseHelper1257Tests, whenIsDummyBlitWaRequiredCalledThenFalseReturned)
whenIsDummyBlitWaRequiredCalledThenFalseReturned();
}
TEST_F(ReleaseHelper1257Tests, whenIsBlitImageAllowedForDepthFormatCalledThenTrueReturned) {
whenIsBlitImageAllowedForDepthFormatCalledThenTrueReturned();
}
TEST_F(ReleaseHelper1257Tests, whenGettingPreferredSlmSizeThenAllEntriesHaveCorrectValues) {
for (auto &revision : getRevisions()) {
ipVersion.revision = revision;

View File

@@ -62,6 +62,10 @@ TEST_F(ReleaseHelper1260Tests, whenIsDummyBlitWaRequiredCalledThenTrueReturned)
whenIsDummyBlitWaRequiredCalledThenTrueReturned();
}
TEST_F(ReleaseHelper1260Tests, whenIsBlitImageAllowedForDepthFormatCalledThenTrueReturned) {
whenIsBlitImageAllowedForDepthFormatCalledThenTrueReturned();
}
TEST_F(ReleaseHelper1260Tests, whenGettingPreferredSlmSizeThenAllEntriesHaveCorrectValues) {
for (auto &revision : getRevisions()) {
ipVersion.revision = revision;

View File

@@ -61,6 +61,10 @@ TEST_F(ReleaseHelper1261Tests, whenIsDummyBlitWaRequiredCalledThenTrueReturned)
whenIsDummyBlitWaRequiredCalledThenTrueReturned();
}
TEST_F(ReleaseHelper1261Tests, whenIsBlitImageAllowedForDepthFormatCalledThenTrueReturned) {
whenIsBlitImageAllowedForDepthFormatCalledThenTrueReturned();
}
TEST_F(ReleaseHelper1261Tests, whenGettingPreferredSlmSizeThenAllEntriesHaveCorrectValues) {
for (auto &revision : getRevisions()) {
ipVersion.revision = revision;

View File

@@ -75,6 +75,10 @@ TEST_F(ReleaseHelper1270Tests, whenIsDummyBlitWaRequiredCalledThenTrueReturned)
whenIsDummyBlitWaRequiredCalledThenTrueReturned();
}
TEST_F(ReleaseHelper1270Tests, whenIsBlitImageAllowedForDepthFormatCalledThenTrueReturned) {
whenIsBlitImageAllowedForDepthFormatCalledThenTrueReturned();
}
TEST_F(ReleaseHelper1270Tests, whenGettingPreferredSlmSizeThenAllEntriesHaveCorrectValues) {
for (auto &revision : getRevisions()) {
ipVersion.revision = revision;

View File

@@ -75,6 +75,10 @@ TEST_F(ReleaseHelper1271Tests, whenIsDummyBlitWaRequiredCalledThenTrueReturned)
whenIsDummyBlitWaRequiredCalledThenTrueReturned();
}
TEST_F(ReleaseHelper1271Tests, whenIsBlitImageAllowedForDepthFormatCalledThenTrueReturned) {
whenIsBlitImageAllowedForDepthFormatCalledThenTrueReturned();
}
TEST_F(ReleaseHelper1271Tests, whenGettingPreferredSlmSizeThenAllEntriesHaveCorrectValues) {
for (auto &revision : getRevisions()) {
ipVersion.revision = revision;

View File

@@ -101,3 +101,11 @@ TEST_F(ReleaseHelper1274Tests, whenGettingPreferredSlmSizeThenAllEntriesHaveCorr
EXPECT_EQ(13u, preferredSlmValueArray[5].valueToProgram);
}
}
TEST_F(ReleaseHelper1274Tests, whenIsBlitImageAllowedForDepthFormatCalledThenFalseReturned) {
for (auto &revision : getRevisions()) {
ipVersion.revision = revision;
releaseHelper = ReleaseHelper::create(ipVersion);
ASSERT_NE(nullptr, releaseHelper);
EXPECT_FALSE(releaseHelper->isBlitImageAllowedForDepthFormat());
}
}

View File

@@ -72,6 +72,10 @@ TEST_F(ReleaseHelper2001Tests, whenIsDummyBlitWaRequiredCalledThenFalseReturned)
whenIsDummyBlitWaRequiredCalledThenFalseReturned();
}
TEST_F(ReleaseHelper2001Tests, whenIsBlitImageAllowedForDepthFormatCalledThenTrueReturned) {
whenIsBlitImageAllowedForDepthFormatCalledThenTrueReturned();
}
TEST_F(ReleaseHelper2001Tests, whenGettingPreferredSlmSizeThenAllEntriesHaveCorrectValues) {
for (auto &revision : getRevisions()) {
ipVersion.revision = revision;

View File

@@ -74,6 +74,10 @@ TEST_F(ReleaseHelper2004Tests, whenIsDummyBlitWaRequiredCalledThenFalseReturned)
whenIsDummyBlitWaRequiredCalledThenFalseReturned();
}
TEST_F(ReleaseHelper2004Tests, whenIsBlitImageAllowedForDepthFormatCalledThenTrueReturned) {
whenIsBlitImageAllowedForDepthFormatCalledThenTrueReturned();
}
TEST_F(ReleaseHelper2004Tests, whenGettingPreferredSlmSizeThenAllEntriesHaveCorrectValues) {
for (auto &revision : getRevisions()) {
ipVersion.revision = revision;

View File

@@ -76,6 +76,10 @@ TEST_F(ReleaseHelper3000Tests, whenIsDummyBlitWaRequiredCalledThenFalseReturned)
whenIsDummyBlitWaRequiredCalledThenFalseReturned();
}
TEST_F(ReleaseHelper3000Tests, whenIsBlitImageAllowedForDepthFormatCalledThenTrueReturned) {
whenIsBlitImageAllowedForDepthFormatCalledThenTrueReturned();
}
TEST_F(ReleaseHelper3000Tests, whenGettingPreferredSlmSizeThenAllEntriesHaveCorrectValues) {
for (auto &revision : getRevisions()) {
ipVersion.revision = revision;

View File

@@ -76,6 +76,10 @@ TEST_F(ReleaseHelper3001Tests, whenIsDummyBlitWaRequiredCalledThenFalseReturned)
whenIsDummyBlitWaRequiredCalledThenFalseReturned();
}
TEST_F(ReleaseHelper3001Tests, whenIsBlitImageAllowedForDepthFormatCalledThenTrueReturned) {
whenIsBlitImageAllowedForDepthFormatCalledThenTrueReturned();
}
TEST_F(ReleaseHelper3001Tests, whenGettingPreferredSlmSizeThenAllEntriesHaveCorrectValues) {
for (auto &revision : getRevisions()) {
ipVersion.revision = revision;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023-2024 Intel Corporation
* Copyright (C) 2023-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -170,3 +170,11 @@ void ReleaseHelperTestsBase::whenIsDummyBlitWaRequiredCalledThenFalseReturned()
EXPECT_FALSE(releaseHelper->isDummyBlitWaRequired());
}
}
void ReleaseHelperTestsBase::whenIsBlitImageAllowedForDepthFormatCalledThenTrueReturned() {
for (auto &revision : getRevisions()) {
ipVersion.revision = revision;
releaseHelper = ReleaseHelper::create(ipVersion);
ASSERT_NE(nullptr, releaseHelper);
EXPECT_TRUE(releaseHelper->isBlitImageAllowedForDepthFormat());
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023-2024 Intel Corporation
* Copyright (C) 2023-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -34,6 +34,7 @@ struct ReleaseHelperTestsBase : public ::testing::Test {
void whenGettingSupportedNumGrfsThenValuesUpTo256Returned();
void whenGettingNumThreadsPerEuThenCorrectValueIsReturnedBasedOnDebugKey();
void whenGettingThreadsPerEuConfigsThenCorrectValueIsReturnedBasedOnNumThreadPerEu();
void whenIsBlitImageAllowedForDepthFormatCalledThenTrueReturned();
virtual std::vector<uint32_t> getRevisions() = 0;
std::unique_ptr<ReleaseHelper> releaseHelper;