Optimize appendWriteGlobalTimestamp

Change-Id: Ia63a6324c3ce3dbdc18b790b3d9c2fbe4340e88c
Signed-off-by: Maciej Dziuban <maciej.dziuban@intel.com>
Resolves: NEO-5061
This commit is contained in:
Maciej Dziuban
2020-09-07 16:30:58 +02:00
committed by sys_ocldev
parent 1e41db90e1
commit abacd69def
5 changed files with 35 additions and 23 deletions

View File

@ -1445,12 +1445,11 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendWriteGlobalTimestamp(
NEO::PipeControlArgs args(false);
NEO::MemorySynchronizationCommands<GfxFamily>::addPipeControlAndProgramPostSyncOperation(
NEO::MemorySynchronizationCommands<GfxFamily>::addPipeControlWithPostSync(
*commandContainer.getCommandStream(),
POST_SYNC_OPERATION::POST_SYNC_OPERATION_WRITE_TIMESTAMP,
reinterpret_cast<uint64_t>(dstptr),
0,
commandContainer.getDevice()->getHardwareInfo(),
args);
if (hSignalEvent) {

View File

@ -174,26 +174,22 @@ HWTEST2_F(CommandListCreate, givenCommandListWhenAppendWriteGlobalTimestampCalle
uint32_t timestampAddressHigh = (uint32_t)(timestampAddress >> 32);
uint64_t *dstptr = reinterpret_cast<uint64_t *>(timestampAddress);
const auto commandStreamOffset = commandContainer.getCommandStream()->getUsed();
commandList->appendWriteGlobalTimestamp(dstptr, nullptr, 0, nullptr);
GenCmdList cmdList;
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
cmdList, ptrOffset(commandContainer.getCommandStream()->getCpuBase(), 0), commandContainer.getCommandStream()->getUsed()));
cmdList,
ptrOffset(commandContainer.getCommandStream()->getCpuBase(), commandStreamOffset),
commandContainer.getCommandStream()->getUsed() - commandStreamOffset));
auto itorPC = findAll<PIPE_CONTROL *>(cmdList.begin(), cmdList.end());
EXPECT_NE(0u, itorPC.size());
bool postSyncFound = false;
for (auto it : itorPC) {
auto cmd = genCmdCast<PIPE_CONTROL *>(*it);
if (cmd->getPostSyncOperation() == POST_SYNC_OPERATION::POST_SYNC_OPERATION_WRITE_TIMESTAMP) {
EXPECT_TRUE(cmd->getCommandStreamerStallEnable());
EXPECT_FALSE(cmd->getDcFlushEnable());
EXPECT_EQ(cmd->getAddressHigh(), timestampAddressHigh);
EXPECT_EQ(cmd->getAddress(), timestampAddressLow);
postSyncFound = true;
}
}
EXPECT_TRUE(postSyncFound);
auto iterator = find<PIPE_CONTROL *>(cmdList.begin(), cmdList.end());
auto cmd = genCmdCast<PIPE_CONTROL *>(*iterator);
EXPECT_TRUE(cmd->getCommandStreamerStallEnable());
EXPECT_FALSE(cmd->getDcFlushEnable());
EXPECT_EQ(cmd->getAddressHigh(), timestampAddressHigh);
EXPECT_EQ(cmd->getAddress(), timestampAddressLow);
EXPECT_EQ(POST_SYNC_OPERATION::POST_SYNC_OPERATION_WRITE_TIMESTAMP, cmd->getPostSyncOperation());
}
HWTEST2_F(CommandListCreate, givenImmediateCommandListWhenAppendWriteGlobalTimestampReturnsSuccess, Platforms) {

View File

@ -357,7 +357,12 @@ struct MemorySynchronizationCommands {
uint64_t immediateData,
const HardwareInfo &hwInfo,
PipeControlArgs &args);
static void setPostSyncExtraProperties(PIPE_CONTROL &pipeControl, const HardwareInfo &hwInfo);
static void addPipeControlWithPostSync(LinearStream &commandStream,
POST_SYNC_OPERATION operation,
uint64_t gpuAddress,
uint64_t immediateData,
PipeControlArgs &args);
static void setPostSyncExtraProperties(PipeControlArgs &args, const HardwareInfo &hwInfo);
static void addPipeControlWA(LinearStream &commandStream, uint64_t gpuAddress, const HardwareInfo &hwInfo);
static void addAdditionalSynchronization(LinearStream &commandStream, uint64_t gpuAddress, const HardwareInfo &hwInfo);

View File

@ -211,7 +211,21 @@ void MemorySynchronizationCommands<GfxFamily>::addPipeControlAndProgramPostSyncO
using PIPE_CONTROL = typename GfxFamily::PIPE_CONTROL;
addPipeControlWA(commandStream, gpuAddress, hwInfo);
PIPE_CONTROL *pipeControl = commandStream.getSpaceForCmd<PIPE_CONTROL>();
setPostSyncExtraProperties(args, hwInfo);
addPipeControlWithPostSync(commandStream, operation, gpuAddress, immediateData, args);
MemorySynchronizationCommands<GfxFamily>::addAdditionalSynchronization(commandStream, gpuAddress, hwInfo);
}
template <typename GfxFamily>
void MemorySynchronizationCommands<GfxFamily>::addPipeControlWithPostSync(
LinearStream &commandStream,
POST_SYNC_OPERATION operation,
uint64_t gpuAddress,
uint64_t immediateData,
PipeControlArgs &args) {
using PIPE_CONTROL = typename GfxFamily::PIPE_CONTROL;
PIPE_CONTROL cmd = GfxFamily::cmdInitPipeControl;
setPipeControl(cmd, args);
cmd.setPostSyncOperation(operation);
@ -221,10 +235,8 @@ void MemorySynchronizationCommands<GfxFamily>::addPipeControlAndProgramPostSyncO
cmd.setImmediateData(immediateData);
}
setPostSyncExtraProperties(cmd, hwInfo);
PIPE_CONTROL *pipeControl = commandStream.getSpaceForCmd<PIPE_CONTROL>();
*pipeControl = cmd;
MemorySynchronizationCommands<GfxFamily>::addAdditionalSynchronization(commandStream, gpuAddress, hwInfo);
}
template <typename GfxFamily>

View File

@ -97,7 +97,7 @@ inline void MemorySynchronizationCommands<GfxFamily>::addPipeControlWA(LinearStr
}
template <typename GfxFamily>
inline void MemorySynchronizationCommands<GfxFamily>::setPostSyncExtraProperties(PIPE_CONTROL &pipeControl, const HardwareInfo &hwInfo) {
inline void MemorySynchronizationCommands<GfxFamily>::setPostSyncExtraProperties(PipeControlArgs &args, const HardwareInfo &hwInfo) {
}
template <typename GfxFamily>