mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-26 15:03:02 +08:00
Use wait utils while waiting for timestamps
Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
4d433d8674
commit
63116e4100
@@ -978,34 +978,6 @@ bool CommandQueue::isTimestampWaitEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
void CommandQueue::waitForTimestamps(uint32_t taskCount) {
|
||||
if (isTimestampWaitEnabled()) {
|
||||
bool waited = false;
|
||||
|
||||
for (const auto ×tamp : timestampPacketContainer->peekNodes()) {
|
||||
for (uint32_t i = 0; i < timestamp->getPacketsUsed(); i++) {
|
||||
while (timestamp->getContextEndValue(i) == 1) {
|
||||
}
|
||||
waited = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (isOOQEnabled()) {
|
||||
for (const auto ×tamp : deferredTimestampPackets->peekNodes()) {
|
||||
for (uint32_t i = 0; i < timestamp->getPacketsUsed(); i++) {
|
||||
while (timestamp->getContextEndValue(i) == 1) {
|
||||
}
|
||||
waited = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (waited) {
|
||||
getGpgpuCommandStreamReceiver().updateTagFromCpu(taskCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CommandQueue::waitForAllEngines(bool blockedQueue, PrintfHandler *printfHandler, bool cleanTemporaryAllocationsList) {
|
||||
if (blockedQueue) {
|
||||
while (isQueueBlocked()) {
|
||||
|
||||
@@ -216,7 +216,7 @@ class CommandQueue : public BaseObject<_cl_command_queue> {
|
||||
bool isCompleted(uint32_t gpgpuTaskCount, CopyEngineState bcsState) const;
|
||||
|
||||
bool isTimestampWaitEnabled();
|
||||
void waitForTimestamps(uint32_t taskCount);
|
||||
virtual void waitForTimestamps(uint32_t taskCount) = 0;
|
||||
|
||||
MOCKABLE_VIRTUAL bool isQueueBlocked();
|
||||
|
||||
|
||||
@@ -450,6 +450,8 @@ class CommandQueueHw : public CommandQueue {
|
||||
|
||||
bool isCacheFlushCommand(uint32_t commandType) const override;
|
||||
|
||||
void waitForTimestamps(uint32_t taskCount) override;
|
||||
|
||||
MOCKABLE_VIRTUAL bool isCacheFlushForBcsRequired() const;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/blit_commands_helper.h"
|
||||
#include "shared/source/utilities/wait_util.h"
|
||||
|
||||
#include "opencl/source/built_ins/aux_translation_builtin.h"
|
||||
#include "opencl/source/command_queue/enqueue_barrier.h"
|
||||
@@ -134,6 +135,39 @@ bool CommandQueueHw<Family>::isCacheFlushForBcsRequired() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename TSPacketType>
|
||||
inline bool waitForTimestampsWithinContainer(TimestampPacketContainer *container) {
|
||||
bool waited = false;
|
||||
|
||||
for (const auto ×tamp : container->peekNodes()) {
|
||||
for (uint32_t i = 0; i < timestamp->getPacketsUsed(); i++) {
|
||||
while (timestamp->getContextEndValue(i) == 1) {
|
||||
WaitUtils::waitFunctionWithPredicate<const TSPacketType>(static_cast<TSPacketType const *>(timestamp->getContextEndAddress(i)), 1u, std::not_equal_to<TSPacketType>());
|
||||
}
|
||||
waited = true;
|
||||
}
|
||||
}
|
||||
|
||||
return waited;
|
||||
}
|
||||
|
||||
template <typename Family>
|
||||
void CommandQueueHw<Family>::waitForTimestamps(uint32_t taskCount) {
|
||||
using TSPacketType = typename Family::TimestampPacketType;
|
||||
|
||||
if (isTimestampWaitEnabled()) {
|
||||
bool waited = waitForTimestampsWithinContainer<TSPacketType>(timestampPacketContainer.get());
|
||||
|
||||
if (isOOQEnabled()) {
|
||||
waited |= waitForTimestampsWithinContainer<TSPacketType>(deferredTimestampPackets.get());
|
||||
}
|
||||
|
||||
if (waited) {
|
||||
getGpgpuCommandStreamReceiver().updateTagFromCpu(taskCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Family>
|
||||
void CommandQueueHw<Family>::setupBlitAuxTranslation(MultiDispatchInfo &multiDispatchInfo) {
|
||||
multiDispatchInfo.begin()->dispatchInitCommands.registerMethod(
|
||||
|
||||
Reference in New Issue
Block a user