mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Decouple memory manager and device
Change-Id: Ia64cc955e1d290cad4c50b6a2a41052d9acf0eec
This commit is contained in:

committed by
sys_ocldev

parent
a30d6d66ca
commit
1ad70dfebe
@ -60,7 +60,7 @@ class CommandStreamReceiverHw : public CommandStreamReceiver {
|
||||
|
||||
size_t getRequiredCmdStreamSize(const DispatchFlags &dispatchFlags, Device &device);
|
||||
size_t getRequiredCmdStreamSizeAligned(const DispatchFlags &dispatchFlags, Device &device);
|
||||
size_t getRequiredCmdSizeForPreamble() const;
|
||||
size_t getRequiredCmdSizeForPreamble(Device &device) const;
|
||||
size_t getCmdSizeForPreemption(const DispatchFlags &dispatchFlags) const;
|
||||
size_t getCmdSizeForL3Config() const;
|
||||
size_t getCmdSizeForPipelineSelect() const;
|
||||
@ -86,9 +86,9 @@ class CommandStreamReceiverHw : public CommandStreamReceiver {
|
||||
}
|
||||
|
||||
protected:
|
||||
void programPreemption(LinearStream &csr, DispatchFlags &dispatchFlags);
|
||||
void programPreemption(LinearStream &csr, Device &device, DispatchFlags &dispatchFlags);
|
||||
void programL3(LinearStream &csr, DispatchFlags &dispatchFlags, uint32_t &newL3Config);
|
||||
void programPreamble(LinearStream &csr, DispatchFlags &dispatchFlags, uint32_t &newL3Config);
|
||||
void programPreamble(LinearStream &csr, Device &device, DispatchFlags &dispatchFlags, uint32_t &newL3Config);
|
||||
void programPipelineSelect(LinearStream &csr, DispatchFlags &dispatchFlags);
|
||||
void programMediaSampler(LinearStream &csr, DispatchFlags &dispatchFlags);
|
||||
virtual void programVFEState(LinearStream &csr, DispatchFlags &dispatchFlags);
|
||||
|
@ -88,14 +88,14 @@ inline void CommandStreamReceiverHw<GfxFamily>::alignToCacheLine(LinearStream &c
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline size_t CommandStreamReceiverHw<GfxFamily>::getRequiredCmdSizeForPreamble() const {
|
||||
inline size_t CommandStreamReceiverHw<GfxFamily>::getRequiredCmdSizeForPreamble(Device &device) const {
|
||||
size_t size = 0;
|
||||
|
||||
if (mediaVfeStateDirty) {
|
||||
size += sizeof(typename GfxFamily::PIPE_CONTROL) + sizeof(typename GfxFamily::MEDIA_VFE_STATE);
|
||||
}
|
||||
if (!this->isPreambleSent) {
|
||||
size += PreambleHelper<GfxFamily>::getAdditionalCommandsSize(*memoryManager->device);
|
||||
size += PreambleHelper<GfxFamily>::getAdditionalCommandsSize(device);
|
||||
}
|
||||
if (!this->isPreambleSent || this->lastSentThreadArbitrationPolicy != this->requiredThreadArbitrationPolicy) {
|
||||
size += PreambleHelper<GfxFamily>::getThreadArbitrationCommandsSize();
|
||||
@ -254,11 +254,11 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
|
||||
auto commandStreamStartCSR = commandStreamCSR.getUsed();
|
||||
|
||||
initPageTableManagerRegisters(commandStreamCSR);
|
||||
programPreemption(commandStreamCSR, dispatchFlags);
|
||||
programPreemption(commandStreamCSR, device, dispatchFlags);
|
||||
programCoherency(commandStreamCSR, dispatchFlags);
|
||||
programL3(commandStreamCSR, dispatchFlags, newL3Config);
|
||||
programPipelineSelect(commandStreamCSR, dispatchFlags);
|
||||
programPreamble(commandStreamCSR, dispatchFlags, newL3Config);
|
||||
programPreamble(commandStreamCSR, device, dispatchFlags, newL3Config);
|
||||
programMediaSampler(commandStreamCSR, dispatchFlags);
|
||||
|
||||
if (this->lastSentThreadArbitrationPolicy != this->requiredThreadArbitrationPolicy) {
|
||||
@ -428,7 +428,7 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
|
||||
this->latestFlushedTaskCount = this->taskCount + 1;
|
||||
this->makeSurfacePackNonResident(nullptr);
|
||||
} else {
|
||||
auto commandBuffer = new CommandBuffer;
|
||||
auto commandBuffer = new CommandBuffer(device);
|
||||
commandBuffer->batchBuffer = batchBuffer;
|
||||
commandBuffer->surfaces.swap(getMemoryManager()->getResidencyAllocations());
|
||||
commandBuffer->batchBufferEndLocation = bbEndLocation;
|
||||
@ -480,12 +480,13 @@ inline void CommandStreamReceiverHw<GfxFamily>::flushBatchedSubmissions() {
|
||||
}
|
||||
typedef typename GfxFamily::MI_BATCH_BUFFER_START MI_BATCH_BUFFER_START;
|
||||
typedef typename GfxFamily::PIPE_CONTROL PIPE_CONTROL;
|
||||
Device *device = this->getMemoryManager()->device;
|
||||
std::unique_lock<MutexType> lockGuard(ownershipMutex);
|
||||
EngineType engineType = device->getEngineType();
|
||||
|
||||
auto &commandBufferList = this->submissionAggregator->peekCmdBufferList();
|
||||
if (!commandBufferList.peekIsEmpty()) {
|
||||
auto &device = commandBufferList.peekHead()->device;
|
||||
EngineType engineType = device.getEngineType();
|
||||
|
||||
ResidencyContainer surfacesForSubmit;
|
||||
ResourcePackage resourcePackage;
|
||||
auto pipeControlLocationSize = getRequiredPipeControlSize();
|
||||
@ -494,7 +495,7 @@ inline void CommandStreamReceiverHw<GfxFamily>::flushBatchedSubmissions() {
|
||||
|
||||
while (!commandBufferList.peekIsEmpty()) {
|
||||
size_t totalUsedSize = 0u;
|
||||
this->submissionAggregator->aggregateCommandBuffers(resourcePackage, totalUsedSize, (size_t)device->getDeviceInfo().globalMemSize * 5 / 10);
|
||||
this->submissionAggregator->aggregateCommandBuffers(resourcePackage, totalUsedSize, (size_t)device.getDeviceInfo().globalMemSize * 5 / 10);
|
||||
auto primaryCmdBuffer = commandBufferList.removeFrontOne();
|
||||
auto nextCommandBuffer = commandBufferList.peekHead();
|
||||
auto currentBBendLocation = primaryCmdBuffer->batchBufferEndLocation;
|
||||
@ -609,7 +610,7 @@ size_t CommandStreamReceiverHw<GfxFamily>::getRequiredCmdStreamSizeAligned(const
|
||||
|
||||
template <typename GfxFamily>
|
||||
size_t CommandStreamReceiverHw<GfxFamily>::getRequiredCmdStreamSize(const DispatchFlags &dispatchFlags, Device &device) {
|
||||
size_t size = getRequiredCmdSizeForPreamble();
|
||||
size_t size = getRequiredCmdSizeForPreamble(device);
|
||||
size += sizeof(typename GfxFamily::STATE_BASE_ADDRESS) + sizeof(PIPE_CONTROL);
|
||||
size += getRequiredPipeControlSize();
|
||||
size += sizeof(typename GfxFamily::MI_BATCH_BUFFER_START);
|
||||
@ -658,9 +659,8 @@ inline void CommandStreamReceiverHw<GfxFamily>::waitForTaskCountWithKmdNotifyFal
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline void CommandStreamReceiverHw<GfxFamily>::programPreemption(LinearStream &csr, DispatchFlags &dispatchFlags) {
|
||||
PreemptionHelper::programCmdStream<GfxFamily>(csr, dispatchFlags.preemptionMode, this->lastPreemptionMode, preemptionCsrAllocation,
|
||||
*memoryManager->device);
|
||||
inline void CommandStreamReceiverHw<GfxFamily>::programPreemption(LinearStream &csr, Device &device, DispatchFlags &dispatchFlags) {
|
||||
PreemptionHelper::programCmdStream<GfxFamily>(csr, dispatchFlags.preemptionMode, this->lastPreemptionMode, preemptionCsrAllocation, device);
|
||||
this->lastPreemptionMode = dispatchFlags.preemptionMode;
|
||||
}
|
||||
|
||||
@ -696,9 +696,9 @@ inline size_t CommandStreamReceiverHw<GfxFamily>::getCmdSizeForL3Config() const
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline void CommandStreamReceiverHw<GfxFamily>::programPreamble(LinearStream &csr, DispatchFlags &dispatchFlags, uint32_t &newL3Config) {
|
||||
inline void CommandStreamReceiverHw<GfxFamily>::programPreamble(LinearStream &csr, Device &device, DispatchFlags &dispatchFlags, uint32_t &newL3Config) {
|
||||
if (!this->isPreambleSent) {
|
||||
PreambleHelper<GfxFamily>::programPreamble(&csr, *memoryManager->device, newL3Config, this->requiredThreadArbitrationPolicy, this->preemptionCsrAllocation);
|
||||
PreambleHelper<GfxFamily>::programPreamble(&csr, device, newL3Config, this->requiredThreadArbitrationPolicy, this->preemptionCsrAllocation);
|
||||
this->isPreambleSent = true;
|
||||
this->lastSentL3Config = newL3Config;
|
||||
this->lastSentThreadArbitrationPolicy = this->requiredThreadArbitrationPolicy;
|
||||
|
@ -110,6 +110,6 @@ void OCLRT::SubmissionAggregator::aggregateCommandBuffers(ResourcePackage &resou
|
||||
OCLRT::BatchBuffer::BatchBuffer(GraphicsAllocation *commandBufferAllocation, size_t startOffset, size_t chainedBatchBufferStartOffset, GraphicsAllocation *chainedBatchBuffer, bool requiresCoherency, bool lowPriority, QueueThrottle throttle, size_t usedSize, LinearStream *stream) : commandBufferAllocation(commandBufferAllocation), startOffset(startOffset), chainedBatchBufferStartOffset(chainedBatchBufferStartOffset), chainedBatchBuffer(chainedBatchBuffer), requiresCoherency(requiresCoherency), low_priority(lowPriority), throttle(throttle), usedSize(usedSize), stream(stream) {
|
||||
}
|
||||
|
||||
OCLRT::CommandBuffer::CommandBuffer() {
|
||||
OCLRT::CommandBuffer::CommandBuffer(Device &device) : device(device) {
|
||||
flushStamp.reset(new FlushStampTracker(false));
|
||||
}
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "runtime/memory_manager/residency_container.h"
|
||||
#include <vector>
|
||||
namespace OCLRT {
|
||||
class Device;
|
||||
class Event;
|
||||
class FlushStampTracker;
|
||||
class GraphicsAllocation;
|
||||
@ -56,7 +57,7 @@ struct BatchBuffer {
|
||||
};
|
||||
|
||||
struct CommandBuffer : public IDNode<CommandBuffer> {
|
||||
CommandBuffer();
|
||||
CommandBuffer(Device &);
|
||||
ResidencyContainer surfaces;
|
||||
BatchBuffer batchBuffer;
|
||||
void *batchBufferEndLocation = nullptr;
|
||||
@ -65,6 +66,7 @@ struct CommandBuffer : public IDNode<CommandBuffer> {
|
||||
void *pipeControlThatMayBeErasedLocation = nullptr;
|
||||
void *epiloguePipeControlLocation = nullptr;
|
||||
std::unique_ptr<FlushStampTracker> flushStamp;
|
||||
Device &device;
|
||||
};
|
||||
|
||||
struct CommandBufferList : public IDList<CommandBuffer, false, true, false> {};
|
||||
@ -81,4 +83,4 @@ class SubmissionAggregator {
|
||||
CommandBufferList cmdBuffers;
|
||||
uint32_t inspectionId = 1;
|
||||
};
|
||||
} // namespace OCLRT
|
||||
} // namespace OCLRT
|
||||
|
@ -166,7 +166,6 @@ bool Device::createDeviceImpl(const HardwareInfo *pHwInfo, Device &outDevice) {
|
||||
}
|
||||
|
||||
outDevice.executionEnvironment->memoryManager->setForce32BitAllocations(pDevice->getDeviceInfo().force32BitAddressess);
|
||||
outDevice.executionEnvironment->memoryManager->device = pDevice;
|
||||
|
||||
if (pDevice->preemptionMode == PreemptionMode::MidThread || pDevice->isSourceLevelDebuggerActive()) {
|
||||
size_t requiredSize = pHwInfo->capabilityTable.requiredPreemptionSurfaceSize;
|
||||
|
@ -202,7 +202,6 @@ class MemoryManager {
|
||||
AllocationsList allocationsForReuse;
|
||||
|
||||
CommandStreamReceiver *csr = nullptr;
|
||||
Device *device = nullptr;
|
||||
HostPtrManager hostPtrManager;
|
||||
|
||||
virtual GraphicsAllocation *createGraphicsAllocation(OsHandleStorage &handleStorage, size_t hostPtrSize, const void *hostPtr) = 0;
|
||||
|
@ -673,7 +673,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, flushTaskWithOnlyEnoughMemoryForPr
|
||||
commandStreamReceiver.lastSentL3Config = l3Config;
|
||||
|
||||
auto &csrCS = commandStreamReceiver.getCS();
|
||||
size_t sizeNeededForPreamble = commandStreamReceiver.getRequiredCmdSizeForPreamble();
|
||||
size_t sizeNeededForPreamble = commandStreamReceiver.getRequiredCmdSizeForPreamble(*pDevice);
|
||||
size_t sizeNeeded = commandStreamReceiver.getRequiredCmdStreamSize(flushTaskFlags, *pDevice);
|
||||
sizeNeeded -= sizeof(MI_BATCH_BUFFER_START); // no task to submit
|
||||
sizeNeeded += sizeof(MI_BATCH_BUFFER_END); // no task to submit, add BBE to CSR stream
|
||||
@ -704,7 +704,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, flushTaskWithOnlyEnoughMemoryForPr
|
||||
commandStreamReceiver.lastSentL3Config = l3Config;
|
||||
|
||||
auto &csrCS = commandStreamReceiver.getCS();
|
||||
size_t sizeNeededForPreamble = commandStreamReceiver.getRequiredCmdSizeForPreamble();
|
||||
size_t sizeNeededForPreamble = commandStreamReceiver.getRequiredCmdSizeForPreamble(*pDevice);
|
||||
size_t sizeNeededForStateBaseAddress = sizeof(STATE_BASE_ADDRESS) + sizeof(PIPE_CONTROL);
|
||||
size_t sizeNeeded = commandStreamReceiver.getRequiredCmdStreamSize(flushTaskFlags, *pDevice);
|
||||
sizeNeeded -= sizeof(MI_BATCH_BUFFER_START); // no task to submit
|
||||
@ -2136,7 +2136,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeAndThreeReco
|
||||
auto mockedSubmissionsAggregator = new mockSubmissionsAggregator();
|
||||
mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator);
|
||||
|
||||
auto memorySize = (size_t)mockCsr->getMemoryManager()->device->getDeviceInfo().globalMemSize;
|
||||
auto memorySize = (size_t)pDevice->getDeviceInfo().globalMemSize;
|
||||
GraphicsAllocation largeAllocation(nullptr, memorySize);
|
||||
|
||||
DispatchFlags dispatchFlags;
|
||||
@ -2319,10 +2319,10 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenRecorded
|
||||
|
||||
mockCsr->flushBatchedSubmissions();
|
||||
|
||||
EXPECT_FALSE(mockCsr->recordedCommandBuffer.batchBuffer.low_priority);
|
||||
EXPECT_TRUE(mockCsr->recordedCommandBuffer.batchBuffer.requiresCoherency);
|
||||
EXPECT_EQ(mockCsr->recordedCommandBuffer.batchBuffer.commandBufferAllocation, commandStream.getGraphicsAllocation());
|
||||
EXPECT_EQ(4u, mockCsr->recordedCommandBuffer.batchBuffer.startOffset);
|
||||
EXPECT_FALSE(mockCsr->recordedCommandBuffer->batchBuffer.low_priority);
|
||||
EXPECT_TRUE(mockCsr->recordedCommandBuffer->batchBuffer.requiresCoherency);
|
||||
EXPECT_EQ(mockCsr->recordedCommandBuffer->batchBuffer.commandBufferAllocation, commandStream.getGraphicsAllocation());
|
||||
EXPECT_EQ(4u, mockCsr->recordedCommandBuffer->batchBuffer.startOffset);
|
||||
EXPECT_EQ(1, mockCsr->flushCalledCount);
|
||||
|
||||
EXPECT_TRUE(mockedSubmissionsAggregator->peekCommandBuffers().peekIsEmpty());
|
||||
@ -2594,7 +2594,6 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenTotalRes
|
||||
std::unique_ptr<MockedMemoryManager> mockedMemoryManager(new MockedMemoryManager());
|
||||
std::unique_ptr<MockCsrHw2<FamilyType>> mockCsr(new MockCsrHw2<FamilyType>(*platformDevices[0], *pDevice->executionEnvironment));
|
||||
|
||||
mockedMemoryManager->device = pDevice;
|
||||
mockCsr->setMemoryManager(mockedMemoryManager.get());
|
||||
mockCsr->initializeTagAllocation();
|
||||
mockCsr->setPreemptionCsrAllocation(pDevice->getPreemptionAllocation());
|
||||
@ -2627,7 +2626,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenTotalRes
|
||||
|
||||
EXPECT_EQ(expectedUsed, mockCsr->peekTotalMemoryUsed());
|
||||
|
||||
auto budgetSize = (size_t)mockCsr->getMemoryManager()->device->getDeviceInfo().globalMemSize;
|
||||
auto budgetSize = (size_t)pDevice->getDeviceInfo().globalMemSize;
|
||||
GraphicsAllocation hugeAllocation(nullptr, budgetSize / 4);
|
||||
mockCsr->makeResident(hugeAllocation);
|
||||
|
||||
|
@ -62,7 +62,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, UltCommandStreamReceiverTest, givenPreambleSentAndTh
|
||||
commandStreamReceiver.isPreambleSent = true;
|
||||
commandStreamReceiver.requiredThreadArbitrationPolicy = commandStreamReceiver.lastSentThreadArbitrationPolicy;
|
||||
auto expectedCmdSize = sizeof(typename FamilyType::PIPE_CONTROL) + sizeof(typename FamilyType::MEDIA_VFE_STATE);
|
||||
EXPECT_EQ(expectedCmdSize, commandStreamReceiver.getRequiredCmdSizeForPreamble());
|
||||
EXPECT_EQ(expectedCmdSize, commandStreamReceiver.getRequiredCmdSizeForPreamble(*pDevice));
|
||||
}
|
||||
|
||||
HWTEST_F(UltCommandStreamReceiverTest, givenPreambleSentAndThreadArbitrationPolicyChangedWhenEstimatingPreambleCmdSizeThenResultDependsOnPolicyProgrammingCmdSize) {
|
||||
@ -70,10 +70,10 @@ HWTEST_F(UltCommandStreamReceiverTest, givenPreambleSentAndThreadArbitrationPoli
|
||||
commandStreamReceiver.isPreambleSent = true;
|
||||
|
||||
commandStreamReceiver.requiredThreadArbitrationPolicy = commandStreamReceiver.lastSentThreadArbitrationPolicy;
|
||||
auto policyNotChanged = commandStreamReceiver.getRequiredCmdSizeForPreamble();
|
||||
auto policyNotChanged = commandStreamReceiver.getRequiredCmdSizeForPreamble(*pDevice);
|
||||
|
||||
commandStreamReceiver.requiredThreadArbitrationPolicy = commandStreamReceiver.lastSentThreadArbitrationPolicy + 1;
|
||||
auto policyChanged = commandStreamReceiver.getRequiredCmdSizeForPreamble();
|
||||
auto policyChanged = commandStreamReceiver.getRequiredCmdSizeForPreamble(*pDevice);
|
||||
|
||||
auto actualDifference = policyChanged - policyNotChanged;
|
||||
auto expectedDifference = PreambleHelper<FamilyType>::getThreadArbitrationCommandsSize();
|
||||
@ -85,10 +85,10 @@ HWTEST_F(UltCommandStreamReceiverTest, givenPreambleSentWhenEstimatingPreambleCm
|
||||
commandStreamReceiver.requiredThreadArbitrationPolicy = commandStreamReceiver.lastSentThreadArbitrationPolicy;
|
||||
|
||||
commandStreamReceiver.isPreambleSent = false;
|
||||
auto preambleNotSent = commandStreamReceiver.getRequiredCmdSizeForPreamble();
|
||||
auto preambleNotSent = commandStreamReceiver.getRequiredCmdSizeForPreamble(*pDevice);
|
||||
|
||||
commandStreamReceiver.isPreambleSent = true;
|
||||
auto preambleSent = commandStreamReceiver.getRequiredCmdSizeForPreamble();
|
||||
auto preambleSent = commandStreamReceiver.getRequiredCmdSizeForPreamble(*pDevice);
|
||||
|
||||
auto actualDifference = preambleNotSent - preambleSent;
|
||||
auto expectedDifference = PreambleHelper<FamilyType>::getThreadArbitrationCommandsSize() + PreambleHelper<FamilyType>::getAdditionalCommandsSize(*pDevice);
|
||||
@ -102,10 +102,10 @@ HWCMDTEST_F(IGFX_GEN8_CORE, UltCommandStreamReceiverTest, givenMediaVfeStateDirt
|
||||
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
|
||||
commandStreamReceiver.overrideMediaVFEStateDirty(false);
|
||||
auto notDirty = commandStreamReceiver.getRequiredCmdSizeForPreamble();
|
||||
auto notDirty = commandStreamReceiver.getRequiredCmdSizeForPreamble(*pDevice);
|
||||
|
||||
commandStreamReceiver.overrideMediaVFEStateDirty(true);
|
||||
auto dirty = commandStreamReceiver.getRequiredCmdSizeForPreamble();
|
||||
auto dirty = commandStreamReceiver.getRequiredCmdSizeForPreamble(*pDevice);
|
||||
|
||||
auto actualDifference = dirty - notDirty;
|
||||
auto expectedDifference = sizeof(PIPE_CONTROL) + sizeof(MEDIA_VFE_STATE);
|
||||
|
@ -44,7 +44,9 @@ TEST(SubmissionsAggregator, givenDefaultSubmissionsAggregatorWhenItIsCreatedThen
|
||||
|
||||
TEST(SubmissionsAggregator, givenCommandBufferWhenItIsPassedToSubmissionsAggregatorThenItIsRecorded) {
|
||||
MockSubmissionAggregator submissionsAggregator;
|
||||
CommandBuffer *cmdBuffer = new CommandBuffer;
|
||||
|
||||
std::unique_ptr<Device> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
CommandBuffer *cmdBuffer = new CommandBuffer(*device);
|
||||
|
||||
submissionsAggregator.recordCommandBuffer(cmdBuffer);
|
||||
EXPECT_FALSE(submissionsAggregator.peekCommandBuffersList().peekIsEmpty());
|
||||
@ -56,8 +58,10 @@ TEST(SubmissionsAggregator, givenCommandBufferWhenItIsPassedToSubmissionsAggrega
|
||||
|
||||
TEST(SubmissionsAggregator, givenTwoCommandBuffersWhenMergeResourcesIsCalledThenDuplicatesAreEliminated) {
|
||||
MockSubmissionAggregator submissionsAggregator;
|
||||
CommandBuffer *cmdBuffer = new CommandBuffer;
|
||||
CommandBuffer *cmdBuffer2 = new CommandBuffer;
|
||||
|
||||
std::unique_ptr<Device> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
CommandBuffer *cmdBuffer = new CommandBuffer(*device);
|
||||
CommandBuffer *cmdBuffer2 = new CommandBuffer(*device);
|
||||
|
||||
GraphicsAllocation alloc1(nullptr, 1);
|
||||
GraphicsAllocation alloc2(nullptr, 2);
|
||||
@ -113,9 +117,11 @@ TEST(SubmissionsAggregator, givenTwoCommandBuffersWhenMergeResourcesIsCalledThen
|
||||
|
||||
TEST(SubmissionsAggregator, givenSubmissionAggregatorWhenThreeCommandBuffersAreSubmittedThenTheyAreAggregated) {
|
||||
MockSubmissionAggregator submissionsAggregator;
|
||||
CommandBuffer *cmdBuffer = new CommandBuffer;
|
||||
CommandBuffer *cmdBuffer2 = new CommandBuffer;
|
||||
CommandBuffer *cmdBuffer3 = new CommandBuffer;
|
||||
|
||||
std::unique_ptr<Device> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
CommandBuffer *cmdBuffer = new CommandBuffer(*device);
|
||||
CommandBuffer *cmdBuffer2 = new CommandBuffer(*device);
|
||||
CommandBuffer *cmdBuffer3 = new CommandBuffer(*device);
|
||||
|
||||
GraphicsAllocation alloc1(nullptr, 1);
|
||||
GraphicsAllocation alloc2(nullptr, 2);
|
||||
@ -175,9 +181,11 @@ TEST(SubmissionsAggregator, givenSubmissionAggregatorWhenThreeCommandBuffersAreS
|
||||
|
||||
TEST(SubmissionsAggregator, givenMultipleCommandBuffersWhenTheyAreAggreagateWithCertainMemoryLimitThenOnlyThatFitAreAggregated) {
|
||||
MockSubmissionAggregator submissionsAggregator;
|
||||
CommandBuffer *cmdBuffer = new CommandBuffer;
|
||||
CommandBuffer *cmdBuffer2 = new CommandBuffer;
|
||||
CommandBuffer *cmdBuffer3 = new CommandBuffer;
|
||||
|
||||
std::unique_ptr<Device> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
CommandBuffer *cmdBuffer = new CommandBuffer(*device);
|
||||
CommandBuffer *cmdBuffer2 = new CommandBuffer(*device);
|
||||
CommandBuffer *cmdBuffer3 = new CommandBuffer(*device);
|
||||
|
||||
GraphicsAllocation alloc1(nullptr, 1);
|
||||
GraphicsAllocation alloc2(nullptr, 2);
|
||||
@ -229,9 +237,11 @@ TEST(SubmissionsAggregator, givenMultipleCommandBuffersWhenTheyAreAggreagateWith
|
||||
|
||||
TEST(SubmissionsAggregator, givenMultipleCommandBuffersWhenAggregateIsCalledMultipleTimesThenFurtherInspectionAreHandledCorrectly) {
|
||||
MockSubmissionAggregator submissionsAggregator;
|
||||
CommandBuffer *cmdBuffer = new CommandBuffer;
|
||||
CommandBuffer *cmdBuffer2 = new CommandBuffer;
|
||||
CommandBuffer *cmdBuffer3 = new CommandBuffer;
|
||||
|
||||
std::unique_ptr<Device> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
CommandBuffer *cmdBuffer = new CommandBuffer(*device);
|
||||
CommandBuffer *cmdBuffer2 = new CommandBuffer(*device);
|
||||
CommandBuffer *cmdBuffer3 = new CommandBuffer(*device);
|
||||
|
||||
GraphicsAllocation alloc1(nullptr, 1);
|
||||
GraphicsAllocation alloc2(nullptr, 2);
|
||||
@ -292,8 +302,9 @@ TEST(SubmissionsAggregator, givenMultipleCommandBuffersWhenAggregateIsCalledMult
|
||||
TEST(SubmissionsAggregator, givenMultipleCommandBuffersWithDifferentGraphicsAllocationsWhenAggregateIsCalledThenResourcePackContainSecondBatchBuffer) {
|
||||
MockSubmissionAggregator submissionsAggregator;
|
||||
|
||||
CommandBuffer *cmdBuffer = new CommandBuffer;
|
||||
CommandBuffer *cmdBuffer2 = new CommandBuffer;
|
||||
std::unique_ptr<Device> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
CommandBuffer *cmdBuffer = new CommandBuffer(*device);
|
||||
CommandBuffer *cmdBuffer2 = new CommandBuffer(*device);
|
||||
|
||||
GraphicsAllocation alloc1(nullptr, 1);
|
||||
GraphicsAllocation alloc2(nullptr, 2);
|
||||
@ -324,8 +335,9 @@ TEST(SubmissionsAggregator, givenMultipleCommandBuffersWithDifferentGraphicsAllo
|
||||
TEST(SubmissionsAggregator, givenTwoCommandBufferWhereSecondContainsFirstOnResourceListWhenItIsAggregatedThenResourcePackDoesntContainPrimaryBatch) {
|
||||
MockSubmissionAggregator submissionsAggregator;
|
||||
|
||||
CommandBuffer *cmdBuffer = new CommandBuffer;
|
||||
CommandBuffer *cmdBuffer2 = new CommandBuffer;
|
||||
std::unique_ptr<Device> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
CommandBuffer *cmdBuffer = new CommandBuffer(*device);
|
||||
CommandBuffer *cmdBuffer2 = new CommandBuffer(*device);
|
||||
|
||||
GraphicsAllocation cmdBufferAllocation1(nullptr, 1);
|
||||
GraphicsAllocation cmdBufferAllocation2(nullptr, 2);
|
||||
@ -358,8 +370,9 @@ TEST(SubmissionsAggregator, givenTwoCommandBufferWhereSecondContainsFirstOnResou
|
||||
TEST(SubmissionsAggregator, givenTwoCommandBufferWhereSecondContainsTheFirstCommandBufferGraphicsAllocaitonWhenItIsAggregatedThenResourcePackDoesntContainPrimaryBatch) {
|
||||
MockSubmissionAggregator submissionsAggregator;
|
||||
|
||||
CommandBuffer *cmdBuffer = new CommandBuffer;
|
||||
CommandBuffer *cmdBuffer2 = new CommandBuffer;
|
||||
std::unique_ptr<Device> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
CommandBuffer *cmdBuffer = new CommandBuffer(*device);
|
||||
CommandBuffer *cmdBuffer2 = new CommandBuffer(*device);
|
||||
|
||||
GraphicsAllocation cmdBufferAllocation1(nullptr, 1);
|
||||
GraphicsAllocation alloc5(nullptr, 5);
|
||||
@ -389,8 +402,9 @@ TEST(SubmissionsAggregator, givenTwoCommandBufferWhereSecondContainsTheFirstComm
|
||||
TEST(SubmissionsAggregator, givenCommandBuffersRequiringDifferentCoherencySettingWhenAggregateIsCalledThenTheyAreNotAgggregated) {
|
||||
MockSubmissionAggregator submissionsAggregator;
|
||||
|
||||
CommandBuffer *cmdBuffer = new CommandBuffer;
|
||||
CommandBuffer *cmdBuffer2 = new CommandBuffer;
|
||||
std::unique_ptr<Device> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
CommandBuffer *cmdBuffer = new CommandBuffer(*device);
|
||||
CommandBuffer *cmdBuffer2 = new CommandBuffer(*device);
|
||||
|
||||
GraphicsAllocation alloc1(nullptr, 1);
|
||||
GraphicsAllocation alloc7(nullptr, 7);
|
||||
@ -417,8 +431,9 @@ TEST(SubmissionsAggregator, givenCommandBuffersRequiringDifferentCoherencySettin
|
||||
TEST(SubmissionsAggregator, givenCommandBuffersRequiringDifferentThrottleSettingWhenAggregateIsCalledThenTheyAreNotAgggregated) {
|
||||
MockSubmissionAggregator submissionsAggregator;
|
||||
|
||||
CommandBuffer *cmdBuffer = new CommandBuffer;
|
||||
CommandBuffer *cmdBuffer2 = new CommandBuffer;
|
||||
std::unique_ptr<Device> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
CommandBuffer *cmdBuffer = new CommandBuffer(*device);
|
||||
CommandBuffer *cmdBuffer2 = new CommandBuffer(*device);
|
||||
|
||||
GraphicsAllocation alloc1(nullptr, 1);
|
||||
GraphicsAllocation alloc7(nullptr, 7);
|
||||
@ -445,8 +460,9 @@ TEST(SubmissionsAggregator, givenCommandBuffersRequiringDifferentThrottleSetting
|
||||
TEST(SubmissionsAggregator, givenCommandBuffersRequiringDifferentPrioritySettingWhenAggregateIsCalledThenTheyAreNotAgggregated) {
|
||||
MockSubmissionAggregator submissionsAggregator;
|
||||
|
||||
CommandBuffer *cmdBuffer = new CommandBuffer;
|
||||
CommandBuffer *cmdBuffer2 = new CommandBuffer;
|
||||
std::unique_ptr<Device> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
CommandBuffer *cmdBuffer = new CommandBuffer(*device);
|
||||
CommandBuffer *cmdBuffer2 = new CommandBuffer(*device);
|
||||
|
||||
GraphicsAllocation alloc1(nullptr, 1);
|
||||
GraphicsAllocation alloc7(nullptr, 7);
|
||||
@ -471,7 +487,8 @@ TEST(SubmissionsAggregator, givenCommandBuffersRequiringDifferentPrioritySetting
|
||||
}
|
||||
|
||||
TEST(SubmissionsAggregator, dontAllocateFlushStamp) {
|
||||
CommandBuffer cmdBuffer;
|
||||
std::unique_ptr<Device> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
CommandBuffer cmdBuffer(*device);
|
||||
EXPECT_EQ(nullptr, cmdBuffer.flushStamp->getStampReference());
|
||||
}
|
||||
|
||||
|
@ -99,11 +99,6 @@ TEST_F(DeviceTest, retainAndRelease) {
|
||||
ASSERT_EQ(1, pDevice->getReference());
|
||||
}
|
||||
|
||||
TEST_F(DeviceTest, givenMemoryManagerWhenDeviceIsCreatedThenItHasAccessToDevice) {
|
||||
auto memoryManager = pDevice->getMemoryManager();
|
||||
EXPECT_EQ(memoryManager->device, pDevice);
|
||||
}
|
||||
|
||||
TEST_F(DeviceTest, getEngineTypeDefault) {
|
||||
auto pTestDevice = std::unique_ptr<Device>(createWithUsDeviceId(0));
|
||||
|
||||
|
@ -58,12 +58,12 @@ GEN9TEST_F(UltCommandStreamReceiverTest, givenNotSentPreambleAndMidThreadPreempt
|
||||
uint32_t newL3Config;
|
||||
DispatchFlags dispatchFlags;
|
||||
|
||||
auto cmdSizePreambleMidThread = commandStreamReceiver.getRequiredCmdSizeForPreamble();
|
||||
auto cmdSizePreambleMidThread = commandStreamReceiver.getRequiredCmdSizeForPreamble(*pDevice);
|
||||
StackVec<char, 4096> preemptionBuffer;
|
||||
preemptionBuffer.resize(cmdSizePreambleMidThread);
|
||||
LinearStream preambleStream(&*preemptionBuffer.begin(), preemptionBuffer.size());
|
||||
auto sipAllocation = BuiltIns::getInstance().getSipKernel(SipKernelType::Csr, *pDevice).getSipAllocation();
|
||||
commandStreamReceiver.programPreamble(preambleStream, dispatchFlags, newL3Config);
|
||||
commandStreamReceiver.programPreamble(preambleStream, *pDevice, dispatchFlags, newL3Config);
|
||||
|
||||
this->parseCommands<FamilyType>(preambleStream);
|
||||
auto itorStateSip = find<STATE_SIP *>(this->cmdList.begin(), this->cmdList.end());
|
||||
@ -88,7 +88,7 @@ GEN9TEST_F(UltCommandStreamReceiverTest, givenNotSentPreambleAndKernelDebuggingA
|
||||
uint32_t newL3Config;
|
||||
DispatchFlags dispatchFlags;
|
||||
|
||||
auto cmdSizePreambleMidThread = commandStreamReceiver.getRequiredCmdSizeForPreamble();
|
||||
auto cmdSizePreambleMidThread = commandStreamReceiver.getRequiredCmdSizeForPreamble(*pDevice);
|
||||
StackVec<char, 4096> preemptionBuffer;
|
||||
preemptionBuffer.resize(cmdSizePreambleMidThread);
|
||||
LinearStream preambleStream(&*preemptionBuffer.begin(), preemptionBuffer.size());
|
||||
@ -99,7 +99,7 @@ GEN9TEST_F(UltCommandStreamReceiverTest, givenNotSentPreambleAndKernelDebuggingA
|
||||
ASSERT_NE(dbgLocalSipAllocation, nullptr);
|
||||
ASSERT_NE(sipAllocation, nullptr);
|
||||
|
||||
commandStreamReceiver.programPreamble(preambleStream, dispatchFlags, newL3Config);
|
||||
commandStreamReceiver.programPreamble(preambleStream, *pDevice, dispatchFlags, newL3Config);
|
||||
|
||||
this->parseCommands<FamilyType>(preambleStream);
|
||||
auto itorStateSip = find<STATE_SIP *>(this->cmdList.begin(), this->cmdList.end());
|
||||
|
@ -174,7 +174,6 @@ TEST(MemObj, givenNotReadyGraphicsAllocationWhenMemObjDestroysAllocationAsyncThe
|
||||
MockContext context;
|
||||
|
||||
context.setMemoryManager(&memoryManager);
|
||||
memoryManager.setDevice(context.getDevice(0));
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemory(MemoryConstants::pageSize);
|
||||
allocation->taskCount = 2;
|
||||
@ -194,11 +193,10 @@ TEST(MemObj, givenReadyGraphicsAllocationWhenMemObjDestroysAllocationAsyncThenAl
|
||||
MockContext context;
|
||||
|
||||
context.setMemoryManager(&memoryManager);
|
||||
memoryManager.setDevice(context.getDevice(0));
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemory(MemoryConstants::pageSize);
|
||||
allocation->taskCount = 1;
|
||||
*memoryManager.device->getTagAddress() = 1;
|
||||
*context.getDevice(0)->getTagAddress() = 1;
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, CL_MEM_COPY_HOST_PTR,
|
||||
MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false);
|
||||
|
||||
@ -213,7 +211,6 @@ TEST(MemObj, givenNotUsedGraphicsAllocationWhenMemObjDestroysAllocationAsyncThen
|
||||
MockContext context;
|
||||
|
||||
context.setMemoryManager(&memoryManager);
|
||||
memoryManager.setDevice(context.getDevice(0));
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemory(MemoryConstants::pageSize);
|
||||
allocation->taskCount = ObjectNotUsed;
|
||||
@ -252,13 +249,9 @@ TEST(MemObj, givenMemObjWhenItDoesntHaveGraphicsAllocationThenWaitForCsrCompleti
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, CL_MEM_COPY_HOST_PTR,
|
||||
MemoryConstants::pageSize, nullptr, nullptr, nullptr, true, false, false);
|
||||
|
||||
EXPECT_EQ(nullptr, memoryManager.device);
|
||||
EXPECT_EQ(nullptr, memObj.getGraphicsAllocation());
|
||||
memObj.waitForCsrCompletion();
|
||||
|
||||
memoryManager.setDevice(context.getDevice(0));
|
||||
|
||||
EXPECT_NE(nullptr, memoryManager.device);
|
||||
EXPECT_EQ(nullptr, memObj.getGraphicsAllocation());
|
||||
memObj.waitForCsrCompletion();
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ class MockCsrHw2 : public CommandStreamReceiverHw<GfxFamily> {
|
||||
FlushStamp flush(BatchBuffer &batchBuffer, EngineType engineType,
|
||||
ResidencyContainer *allocationsForResidency) override {
|
||||
flushCalledCount++;
|
||||
recordedCommandBuffer.batchBuffer = batchBuffer;
|
||||
recordedCommandBuffer->batchBuffer = batchBuffer;
|
||||
copyOfAllocations.clear();
|
||||
|
||||
if (allocationsForResidency) {
|
||||
@ -197,12 +197,13 @@ class MockCsrHw2 : public CommandStreamReceiverHw<GfxFamily> {
|
||||
const IndirectHeap &dsh, const IndirectHeap &ioh,
|
||||
const IndirectHeap &ssh, uint32_t taskLevel, DispatchFlags &dispatchFlags, Device &device) override {
|
||||
passedDispatchFlags = dispatchFlags;
|
||||
recordedCommandBuffer = std::unique_ptr<CommandBuffer>(new CommandBuffer(device));
|
||||
return CommandStreamReceiverHw<GfxFamily>::flushTask(commandStream, commandStreamStart,
|
||||
dsh, ioh, ssh, taskLevel, dispatchFlags, device);
|
||||
}
|
||||
|
||||
int flushCalledCount = 0;
|
||||
CommandBuffer recordedCommandBuffer;
|
||||
std::unique_ptr<CommandBuffer> recordedCommandBuffer = nullptr;
|
||||
ResidencyContainer copyOfAllocations;
|
||||
DispatchFlags passedDispatchFlags = {};
|
||||
};
|
||||
|
@ -68,7 +68,6 @@ void MockDevice::injectMemoryManager(MockMemoryManager *memoryManager) {
|
||||
memoryManager->setCommandStreamReceiver(executionEnvironment->commandStreamReceiver.get());
|
||||
executionEnvironment->commandStreamReceiver->setMemoryManager(memoryManager);
|
||||
setMemoryManager(memoryManager);
|
||||
memoryManager->setDevice(this);
|
||||
}
|
||||
|
||||
void MockDevice::resetCommandStreamReceiver(CommandStreamReceiver *newCsr) {
|
||||
|
@ -52,10 +52,6 @@ void MockMemoryManager::setCommandStreamReceiver(CommandStreamReceiver *csr) {
|
||||
this->csr = csr;
|
||||
}
|
||||
|
||||
void MockMemoryManager::setDevice(Device *device) {
|
||||
this->device = device;
|
||||
}
|
||||
|
||||
bool MockMemoryManager::isAllocationListEmpty() {
|
||||
return graphicsAllocations.peekIsEmpty();
|
||||
}
|
||||
|
@ -41,7 +41,6 @@ class MockMemoryManager : public OsAgnosticMemoryManager {
|
||||
GraphicsAllocation *allocateGraphicsMemoryForImage(ImageInfo &imgInfo, Gmm *gmm) override;
|
||||
int redundancyRatio = 1;
|
||||
void setCommandStreamReceiver(CommandStreamReceiver *csr);
|
||||
void setDevice(Device *device);
|
||||
bool isAllocationListEmpty();
|
||||
GraphicsAllocation *peekAllocationListHead();
|
||||
|
||||
|
@ -687,7 +687,6 @@ class DrmCommandStreamEnhancedFixture
|
||||
executionEnvironment->memoryManager.reset(mm);
|
||||
device = Device::create<MockDevice>(platformDevices[0], executionEnvironment);
|
||||
ASSERT_NE(nullptr, device);
|
||||
mm->device = device;
|
||||
}
|
||||
|
||||
void TearDown() {
|
||||
@ -993,8 +992,6 @@ TEST_F(DrmCommandStreamBatchingTests, givenCsrWhenDispatchPolicyIsSetToBatchingT
|
||||
|
||||
std::unique_ptr<Device> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
|
||||
tCsr->getMemoryManager()->device = device.get();
|
||||
|
||||
tCsr->setTagAllocation(tagAllocation);
|
||||
tCsr->setPreemptionCsrAllocation(preemptionAllocation);
|
||||
DispatchFlags dispatchFlags;
|
||||
@ -1007,7 +1004,7 @@ TEST_F(DrmCommandStreamBatchingTests, givenCsrWhenDispatchPolicyIsSetToBatchingT
|
||||
EXPECT_NE(nullptr, cmdBuffers.peekHead());
|
||||
|
||||
//preemption allocation
|
||||
size_t csrSurfaceCount = (tCsr->getMemoryManager()->device->getPreemptionMode() == PreemptionMode::MidThread) ? 2 : 0;
|
||||
size_t csrSurfaceCount = (device->getPreemptionMode() == PreemptionMode::MidThread) ? 2 : 0;
|
||||
|
||||
//preemption allocation + sipKernel
|
||||
int ioctlExtraCnt = (PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]) == PreemptionMode::MidThread) ? 2 : 0;
|
||||
@ -1048,7 +1045,6 @@ TEST_F(DrmCommandStreamBatchingTests, givenRecordedCommandBufferWhenItIsSubmitte
|
||||
IndirectHeap cs(commandBuffer);
|
||||
std::unique_ptr<Device> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
|
||||
tCsr->getMemoryManager()->device = device.get();
|
||||
tCsr->setTagAllocation(tagAllocation);
|
||||
tCsr->setPreemptionCsrAllocation(preemptionAllocation);
|
||||
auto &submittedCommandBuffer = tCsr->getCS(1024);
|
||||
@ -1074,7 +1070,7 @@ TEST_F(DrmCommandStreamBatchingTests, givenRecordedCommandBufferWhenItIsSubmitte
|
||||
EXPECT_FALSE(commandBufferGraphicsAllocation->isResident());
|
||||
|
||||
//preemption allocation
|
||||
size_t csrSurfaceCount = (tCsr->getMemoryManager()->device->getPreemptionMode() == PreemptionMode::MidThread) ? 2 : 0;
|
||||
size_t csrSurfaceCount = (device->getPreemptionMode() == PreemptionMode::MidThread) ? 2 : 0;
|
||||
|
||||
//preemption allocation +sip Kernel
|
||||
int ioctlExtraCnt = (PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]) == PreemptionMode::MidThread) ? 2 : 0;
|
||||
|
@ -1056,7 +1056,6 @@ TEST_F(DrmMemoryManagerTest, Given32BitDeviceWithMemoryManagerWhenInternalHeapIs
|
||||
DebugManager.flags.Force32bitAddressing.set(true);
|
||||
memoryManager->setForce32BitAllocations(true);
|
||||
std::unique_ptr<Device> pDevice(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
memoryManager->device = pDevice.get();
|
||||
|
||||
auto allocator = memoryManager->getDrmInternal32BitAllocator();
|
||||
size_t size = getSizeToMap();
|
||||
@ -1066,7 +1065,7 @@ TEST_F(DrmMemoryManagerTest, Given32BitDeviceWithMemoryManagerWhenInternalHeapIs
|
||||
size_t allocationSize = 4096 * 3;
|
||||
auto graphicsAllocation = memoryManager->allocate32BitGraphicsMemory(allocationSize, nullptr, AllocationOrigin::INTERNAL_ALLOCATION);
|
||||
EXPECT_EQ(nullptr, graphicsAllocation);
|
||||
EXPECT_TRUE(memoryManager->device->getDeviceInfo().force32BitAddressess);
|
||||
EXPECT_TRUE(pDevice->getDeviceInfo().force32BitAddressess);
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerTest, GivenMemoryManagerWhenAllocateGraphicsMemoryForImageIsCalledThenProperIoctlsAreCalledAndUnmapSizeIsNonZero) {
|
||||
|
@ -79,8 +79,6 @@ class WddmCommandStreamFixture {
|
||||
memManager.reset(mockWddmMM);
|
||||
csr->setMemoryManager(memManager.get());
|
||||
|
||||
memManager->device = device.get();
|
||||
|
||||
ASSERT_NE(nullptr, memManager);
|
||||
}
|
||||
|
||||
@ -93,6 +91,7 @@ class WddmCommandStreamFixture {
|
||||
template <typename GfxFamily>
|
||||
struct MockWddmCsr : public WddmCommandStreamReceiver<GfxFamily> {
|
||||
MockWddmCsr(const HardwareInfo &hwInfoIn, Wddm *wddm, ExecutionEnvironment &executionEnvironment) : WddmCommandStreamReceiver(hwInfoIn, wddm, executionEnvironment){};
|
||||
|
||||
using CommandStreamReceiver::commandStream;
|
||||
using CommandStreamReceiver::dispatchMode;
|
||||
using CommandStreamReceiver::getCS;
|
||||
@ -111,8 +110,12 @@ struct MockWddmCsr : public WddmCommandStreamReceiver<GfxFamily> {
|
||||
this->submissionAggregator.reset(newSubmissionsAggregator);
|
||||
}
|
||||
|
||||
void overrideRecorededCommandBuffer(Device &device) {
|
||||
recordedCommandBuffer = std::unique_ptr<CommandBuffer>(new CommandBuffer(device));
|
||||
}
|
||||
|
||||
int flushCalledCount = 0;
|
||||
CommandBuffer recordedCommandBuffer;
|
||||
std::unique_ptr<CommandBuffer> recordedCommandBuffer = nullptr;
|
||||
};
|
||||
|
||||
class WddmCommandStreamWithMockGdiFixture {
|
||||
@ -140,6 +143,7 @@ class WddmCommandStreamWithMockGdiFixture {
|
||||
executionEnvironment->memoryManager.reset(memManager);
|
||||
device = Device::create<MockDevice>(platformDevices[0], executionEnvironment);
|
||||
ASSERT_NE(nullptr, device);
|
||||
this->csr->overrideRecorededCommandBuffer(*device);
|
||||
if (device->getPreemptionMode() == PreemptionMode::MidThread) {
|
||||
preemptionAllocation = memManager->allocateGraphicsMemory(1024);
|
||||
}
|
||||
@ -779,9 +783,10 @@ using WddmSimpleTest = ::testing::Test;
|
||||
|
||||
HWTEST_F(WddmSimpleTest, givenDefaultWddmCsrWhenItIsCreatedThenBatchingIsTurnedOn) {
|
||||
DebugManager.flags.CsrDispatchMode.set(0);
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
ExecutionEnvironment *executionEnvironment = new ExecutionEnvironment;
|
||||
std::unique_ptr<MockDevice> device(Device::create<MockDevice>(platformDevices[0], executionEnvironment));
|
||||
auto wddm = Wddm::createWddm();
|
||||
std::unique_ptr<MockWddmCsr<FamilyType>> mockCsr(new MockWddmCsr<FamilyType>(*platformDevices[0], wddm, executionEnvironment));
|
||||
std::unique_ptr<MockWddmCsr<FamilyType>> mockCsr(new MockWddmCsr<FamilyType>(*platformDevices[0], wddm, *executionEnvironment));
|
||||
EXPECT_EQ(DispatchMode::BatchedDispatch, mockCsr->dispatchMode);
|
||||
}
|
||||
|
||||
@ -819,11 +824,12 @@ struct WddmCsrCompressionTests : ::testing::Test {
|
||||
HWTEST_F(WddmCsrCompressionTests, givenEnabledCompressionWhenInitializedThenCreatePagetableMngr) {
|
||||
bool compressionEnabled[2][2] = {{true, false}, {false, true}};
|
||||
for (size_t i = 0; i < 2; i++) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
ExecutionEnvironment *executionEnvironment = new ExecutionEnvironment;
|
||||
std::unique_ptr<MockDevice> device(Device::create<MockDevice>(platformDevices[0], executionEnvironment));
|
||||
setCompressionEnabled(compressionEnabled[i][0], compressionEnabled[i][1]);
|
||||
createMockWddm();
|
||||
EXPECT_EQ(nullptr, myMockWddm->getPageTableManager());
|
||||
MockWddmCsr<FamilyType> mockWddmCsr(hwInfo, myMockWddm, executionEnvironment);
|
||||
MockWddmCsr<FamilyType> mockWddmCsr(hwInfo, myMockWddm, *executionEnvironment);
|
||||
ASSERT_NE(nullptr, myMockWddm->getPageTableManager());
|
||||
|
||||
auto mockMngr = reinterpret_cast<MockGmmPageTableMngr *>(myMockWddm->getPageTableManager());
|
||||
@ -863,10 +869,11 @@ HWTEST_F(WddmCsrCompressionTests, givenEnabledCompressionWhenInitializedThenCrea
|
||||
}
|
||||
|
||||
HWTEST_F(WddmCsrCompressionTests, givenDisabledCompressionWhenInitializedThenDontCreatePagetableMngr) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
ExecutionEnvironment *executionEnvironment = new ExecutionEnvironment;
|
||||
std::unique_ptr<MockDevice> device(Device::create<MockDevice>(platformDevices[0], executionEnvironment));
|
||||
setCompressionEnabled(false, false);
|
||||
createMockWddm();
|
||||
MockWddmCsr<FamilyType> mockWddmCsr(hwInfo, myMockWddm, executionEnvironment);
|
||||
MockWddmCsr<FamilyType> mockWddmCsr(hwInfo, myMockWddm, *executionEnvironment);
|
||||
EXPECT_EQ(nullptr, myMockWddm->getPageTableManager());
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user