Add flag forcing 2dimage as array in surface state

Workaround for a hw bug causing invalid texture address request

Related-To: NEO-5653

Signed-off-by: Dominik Dabek <dominik.dabek@intel.com>
This commit is contained in:
Dominik Dabek
2021-12-13 13:42:01 +00:00
committed by Compute-Runtime-Automation
parent 723ce5d373
commit 4f71b9ea61
4 changed files with 123 additions and 2 deletions

View File

@ -364,3 +364,4 @@ UpdateCrossThreadDataSize = 0
ForceBcsEngineIndex = -1
ResolveDependenciesViaPipeControls = -1
ExperimentalEnableSourceLevelDebugger = 0
Force2dImageAsArray = -1

View File

@ -178,6 +178,7 @@ DECLARE_DEBUG_VARIABLE(int32_t, ForceTile0PlacementForTile1ResourcesWaActive, -1
DECLARE_DEBUG_VARIABLE(int32_t, ClosEnabled, -1, "-1: default, 0: disabled, 1: enabled. Enable CLOS based cache reservation")
DECLARE_DEBUG_VARIABLE(int32_t, EngineUsageHint, -1, "-1: default, >=0: engine usage value to use when creating command queue on user selected engine")
DECLARE_DEBUG_VARIABLE(int32_t, ForceBcsEngineIndex, -1, "-1: default, >=0 Copy Engine index")
DECLARE_DEBUG_VARIABLE(int32_t, Force2dImageAsArray, -1, "-1: default, 0: WA Disabled, 1: Forces surface state of 2dImage to array")
/*LOGGING FLAGS*/
DECLARE_DEBUG_VARIABLE(int32_t, PrintDriverDiagnostics, -1, "prints driver diagnostics messages to standard output, value corresponds to hint level")

View File

@ -7,6 +7,7 @@
#pragma once
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/source/execution_environment/execution_environment.h"
#include "shared/source/gmm_helper/gmm.h"
#include "shared/source/gmm_helper/gmm_helper.h"
@ -33,6 +34,8 @@ inline void setImageSurfaceState(typename GfxFamily::RENDER_SURFACE_STATE *surfa
(imageInfo.imgDesc.imageType == ImageType::Image2DArray ||
imageInfo.imgDesc.imageType == ImageType::Image1DArray);
isImageArray |= (imageInfo.imgDesc.imageType == ImageType::Image2D || imageInfo.imgDesc.imageType == ImageType::Image2DArray) && DebugManager.flags.Force2dImageAsArray.get() == 1;
uint32_t renderTargetViewExtent = static_cast<uint32_t>(imageCount);
uint32_t minimumArrayElement = 0;
auto hAlign = RENDER_SURFACE_STATE::SURFACE_HORIZONTAL_ALIGNMENT_HALIGN_4;

View File

@ -5,6 +5,7 @@
*
*/
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/unit_test/image/image_surface_state_fixture.h"
using namespace NEO;
@ -106,3 +107,118 @@ HWTEST_F(ImageSurfaceStateTests, givenGmmWhenSetAuxParamsForCCSThenAuxiliarySurf
mockGmm->isCompressionEnabled = true;
EXPECT_TRUE(EncodeSurfaceState<FamilyType>::isAuxModeEnabled(castSurfaceState, mockGmm.get()));
}
HWTEST_F(ImageSurfaceStateTests, givenImage2DWhen2dImageWAIsEnabledThenArrayFlagIsSet) {
DebugManagerStateRestore debugSettingsRestore;
DebugManager.flags.Force2dImageAsArray.set(1);
auto size = sizeof(typename FamilyType::RENDER_SURFACE_STATE);
auto surfaceState = std::make_unique<char[]>(size);
auto castSurfaceState = reinterpret_cast<typename FamilyType::RENDER_SURFACE_STATE *>(surfaceState.get());
imageInfo.imgDesc.imageType = ImageType::Image2D;
imageInfo.imgDesc.imageDepth = 1;
imageInfo.imgDesc.imageArraySize = 1;
imageInfo.qPitch = 0;
SurfaceOffsets surfaceOffsets = {0, 0, 0, 0};
const uint32_t cubeFaceIndex = __GMM_NO_CUBE_MAP;
SurfaceFormatInfo surfaceFormatInfo;
surfaceFormatInfo.GenxSurfaceFormat = GFX3DSTATE_SURFACEFORMAT::GFX3DSTATE_SURFACEFORMAT_A32_FLOAT;
imageInfo.surfaceFormat = &surfaceFormatInfo;
const uint64_t gpuAddress = 0x000001a78a8a8000;
setImageSurfaceState<FamilyType>(castSurfaceState, imageInfo, mockGmm.get(), *gmmHelper, cubeFaceIndex, gpuAddress, surfaceOffsets, true);
EXPECT_TRUE(castSurfaceState->getSurfaceArray());
}
HWTEST_F(ImageSurfaceStateTests, givenImage2DWhen2dImageWAIsDisabledThenArrayFlagIsNotSet) {
DebugManagerStateRestore debugSettingsRestore;
DebugManager.flags.Force2dImageAsArray.set(0);
auto size = sizeof(typename FamilyType::RENDER_SURFACE_STATE);
auto surfaceState = std::make_unique<char[]>(size);
auto castSurfaceState = reinterpret_cast<typename FamilyType::RENDER_SURFACE_STATE *>(surfaceState.get());
imageInfo.imgDesc.imageType = ImageType::Image2D;
imageInfo.imgDesc.imageDepth = 1;
imageInfo.imgDesc.imageArraySize = 1;
imageInfo.qPitch = 0;
SurfaceOffsets surfaceOffsets = {0, 0, 0, 0};
const uint32_t cubeFaceIndex = __GMM_NO_CUBE_MAP;
SurfaceFormatInfo surfaceFormatInfo;
surfaceFormatInfo.GenxSurfaceFormat = GFX3DSTATE_SURFACEFORMAT::GFX3DSTATE_SURFACEFORMAT_A32_FLOAT;
imageInfo.surfaceFormat = &surfaceFormatInfo;
const uint64_t gpuAddress = 0x000001a78a8a8000;
setImageSurfaceState<FamilyType>(castSurfaceState, imageInfo, mockGmm.get(), *gmmHelper, cubeFaceIndex, gpuAddress, surfaceOffsets, true);
EXPECT_FALSE(castSurfaceState->getSurfaceArray());
}
HWTEST_F(ImageSurfaceStateTests, givenImage2DArrayOfSize1When2dImageWAIsEnabledThenArrayFlagIsSet) {
DebugManagerStateRestore debugSettingsRestore;
DebugManager.flags.Force2dImageAsArray.set(1);
auto size = sizeof(typename FamilyType::RENDER_SURFACE_STATE);
auto surfaceState = std::make_unique<char[]>(size);
auto castSurfaceState = reinterpret_cast<typename FamilyType::RENDER_SURFACE_STATE *>(surfaceState.get());
imageInfo.imgDesc.imageType = ImageType::Image2DArray;
imageInfo.imgDesc.imageDepth = 1;
imageInfo.imgDesc.imageArraySize = 1;
imageInfo.qPitch = 0;
SurfaceOffsets surfaceOffsets = {0, 0, 0, 0};
const uint32_t cubeFaceIndex = __GMM_NO_CUBE_MAP;
SurfaceFormatInfo surfaceFormatInfo;
surfaceFormatInfo.GenxSurfaceFormat = GFX3DSTATE_SURFACEFORMAT::GFX3DSTATE_SURFACEFORMAT_A32_FLOAT;
imageInfo.surfaceFormat = &surfaceFormatInfo;
const uint64_t gpuAddress = 0x000001a78a8a8000;
setImageSurfaceState<FamilyType>(castSurfaceState, imageInfo, mockGmm.get(), *gmmHelper, cubeFaceIndex, gpuAddress, surfaceOffsets, true);
EXPECT_TRUE(castSurfaceState->getSurfaceArray());
}
HWTEST_F(ImageSurfaceStateTests, givenImage2DArrayOfSize1When2dImageWAIsDisabledThenArrayFlagIsNotSet) {
DebugManagerStateRestore debugSettingsRestore;
DebugManager.flags.Force2dImageAsArray.set(0);
auto size = sizeof(typename FamilyType::RENDER_SURFACE_STATE);
auto surfaceState = std::make_unique<char[]>(size);
auto castSurfaceState = reinterpret_cast<typename FamilyType::RENDER_SURFACE_STATE *>(surfaceState.get());
imageInfo.imgDesc.imageType = ImageType::Image2DArray;
imageInfo.imgDesc.imageDepth = 1;
imageInfo.imgDesc.imageArraySize = 1;
imageInfo.qPitch = 0;
SurfaceOffsets surfaceOffsets = {0, 0, 0, 0};
const uint32_t cubeFaceIndex = __GMM_NO_CUBE_MAP;
SurfaceFormatInfo surfaceFormatInfo;
surfaceFormatInfo.GenxSurfaceFormat = GFX3DSTATE_SURFACEFORMAT::GFX3DSTATE_SURFACEFORMAT_A32_FLOAT;
imageInfo.surfaceFormat = &surfaceFormatInfo;
const uint64_t gpuAddress = 0x000001a78a8a8000;
setImageSurfaceState<FamilyType>(castSurfaceState, imageInfo, mockGmm.get(), *gmmHelper, cubeFaceIndex, gpuAddress, surfaceOffsets, true);
EXPECT_FALSE(castSurfaceState->getSurfaceArray());
}
HWTEST_F(ImageSurfaceStateTests, givenImage1DWhen2dImageWAIsEnabledThenArrayFlagIsNotSet) {
DebugManagerStateRestore debugSettingsRestore;
DebugManager.flags.Force2dImageAsArray.set(1);
auto size = sizeof(typename FamilyType::RENDER_SURFACE_STATE);
auto surfaceState = std::make_unique<char[]>(size);
auto castSurfaceState = reinterpret_cast<typename FamilyType::RENDER_SURFACE_STATE *>(surfaceState.get());
imageInfo.imgDesc.imageType = ImageType::Image1D;
imageInfo.imgDesc.imageDepth = 1;
imageInfo.imgDesc.imageArraySize = 1;
imageInfo.qPitch = 0;
SurfaceOffsets surfaceOffsets = {0, 0, 0, 0};
const uint32_t cubeFaceIndex = __GMM_NO_CUBE_MAP;
SurfaceFormatInfo surfaceFormatInfo;
surfaceFormatInfo.GenxSurfaceFormat = GFX3DSTATE_SURFACEFORMAT::GFX3DSTATE_SURFACEFORMAT_A32_FLOAT;
imageInfo.surfaceFormat = &surfaceFormatInfo;
const uint64_t gpuAddress = 0x000001a78a8a8000;
setImageSurfaceState<FamilyType>(castSurfaceState, imageInfo, mockGmm.get(), *gmmHelper, cubeFaceIndex, gpuAddress, surfaceOffsets, true);
EXPECT_FALSE(castSurfaceState->getSurfaceArray());
}