From 0ecb1b804fc9530cd393813a4491e66b23db27ab Mon Sep 17 00:00:00 2001 From: Kamil Diedrich Date: Fri, 4 Dec 2020 12:53:01 +0100 Subject: [PATCH] combine timestamps implementation Signed-off-by: Kamil Diedrich --- .../command_queue/gpgpu_walker_bdw_plus.inl | 53 +++++++++++-------- .../source/gen12lp/gpgpu_walker_gen12lp.cpp | 34 ------------ 2 files changed, 31 insertions(+), 56 deletions(-) diff --git a/opencl/source/command_queue/gpgpu_walker_bdw_plus.inl b/opencl/source/command_queue/gpgpu_walker_bdw_plus.inl index ddeafd683b..bcc8964b30 100644 --- a/opencl/source/command_queue/gpgpu_walker_bdw_plus.inl +++ b/opencl/source/command_queue/gpgpu_walker_bdw_plus.inl @@ -243,16 +243,18 @@ void GpgpuWalkerHelper::dispatchProfilingCommandsStart( hwInfo, args); - //MI_STORE_REGISTER_MEM for context local timestamp - timeStampAddress = hwTimeStamps.getGpuAddress() + offsetof(HwTimeStamps, ContextStartTS); + if (!HwHelper::get(hwInfo.platform.eRenderCoreFamily).useOnlyGlobalTimestamps()) { + //MI_STORE_REGISTER_MEM for context local timestamp + timeStampAddress = hwTimeStamps.getGpuAddress() + offsetof(HwTimeStamps, ContextStartTS); - //low part - auto pMICmdLow = commandStream->getSpaceForCmd(); - MI_STORE_REGISTER_MEM cmd = GfxFamily::cmdInitStoreRegisterMem; - adjustMiStoreRegMemMode(&cmd); - cmd.setRegisterAddress(GP_THREAD_TIME_REG_ADDRESS_OFFSET_LOW); - cmd.setMemoryAddress(timeStampAddress); - *pMICmdLow = cmd; + //low part + auto pMICmdLow = commandStream->getSpaceForCmd(); + MI_STORE_REGISTER_MEM cmd = GfxFamily::cmdInitStoreRegisterMem; + adjustMiStoreRegMemMode(&cmd); + cmd.setRegisterAddress(GP_THREAD_TIME_REG_ADDRESS_OFFSET_LOW); + cmd.setMemoryAddress(timeStampAddress); + *pMICmdLow = cmd; + } } template @@ -263,21 +265,28 @@ void GpgpuWalkerHelper::dispatchProfilingCommandsEnd( using MI_STORE_REGISTER_MEM = typename GfxFamily::MI_STORE_REGISTER_MEM; // PIPE_CONTROL for global timestamp - auto pPipeControlCmd = commandStream->getSpaceForCmd(); - PIPE_CONTROL cmdPipeControl = GfxFamily::cmdInitPipeControl; - cmdPipeControl.setCommandStreamerStallEnable(true); - *pPipeControlCmd = cmdPipeControl; + uint64_t timeStampAddress = hwTimeStamps.getGpuAddress() + offsetof(HwTimeStamps, GlobalEndTS); + PipeControlArgs args; + MemorySynchronizationCommands::addPipeControlAndProgramPostSyncOperation( + *commandStream, + PIPE_CONTROL::POST_SYNC_OPERATION_WRITE_TIMESTAMP, + timeStampAddress, + 0llu, + hwInfo, + args); - //MI_STORE_REGISTER_MEM for context local timestamp - uint64_t timeStampAddress = hwTimeStamps.getGpuAddress() + offsetof(HwTimeStamps, ContextEndTS); + if (!HwHelper::get(hwInfo.platform.eRenderCoreFamily).useOnlyGlobalTimestamps()) { + //MI_STORE_REGISTER_MEM for context local timestamp + uint64_t timeStampAddress = hwTimeStamps.getGpuAddress() + offsetof(HwTimeStamps, ContextEndTS); - //low part - auto pMICmdLow = commandStream->getSpaceForCmd(); - MI_STORE_REGISTER_MEM cmd = GfxFamily::cmdInitStoreRegisterMem; - adjustMiStoreRegMemMode(&cmd); - cmd.setRegisterAddress(GP_THREAD_TIME_REG_ADDRESS_OFFSET_LOW); - cmd.setMemoryAddress(timeStampAddress); - *pMICmdLow = cmd; + //low part + auto pMICmdLow = commandStream->getSpaceForCmd(); + MI_STORE_REGISTER_MEM cmd = GfxFamily::cmdInitStoreRegisterMem; + adjustMiStoreRegMemMode(&cmd); + cmd.setRegisterAddress(GP_THREAD_TIME_REG_ADDRESS_OFFSET_LOW); + cmd.setMemoryAddress(timeStampAddress); + *pMICmdLow = cmd; + } } template diff --git a/opencl/source/gen12lp/gpgpu_walker_gen12lp.cpp b/opencl/source/gen12lp/gpgpu_walker_gen12lp.cpp index ab33b249a8..4781b2d355 100644 --- a/opencl/source/gen12lp/gpgpu_walker_gen12lp.cpp +++ b/opencl/source/gen12lp/gpgpu_walker_gen12lp.cpp @@ -20,40 +20,6 @@ void GpgpuWalkerHelper::adjustMiStoreRegMemMode(MI_STORE_REG_MEMsetMmioRemapEnable(true); } -template <> -void GpgpuWalkerHelper::dispatchProfilingCommandsStart( - TagNode &hwTimeStamps, - LinearStream *commandStream, - const HardwareInfo &hwInfo) { - // PIPE_CONTROL for global timestamp - uint64_t timeStampAddress = hwTimeStamps.getGpuAddress() + offsetof(HwTimeStamps, GlobalStartTS); - PipeControlArgs args; - MemorySynchronizationCommands::addPipeControlAndProgramPostSyncOperation( - *commandStream, - PIPE_CONTROL::POST_SYNC_OPERATION_WRITE_TIMESTAMP, - timeStampAddress, - 0llu, - hwInfo, - args); -} - -template <> -void GpgpuWalkerHelper::dispatchProfilingCommandsEnd( - TagNode &hwTimeStamps, - LinearStream *commandStream, - const HardwareInfo &hwInfo) { - // PIPE_CONTROL for global timestamp - uint64_t timeStampAddress = hwTimeStamps.getGpuAddress() + offsetof(HwTimeStamps, GlobalEndTS); - PipeControlArgs args; - MemorySynchronizationCommands::addPipeControlAndProgramPostSyncOperation( - *commandStream, - PIPE_CONTROL::POST_SYNC_OPERATION_WRITE_TIMESTAMP, - timeStampAddress, - 0llu, - hwInfo, - args); -} - template <> void HardwareInterface::dispatchWorkarounds( LinearStream *commandStream,