mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-20 00:24:58 +08:00
Limit device usage in memory manager.
Change-Id: I488574dc2b2878b640f0bac2b23bd9a6a265f0e2
This commit is contained in:
committed by
sys_ocldev
parent
2a1feaffe9
commit
f487ce11a2
@@ -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() {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user