diff --git a/shared/source/helpers/gfx_core_helper_base.inl b/shared/source/helpers/gfx_core_helper_base.inl index f99acd2cd7..b8f0f316d0 100644 --- a/shared/source/helpers/gfx_core_helper_base.inl +++ b/shared/source/helpers/gfx_core_helper_base.inl @@ -293,6 +293,7 @@ void MemorySynchronizationCommands::setSingleBarrier(void *commandsBu } if (postSyncMode != PostSyncMode::noWrite) { + args.postSyncCmd = commandsBuffer; pipeControl.setAddress(static_cast(gpuAddress & 0x0000FFFFFFFFULL)); pipeControl.setAddressHigh(static_cast(gpuAddress >> 32)); } diff --git a/shared/source/helpers/pipe_control_args.h b/shared/source/helpers/pipe_control_args.h index 9477249122..95a5f9a298 100644 --- a/shared/source/helpers/pipe_control_args.h +++ b/shared/source/helpers/pipe_control_args.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2023 Intel Corporation + * Copyright (C) 2020-2024 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -11,6 +11,7 @@ namespace NEO { struct PipeControlArgs { PipeControlArgs() = default; + void *postSyncCmd = nullptr; bool blockSettingPostSyncProperties = false; bool csStallOnly = false; diff --git a/shared/test/unit_test/helpers/gfx_core_helper_tests.cpp b/shared/test/unit_test/helpers/gfx_core_helper_tests.cpp index 1e83bcbbb3..96758f7dff 100644 --- a/shared/test/unit_test/helpers/gfx_core_helper_tests.cpp +++ b/shared/test/unit_test/helpers/gfx_core_helper_tests.cpp @@ -260,9 +260,12 @@ HWTEST_F(PipeControlHelperTests, givenPostSyncWriteTimestampModeWhenHelperIsUsed stream, PostSyncMode::timestamp, address, immediateData, rootDeviceEnvironment, args); auto additionalPcSize = MemorySynchronizationCommands::getSizeForBarrierWithPostSyncOperation(rootDeviceEnvironment, false) - sizeof(PIPE_CONTROL); auto pipeControlLocationSize = additionalPcSize - MemorySynchronizationCommands::getSizeForSingleAdditionalSynchronization(rootDeviceEnvironment); - auto pipeControl = genCmdCast(ptrOffset(stream.getCpuBase(), pipeControlLocationSize)); + void *cpuPipeControlBuffer = ptrOffset(stream.getCpuBase(), pipeControlLocationSize); + auto pipeControl = genCmdCast(cpuPipeControlBuffer); ASSERT_NE(nullptr, pipeControl); + EXPECT_EQ(cpuPipeControlBuffer, args.postSyncCmd); + EXPECT_EQ(sizeof(PIPE_CONTROL) + additionalPcSize, stream.getUsed()); EXPECT_EQ(pipeControl->getCommandStreamerStallEnable(), expectedPipeControl.getCommandStreamerStallEnable()); EXPECT_EQ(pipeControl->getPostSyncOperation(), expectedPipeControl.getPostSyncOperation()); @@ -317,9 +320,12 @@ HWTEST_F(PipeControlHelperTests, givenPostSyncWriteImmediateDataModeWhenHelperIs stream, PostSyncMode::immediateData, address, immediateData, rootDeviceEnvironment, args); auto additionalPcSize = MemorySynchronizationCommands::getSizeForBarrierWithPostSyncOperation(rootDeviceEnvironment, false) - sizeof(PIPE_CONTROL); auto pipeControlLocationSize = additionalPcSize - MemorySynchronizationCommands::getSizeForSingleAdditionalSynchronization(rootDeviceEnvironment); - auto pipeControl = genCmdCast(ptrOffset(stream.getCpuBase(), pipeControlLocationSize)); + void *cpuPipeControlBuffer = ptrOffset(stream.getCpuBase(), pipeControlLocationSize); + auto pipeControl = genCmdCast(cpuPipeControlBuffer); ASSERT_NE(nullptr, pipeControl); + EXPECT_EQ(cpuPipeControlBuffer, args.postSyncCmd); + EXPECT_EQ(sizeof(PIPE_CONTROL) + additionalPcSize, stream.getUsed()); EXPECT_EQ(pipeControl->getCommandStreamerStallEnable(), expectedPipeControl.getCommandStreamerStallEnable()); EXPECT_EQ(pipeControl->getPostSyncOperation(), expectedPipeControl.getPostSyncOperation());