refactor: reorganize command encode classes 2/n

- add new inl files for selected platform families
- split image compression methods into correct inl files
- remove dedicated compression inl files

Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
Zbigniew Zdanowicz
2024-11-07 15:59:03 +00:00
committed by Compute-Runtime-Automation
parent 34e22f0eee
commit eb435acb22
11 changed files with 78 additions and 103 deletions

View File

@@ -35,6 +35,12 @@ if(SUPPORT_XEHP_AND_LATER)
)
endif()
if(SUPPORT_XE_HPG OR SUPPORT_XE_HPC)
list(APPEND NEO_CORE_COMMAND_CONTAINER
${CMAKE_CURRENT_SOURCE_DIR}/command_encoder_xe_hpg_core_and_xe_hpc.inl
)
endif()
if(SUPPORT_DG2_AND_LATER)
list(APPEND NEO_CORE_COMMAND_CONTAINER
${CMAKE_CURRENT_SOURCE_DIR}/command_encoder_xe_hpg_core_and_later.inl

View File

@@ -5,6 +5,9 @@
*
*/
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/release_helper/release_helper.h"
namespace NEO {
template <typename Family>
size_t EncodeDispatchKernel<Family>::getDefaultIOHAlignment() {
@@ -27,4 +30,36 @@ void EncodeSurfaceState<Family>::disableCompressionFlags(R_SURFACE_STATE *surfac
surfaceState->setMemoryCompressionEnable(false);
}
template <typename Family>
void EncodeSurfaceState<Family>::setAuxParamsForMCSCCS(R_SURFACE_STATE *surfaceState, const ReleaseHelper *releaseHelper) {
if (releaseHelper && releaseHelper->isAuxSurfaceModeOverrideRequired())
surfaceState->setAuxiliarySurfaceMode(AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_CCS_E);
else
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);
auto gmmHelper = gmm->getGmmHelper();
uint64_t clearColorAddress = gmmHelper->decanonize(surfaceState->getSurfaceBaseAddress() +
gmm->gmmResourceInfo->getUnifiedAuxSurfaceOffset(GMM_UNIFIED_AUX_TYPE::GMM_AUX_CC));
surfaceState->setClearColorAddress(static_cast<uint32_t>(clearColorAddress & 0xFFFFFFFFULL));
surfaceState->setClearColorAddressHigh(static_cast<uint32_t>(clearColorAddress >> 32));
}
}
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);
} else {
surfaceState->setMemoryCompressionEnable(false);
}
}
} // namespace NEO

View File

@@ -5,6 +5,9 @@
*
*/
#include "shared/source/gmm_helper/client_context/gmm_client_context.h"
#include "shared/source/gmm_helper/gmm_helper.h"
namespace NEO {
template <typename Family>
size_t EncodeDispatchKernel<Family>::getDefaultIOHAlignment() {
@@ -40,4 +43,28 @@ template <typename Family>
void EncodeSurfaceState<Family>::disableCompressionFlags(R_SURFACE_STATE *surfaceState) {
}
template <typename Family>
void EncodeSurfaceState<Family>::appendImageCompressionParams(R_SURFACE_STATE *surfaceState, GraphicsAllocation *allocation,
GmmHelper *gmmHelper, bool imageFromBuffer, GMM_YUV_PLANE_ENUM plane) {
if (!allocation->isCompressionEnabled()) {
return;
}
using COMPRESSION_FORMAT = typename R_SURFACE_STATE::COMPRESSION_FORMAT;
auto gmmResourceInfo = allocation->getDefaultGmm()->gmmResourceInfo.get();
auto compressionFormat = gmmHelper->getClientContext()->getSurfaceStateCompressionFormat(gmmResourceInfo->getResourceFormat());
surfaceState->setCompressionFormat(static_cast<COMPRESSION_FORMAT>(compressionFormat));
}
template <typename Family>
void EncodeSurfaceState<Family>::setClearColorParams(R_SURFACE_STATE *surfaceState, Gmm *gmm) {
}
template <typename Family>
inline void EncodeSurfaceState<Family>::setFlagsForMediaCompression(R_SURFACE_STATE *surfaceState, Gmm *gmm) {
}
} // namespace NEO

View File

@@ -1,10 +1,12 @@
/*
* Copyright (C) 2021-2023 Intel Corporation
* Copyright (C) 2021-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/gmm_helper/client_context/gmm_client_context.h"
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/gmm_helper/resource_info.h"
namespace NEO {

View File

@@ -1,16 +0,0 @@
#
# Copyright (C) 2021 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
set(NEO_CORE_COMMAND_CONTAINER_IMAGE_SURFACE_STATE
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/compression_params_bdw_and_later.inl
${CMAKE_CURRENT_SOURCE_DIR}/compression_params_tgllp_and_later.inl
${CMAKE_CURRENT_SOURCE_DIR}/compression_params_xehp_and_later.inl
)
set_property(GLOBAL APPEND PROPERTY NEO_CORE_COMMAND_CONTAINER ${NEO_CORE_COMMAND_CONTAINER_IMAGE_SURFACE_STATE})
add_subdirectories()

View File

@@ -1,14 +0,0 @@
/*
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
namespace NEO {
template <typename Family>
void EncodeSurfaceState<Family>::appendImageCompressionParams(R_SURFACE_STATE *surfaceState, GraphicsAllocation *allocation,
GmmHelper *gmmHelper, bool imageFromBuffer, GMM_YUV_PLANE_ENUM plane) {
}
} // namespace NEO

View File

@@ -1,41 +0,0 @@
/*
* Copyright (C) 2021-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
namespace NEO {
template <typename Family>
void EncodeSurfaceState<Family>::setAuxParamsForMCSCCS(R_SURFACE_STATE *surfaceState, const ReleaseHelper *releaseHelper) {
if (releaseHelper && releaseHelper->isAuxSurfaceModeOverrideRequired())
surfaceState->setAuxiliarySurfaceMode(AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_CCS_E);
else
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);
auto gmmHelper = gmm->getGmmHelper();
uint64_t clearColorAddress = gmmHelper->decanonize(surfaceState->getSurfaceBaseAddress() +
gmm->gmmResourceInfo->getUnifiedAuxSurfaceOffset(GMM_UNIFIED_AUX_TYPE::GMM_AUX_CC));
surfaceState->setClearColorAddress(static_cast<uint32_t>(clearColorAddress & 0xFFFFFFFFULL));
surfaceState->setClearColorAddressHigh(static_cast<uint32_t>(clearColorAddress >> 32));
}
}
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);
} else {
surfaceState->setMemoryCompressionEnable(false);
}
}
} // namespace NEO