mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Optimize appendWriteGlobalTimestamp
Change-Id: Ia63a6324c3ce3dbdc18b790b3d9c2fbe4340e88c Signed-off-by: Maciej Dziuban <maciej.dziuban@intel.com> Resolves: NEO-5061
This commit is contained in:

committed by
sys_ocldev

parent
1e41db90e1
commit
abacd69def
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
Reference in New Issue
Block a user