Limit device usage in memory manager.

Change-Id: I488574dc2b2878b640f0bac2b23bd9a6a265f0e2
This commit is contained in:
Mrozek, Michal
2018-07-19 14:05:53 +02:00
committed by sys_ocldev
parent 2a1feaffe9
commit f487ce11a2
5 changed files with 11 additions and 12 deletions

View File

@@ -23,7 +23,6 @@
#include "runtime/command_stream/command_stream_receiver.h"
#include "runtime/command_stream/experimental_command_buffer.h"
#include "runtime/command_stream/linear_stream.h"
#include "runtime/device/device.h"
#include "runtime/memory_manager/memory_constants.h"
#include "runtime/memory_manager/memory_manager.h"
#include <cstring>
@@ -31,16 +30,16 @@
namespace OCLRT {
ExperimentalCommandBuffer::ExperimentalCommandBuffer(CommandStreamReceiver *csr) : commandStreamReceiver(csr),
ExperimentalCommandBuffer::ExperimentalCommandBuffer(CommandStreamReceiver *csr, double profilingTimerResolution) : commandStreamReceiver(csr),
currentStream(nullptr),
timestampsOffset(0),
experimentalAllocationOffset(0),
defaultPrint(true) {
defaultPrint(true),
timerResolution(profilingTimerResolution) {
timestamps = csr->getMemoryManager()->allocateGraphicsMemory(MemoryConstants::pageSize);
memset(timestamps->getUnderlyingBuffer(), 0, timestamps->getUnderlyingBufferSize());
experimentalAllocation = csr->getMemoryManager()->allocateGraphicsMemory(MemoryConstants::pageSize);
memset(experimentalAllocation->getUnderlyingBuffer(), 0, experimentalAllocation->getUnderlyingBufferSize());
timerResolution = commandStreamReceiver->getMemoryManager()->device->getDeviceInfo().profilingTimerResolution;
}
ExperimentalCommandBuffer::~ExperimentalCommandBuffer() {

View File

@@ -34,7 +34,7 @@ class MemoryManager;
class ExperimentalCommandBuffer {
public:
virtual ~ExperimentalCommandBuffer();
ExperimentalCommandBuffer(CommandStreamReceiver *csr);
ExperimentalCommandBuffer(CommandStreamReceiver *csr, double profilingTimerResolution);
template <typename GfxFamily>
void injectBufferStart(LinearStream &parentStream, size_t cmdBufferOffset);

View File

@@ -187,7 +187,7 @@ bool Device::createDeviceImpl(const HardwareInfo *pHwInfo, Device &outDevice) {
if (DebugManager.flags.EnableExperimentalCommandBuffer.get() > 0) {
commandStreamReceiver->setExperimentalCmdBuffer(
std::unique_ptr<ExperimentalCommandBuffer>(new ExperimentalCommandBuffer(commandStreamReceiver)));
std::unique_ptr<ExperimentalCommandBuffer>(new ExperimentalCommandBuffer(commandStreamReceiver, pDevice->getDeviceInfo().profilingTimerResolution)));
}
return true;

View File

@@ -312,8 +312,8 @@ void MemObj::releaseAllocatedMapPtr() {
}
void MemObj::waitForCsrCompletion() {
if (memoryManager->device && graphicsAllocation) {
memoryManager->device->getCommandStreamReceiver().waitForCompletionWithTimeout(false, TimeoutControls::maxTimeout, graphicsAllocation->taskCount);
if (memoryManager->csr) {
memoryManager->csr->waitForCompletionWithTimeout(false, TimeoutControls::maxTimeout, graphicsAllocation->taskCount);
}
}

View File

@@ -35,7 +35,7 @@ class MockExperimentalCommandBuffer : public ExperimentalCommandBuffer {
using BaseClass::timestamps;
using BaseClass::timestampsOffset;
MockExperimentalCommandBuffer(CommandStreamReceiver *csr) : ExperimentalCommandBuffer(csr) {
MockExperimentalCommandBuffer(CommandStreamReceiver *csr) : ExperimentalCommandBuffer(csr, 80.0) {
defaultPrint = false;
}
};