mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Synchronize switching command buffers for all partitions
Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
6b062a62b8
commit
cd4f3c221a
@ -61,7 +61,7 @@ ze_result_t CommandQueueImp::initialize(bool copyOnly, bool isInternal) {
|
||||
void CommandQueueImp::reserveLinearStreamSize(size_t size) {
|
||||
UNRECOVERABLE_IF(commandStream == nullptr);
|
||||
if (commandStream->getAvailableSpace() < size) {
|
||||
buffers.switchBuffers(csr);
|
||||
buffers.switchBuffers(csr, partitionCount, addressOffset);
|
||||
NEO::GraphicsAllocation *nextBufferAllocation = buffers.getCurrentBufferAllocation();
|
||||
commandStream->replaceBuffer(nextBufferAllocation->getUnderlyingBuffer(),
|
||||
defaultQueueCmdBufferSize);
|
||||
@ -87,7 +87,7 @@ void CommandQueueImp::submitBatchBuffer(size_t offset, NEO::ResidencyContainer &
|
||||
ze_result_t CommandQueueImp::synchronize(uint64_t timeout) {
|
||||
if ((timeout == std::numeric_limits<uint64_t>::max()) && useKmdWaitFunction) {
|
||||
auto &waitPair = buffers.getCurrentFlushStamp();
|
||||
csr->waitForTaskCountWithKmdNotifyFallback(waitPair.first, waitPair.second, false, false);
|
||||
csr->waitForTaskCountWithKmdNotifyFallback(waitPair.first, waitPair.second, false, false, partitionCount, addressOffset);
|
||||
postSyncOperations();
|
||||
return ZE_RESULT_SUCCESS;
|
||||
} else {
|
||||
@ -106,19 +106,15 @@ ze_result_t CommandQueueImp::synchronizeByPollingForTaskCount(uint64_t timeout)
|
||||
timeoutMicroseconds = NEO::TimeoutControls::maxTimeout;
|
||||
}
|
||||
|
||||
bool ready = false;
|
||||
if (partitionCount > 1) {
|
||||
volatile uint32_t *pollAddress = csr->getTagAddress();
|
||||
for (uint32_t i = 0; i < partitionCount; i++) {
|
||||
csr->waitForCompletionWithTimeout(pollAddress, enableTimeout, timeoutMicroseconds, this->taskCount);
|
||||
pollAddress += addressOffsetDwords;
|
||||
}
|
||||
ready = csr->waitForCompletionWithTimeout(csr->getTagAddress(), enableTimeout, timeoutMicroseconds, taskCountToWait, partitionCount, addressOffset);
|
||||
} else {
|
||||
csr->waitForCompletionWithTimeout(enableTimeout, timeoutMicroseconds, this->taskCount);
|
||||
if (*csr->getTagAddress() < taskCountToWait) {
|
||||
return ZE_RESULT_NOT_READY;
|
||||
}
|
||||
ready = csr->waitForCompletionWithTimeout(enableTimeout, timeoutMicroseconds, taskCountToWait);
|
||||
}
|
||||
if (!ready) {
|
||||
return ZE_RESULT_NOT_READY;
|
||||
}
|
||||
|
||||
postSyncOperations();
|
||||
|
||||
return ZE_RESULT_SUCCESS;
|
||||
@ -201,7 +197,7 @@ void CommandQueueImp::CommandBufferManager::destroy(NEO::MemoryManager *memoryMa
|
||||
}
|
||||
}
|
||||
|
||||
void CommandQueueImp::CommandBufferManager::switchBuffers(NEO::CommandStreamReceiver *csr) {
|
||||
void CommandQueueImp::CommandBufferManager::switchBuffers(NEO::CommandStreamReceiver *csr, uint32_t partitionCount, uint32_t offsetSize) {
|
||||
if (bufferUse == BUFFER_ALLOCATION::FIRST) {
|
||||
bufferUse = BUFFER_ALLOCATION::SECOND;
|
||||
} else {
|
||||
@ -211,7 +207,7 @@ void CommandQueueImp::CommandBufferManager::switchBuffers(NEO::CommandStreamRece
|
||||
auto completionId = flushId[bufferUse];
|
||||
if (completionId.second != 0u) {
|
||||
UNRECOVERABLE_IF(csr == nullptr);
|
||||
csr->waitForTaskCountWithKmdNotifyFallback(completionId.first, completionId.second, false, false);
|
||||
csr->waitForTaskCountWithKmdNotifyFallback(completionId.first, completionId.second, false, false, partitionCount, offsetSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user