Update compression encoding interface + test traits

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski 2021-01-29 10:17:10 +00:00 committed by Compute-Runtime-Automation
parent 4b1684541c
commit c2e333fe38
37 changed files with 206 additions and 148 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2020 Intel Corporation
* Copyright (C) 2019-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -103,7 +103,7 @@ ze_result_t ImageCoreFamily<gfxCoreFamily>::initialize(Device *device, const ze_
surfaceState.setNumberOfMultisamples(RENDER_SURFACE_STATE::NUMBER_OF_MULTISAMPLES::NUMBER_OF_MULTISAMPLES_MULTISAMPLECOUNT_1);
if (gmm && gmm->isRenderCompressed) {
NEO::setAuxParamsForCCS<GfxFamily>(&surfaceState, gmm);
NEO::EncodeSurfaceState<GfxFamily>::setAuxParamsForCCS(&surfaceState, gmm);
}
}
{
@ -144,7 +144,7 @@ ze_result_t ImageCoreFamily<gfxCoreFamily>::initialize(Device *device, const ze_
redescribedSurfaceState.setNumberOfMultisamples(RENDER_SURFACE_STATE::NUMBER_OF_MULTISAMPLES::NUMBER_OF_MULTISAMPLES_MULTISAMPLECOUNT_1);
if (gmm && gmm->isRenderCompressed) {
NEO::setAuxParamsForCCS<GfxFamily>(&redescribedSurfaceState, gmm);
NEO::EncodeSurfaceState<GfxFamily>::setAuxParamsForCCS(&redescribedSurfaceState, gmm);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2020 Intel Corporation
* Copyright (C) 2018-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -302,7 +302,6 @@ class ImageHw : public Image {
void setImageArg(void *memory, bool setAsMediaBlockImage, uint32_t mipLevel, uint32_t rootDeviceIndex) override;
void setAuxParamsForMultisamples(RENDER_SURFACE_STATE *surfaceState);
MOCKABLE_VIRTUAL void setAuxParamsForMCSCCS(RENDER_SURFACE_STATE *surfaceState, Gmm *gmm);
void setMediaImageArg(void *memory, uint32_t rootDeviceIndex) override;
void setMediaSurfaceRotation(void *memory) override;
void setSurfaceMemoryObjectControlStateIndexToMocsTable(void *memory, uint32_t value) override;

View File

@ -89,7 +89,7 @@ void ImageHw<GfxFamily>::setImageArg(void *memory, bool setAsMediaBlockImage, ui
if (imageDesc.num_samples > 1) {
setAuxParamsForMultisamples(surfaceState);
} else if (gmm && gmm->isRenderCompressed) {
setAuxParamsForCCS<GfxFamily>(surfaceState, gmm);
EncodeSurfaceState<GfxFamily>::setAuxParamsForCCS(surfaceState, gmm);
}
appendSurfaceStateDepthParams(surfaceState, gmm);
EncodeSurfaceState<GfxFamily>::appendImageCompressionParams(surfaceState, graphicsAllocation, gmmHelper, isImageFromBuffer());
@ -105,13 +105,13 @@ void ImageHw<GfxFamily>::setAuxParamsForMultisamples(RENDER_SURFACE_STATE *surfa
auto mcsGmm = getMcsAllocation()->getDefaultGmm();
if (mcsGmm->unifiedAuxTranslationCapable() && mcsGmm->hasMultisampleControlSurface()) {
setAuxParamsForMCSCCS(surfaceState, mcsGmm);
EncodeSurfaceState<GfxFamily>::setAuxParamsForMCSCCS(surfaceState);
surfaceState->setAuxiliarySurfacePitch(mcsGmm->getUnifiedAuxPitchTiles());
surfaceState->setAuxiliarySurfaceQpitch(mcsGmm->getAuxQPitch());
setClearColorParams<GfxFamily>(surfaceState, mcsGmm);
EncodeSurfaceState<GfxFamily>::setClearColorParams(surfaceState, mcsGmm);
setUnifiedAuxBaseAddress<GfxFamily>(surfaceState, mcsGmm);
} else if (mcsGmm->unifiedAuxTranslationCapable()) {
setAuxParamsForCCS<GfxFamily>(surfaceState, mcsGmm);
EncodeSurfaceState<GfxFamily>::setAuxParamsForCCS(surfaceState, mcsGmm);
} else {
surfaceState->setAuxiliarySurfaceMode((typename RENDER_SURFACE_STATE::AUXILIARY_SURFACE_MODE)1);
surfaceState->setAuxiliarySurfacePitch(mcsSurfaceInfo.pitch);
@ -199,7 +199,4 @@ void ImageHw<GfxFamily>::transformImage3dTo2dArray(void *memory) {
surfaceState->setSurfaceArray(true);
}
template <typename GfxFamily>
void ImageHw<GfxFamily>::setAuxParamsForMCSCCS(RENDER_SURFACE_STATE *surfaceState, Gmm *gmm) {
}
} // namespace NEO

View File

@ -1,15 +1,10 @@
/*
* Copyright (C) 2019-2020 Intel Corporation
* Copyright (C) 2019-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
template <>
void ImageHw<Family>::setAuxParamsForMCSCCS(RENDER_SURFACE_STATE *surfaceState, Gmm *gmm) {
surfaceState->setAuxiliarySurfaceMode(AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_MCS_LCE);
}
template <>
void ImageHw<Family>::appendSurfaceStateDepthParams(RENDER_SURFACE_STATE *surfaceState, Gmm *gmm) {
if (gmm) {

View File

@ -202,7 +202,10 @@ set_target_properties(copy_test_files_per_product PROPERTIES FOLDER ${OPENCL_TES
set_target_properties(prepare_test_kernels PROPERTIES FOLDER ${OPENCL_TEST_PROJECTS_FOLDER})
set_target_properties(run_unit_tests PROPERTIES FOLDER ${OPENCL_TEST_PROJECTS_FOLDER})
target_include_directories(igdrcl_tests BEFORE PRIVATE ${NEO_SHARED_TEST_DIRECTORY}/unit_test/test_macros/header${BRANCH_DIR_SUFFIX})
target_include_directories(igdrcl_tests BEFORE PRIVATE
${NEO_SHARED_TEST_DIRECTORY}/unit_test/test_macros/header${BRANCH_DIR_SUFFIX}
${NEO_SHARED_TEST_DIRECTORY}/unit_test/helpers/includes${BRANCH_DIR_SUFFIX}
)
if(NOT DEFINED cloc_cmd_prefix)
if(WIN32)

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2020 Intel Corporation
* Copyright (C) 2018-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -89,7 +89,7 @@ GEN11TEST_F(gen11ImageTests, givenImageForGen11WhenClearColorParametersAreSetThe
EXPECT_EQ(0, memcmp(&surfaceStateBefore, &surfaceStateAfter, sizeof(RENDER_SURFACE_STATE)));
setClearColorParams<FamilyType>(&surfaceStateAfter, imageHw->getGraphicsAllocation(context.getDevice(0)->getRootDeviceIndex())->getDefaultGmm());
EncodeSurfaceState<FamilyType>::setClearColorParams(&surfaceStateAfter, imageHw->getGraphicsAllocation(context.getDevice(0)->getRootDeviceIndex())->getDefaultGmm());
EXPECT_EQ(0, memcmp(&surfaceStateBefore, &surfaceStateAfter, sizeof(RENDER_SURFACE_STATE)));
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2020 Intel Corporation
* Copyright (C) 2019-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -54,7 +54,7 @@ GEN12LPTEST_F(ImageClearColorFixture, givenImageForGen12LpWhenClearColorParamete
std::unique_ptr<ImageHw<FamilyType>> imageHw(static_cast<ImageHw<FamilyType> *>(ImageHelper<Image2dDefaults>::create(&context)));
auto gmm = imageHw->getGraphicsAllocation(context.getDevice(0)->getRootDeviceIndex())->getDefaultGmm();
gmm->gmmResourceInfo->getResourceFlags()->Gpu.IndirectClearColor = 1;
setClearColorParams<FamilyType>(&surfaceState, gmm);
EncodeSurfaceState<FamilyType>::setClearColorParams(&surfaceState, gmm);
EXPECT_EQ(true, surfaceState.getClearValueAddressEnable());
EXPECT_NE(0u, surfaceState.getClearColorAddress());
@ -73,7 +73,7 @@ GEN12LPTEST_F(ImageClearColorFixture, givenImageForGen12LpWhenCanonicalAddresFor
std::unique_ptr<ImageHw<FamilyType>> imageHw(static_cast<ImageHw<FamilyType> *>(ImageHelper<Image2dDefaults>::create(&context)));
auto gmm = imageHw->getGraphicsAllocation(context.getDevice(0)->getRootDeviceIndex())->getDefaultGmm();
gmm->gmmResourceInfo->getResourceFlags()->Gpu.IndirectClearColor = 1;
EXPECT_NO_THROW(setClearColorParams<FamilyType>(&surfaceState, gmm));
EXPECT_NO_THROW(EncodeSurfaceState<FamilyType>::setClearColorParams(&surfaceState, gmm));
uint64_t nonCanonicalAddress = ((static_cast<uint64_t>(surfaceState.getClearColorAddressHigh()) << 32) | surfaceState.getClearColorAddress());
EXPECT_EQ(GmmHelper::decanonize(canonicalAddress), nonCanonicalAddress);
@ -120,7 +120,7 @@ GEN12LPTEST_F(gen12LpImageTests, givenRenderCompressionThenSurfaceStateParamsAre
auto surfaceState = FamilyType::cmdInitRenderSurfaceState;
auto imageHw = static_cast<ImageHw<FamilyType> *>(image.get());
imageHw->getGraphicsAllocation(context.getDevice(0)->getRootDeviceIndex())->getDefaultGmm()->gmmResourceInfo->getResourceFlags()->Info.RenderCompressed = true;
setAuxParamsForCCS<FamilyType>(&surfaceState, imageHw->getGraphicsAllocation(context.getDevice(0)->getRootDeviceIndex())->getDefaultGmm());
EncodeSurfaceState<FamilyType>::setAuxParamsForCCS(&surfaceState, imageHw->getGraphicsAllocation(context.getDevice(0)->getRootDeviceIndex())->getDefaultGmm());
EXPECT_FALSE(surfaceState.getMemoryCompressionEnable());
EXPECT_EQ(surfaceState.getAuxiliarySurfaceMode(), RENDER_SURFACE_STATE::AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_CCS_E);
@ -136,7 +136,7 @@ GEN12LPTEST_F(gen12LpImageTests, givenMediaCompressionThenSurfaceStateParamsAreS
auto imageHw = static_cast<ImageHw<FamilyType> *>(image.get());
imageHw->getGraphicsAllocation(context.getDevice(0)->getRootDeviceIndex())->getDefaultGmm()->gmmResourceInfo->getResourceFlags()->Info.MediaCompressed = true;
surfaceState.setAuxiliarySurfaceMode(RENDER_SURFACE_STATE::AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_CCS_E);
setAuxParamsForCCS<FamilyType>(&surfaceState, imageHw->getGraphicsAllocation(context.getDevice(0)->getRootDeviceIndex())->getDefaultGmm());
EncodeSurfaceState<FamilyType>::setAuxParamsForCCS(&surfaceState, imageHw->getGraphicsAllocation(context.getDevice(0)->getRootDeviceIndex())->getDefaultGmm());
EXPECT_TRUE(surfaceState.getMemoryCompressionEnable());
EXPECT_EQ(surfaceState.getAuxiliarySurfaceMode(), RENDER_SURFACE_STATE::AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_NONE);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2020 Intel Corporation
* Copyright (C) 2017-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -1594,67 +1594,6 @@ HWTEST_F(ImageTransformTest, givenSurfaceBaseAddressAndUnifiedSurfaceWhenSetUnif
EXPECT_EQ(surfBsaseAddress + offset, surfaceState.getAuxiliarySurfaceBaseAddress());
}
template <typename FamilyName>
class MockImageHw : public ImageHw<FamilyName> {
public:
MockImageHw(Context *context, const cl_image_format &format, const cl_image_desc &desc, ClSurfaceFormatInfo &surfaceFormatInfo, GraphicsAllocation *graphicsAllocation) : ImageHw<FamilyName>(context, {}, 0, 0, 0, nullptr, nullptr, format, desc, false, GraphicsAllocationHelper::toMultiGraphicsAllocation(graphicsAllocation), false, 0, 0, surfaceFormatInfo) {
}
void setAuxParamsForMCSCCS(typename FamilyName::RENDER_SURFACE_STATE *surfaceState, Gmm *gmm) override;
bool setAuxParamsForMCSCCSCalled = false;
};
template <typename FamilyName>
void MockImageHw<FamilyName>::setAuxParamsForMCSCCS(typename FamilyName::RENDER_SURFACE_STATE *surfaceState, Gmm *gmm) {
this->setAuxParamsForMCSCCSCalled = true;
}
using HwImageTest = ::testing::Test;
HWTEST_F(HwImageTest, givenImageHwWithUnifiedSurfaceAndMcsWhenSettingParamsForMultisampleImageThenSetParamsForCcsMcsIsCalled) {
MockContext context;
OsAgnosticMemoryManager memoryManager(*context.getDevice(0)->getExecutionEnvironment());
context.memoryManager = &memoryManager;
cl_image_desc imgDesc = {};
imgDesc.image_height = 1;
imgDesc.image_width = 4;
imgDesc.image_depth = 1;
imgDesc.image_type = CL_MEM_OBJECT_IMAGE1D;
imgDesc.num_samples = 8;
cl_image_format format = {};
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
auto memoryProperties = MemoryPropertiesHelper::createMemoryProperties(0, 0, 0, &context.getDevice(0)->getDevice());
AllocationProperties allocProperties = MemObjHelper::getAllocationPropertiesWithImageInfo(0, imgInfo, true, memoryProperties, context.getDevice(0)->getHardwareInfo(), context.getDeviceBitfieldForAllocation(0));
auto graphicsAllocation = memoryManager.allocateGraphicsMemoryInPreferredPool(allocProperties, nullptr);
ClSurfaceFormatInfo formatInfo = {};
std::unique_ptr<MockImageHw<FamilyType>> mockImage(new MockImageHw<FamilyType>(&context, format, imgDesc, formatInfo, graphicsAllocation));
McsSurfaceInfo msi = {10, 20, 3};
auto mcsAlloc = context.getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{context.getDevice(0)->getRootDeviceIndex(), MemoryConstants::pageSize});
mcsAlloc->setDefaultGmm(new Gmm(context.getDevice(0)->getGmmClientContext(), nullptr, 1, false));
auto mockMcsGmmResInfo = reinterpret_cast<::testing::NiceMock<MockGmmResourceInfo> *>(mcsAlloc->getDefaultGmm()->gmmResourceInfo.get());
mockMcsGmmResInfo->setUnifiedAuxTranslationCapable();
mockMcsGmmResInfo->setMultisampleControlSurface();
EXPECT_TRUE(mcsAlloc->getDefaultGmm()->unifiedAuxTranslationCapable());
EXPECT_TRUE(mcsAlloc->getDefaultGmm()->hasMultisampleControlSurface());
mockImage->setMcsSurfaceInfo(msi);
mockImage->setMcsAllocation(mcsAlloc);
typedef typename FamilyType::RENDER_SURFACE_STATE RENDER_SURFACE_STATE;
auto surfaceState = FamilyType::cmdInitRenderSurfaceState;
EXPECT_FALSE(mockImage->setAuxParamsForMCSCCSCalled);
mockImage->setAuxParamsForMultisamples(&surfaceState);
EXPECT_TRUE(mockImage->setAuxParamsForMCSCCSCalled);
}
using ImageMultiRootDeviceTests = MultiRootDeviceFixture;
TEST_F(ImageMultiRootDeviceTests, WhenImageIsCreatedThenImageAllocationHasCorrectRootDeviceIndex) {

View File

@ -251,6 +251,10 @@ struct EncodeSurfaceState {
size_t numberOfBindingTableStates, size_t offsetOfBindingTable);
static void appendImageCompressionParams(R_SURFACE_STATE *surfaceState, GraphicsAllocation *allocation, GmmHelper *gmmHelper, bool imageFromBuffer);
static void setAuxParamsForCCS(R_SURFACE_STATE *surfaceState, Gmm *gmm);
static void setAuxParamsForMCSCCS(R_SURFACE_STATE *surfaceState);
static void setClearColorParams(R_SURFACE_STATE *surfaceState, Gmm *gmm);
static void setFlagsForMediaCompression(R_SURFACE_STATE *surfaceState, Gmm *gmm);
};
template <typename GfxFamily>

View File

@ -20,6 +20,7 @@
#include "shared/source/helpers/register_offsets.h"
#include "shared/source/helpers/simd_helper.h"
#include "shared/source/helpers/string.h"
#include "shared/source/image/image_surface_state.h"
#include "shared/source/kernel/dispatch_kernel_encoder_interface.h"
#include "shared/source/kernel/kernel_descriptor.h"
@ -425,6 +426,17 @@ size_t EncodeSurfaceState<Family>::pushBindingTableAndSurfaceStates(IndirectHeap
template <typename Family>
void EncodeSurfaceState<Family>::encodeExtraCacheSettings(R_SURFACE_STATE *surfaceState, const HardwareInfo &hwInfo) {}
template <typename Family>
void EncodeSurfaceState<Family>::setAuxParamsForCCS(R_SURFACE_STATE *surfaceState, Gmm *gmm) {
using AUXILIARY_SURFACE_MODE = typename Family::RENDER_SURFACE_STATE::AUXILIARY_SURFACE_MODE;
// Its expected to not program pitch/qpitch/baseAddress for Aux surface in CCS scenarios
surfaceState->setAuxiliarySurfaceMode(AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_CCS_E);
setFlagsForMediaCompression(surfaceState, gmm);
setClearColorParams(surfaceState, gmm);
setUnifiedAuxBaseAddress<Family>(surfaceState, gmm);
}
template <typename Family>
void *EncodeDispatchKernel<Family>::getInterfaceDescriptor(CommandContainer &container, uint32_t &iddOffset) {

View File

@ -7,6 +7,7 @@
set(NEO_CORE_COMMAND_CONTAINER_IMAGE_SURFACE_STATE
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/compression_params_bdw_plus.inl
${CMAKE_CURRENT_SOURCE_DIR}/compression_params_tgllp_plus.inl
)
set_property(GLOBAL APPEND PROPERTY NEO_CORE_COMMAND_CONTAINER ${NEO_CORE_COMMAND_CONTAINER_IMAGE_SURFACE_STATE})

View File

@ -1,12 +1,18 @@
/*
* Copyright (C) 2020 Intel Corporation
* Copyright (C) 2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
template <>
void setClearColorParams<Family>(typename Family::RENDER_SURFACE_STATE *surfaceState, const Gmm *gmm) {
namespace NEO {
template <typename Family>
void EncodeSurfaceState<Family>::setAuxParamsForMCSCCS(R_SURFACE_STATE *surfaceState) {
surfaceState->setAuxiliarySurfaceMode(AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_MCS_LCE);
}
template <typename Family>
void EncodeSurfaceState<Family>::setClearColorParams(R_SURFACE_STATE *surfaceState, Gmm *gmm) {
if (gmm->gmmResourceInfo->getResourceFlags()->Gpu.IndirectClearColor) {
surfaceState->setClearValueAddressEnable(true);
@ -17,8 +23,8 @@ void setClearColorParams<Family>(typename Family::RENDER_SURFACE_STATE *surfaceS
}
}
template <>
void setFlagsForMediaCompression<Family>(typename Family::RENDER_SURFACE_STATE *surfaceState, Gmm *gmm) {
template <typename Family>
void EncodeSurfaceState<Family>::setFlagsForMediaCompression(R_SURFACE_STATE *surfaceState, Gmm *gmm) {
if (gmm->gmmResourceInfo->getResourceFlags()->Info.MediaCompressed) {
surfaceState->setAuxiliarySurfaceMode(Family::RENDER_SURFACE_STATE::AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_NONE);
surfaceState->setMemoryCompressionEnable(true);
@ -26,3 +32,5 @@ void setFlagsForMediaCompression<Family>(typename Family::RENDER_SURFACE_STATE *
surfaceState->setMemoryCompressionEnable(false);
}
}
} // namespace NEO

View File

@ -23,6 +23,21 @@ bool EncodeSurfaceState<Family>::doBindingTablePrefetch() {
return false;
}
template <>
void EncodeSurfaceState<Family>::setAuxParamsForMCSCCS(R_SURFACE_STATE *surfaceState) {
}
template <>
void EncodeSurfaceState<Family>::setClearColorParams(R_SURFACE_STATE *surfaceState, Gmm *gmm) {
}
template <>
void EncodeSurfaceState<Family>::setFlagsForMediaCompression(R_SURFACE_STATE *surfaceState, Gmm *gmm) {
if (gmm->gmmResourceInfo->getResourceFlags()->Info.MediaCompressed) {
surfaceState->setAuxiliarySurfaceMode(Family::RENDER_SURFACE_STATE::AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_NONE);
}
}
template struct EncodeDispatchKernel<Family>;
template struct EncodeStates<Family>;
template struct EncodeMath<Family>;

View File

@ -16,6 +16,7 @@ using Family = NEO::TGLLPFamily;
#include "shared/source/command_container/command_encoder_bdw_plus.inl"
#include "shared/source/command_container/encode_compute_mode_tgllp_plus.inl"
#include "shared/source/command_container/image_surface_state/compression_params_bdw_plus.inl"
#include "shared/source/command_container/image_surface_state/compression_params_tgllp_plus.inl"
#include "shared/source/command_stream/command_stream_receiver.h"
namespace NEO {

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -16,7 +16,6 @@ template <>
void setFilterMode<Family>(Family::RENDER_SURFACE_STATE *surfaceState, const HardwareInfo *hwInfo){};
// clang-format off
#include "shared/source/image/image_tgllp_plus.inl"
#include "shared/source/image/image_skl_plus.inl"
// clang-format on
} // namespace NEO

View File

@ -17,6 +17,21 @@ using Family = NEO::BDWFamily;
#include "shared/source/command_container/image_surface_state/compression_params_bdw_plus.inl"
namespace NEO {
template <>
void EncodeSurfaceState<Family>::setAuxParamsForMCSCCS(R_SURFACE_STATE *surfaceState) {
}
template <>
void EncodeSurfaceState<Family>::setClearColorParams(R_SURFACE_STATE *surfaceState, Gmm *gmm) {
}
template <>
void EncodeSurfaceState<Family>::setFlagsForMediaCompression(R_SURFACE_STATE *surfaceState, Gmm *gmm) {
if (gmm->gmmResourceInfo->getResourceFlags()->Info.MediaCompressed) {
surfaceState->setAuxiliarySurfaceMode(Family::RENDER_SURFACE_STATE::AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_NONE);
}
}
template struct EncodeDispatchKernel<Family>;
template struct EncodeStates<Family>;
template struct EncodeMath<Family>;

View File

@ -17,6 +17,21 @@ using Family = NEO::SKLFamily;
#include "shared/source/command_container/image_surface_state/compression_params_bdw_plus.inl"
namespace NEO {
template <>
void EncodeSurfaceState<Family>::setAuxParamsForMCSCCS(R_SURFACE_STATE *surfaceState) {
}
template <>
void EncodeSurfaceState<Family>::setClearColorParams(R_SURFACE_STATE *surfaceState, Gmm *gmm) {
}
template <>
void EncodeSurfaceState<Family>::setFlagsForMediaCompression(R_SURFACE_STATE *surfaceState, Gmm *gmm) {
if (gmm->gmmResourceInfo->getResourceFlags()->Info.MediaCompressed) {
surfaceState->setAuxiliarySurfaceMode(Family::RENDER_SURFACE_STATE::AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_NONE);
}
}
template struct EncodeDispatchKernel<Family>;
template struct EncodeStates<Family>;
template struct EncodeMath<Family>;

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2020 Intel Corporation
# Copyright (C) 2020-2021 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
@ -8,7 +8,6 @@ set(NEO_CORE_IMAGE
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/image_surface_state.h
${CMAKE_CURRENT_SOURCE_DIR}/image_bdw_plus.inl
${CMAKE_CURRENT_SOURCE_DIR}/image_tgllp_plus.inl
${CMAKE_CURRENT_SOURCE_DIR}/image_skl_plus.inl
)

View File

@ -1,21 +1,9 @@
/*
* Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
template <>
void setClearColorParams<Family>(typename Family::RENDER_SURFACE_STATE *surfaceState, const Gmm *gmm) {
}
template <>
void setFlagsForMediaCompression<Family>(typename Family::RENDER_SURFACE_STATE *surfaceState, Gmm *gmm) {
using AUXILIARY_SURFACE_MODE = typename Family::RENDER_SURFACE_STATE::AUXILIARY_SURFACE_MODE;
if (gmm->gmmResourceInfo->getResourceFlags()->Info.MediaCompressed) {
surfaceState->setAuxiliarySurfaceMode(AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_NONE);
}
}
template <>
void setFilterMode<Family>(typename Family::RENDER_SURFACE_STATE *surfaceState, const HardwareInfo *hwInfo){};
void setFilterMode<Family>(typename Family::RENDER_SURFACE_STATE *surfaceState, const HardwareInfo *hwInfo){};

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -123,23 +123,7 @@ inline void setUnifiedAuxBaseAddress(typename GfxFamily::RENDER_SURFACE_STATE *s
surfaceState->setAuxiliarySurfaceBaseAddress(baseAddress);
}
template <typename GfxFamily>
void setFlagsForMediaCompression(typename GfxFamily::RENDER_SURFACE_STATE *surfaceState, Gmm *gmm);
template <typename GfxFamily>
void setClearColorParams(typename GfxFamily::RENDER_SURFACE_STATE *surfaceState, const Gmm *gmm);
template <typename GfxFamily>
void setMipTailStartLod(typename GfxFamily::RENDER_SURFACE_STATE *surfaceState, Gmm *gmm);
template <typename GfxFamily>
inline void setAuxParamsForCCS(typename GfxFamily::RENDER_SURFACE_STATE *surfaceState, Gmm *gmm) {
using AUXILIARY_SURFACE_MODE = typename GfxFamily::RENDER_SURFACE_STATE::AUXILIARY_SURFACE_MODE;
// Its expected to not program pitch/qpitch/baseAddress for Aux surface in CCS scenarios
surfaceState->setAuxiliarySurfaceMode(AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_CCS_E);
setFlagsForMediaCompression<GfxFamily>(surfaceState, gmm);
setClearColorParams<GfxFamily>(surfaceState, gmm);
setUnifiedAuxBaseAddress<GfxFamily>(surfaceState, gmm);
}
} // namespace NEO

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2019-2020 Intel Corporation
# Copyright (C) 2019-2021 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
@ -96,6 +96,7 @@ if(NOT SKIP_UNIT_TESTS)
${CMAKE_CURRENT_SOURCE_DIR}
${ENGINE_NODE_DIR}
${NEO_SHARED_TEST_DIRECTORY}/unit_test/test_macros/header${BRANCH_DIR_SUFFIX}
${NEO_SHARED_TEST_DIRECTORY}/unit_test/helpers/includes${BRANCH_DIR_SUFFIX}
)
if(UNIX)

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2019-2020 Intel Corporation
# Copyright (C) 2019-2021 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
@ -10,6 +10,7 @@ if(TESTS_GEN11)
${CMAKE_CURRENT_SOURCE_DIR}/preamble_tests_gen11.cpp
${CMAKE_CURRENT_SOURCE_DIR}/simd_helper_tests_gen11.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_preamble_gen11.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_traits_gen11.h
)
set_property(GLOBAL PROPERTY NEO_CORE_TESTS_GEN11 ${NEO_CORE_TESTS_GEN11})
add_subdirectories()

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -18,10 +18,10 @@ GEN11TEST_F(ImageSurfaceStateTestsGen11, givenGmmWithMediaCompressedWhenSetFlags
castSurfaceState->setAuxiliarySurfaceMode(FamilyType::RENDER_SURFACE_STATE::AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_CCS_E);
mockGmm.gmmResourceInfo->getResourceFlags()->Info.MediaCompressed = false;
setFlagsForMediaCompression<FamilyType>(castSurfaceState, &mockGmm);
EncodeSurfaceState<FamilyType>::setFlagsForMediaCompression(castSurfaceState, &mockGmm);
EXPECT_EQ(castSurfaceState->getAuxiliarySurfaceMode(), FamilyType::RENDER_SURFACE_STATE::AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_CCS_E);
mockGmm.gmmResourceInfo->getResourceFlags()->Info.MediaCompressed = true;
setFlagsForMediaCompression<FamilyType>(castSurfaceState, &mockGmm);
EncodeSurfaceState<FamilyType>::setFlagsForMediaCompression(castSurfaceState, &mockGmm);
EXPECT_EQ(castSurfaceState->getAuxiliarySurfaceMode(), FamilyType::RENDER_SURFACE_STATE::AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_NONE);
}

View File

@ -0,0 +1,13 @@
/*
* Copyright (C) 2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/test/unit_test/helpers/test_traits.h"
template <>
struct TestTraits<IGFX_GEN11_CORE> {
};

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2019-2020 Intel Corporation
# Copyright (C) 2019-2021 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
@ -10,6 +10,7 @@ if(TESTS_GEN12LP)
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/simd_helper_tests_gen12lp.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_preamble_gen12lp.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_traits_gen12lp.h
)
set_property(GLOBAL PROPERTY NEO_CORE_TESTS_GEN12LP ${NEO_CORE_TESTS_GEN12LP})
add_subdirectories()

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -18,11 +18,11 @@ GEN12LPTEST_F(ImageSurfaceStateTestsGen12LP, givenGmmWithMediaCompressedWhenSetF
castSurfaceState->setAuxiliarySurfaceMode(TGLLPFamily::RENDER_SURFACE_STATE::AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_CCS_E);
mockGmm.gmmResourceInfo->getResourceFlags()->Info.MediaCompressed = false;
setFlagsForMediaCompression<TGLLPFamily>(castSurfaceState, &mockGmm);
EncodeSurfaceState<FamilyType>::setFlagsForMediaCompression(castSurfaceState, &mockGmm);
EXPECT_EQ(castSurfaceState->getAuxiliarySurfaceMode(), TGLLPFamily::RENDER_SURFACE_STATE::AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_CCS_E);
EXPECT_EQ(castSurfaceState->getMemoryCompressionEnable(), false);
mockGmm.gmmResourceInfo->getResourceFlags()->Info.MediaCompressed = true;
setFlagsForMediaCompression<TGLLPFamily>(castSurfaceState, &mockGmm);
EncodeSurfaceState<FamilyType>::setFlagsForMediaCompression(castSurfaceState, &mockGmm);
EXPECT_EQ(castSurfaceState->getAuxiliarySurfaceMode(), TGLLPFamily::RENDER_SURFACE_STATE::AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_NONE);
EXPECT_EQ(castSurfaceState->getMemoryCompressionEnable(), true);
}
@ -33,7 +33,7 @@ GEN12LPTEST_F(ImageSurfaceStateTestsGen12LP, givenGmmWhenSetClearColorParamsThen
auto castSurfaceState = reinterpret_cast<typename TGLLPFamily::RENDER_SURFACE_STATE *>(surfaceState.get());
mockGmm.gmmResourceInfo->getResourceFlags()->Gpu.IndirectClearColor = true;
setClearColorParams<TGLLPFamily>(castSurfaceState, &mockGmm);
EncodeSurfaceState<TGLLPFamily>::setClearColorParams(castSurfaceState, &mockGmm);
EXPECT_EQ(castSurfaceState->getClearValueAddressEnable(), true);
}

View File

@ -0,0 +1,13 @@
/*
* Copyright (C) 2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/test/unit_test/helpers/test_traits.h"
template <>
struct TestTraits<IGFX_GEN12LP_CORE> {
};

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2019-2020 Intel Corporation
# Copyright (C) 2019-2021 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
@ -10,6 +10,7 @@ if(TESTS_GEN8)
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/simd_helper_tests_gen8.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_preamble_gen8.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_traits_gen8.h
)
set_property(GLOBAL PROPERTY NEO_CORE_TESTS_GEN8 ${NEO_CORE_TESTS_GEN8})
add_subdirectories()

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -18,10 +18,10 @@ GEN8TEST_F(ImageSurfaceStateTestsGen8, givenGmmWithMediaCompressedWhenSetFlagsFo
castSurfaceState->setAuxiliarySurfaceMode(FamilyType::RENDER_SURFACE_STATE::AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_CCS_E);
mockGmm.gmmResourceInfo->getResourceFlags()->Info.MediaCompressed = false;
setFlagsForMediaCompression<FamilyType>(castSurfaceState, &mockGmm);
EncodeSurfaceState<FamilyType>::setFlagsForMediaCompression(castSurfaceState, &mockGmm);
EXPECT_EQ(castSurfaceState->getAuxiliarySurfaceMode(), FamilyType::RENDER_SURFACE_STATE::AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_CCS_E);
mockGmm.gmmResourceInfo->getResourceFlags()->Info.MediaCompressed = true;
setFlagsForMediaCompression<FamilyType>(castSurfaceState, &mockGmm);
EncodeSurfaceState<FamilyType>::setFlagsForMediaCompression(castSurfaceState, &mockGmm);
EXPECT_EQ(castSurfaceState->getAuxiliarySurfaceMode(), FamilyType::RENDER_SURFACE_STATE::AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_NONE);
}

View File

@ -0,0 +1,13 @@
/*
* Copyright (C) 2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/test/unit_test/helpers/test_traits.h"
template <>
struct TestTraits<IGFX_GEN8_CORE> {
};

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2019-2020 Intel Corporation
# Copyright (C) 2019-2021 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
@ -10,6 +10,7 @@ if(TESTS_GEN9)
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/preamble_tests_gen9.cpp
${CMAKE_CURRENT_SOURCE_DIR}/simd_helper_tests_gen9.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_traits_gen9.h
)
set_property(GLOBAL PROPERTY NEO_CORE_TESTS_GEN9 ${NEO_CORE_TESTS_GEN9})
add_subdirectories()

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -18,10 +18,10 @@ GEN9TEST_F(ImageSurfaceStateTestsGen9, givenGmmWithMediaCompressedWhenSetFlagsFo
castSurfaceState->setAuxiliarySurfaceMode(FamilyType::RENDER_SURFACE_STATE::AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_CCS_E);
mockGmm.gmmResourceInfo->getResourceFlags()->Info.MediaCompressed = false;
setFlagsForMediaCompression<FamilyType>(castSurfaceState, &mockGmm);
EncodeSurfaceState<FamilyType>::setFlagsForMediaCompression(castSurfaceState, &mockGmm);
EXPECT_EQ(castSurfaceState->getAuxiliarySurfaceMode(), FamilyType::RENDER_SURFACE_STATE::AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_CCS_E);
mockGmm.gmmResourceInfo->getResourceFlags()->Info.MediaCompressed = true;
setFlagsForMediaCompression<FamilyType>(castSurfaceState, &mockGmm);
EncodeSurfaceState<FamilyType>::setFlagsForMediaCompression(castSurfaceState, &mockGmm);
EXPECT_EQ(castSurfaceState->getAuxiliarySurfaceMode(), FamilyType::RENDER_SURFACE_STATE::AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_NONE);
}

View File

@ -0,0 +1,13 @@
/*
* Copyright (C) 2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/test/unit_test/helpers/test_traits.h"
template <>
struct TestTraits<IGFX_GEN9_CORE> {
};

View File

@ -25,6 +25,8 @@ set(NEO_CORE_HELPERS_TESTS
${CMAKE_CURRENT_SOURCE_DIR}/simd_helper_tests.inl
${CMAKE_CURRENT_SOURCE_DIR}/string_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/string_to_hash_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_traits.h
${CMAKE_CURRENT_SOURCE_DIR}/includes${BRANCH_DIR_SUFFIX}/test_traits_common.h
${CMAKE_CURRENT_SOURCE_DIR}/ult_hw_config.h
${CMAKE_CURRENT_SOURCE_DIR}/ult_hw_config.inl
${CMAKE_CURRENT_SOURCE_DIR}/ult_hw_helper.h

View File

@ -0,0 +1,12 @@
/*
* Copyright (C) 2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/test/unit_test/gen11/test_traits_gen11.h"
#include "shared/test/unit_test/gen12lp/test_traits_gen12lp.h"
#include "shared/test/unit_test/gen8/test_traits_gen8.h"
#include "shared/test/unit_test/gen9/test_traits_gen9.h"

View File

@ -0,0 +1,13 @@
/*
* Copyright (C) 2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "igfxfmid.h"
template <GFXCORE_FAMILY gfxCoreFamily>
struct TestTraits;

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -101,7 +101,7 @@ HWTEST_F(ImageSurfaceStateTests, givenGmmWhenSetAuxParamsForCCSThenAuxiliarySurf
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());
setAuxParamsForCCS<FamilyType>(castSurfaceState, &mockGmm);
EncodeSurfaceState<FamilyType>::setAuxParamsForCCS(castSurfaceState, &mockGmm);
EXPECT_EQ(castSurfaceState->getAuxiliarySurfaceMode(), FamilyType::RENDER_SURFACE_STATE::AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_CCS_E);
}