mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 09:09:04 +08:00
refactor: move isPostImageWriteFlushRequired to release helper
Related-To: NEO-14935 Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
027e5597a3
commit
299c8689da
@@ -430,6 +430,7 @@ struct CommandListCoreFamily : public CommandListImp {
|
||||
bool copyOperationFenceSupported = false;
|
||||
bool implicitSynchronizedDispatchForCooperativeKernelsAllowed = false;
|
||||
bool useAdditionalBlitProperties = false;
|
||||
bool isPostImageWriteFlushRequired = false;
|
||||
};
|
||||
|
||||
template <PRODUCT_FAMILY gfxProductFamily>
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "shared/source/os_interface/os_context.h"
|
||||
#include "shared/source/page_fault_manager/cpu_page_fault_manager.h"
|
||||
#include "shared/source/program/sync_buffer_handler.h"
|
||||
#include "shared/source/release_helper/release_helper.h"
|
||||
#include "shared/source/utilities/software_tags_manager.h"
|
||||
|
||||
#include "level_zero/core/source/builtin/builtin_functions_lib.h"
|
||||
@@ -233,6 +234,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::initialize(Device *device, NEO
|
||||
auto &rootDeviceEnvironment = neoDevice->getRootDeviceEnvironment();
|
||||
auto &productHelper = rootDeviceEnvironment.getHelper<NEO::ProductHelper>();
|
||||
auto &gfxCoreHelper = neoDevice->getGfxCoreHelper();
|
||||
auto releaseHelper = neoDevice->getReleaseHelper();
|
||||
auto &l0GfxCoreHelper = device->getL0GfxCoreHelper();
|
||||
auto &compilerProductHelper = neoDevice->getCompilerProductHelper();
|
||||
auto gmmHelper = rootDeviceEnvironment.getGmmHelper();
|
||||
@@ -268,6 +270,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::initialize(Device *device, NEO
|
||||
this->l3FlushAfterPostSyncRequired = productHelper.isL3FlushAfterPostSyncRequired(heaplessModeEnabled);
|
||||
this->compactL3FlushEventPacket = L0GfxCoreHelper::useCompactL3FlushEventPacket(hwInfo, this->l3FlushAfterPostSyncRequired);
|
||||
this->useAdditionalBlitProperties = productHelper.useAdditionalBlitProperties();
|
||||
this->isPostImageWriteFlushRequired = releaseHelper ? releaseHelper->isPostImageWriteFlushRequired() : false;
|
||||
|
||||
if (NEO::debugManager.flags.OverrideThreadArbitrationPolicy.get() != -1) {
|
||||
this->defaultPipelinedThreadArbitrationPolicy = NEO::debugManager.flags.OverrideThreadArbitrationPolicy.get();
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "shared/source/memory_manager/residency_container.h"
|
||||
#include "shared/source/memory_manager/unified_memory_manager.h"
|
||||
#include "shared/source/program/kernel_info.h"
|
||||
#include "shared/source/release_helper/release_helper.h"
|
||||
#include "shared/source/unified_memory/unified_memory.h"
|
||||
#include "shared/source/utilities/software_tags_manager.h"
|
||||
|
||||
@@ -454,7 +455,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelWithParams(K
|
||||
}
|
||||
|
||||
bool textureFlushRequired = false;
|
||||
if (this->device->getProductHelper().isPostImageWriteFlushRequired() &&
|
||||
if (this->isPostImageWriteFlushRequired &&
|
||||
kernelInfo->kernelDescriptor.kernelAttributes.hasImageWriteArg) {
|
||||
if (this->isImmediateType()) {
|
||||
textureFlushRequired = true;
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "shared/test/common/libult/ult_command_stream_receiver.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_graphics_allocation.h"
|
||||
#include "shared/test/common/mocks/mock_release_helper.h"
|
||||
#include "shared/test/common/test_macros/hw_test.h"
|
||||
#include "shared/test/unit_test/fixtures/command_container_fixture.h"
|
||||
|
||||
@@ -1321,12 +1322,11 @@ HWTEST_F(CommandListAppendLaunchKernel, givenImmediateCommandListWhenAppendLaunc
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
|
||||
}
|
||||
|
||||
HWTEST_F(CommandListAppendLaunchKernel, GivenImmCmdListAndKernelWithImageWriteArgAndPlatformRequiresFlushWhenLaunchingKernelThenPipeControlWithTextureCacheInvalidationIsAdded) {
|
||||
if (!device->getProductHelper().isPostImageWriteFlushRequired()) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListAppendLaunchKernel, GivenImmCmdListAndKernelWithImageWriteArgAndPlatformRequiresFlushWhenLaunchingKernelThenPipeControlWithTextureCacheInvalidationIsAdded, IsAtLeastXeHpCore) {
|
||||
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
|
||||
auto releaseHelper = std::make_unique<MockReleaseHelper>();
|
||||
releaseHelper->isPostImageWriteFlushRequiredResult = true;
|
||||
device->getNEODevice()->getRootDeviceEnvironmentRef().releaseHelper = std::move(releaseHelper);
|
||||
|
||||
auto kernel = std::make_unique<Mock<KernelImp>>();
|
||||
kernel->module = module.get();
|
||||
@@ -1365,13 +1365,17 @@ HWTEST_F(CommandListAppendLaunchKernel, GivenImmCmdListAndKernelWithImageWriteAr
|
||||
EXPECT_TRUE(cmd->getTextureCacheInvalidationEnable());
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListAppendLaunchKernel, GivenRegularCommandListAndOutOfOrderExecutionWhenKernelWithImageWriteIsAppendedThenBarrierContainsTextureCacheFlush, IsXeHpgCore) {
|
||||
HWTEST2_F(CommandListAppendLaunchKernel, GivenRegularCommandListAndOutOfOrderExecutionWhenKernelWithImageWriteIsAppendedThenBarrierContainsTextureCacheFlush, IsAtLeastXeHpCore) {
|
||||
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
|
||||
|
||||
auto kernel = std::make_unique<Mock<KernelImp>>();
|
||||
kernel->module = module.get();
|
||||
kernel->immutableData.kernelInfo->kernelDescriptor.kernelAttributes.hasImageWriteArg = true;
|
||||
|
||||
auto releaseHelper = std::make_unique<MockReleaseHelper>();
|
||||
releaseHelper->isPostImageWriteFlushRequiredResult = true;
|
||||
device->getNEODevice()->getRootDeviceEnvironmentRef().releaseHelper = std::move(releaseHelper);
|
||||
|
||||
ze_group_count_t groupCount{1, 1, 1};
|
||||
ze_result_t returnValue;
|
||||
ze_command_list_flags_t flags = ZE_COMMAND_LIST_FLAG_RELAXED_ORDERING;
|
||||
@@ -1406,13 +1410,16 @@ HWTEST2_F(CommandListAppendLaunchKernel, GivenRegularCommandListAndOutOfOrderExe
|
||||
EXPECT_TRUE(cmd->getTextureCacheInvalidationEnable());
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListAppendLaunchKernel, GivenKernelWithImageWriteArgWhenAppendingTwiceThenPipeControlWithTextureCacheInvalidationIsProgrammedBetweenWalkers, IsXeHpgCore) {
|
||||
HWTEST2_F(CommandListAppendLaunchKernel, GivenKernelWithImageWriteArgWhenAppendingTwiceThenPipeControlWithTextureCacheInvalidationIsProgrammedBetweenWalkers, IsAtLeastXeHpCore) {
|
||||
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
|
||||
using COMPUTE_WALKER = typename FamilyType::COMPUTE_WALKER;
|
||||
using COMPUTE_WALKER = typename FamilyType::DefaultWalkerType;
|
||||
|
||||
StackVec<ze_command_list_flags_t, 2> testedCmdListFlags = {ZE_COMMAND_LIST_FLAG_IN_ORDER,
|
||||
ZE_COMMAND_LIST_FLAG_RELAXED_ORDERING};
|
||||
|
||||
auto releaseHelper = std::make_unique<MockReleaseHelper>();
|
||||
releaseHelper->isPostImageWriteFlushRequiredResult = true;
|
||||
device->getNEODevice()->getRootDeviceEnvironmentRef().releaseHelper = std::move(releaseHelper);
|
||||
for (auto cmdListFlags : testedCmdListFlags) {
|
||||
auto kernel = std::make_unique<Mock<KernelImp>>();
|
||||
kernel->module = module.get();
|
||||
@@ -1471,6 +1478,9 @@ HWTEST2_F(CommandListAppendLaunchKernel, whenResettingRegularCommandListThenText
|
||||
kernel->module = module.get();
|
||||
kernel->immutableData.kernelInfo->kernelDescriptor.kernelAttributes.hasImageWriteArg = true;
|
||||
|
||||
auto releaseHelper = std::make_unique<MockReleaseHelper>();
|
||||
releaseHelper->isPostImageWriteFlushRequiredResult = true;
|
||||
device->getNEODevice()->getRootDeviceEnvironmentRef().releaseHelper = std::move(releaseHelper);
|
||||
ze_group_count_t groupCount{1, 1, 1};
|
||||
ze_result_t returnValue;
|
||||
ze_command_list_flags_t flags = ZE_COMMAND_LIST_FLAG_RELAXED_ORDERING;
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "shared/source/helpers/register_offsets.h"
|
||||
#include "shared/source/indirect_heap/indirect_heap.h"
|
||||
#include "shared/source/memory_manager/internal_allocation_storage.h"
|
||||
#include "shared/source/release_helper/release_helper.h"
|
||||
#include "shared/test/common/helpers/relaxed_ordering_commands_helper.h"
|
||||
#include "shared/test/common/helpers/unit_test_helper.h"
|
||||
#include "shared/test/common/libult/ult_command_stream_receiver.h"
|
||||
@@ -2671,7 +2672,8 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, InOrderCmdListTests, givenInOrderModeWhenProgrammin
|
||||
EXPECT_EQ(immCmdList->inOrderExecInfo->getBaseDeviceAddress() + counterOffset, address);
|
||||
EXPECT_EQ(2u, pcCmd->getImmediateData());
|
||||
|
||||
const bool textureFlushRequired = device->getProductHelper().isPostImageWriteFlushRequired() &&
|
||||
auto releaseHelper = device->getNEODevice()->getReleaseHelper();
|
||||
const bool textureFlushRequired = releaseHelper && releaseHelper->isPostImageWriteFlushRequired() &&
|
||||
kernel->kernelImmData->getKernelInfo()->kernelDescriptor.kernelAttributes.hasImageWriteArg;
|
||||
EXPECT_EQ(textureFlushRequired, pcCmd->getTextureCacheInvalidationEnable());
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user