mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 14:55:24 +08:00
fix: Removing streamProvider and addressMapper
Related-To: NEO-14718 Signed-off-by: Aleksandra Nizio <aleksandra.nizio@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
42a8b63725
commit
31fe1978d4
@@ -8,7 +8,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "shared/source/aub/aub_center.h"
|
||||
#include "shared/source/aub/aub_stream_provider.h"
|
||||
#include "shared/source/aub_mem_dump/aub_mem_dump.h"
|
||||
#include "shared/test/common/mocks/mock_aub_file_stream.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
@@ -42,16 +42,6 @@ struct MockAubFileStreamMockMmioWrite : public AubMemDump::AubFileStream {
|
||||
std::vector<std::pair<uint32_t, uint32_t>> mmioList;
|
||||
};
|
||||
|
||||
template <typename GfxFamily>
|
||||
struct MockAubCsrToTestDumpContext : public AUBCommandStreamReceiverHw<GfxFamily> {
|
||||
using AUBCommandStreamReceiverHw<GfxFamily>::AUBCommandStreamReceiverHw;
|
||||
|
||||
void addContextToken(uint32_t dumpHandle) override {
|
||||
handle = dumpHandle;
|
||||
}
|
||||
uint32_t handle = 0;
|
||||
};
|
||||
|
||||
template <typename GfxFamily>
|
||||
struct MockAubCsr : public AUBCommandStreamReceiverHw<GfxFamily> {
|
||||
using CommandStreamReceiverHw<GfxFamily>::defaultSshSize;
|
||||
@@ -200,8 +190,6 @@ struct MockAubCsr : public AUBCommandStreamReceiverHw<GfxFamily> {
|
||||
bool fileIsOpen = false;
|
||||
std::string openFileName = "";
|
||||
|
||||
ADDMETHOD_NOBASE(addPatchInfoComments, bool, true, ());
|
||||
|
||||
using CommandStreamReceiverHw<GfxFamily>::localMemoryEnabled;
|
||||
};
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ using namespace NEO;
|
||||
|
||||
using AubCommandStreamReceiverTests = Test<AubCommandStreamReceiverFixture>;
|
||||
using AubCommandStreamReceiverWithoutAubStreamTests = Test<AubCommandStreamReceiverWithoutAubStreamFixture>;
|
||||
using AubCsrTests = Test<AubCommandStreamReceiverFixture>;
|
||||
|
||||
template <typename GfxFamily>
|
||||
struct MockAubCsrToTestDumpAubNonWritable : public AUBCommandStreamReceiverHw<GfxFamily> {
|
||||
@@ -130,42 +131,6 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenItIsCre
|
||||
EXPECT_NE(nullptr, memoryManager.get());
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenMultipleInstancesAreCreatedThenTheyOperateOnSingleFileStream) {
|
||||
auto aubCsr1 = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
auto aubCsr2 = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
EXPECT_EQ(aubCsr1->stream, aubCsr2->stream);
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenMultipleInstancesAreCreatedThenTheyUseTheSameFileStream) {
|
||||
auto aubCsr1 = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
auto streamProvider1 = pDevice->executionEnvironment->rootDeviceEnvironments[0]->aubCenter->getStreamProvider();
|
||||
EXPECT_NE(nullptr, streamProvider1);
|
||||
auto aubCsr2 = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
auto streamProvider2 = pDevice->executionEnvironment->rootDeviceEnvironments[0]->aubCenter->getStreamProvider();
|
||||
EXPECT_NE(nullptr, streamProvider2);
|
||||
EXPECT_EQ(streamProvider1, streamProvider2);
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenMultipleInstancesAreCreatedThenTheyUseTheSamePhysicalAddressAllocator) {
|
||||
auto aubCsr1 = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
auto physicalAddressAllocator1 = pDevice->executionEnvironment->rootDeviceEnvironments[0]->aubCenter->getPhysicalAddressAllocator();
|
||||
EXPECT_NE(nullptr, physicalAddressAllocator1);
|
||||
auto aubCsr2 = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
auto physicalAddressAllocator2 = pDevice->executionEnvironment->rootDeviceEnvironments[0]->aubCenter->getPhysicalAddressAllocator();
|
||||
EXPECT_NE(nullptr, physicalAddressAllocator2);
|
||||
EXPECT_EQ(physicalAddressAllocator1, physicalAddressAllocator2);
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenMultipleInstancesAreCreatedThenTheyUseTheSameAddressMapper) {
|
||||
auto aubCsr1 = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
auto addressMapper1 = pDevice->executionEnvironment->rootDeviceEnvironments[0]->aubCenter->getAddressMapper();
|
||||
EXPECT_NE(nullptr, addressMapper1);
|
||||
auto aubCsr2 = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
auto addressMapper2 = pDevice->executionEnvironment->rootDeviceEnvironments[0]->aubCenter->getAddressMapper();
|
||||
EXPECT_NE(nullptr, addressMapper2);
|
||||
EXPECT_EQ(addressMapper1, addressMapper2);
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenMultipleInstancesAreCreatedThenTheyUseTheSameSubCaptureCommon) {
|
||||
auto aubCsr1 = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
auto subCaptureCommon1 = pDevice->executionEnvironment->rootDeviceEnvironments[0]->aubCenter->getSubCaptureCommon();
|
||||
@@ -287,43 +252,6 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWhenMakeResidentC
|
||||
memoryManager->freeGraphicsMemory(gfxAllocation);
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverWithoutAubStreamTests, givenAubCommandStreamReceiverWhenMultipleInstancesInitializeTheirEnginesThenUniqueGlobalGttAddressesAreGenerated) {
|
||||
pDevice->executionEnvironment->rootDeviceEnvironments[0]->aubCenter.reset(new AubCenter);
|
||||
|
||||
auto &gfxCoreHelper = pDevice->getGfxCoreHelper();
|
||||
auto engineInstance = gfxCoreHelper.getGpgpuEngineInstances(pDevice->getRootDeviceEnvironment())[0];
|
||||
MockOsContext osContext(0, EngineDescriptorHelper::getDefaultDescriptor(engineInstance));
|
||||
|
||||
auto aubCsr1 = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
auto aubCsr2 = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
|
||||
aubCsr1->setupContext(osContext);
|
||||
aubCsr1->initializeEngine();
|
||||
EXPECT_NE(0u, aubCsr1->engineInfo.ggttLRCA);
|
||||
EXPECT_NE(0u, aubCsr1->engineInfo.ggttHWSP);
|
||||
EXPECT_NE(0u, aubCsr1->engineInfo.ggttRingBuffer);
|
||||
|
||||
aubCsr2->setupContext(osContext);
|
||||
aubCsr2->initializeEngine();
|
||||
EXPECT_NE(aubCsr1->engineInfo.ggttLRCA, aubCsr2->engineInfo.ggttLRCA);
|
||||
EXPECT_NE(aubCsr1->engineInfo.ggttHWSP, aubCsr2->engineInfo.ggttHWSP);
|
||||
EXPECT_NE(aubCsr1->engineInfo.ggttRingBuffer, aubCsr2->engineInfo.ggttRingBuffer);
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverWithoutAubStreamTests, givenAubCommandStreamReceiverWhenFlushIsCalledThenItShouldInitializeEngineInfo) {
|
||||
auto aubExecutionEnvironment = getEnvironment<AUBCommandStreamReceiverHw<FamilyType>>(true, true, true);
|
||||
auto aubCsr = aubExecutionEnvironment->template getCsr<AUBCommandStreamReceiverHw<FamilyType>>();
|
||||
aubCsr->hardwareContextController.reset(nullptr);
|
||||
LinearStream cs(aubExecutionEnvironment->commandBuffer);
|
||||
|
||||
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed());
|
||||
ResidencyContainer allocationsForResidency = {};
|
||||
aubCsr->flush(batchBuffer, allocationsForResidency);
|
||||
EXPECT_NE(nullptr, aubCsr->engineInfo.pLRCA);
|
||||
EXPECT_NE(nullptr, aubCsr->engineInfo.pGlobalHWStatusPage);
|
||||
EXPECT_NE(nullptr, aubCsr->engineInfo.pRingBuffer);
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptureModeWhenProcessResidencyIsCalledButSubCaptureIsDisabledThenItShouldntWriteMemory) {
|
||||
AubSubCaptureCommon aubSubCaptureCommon;
|
||||
auto aubSubCaptureManagerMock = new AubSubCaptureManagerMock("", aubSubCaptureCommon);
|
||||
|
||||
@@ -168,22 +168,6 @@ HWTEST_F(FlatBatchBufferHelperAubTests, givenAubCommandStreamReceiverWhenRemoveP
|
||||
EXPECT_EQ(0u, aubCsr->getFlatBatchBufferHelper().getPatchInfoCollection().size());
|
||||
}
|
||||
|
||||
HWTEST_F(FlatBatchBufferHelperAubTests, givenAubCommandStreamReceiverWhenAddGucStartMessageIsCalledThenBatchBufferAddressIsStoredInPatchInfoCollection) {
|
||||
debugManager.flags.AddPatchInfoCommentsForAUBDump.set(true);
|
||||
|
||||
auto aubExecutionEnvironment = getEnvironment<AUBCommandStreamReceiverHw<FamilyType>>(false, false, true);
|
||||
auto aubCsr = aubExecutionEnvironment->template getCsr<AUBCommandStreamReceiverHw<FamilyType>>();
|
||||
LinearStream cs(aubExecutionEnvironment->commandBuffer);
|
||||
|
||||
std::unique_ptr<char[]> batchBuffer(new char[1024]);
|
||||
aubCsr->addGUCStartMessage(static_cast<uint64_t>(reinterpret_cast<std::uintptr_t>(batchBuffer.get())));
|
||||
|
||||
auto &patchInfoCollection = aubCsr->getFlatBatchBufferHelper().getPatchInfoCollection();
|
||||
ASSERT_EQ(1u, patchInfoCollection.size());
|
||||
EXPECT_EQ(patchInfoCollection[0].sourceAllocation, reinterpret_cast<uint64_t>(batchBuffer.get()));
|
||||
EXPECT_EQ(patchInfoCollection[0].targetType, PatchInfoAllocationType::gucStartMessage);
|
||||
}
|
||||
|
||||
HWTEST_F(FlatBatchBufferHelperAubTests, givenAubCommandStreamReceiverWhenForcedBatchBufferFlatteningInBatchedDispatchModeThenNewCombinedBatchBufferIsCreated) {
|
||||
debugManager.flags.AddPatchInfoCommentsForAUBDump.set(true);
|
||||
debugManager.flags.CsrDispatchMode.set(static_cast<uint32_t>(DispatchMode::batchedDispatch));
|
||||
@@ -431,38 +415,6 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenForcedF
|
||||
EXPECT_EQ(aubCsr->getOsContext().getDeviceBitfield().to_ulong(), mockHelper->flattenBatchBufferParamsPassed[0].deviceBitfield.to_ulong());
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenAddPatchInfoCommentsForAUBDumpIsSetThenAddPatchInfoCommentsIsCalled) {
|
||||
DebugManagerStateRestore stateRestore;
|
||||
debugManager.flags.AddPatchInfoCommentsForAUBDump.set(true);
|
||||
|
||||
auto aubExecutionEnvironment = getEnvironment<MockAubCsr<FamilyType>>(true, true, true);
|
||||
auto aubCsr = aubExecutionEnvironment->template getCsr<MockAubCsr<FamilyType>>();
|
||||
|
||||
aubCsr->hardwareContextController.reset(nullptr);
|
||||
|
||||
LinearStream cs(aubExecutionEnvironment->commandBuffer);
|
||||
|
||||
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed());
|
||||
|
||||
ResidencyContainer allocationsForResidency;
|
||||
|
||||
aubCsr->flush(batchBuffer, allocationsForResidency);
|
||||
EXPECT_EQ(1u, aubCsr->addPatchInfoCommentsCalled);
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenAddPatchInfoCommentsForAUBDumpIsNotSetThenAddPatchInfoCommentsIsNotCalled) {
|
||||
auto aubExecutionEnvironment = getEnvironment<MockAubCsr<FamilyType>>(true, true, true);
|
||||
auto aubCsr = aubExecutionEnvironment->template getCsr<MockAubCsr<FamilyType>>();
|
||||
LinearStream cs(aubExecutionEnvironment->commandBuffer);
|
||||
|
||||
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed());
|
||||
|
||||
ResidencyContainer allocationsForResidency;
|
||||
|
||||
aubCsr->flush(batchBuffer, allocationsForResidency);
|
||||
EXPECT_EQ(0u, aubCsr->addPatchInfoCommentsCalled);
|
||||
}
|
||||
|
||||
HWTEST_F(FlatBatchBufferHelperAubTests, givenAubCommandStreamReceiverWhenGetIndirectPatchCommandsIsCalledForEmptyPatchInfoListThenIndirectPatchCommandBufferIsNotCreated) {
|
||||
auto aubExecutionEnvironment = getEnvironment<AUBCommandStreamReceiverHw<FamilyType>>(false, false, true);
|
||||
auto aubCsr = aubExecutionEnvironment->template getCsr<AUBCommandStreamReceiverHw<FamilyType>>();
|
||||
@@ -812,158 +764,6 @@ HWTEST_F(AubCommandStreamReceiverTests, whenAubCommandStreamReceiverIsCreatedThe
|
||||
EXPECT_NE(0u, physicalAddress);
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenEngineIsInitializedThenDumpHandleIsGenerated) {
|
||||
MockExecutionEnvironment executionEnvironment(defaultHwInfo.get());
|
||||
auto &gfxCoreHelper = executionEnvironment.rootDeviceEnvironments[0]->getHelper<GfxCoreHelper>();
|
||||
auto engineInstance = gfxCoreHelper.getGpgpuEngineInstances(*executionEnvironment.rootDeviceEnvironments[0])[0];
|
||||
DeviceBitfield deviceBitfield(1);
|
||||
MockOsContext osContext(0, EngineDescriptorHelper::getDefaultDescriptor(engineInstance, deviceBitfield));
|
||||
executionEnvironment.initializeMemoryManager();
|
||||
|
||||
auto aubCsr = std::make_unique<MockAubCsrToTestDumpContext<FamilyType>>("", true, executionEnvironment, 0, deviceBitfield);
|
||||
EXPECT_NE(nullptr, aubCsr);
|
||||
EXPECT_EQ(nullptr, aubCsr->hardwareContextController.get());
|
||||
aubCsr->aubManager = nullptr;
|
||||
|
||||
aubCsr->setupContext(osContext);
|
||||
aubCsr->initializeEngine();
|
||||
EXPECT_NE(0u, aubCsr->handle);
|
||||
}
|
||||
|
||||
using InjectMmmioTest = Test<DeviceFixture>;
|
||||
|
||||
HWTEST_F(InjectMmmioTest, givenAddMmioKeySetToZeroWhenInitAdditionalMmioCalledThenDoNotWriteMmio) {
|
||||
DebugManagerStateRestore stateRestore;
|
||||
debugManager.flags.AubDumpAddMmioRegistersList.set("");
|
||||
|
||||
auto aubCsr = std::make_unique<MockAubCsrToTestDumpContext<FamilyType>>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
EXPECT_NE(nullptr, aubCsr);
|
||||
|
||||
auto stream = std::make_unique<MockAubFileStreamMockMmioWrite>();
|
||||
aubCsr->stream = stream.get();
|
||||
EXPECT_EQ(0u, stream->mmioList.size());
|
||||
aubCsr->initAdditionalMMIO();
|
||||
EXPECT_EQ(0u, stream->mmioList.size());
|
||||
}
|
||||
|
||||
HWTEST_F(InjectMmmioTest, givenAddMmioRegistersListSetWhenInitAdditionalMmioCalledThenWriteGivenMmio) {
|
||||
std::string registers("0xdead;0xbeef;and another very long string");
|
||||
MMIOPair mmioPair(0xdead, 0xbeef);
|
||||
|
||||
DebugManagerStateRestore stateRestore;
|
||||
debugManager.flags.AubDumpAddMmioRegistersList.set(registers);
|
||||
|
||||
auto aubCsr = std::make_unique<MockAubCsrToTestDumpContext<FamilyType>>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
EXPECT_NE(nullptr, aubCsr);
|
||||
|
||||
auto stream = std::make_unique<MockAubFileStreamMockMmioWrite>();
|
||||
aubCsr->stream = stream.get();
|
||||
EXPECT_EQ(0u, stream->mmioList.size());
|
||||
aubCsr->initAdditionalMMIO();
|
||||
EXPECT_EQ(1u, stream->mmioList.size());
|
||||
EXPECT_TRUE(stream->isOnMmioList(mmioPair));
|
||||
};
|
||||
|
||||
HWTEST_F(InjectMmmioTest, givenLongSequenceOfAddMmioRegistersListSetWhenInitAdditionalMmioCalledThenWriteGivenMmio) {
|
||||
std::string registers("1;1;2;2;3;3");
|
||||
|
||||
DebugManagerStateRestore stateRestore;
|
||||
debugManager.flags.AubDumpAddMmioRegistersList.set(registers);
|
||||
|
||||
auto aubCsr = std::make_unique<MockAubCsrToTestDumpContext<FamilyType>>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
EXPECT_NE(nullptr, aubCsr);
|
||||
|
||||
auto stream = std::make_unique<MockAubFileStreamMockMmioWrite>();
|
||||
aubCsr->stream = stream.get();
|
||||
EXPECT_EQ(0u, stream->mmioList.size());
|
||||
aubCsr->initAdditionalMMIO();
|
||||
EXPECT_EQ(3u, stream->mmioList.size());
|
||||
}
|
||||
|
||||
HWTEST_F(InjectMmmioTest, givenSequenceWithIncompletePairOfAddMmioRegistersListSetWhenInitAdditionalMmioCalledThenWriteGivenMmio) {
|
||||
std::string registers("0x1;0x1;0x2");
|
||||
MMIOPair mmioPair0(0x1, 0x1);
|
||||
MMIOPair mmioPair1(0x2, 0x2);
|
||||
|
||||
DebugManagerStateRestore stateRestore;
|
||||
debugManager.flags.AubDumpAddMmioRegistersList.set(registers);
|
||||
|
||||
auto aubCsr = std::make_unique<MockAubCsrToTestDumpContext<FamilyType>>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
EXPECT_NE(nullptr, aubCsr);
|
||||
|
||||
auto stream = std::make_unique<MockAubFileStreamMockMmioWrite>();
|
||||
aubCsr->stream = stream.get();
|
||||
EXPECT_EQ(0u, stream->mmioList.size());
|
||||
aubCsr->initAdditionalMMIO();
|
||||
EXPECT_EQ(1u, stream->mmioList.size());
|
||||
EXPECT_TRUE(stream->isOnMmioList(mmioPair0));
|
||||
EXPECT_FALSE(stream->isOnMmioList(mmioPair1));
|
||||
}
|
||||
|
||||
HWTEST_F(InjectMmmioTest, givenAddMmioRegistersListSetWithSemicolonAtTheEndWhenInitAdditionalMmioCalledThenWriteGivenMmio) {
|
||||
std::string registers("0xdead;0xbeef;");
|
||||
MMIOPair mmioPair(0xdead, 0xbeef);
|
||||
|
||||
DebugManagerStateRestore stateRestore;
|
||||
debugManager.flags.AubDumpAddMmioRegistersList.set(registers);
|
||||
|
||||
auto aubCsr = std::make_unique<MockAubCsrToTestDumpContext<FamilyType>>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
EXPECT_NE(nullptr, aubCsr);
|
||||
|
||||
auto stream = std::make_unique<MockAubFileStreamMockMmioWrite>();
|
||||
aubCsr->stream = stream.get();
|
||||
EXPECT_EQ(0u, stream->mmioList.size());
|
||||
aubCsr->initAdditionalMMIO();
|
||||
EXPECT_EQ(1u, stream->mmioList.size());
|
||||
EXPECT_TRUE(stream->isOnMmioList(mmioPair));
|
||||
}
|
||||
|
||||
HWTEST_F(InjectMmmioTest, givenAddMmioRegistersListSetWithInvalidValueWhenInitAdditionalMmioCalledThenMmioIsNotWritten) {
|
||||
std::string registers("0xdead;invalid");
|
||||
|
||||
DebugManagerStateRestore stateRestore;
|
||||
debugManager.flags.AubDumpAddMmioRegistersList.set(registers);
|
||||
|
||||
auto aubCsr = std::make_unique<MockAubCsrToTestDumpContext<FamilyType>>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
EXPECT_NE(nullptr, aubCsr);
|
||||
|
||||
auto stream = std::make_unique<MockAubFileStreamMockMmioWrite>();
|
||||
aubCsr->stream = stream.get();
|
||||
EXPECT_EQ(0u, stream->mmioList.size());
|
||||
aubCsr->initAdditionalMMIO();
|
||||
EXPECT_EQ(0u, stream->mmioList.size());
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCsrWhenAskedForMemoryExpectationThenPassValidCompareOperationType) {
|
||||
class MyMockAubCsr : public AUBCommandStreamReceiverHw<FamilyType> {
|
||||
public:
|
||||
using AUBCommandStreamReceiverHw<FamilyType>::AUBCommandStreamReceiverHw;
|
||||
|
||||
bool expectMemory(const void *gfxAddress, const void *srcAddress, size_t length, uint32_t compareOperation) override {
|
||||
inputCompareOperation = compareOperation;
|
||||
return this->AUBCommandStreamReceiverHw<FamilyType>::expectMemory(gfxAddress, srcAddress, length, compareOperation);
|
||||
}
|
||||
uint32_t inputCompareOperation = 0;
|
||||
};
|
||||
void *mockAddress = reinterpret_cast<void *>(1);
|
||||
uint32_t compareNotEqual = AubMemDump::CmdServicesMemTraceMemoryCompare::CompareOperationValues::CompareNotEqual;
|
||||
uint32_t compareEqual = AubMemDump::CmdServicesMemTraceMemoryCompare::CompareOperationValues::CompareEqual;
|
||||
|
||||
auto mockStream = std::make_unique<MockAubFileStream>();
|
||||
MyMockAubCsr myMockCsr(std::string(), true, *pDevice->getExecutionEnvironment(), pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
myMockCsr.setupContext(pDevice->commandStreamReceivers[0]->getOsContext());
|
||||
myMockCsr.stream = mockStream.get();
|
||||
myMockCsr.hardwareContextController.reset(nullptr);
|
||||
|
||||
myMockCsr.expectMemoryNotEqual(mockAddress, mockAddress, 1);
|
||||
EXPECT_EQ(compareNotEqual, myMockCsr.inputCompareOperation);
|
||||
EXPECT_EQ(compareNotEqual, mockStream->compareOperationFromExpectMemory);
|
||||
|
||||
myMockCsr.expectMemoryEqual(mockAddress, mockAddress, 1);
|
||||
EXPECT_EQ(compareEqual, myMockCsr.inputCompareOperation);
|
||||
EXPECT_EQ(compareEqual, mockStream->compareOperationFromExpectMemory);
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenObtainingPreferredTagPoolSizeThenReturnOne) {
|
||||
auto aubCsr = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
EXPECT_EQ(1u, aubCsr->getPreferredTagPoolSize());
|
||||
|
||||
@@ -38,15 +38,7 @@ using namespace NEO;
|
||||
|
||||
using AubFileStreamTests = Test<AubCommandStreamReceiverFixture>;
|
||||
using AubFileStreamWithoutAubStreamTests = Test<AubCommandStreamReceiverWithoutAubStreamFixture>;
|
||||
|
||||
struct AddPatchInfoCommentsAubTests : AubFileStreamWithoutAubStreamTests {
|
||||
void SetUp() override {
|
||||
debugManager.flags.AddPatchInfoCommentsForAUBDump.set(true);
|
||||
AubFileStreamWithoutAubStreamTests::SetUp();
|
||||
}
|
||||
|
||||
DebugManagerStateRestore restore;
|
||||
};
|
||||
using AubCsrTests = Test<AubCommandStreamReceiverFixture>;
|
||||
|
||||
HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenInitFileIsCalledWithInvalidFileNameThenFileIsNotOpened) {
|
||||
auto aubCsr = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
@@ -55,18 +47,7 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenInitFileIsCalledWi
|
||||
EXPECT_THROW(aubCsr->initFile(invalidFileName), std::exception);
|
||||
}
|
||||
|
||||
HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWithoutAubManagerWhenInitFileIsCalledWithInvalidFileNameThenFileIsNotOpened) {
|
||||
MockExecutionEnvironment executionEnvironment(defaultHwInfo.get());
|
||||
executionEnvironment.initializeMemoryManager();
|
||||
DeviceBitfield deviceBitfield(1);
|
||||
auto aubCsr = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>("", true, executionEnvironment, 0, deviceBitfield);
|
||||
std::string invalidFileName = "";
|
||||
aubCsr->aubManager = nullptr;
|
||||
|
||||
EXPECT_THROW(aubCsr->initFile(invalidFileName), std::exception);
|
||||
}
|
||||
|
||||
HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenInitFileIsCalledThenFileIsOpenedAndFileNameIsStored) {
|
||||
HWTEST_F(AubCsrTests, givenAubCommandStreamReceiverWhenInitFileIsCalledThenFileIsOpenedAndFileNameIsStored) {
|
||||
auto aubCsr = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
std::string fileName = "file_name.aub";
|
||||
|
||||
@@ -79,7 +60,7 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenInitFileIsCalledTh
|
||||
EXPECT_TRUE(aubCsr->getFileName().empty());
|
||||
}
|
||||
|
||||
HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenReopenFileIsCalledThenFileWithSpecifiedNameIsReopened) {
|
||||
HWTEST_F(AubCsrTests, givenAubCommandStreamReceiverWhenReopenFileIsCalledThenFileWithSpecifiedNameIsReopened) {
|
||||
auto aubCsr = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
std::string fileName = "file_name.aub";
|
||||
std::string newFileName = "new_file_name.aub";
|
||||
@@ -93,20 +74,6 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenReopenFileIsCalled
|
||||
EXPECT_STREQ(newFileName.c_str(), aubCsr->getFileName().c_str());
|
||||
}
|
||||
|
||||
HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWithoutAubManagerWhenInitFileIsCalledThenFileShouldBeInitializedWithHeaderOnce) {
|
||||
auto mockAubFileStream = std::make_unique<MockAubFileStream>();
|
||||
auto aubCsr = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
std::string fileName = "file_name.aub";
|
||||
aubCsr->aubManager = nullptr;
|
||||
aubCsr->stream = mockAubFileStream.get();
|
||||
|
||||
aubCsr->initFile(fileName);
|
||||
aubCsr->initFile(fileName);
|
||||
|
||||
EXPECT_EQ(1u, mockAubFileStream->openCalledCnt);
|
||||
EXPECT_EQ(1u, mockAubFileStream->initCalledCnt);
|
||||
}
|
||||
|
||||
HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWithAubManagerWhenInitFileIsCalledThenFileShouldBeInitializedOnce) {
|
||||
auto mockAubManager = std::make_unique<MockAubManager>();
|
||||
auto aubCsr = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
@@ -119,29 +86,7 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWithAubManagerWhenInit
|
||||
EXPECT_EQ(1u, mockAubManager->openCalledCnt);
|
||||
}
|
||||
|
||||
HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWithoutAubManagerWhenFileFunctionsAreCalledThenTheyShouldCallTheExpectedAubManagerFunctions) {
|
||||
auto mockAubFileStream = std::make_unique<MockAubFileStream>();
|
||||
auto aubCsr = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
std::string fileName = "file_name.aub";
|
||||
aubCsr->aubManager = nullptr;
|
||||
aubCsr->stream = mockAubFileStream.get();
|
||||
|
||||
aubCsr->initFile(fileName);
|
||||
EXPECT_EQ(1u, mockAubFileStream->initCalledCnt);
|
||||
|
||||
EXPECT_TRUE(aubCsr->isFileOpen());
|
||||
EXPECT_TRUE(mockAubFileStream->isOpenCalled);
|
||||
|
||||
EXPECT_STREQ(fileName.c_str(), aubCsr->getFileName().c_str());
|
||||
EXPECT_TRUE(mockAubFileStream->getFileNameCalled);
|
||||
|
||||
aubCsr->closeFile();
|
||||
EXPECT_FALSE(aubCsr->isFileOpen());
|
||||
EXPECT_TRUE(aubCsr->getFileName().empty());
|
||||
EXPECT_TRUE(mockAubFileStream->closeCalled);
|
||||
}
|
||||
|
||||
HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWithAubManagerWhenFileFunctionsAreCalledThenTheyShouldCallTheExpectedAubManagerFunctions) {
|
||||
HWTEST_F(AubCsrTests, givenAubCommandStreamReceiverWithAubManagerWhenFileFunctionsAreCalledThenTheyShouldCallTheExpectedAubManagerFunctions) {
|
||||
auto mockAubManager = std::make_unique<MockAubManager>();
|
||||
auto aubCsr = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
std::string fileName = "file_name.aub";
|
||||
@@ -253,42 +198,8 @@ HWTEST_F(AubFileStreamWithoutAubStreamTests, givenAubCommandStreamReceiverWhenDu
|
||||
aubCsr->dumpAllocation(allocation);
|
||||
EXPECT_TRUE(aubCsr->lockStreamCalled);
|
||||
}
|
||||
|
||||
HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenFlushIsCalledThenItShouldCallTheExpectedFunctions) {
|
||||
auto aubExecutionEnvironment = getEnvironment<MockAubCsr<FamilyType>>(true, true, true);
|
||||
auto aubCsr = aubExecutionEnvironment->template getCsr<MockAubCsr<FamilyType>>();
|
||||
aubCsr->aubManager = nullptr;
|
||||
LinearStream cs(aubExecutionEnvironment->commandBuffer);
|
||||
|
||||
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed());
|
||||
ResidencyContainer allocationsForResidency = {};
|
||||
|
||||
aubCsr->flush(batchBuffer, allocationsForResidency);
|
||||
|
||||
EXPECT_TRUE(aubCsr->initializeEngineCalled);
|
||||
EXPECT_TRUE(aubCsr->writeMemoryCalled);
|
||||
EXPECT_TRUE(aubCsr->submitBatchBufferCalled);
|
||||
EXPECT_FALSE(aubCsr->pollForCompletionCalled);
|
||||
}
|
||||
|
||||
HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenCallingAddAubCommentThenCallAddCommentOnAubFileStream) {
|
||||
DebugManagerStateRestore stateRestore;
|
||||
|
||||
auto aubFileStream = std::make_unique<MockAubFileStream>();
|
||||
auto aubExecutionEnvironment = getEnvironment<MockAubCsr<FamilyType>>(true, true, true);
|
||||
auto aubCsr = aubExecutionEnvironment->template getCsr<MockAubCsr<FamilyType>>();
|
||||
aubCsr->stream = aubFileStream.get();
|
||||
aubCsr->aubManager = nullptr;
|
||||
|
||||
const char *comment = "message";
|
||||
aubCsr->addAubComment(comment);
|
||||
|
||||
EXPECT_TRUE(aubCsr->addAubCommentCalled);
|
||||
EXPECT_LT(0u, aubFileStream->addCommentCalled);
|
||||
EXPECT_STREQ(comment, aubFileStream->comments[0].c_str());
|
||||
}
|
||||
|
||||
HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWithAubManagerWhenCallingAddAubCommentThenCallAddCommentOnAubManager) {
|
||||
using AubCsrTests = Test<AubCommandStreamReceiverFixture>;
|
||||
HWTEST_F(AubCsrTests, givenAubCommandStreamReceiverWithAubManagerWhenCallingAddAubCommentThenCallAddCommentOnAubManager) {
|
||||
MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
MockOsContext osContext(0, EngineDescriptorHelper::getDefaultDescriptor());
|
||||
aubCsr.setupContext(osContext);
|
||||
@@ -311,22 +222,6 @@ HWTEST_F(AubFileStreamWithoutAubStreamTests, givenAubCommandStreamReceiverWhenCa
|
||||
EXPECT_TRUE(aubCsr->pollForCompletionCalled);
|
||||
}
|
||||
|
||||
HWTEST_F(AubFileStreamTests, givenNewTaskSinceLastPollWhenCallingPollForCompletionThenCallRegisterPoll) {
|
||||
auto aubStream = std::make_unique<MockAubFileStream>();
|
||||
auto aubExecutionEnvironment = getEnvironment<MockAubCsr<FamilyType>>(true, true, true);
|
||||
auto aubCsr = aubExecutionEnvironment->template getCsr<MockAubCsr<FamilyType>>();
|
||||
aubCsr->hardwareContextController.reset(nullptr);
|
||||
aubCsr->stream = aubStream.get();
|
||||
|
||||
aubCsr->latestSentTaskCount = 50;
|
||||
aubCsr->pollForCompletionTaskCount = 49;
|
||||
ASSERT_FALSE(aubStream->registerPollCalled);
|
||||
|
||||
aubCsr->pollForCompletion();
|
||||
EXPECT_TRUE(aubStream->registerPollCalled);
|
||||
EXPECT_EQ(50u, aubCsr->pollForCompletionTaskCount);
|
||||
}
|
||||
|
||||
HWTEST_F(AubFileStreamWithoutAubStreamTests, givenNoNewTasksSinceLastPollWhenCallingPollForCompletionThenDontCallRegisterPoll) {
|
||||
auto aubStream = std::make_unique<MockAubFileStream>();
|
||||
auto aubExecutionEnvironment = getEnvironment<MockAubCsr<FamilyType>>(true, true, true);
|
||||
@@ -342,21 +237,6 @@ HWTEST_F(AubFileStreamWithoutAubStreamTests, givenNoNewTasksSinceLastPollWhenCal
|
||||
EXPECT_EQ(50u, aubCsr->pollForCompletionTaskCount);
|
||||
}
|
||||
|
||||
HWTEST_F(AubFileStreamTests, givenNewTaskSinceLastPollWhenDeletingAubCsrThenCallRegisterPoll) {
|
||||
auto aubStream = std::make_unique<MockAubFileStream>();
|
||||
auto aubExecutionEnvironment = getEnvironment<MockAubCsr<FamilyType>>(true, true, true);
|
||||
auto aubCsr = aubExecutionEnvironment->template getCsr<MockAubCsr<FamilyType>>();
|
||||
aubCsr->hardwareContextController.reset(nullptr);
|
||||
aubCsr->stream = aubStream.get();
|
||||
|
||||
aubCsr->latestSentTaskCount = 50;
|
||||
aubCsr->pollForCompletionTaskCount = 49;
|
||||
ASSERT_FALSE(aubStream->registerPollCalled);
|
||||
|
||||
aubExecutionEnvironment->commandStreamReceiver.reset();
|
||||
EXPECT_TRUE(aubStream->registerPollCalled);
|
||||
}
|
||||
|
||||
HWTEST_F(AubFileStreamWithoutAubStreamTests, givenNoNewTaskSinceLastPollWhenDeletingAubCsrThenDontCallRegisterPoll) {
|
||||
auto aubStream = std::make_unique<MockAubFileStream>();
|
||||
auto aubExecutionEnvironment = getEnvironment<MockAubCsr<FamilyType>>(true, true, true);
|
||||
@@ -371,7 +251,7 @@ HWTEST_F(AubFileStreamWithoutAubStreamTests, givenNoNewTaskSinceLastPollWhenDele
|
||||
EXPECT_FALSE(aubStream->registerPollCalled);
|
||||
}
|
||||
|
||||
HWTEST_F(AubFileStreamTests, givenNewTasksAndHardwareContextPresentWhenCallingPollForCompletionThenCallPollForCompletion) {
|
||||
HWTEST_F(AubCsrTests, givenNewTasksAndHardwareContextPresentWhenCallingPollForCompletionThenCallPollForCompletion) {
|
||||
MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
MockOsContext osContext(0, EngineDescriptorHelper::getDefaultDescriptor());
|
||||
aubCsr.setupContext(osContext);
|
||||
@@ -385,7 +265,7 @@ HWTEST_F(AubFileStreamTests, givenNewTasksAndHardwareContextPresentWhenCallingPo
|
||||
EXPECT_TRUE(hardwareContext->pollForCompletionCalled);
|
||||
}
|
||||
|
||||
HWTEST_F(AubFileStreamTests, givenNoNewTasksAndHardwareContextPresentWhenCallingPollForCompletionThenDontCallPollForCompletion) {
|
||||
HWTEST_F(AubCsrTests, givenNoNewTasksAndHardwareContextPresentWhenCallingPollForCompletionThenDontCallPollForCompletion) {
|
||||
MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
MockOsContext osContext(0, EngineDescriptorHelper::getDefaultDescriptor());
|
||||
aubCsr.setupContext(osContext);
|
||||
@@ -399,64 +279,6 @@ HWTEST_F(AubFileStreamTests, givenNoNewTasksAndHardwareContextPresentWhenCalling
|
||||
EXPECT_FALSE(hardwareContext->pollForCompletionCalled);
|
||||
}
|
||||
|
||||
HWTEST_F(AubFileStreamWithoutAubStreamTests, givenNoNewTasksSinceLastPollWhenCallingExpectMemoryThenDontCallRegisterPoll) {
|
||||
auto aubStream = std::make_unique<MockAubFileStream>();
|
||||
auto aubExecutionEnvironment = getEnvironment<MockAubCsr<FamilyType>>(true, true, true);
|
||||
auto aubCsr = aubExecutionEnvironment->template getCsr<MockAubCsr<FamilyType>>();
|
||||
aubCsr->stream = aubStream.get();
|
||||
|
||||
aubCsr->latestSentTaskCount = 50;
|
||||
aubCsr->pollForCompletionTaskCount = 50;
|
||||
ASSERT_FALSE(aubStream->registerPollCalled);
|
||||
|
||||
MockGraphicsAllocation allocation(reinterpret_cast<void *>(0x1000), 0x1000);
|
||||
aubCsr->expectMemoryNotEqual(reinterpret_cast<void *>(0x1000), reinterpret_cast<void *>(0x1000), 0x1000);
|
||||
|
||||
EXPECT_FALSE(aubStream->registerPollCalled);
|
||||
}
|
||||
|
||||
HWTEST_F(AubFileStreamWithoutAubStreamTests, givenNewTasksSinceLastPollWhenCallingExpectMemoryThenCallRegisterPoll) {
|
||||
auto aubStream = std::make_unique<MockAubFileStream>();
|
||||
auto aubExecutionEnvironment = getEnvironment<MockAubCsr<FamilyType>>(true, true, true);
|
||||
auto aubCsr = aubExecutionEnvironment->template getCsr<MockAubCsr<FamilyType>>();
|
||||
aubCsr->hardwareContextController.reset(nullptr);
|
||||
aubCsr->stream = aubStream.get();
|
||||
|
||||
aubCsr->latestSentTaskCount = 50;
|
||||
aubCsr->pollForCompletionTaskCount = 49;
|
||||
ASSERT_FALSE(aubStream->registerPollCalled);
|
||||
|
||||
MockGraphicsAllocation allocation(reinterpret_cast<void *>(0x1000), 0x1000);
|
||||
aubCsr->expectMemoryNotEqual(reinterpret_cast<void *>(0x1000), reinterpret_cast<void *>(0x1000), 0x1000);
|
||||
|
||||
EXPECT_TRUE(aubStream->registerPollCalled);
|
||||
}
|
||||
|
||||
HWTEST_F(AubFileStreamWithoutAubStreamTests, givenAubCommandStreamReceiverInSubCaptureModeWhenPollForCompletionIsCalledAndSubCaptureIsEnabledThenItShouldCallRegisterPoll) {
|
||||
DebugManagerStateRestore stateRestore;
|
||||
AubSubCaptureCommon aubSubCaptureCommon;
|
||||
auto aubSubCaptureManagerMock = new AubSubCaptureManagerMock("", aubSubCaptureCommon);
|
||||
auto aubStream = std::make_unique<MockAubFileStream>();
|
||||
auto aubExecutionEnvironment = getEnvironment<MockAubCsr<FamilyType>>(true, true, true);
|
||||
auto aubCsr = aubExecutionEnvironment->template getCsr<MockAubCsr<FamilyType>>();
|
||||
aubCsr->hardwareContextController.reset(nullptr);
|
||||
aubCsr->stream = aubStream.get();
|
||||
|
||||
aubSubCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::toggle;
|
||||
aubSubCaptureManagerMock->setSubCaptureToggleActive(true);
|
||||
aubSubCaptureManagerMock->checkAndActivateSubCapture("kernelName");
|
||||
aubCsr->subCaptureManager = std::unique_ptr<AubSubCaptureManagerMock>(aubSubCaptureManagerMock);
|
||||
ASSERT_TRUE(aubCsr->subCaptureManager->isSubCaptureEnabled());
|
||||
|
||||
aubCsr->latestSentTaskCount = 50;
|
||||
aubCsr->pollForCompletionTaskCount = 49;
|
||||
ASSERT_FALSE(aubStream->registerPollCalled);
|
||||
|
||||
aubCsr->pollForCompletion();
|
||||
|
||||
EXPECT_TRUE(aubStream->registerPollCalled);
|
||||
}
|
||||
|
||||
HWTEST_F(AubFileStreamWithoutAubStreamTests, givenAubCommandStreamReceiverInSubCaptureModeWhenPollForCompletionIsCalledButSubCaptureIsDisabledThenItShouldntCallRegisterPoll) {
|
||||
DebugManagerStateRestore stateRestore;
|
||||
AubSubCaptureCommon aubSubCaptureCommon;
|
||||
@@ -480,7 +302,7 @@ HWTEST_F(AubFileStreamWithoutAubStreamTests, givenAubCommandStreamReceiverInSubC
|
||||
EXPECT_FALSE(aubStream->registerPollCalled);
|
||||
}
|
||||
|
||||
HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWithHardwareContextInSubCaptureModeWhenPollForCompletionIsCalledAndSubCaptureIsEnabledThenItShouldCallPollForCompletionOnHwContext) {
|
||||
HWTEST_F(AubCsrTests, givenAubCommandStreamReceiverWithHardwareContextInSubCaptureModeWhenPollForCompletionIsCalledAndSubCaptureIsEnabledThenItShouldCallPollForCompletionOnHwContext) {
|
||||
DebugManagerStateRestore stateRestore;
|
||||
AubSubCaptureCommon aubSubCaptureCommon;
|
||||
auto aubSubCaptureManagerMock = new AubSubCaptureManagerMock("", aubSubCaptureCommon);
|
||||
@@ -527,19 +349,6 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWithHardwareContextInS
|
||||
EXPECT_FALSE(hardwareContext->pollForCompletionCalled);
|
||||
}
|
||||
|
||||
HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenMakeResidentIsCalledThenItShouldCallTheExpectedFunctions) {
|
||||
auto aubExecutionEnvironment = getEnvironment<MockAubCsr<FamilyType>>(true, true, true);
|
||||
auto aubCsr = aubExecutionEnvironment->template getCsr<MockAubCsr<FamilyType>>();
|
||||
aubCsr->initializeEngine();
|
||||
aubCsr->aubManager = nullptr;
|
||||
|
||||
MockGraphicsAllocation allocation(reinterpret_cast<void *>(0x1000), 0x1000);
|
||||
ResidencyContainer allocationsForResidency = {&allocation};
|
||||
aubCsr->processResidency(allocationsForResidency, 0u);
|
||||
|
||||
EXPECT_TRUE(aubCsr->writeMemoryCalled);
|
||||
}
|
||||
|
||||
HWTEST_F(AubFileStreamWithoutAubStreamTests, givenAubCommandStreamReceiverWhenExpectMemoryEqualIsCalledThenItShouldCallTheExpectedFunctions) {
|
||||
auto aubExecutionEnvironment = getEnvironment<MockAubCsr<FamilyType>>(true, true, true);
|
||||
auto aubCsr = aubExecutionEnvironment->template getCsr<MockAubCsr<FamilyType>>();
|
||||
@@ -654,85 +463,6 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenExpectMemoryNotEqu
|
||||
EXPECT_TRUE(mockHardwareContext->expectMemoryCalled);
|
||||
}
|
||||
|
||||
HWTEST_F(AubFileStreamWithoutAubStreamTests, givenAubCommandStreamReceiverWhenFlushIsCalledThenFileStreamShouldBeFlushed) {
|
||||
auto mockAubFileStream = std::make_unique<MockAubFileStream>();
|
||||
auto aubExecutionEnvironment = getEnvironment<AUBCommandStreamReceiverHw<FamilyType>>(true, true, true);
|
||||
auto aubCsr = aubExecutionEnvironment->template getCsr<AUBCommandStreamReceiverHw<FamilyType>>();
|
||||
LinearStream cs(aubExecutionEnvironment->commandBuffer);
|
||||
|
||||
aubCsr->stream = mockAubFileStream.get();
|
||||
|
||||
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed());
|
||||
ResidencyContainer allocationsForResidency = {};
|
||||
|
||||
aubCsr->flush(batchBuffer, allocationsForResidency);
|
||||
EXPECT_TRUE(mockAubFileStream->flushCalled);
|
||||
}
|
||||
|
||||
HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenExpectMemoryIsCalledThenPageWalkIsCallingStreamsExpectMemory) {
|
||||
auto mockAubFileStream = std::make_unique<MockAubFileStream>();
|
||||
auto aubCsr = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
aubCsr->setupContext(pDevice->commandStreamReceivers[0]->getOsContext());
|
||||
aubCsr->hardwareContextController.reset(nullptr);
|
||||
aubCsr->stream = mockAubFileStream.get();
|
||||
|
||||
uintptr_t gpuAddress = 0x30000;
|
||||
void *sourceAddress = reinterpret_cast<void *>(0x50000);
|
||||
auto physicalAddress = aubCsr->ppgtt->map(gpuAddress, MemoryConstants::pageSize, PageTableEntry::presentBit, MemoryBanks::mainBank);
|
||||
|
||||
aubCsr->expectMemoryEqual(reinterpret_cast<void *>(gpuAddress), sourceAddress, MemoryConstants::pageSize);
|
||||
|
||||
EXPECT_EQ(AubMemDump::AddressSpaceValues::TraceNonlocal, mockAubFileStream->addressSpaceCapturedFromExpectMemory);
|
||||
EXPECT_EQ(reinterpret_cast<uintptr_t>(sourceAddress), mockAubFileStream->memoryCapturedFromExpectMemory);
|
||||
EXPECT_EQ(physicalAddress, mockAubFileStream->physAddressCapturedFromExpectMemory);
|
||||
EXPECT_EQ(MemoryConstants::pageSize, mockAubFileStream->sizeCapturedFromExpectMemory);
|
||||
}
|
||||
|
||||
HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWithoutAubManagerWhenExpectMMIOIsCalledThenTheCorrectFunctionIsCalledFromAubFileStream) {
|
||||
std::string fileName = "file_name.aub";
|
||||
auto mockAubFileStream = std::make_unique<MockAubFileStream>();
|
||||
auto aubCsr = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>(fileName.c_str(), true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
|
||||
aubCsr->aubManager = nullptr;
|
||||
aubCsr->stream = mockAubFileStream.get();
|
||||
aubCsr->setupContext(pDevice->commandStreamReceivers[0]->getOsContext());
|
||||
aubCsr->initFile(fileName);
|
||||
|
||||
aubCsr->expectMMIO(5, 10);
|
||||
|
||||
EXPECT_EQ(5u, mockAubFileStream->mmioRegisterFromExpectMMIO);
|
||||
EXPECT_EQ(10u, mockAubFileStream->expectedValueFromExpectMMIO);
|
||||
}
|
||||
|
||||
HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWithAubManagerWhenExpectMMIOIsCalledThenNoFunctionIsCalledFromAubFileStream) {
|
||||
std::string fileName = "file_name.aub";
|
||||
auto mockAubManager = std::make_unique<MockAubManager>();
|
||||
auto mockAubFileStream = std::make_unique<MockAubFileStream>();
|
||||
auto aubCsr = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>(fileName.c_str(), true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
|
||||
aubCsr->stream = mockAubFileStream.get();
|
||||
aubCsr->setupContext(pDevice->commandStreamReceivers[0]->getOsContext());
|
||||
aubCsr->initFile(fileName);
|
||||
|
||||
aubCsr->expectMMIO(5, 10);
|
||||
|
||||
EXPECT_NE(5u, mockAubFileStream->mmioRegisterFromExpectMMIO);
|
||||
EXPECT_NE(10u, mockAubFileStream->expectedValueFromExpectMMIO);
|
||||
}
|
||||
|
||||
HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenInitializeEngineIsCalledThenMemTraceCommentWithDriverVersionIsPutIntoAubStream) {
|
||||
auto mockAubFileStream = std::make_unique<MockAubFileStream>();
|
||||
auto aubExecutionEnvironment = getEnvironment<AUBCommandStreamReceiverHw<FamilyType>>(false, true, true);
|
||||
auto aubCsr = aubExecutionEnvironment->template getCsr<AUBCommandStreamReceiverHw<FamilyType>>();
|
||||
|
||||
aubCsr->stream = mockAubFileStream.get();
|
||||
aubCsr->hardwareContextController.reset(nullptr);
|
||||
aubCsr->initializeEngine();
|
||||
|
||||
std::string commentWithDriverVersion = "driver version: " + std::string(driverVersion);
|
||||
EXPECT_EQ(commentWithDriverVersion, mockAubFileStream->comments[0]);
|
||||
}
|
||||
|
||||
HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWithAubManagerWhenInitFileIsCalledThenMemTraceCommentWithDriverVersionIsPutIntoAubStream) {
|
||||
auto mockAubManager = std::make_unique<MockAubManager>();
|
||||
|
||||
@@ -754,197 +484,6 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWithAubManagerWhenInit
|
||||
aubCsr->aubManager = nullptr;
|
||||
}
|
||||
|
||||
HWTEST_F(AddPatchInfoCommentsAubTests, givenAddPatchInfoCommentsCalledWhenNoPatchInfoDataObjectsThenCommentsAreEmpty) {
|
||||
auto mockAubFileStream = std::make_unique<MockAubFileStream>();
|
||||
auto aubExecutionEnvironment = getEnvironment<AUBCommandStreamReceiverHw<FamilyType>>(false, true, true);
|
||||
auto aubCsr = aubExecutionEnvironment->template getCsr<AUBCommandStreamReceiverHw<FamilyType>>();
|
||||
|
||||
aubCsr->stream = mockAubFileStream.get();
|
||||
|
||||
bool result = aubCsr->addPatchInfoComments();
|
||||
EXPECT_TRUE(result);
|
||||
|
||||
ASSERT_EQ(2u, mockAubFileStream->comments.size());
|
||||
|
||||
EXPECT_EQ("PatchInfoData\n", mockAubFileStream->comments[0]);
|
||||
EXPECT_EQ("AllocationsList\n", mockAubFileStream->comments[1]);
|
||||
EXPECT_EQ(2u, mockAubFileStream->addCommentCalled);
|
||||
}
|
||||
|
||||
HWTEST_F(AddPatchInfoCommentsAubTests, givenAddPatchInfoCommentsCalledWhenFirstAddCommentsFailsThenFunctionReturnsFalse) {
|
||||
|
||||
auto mockAubFileStream = std::make_unique<MockAubFileStream>();
|
||||
auto aubExecutionEnvironment = getEnvironment<AUBCommandStreamReceiverHw<FamilyType>>(false, true, true);
|
||||
auto aubCsr = aubExecutionEnvironment->template getCsr<AUBCommandStreamReceiverHw<FamilyType>>();
|
||||
|
||||
aubCsr->stream = mockAubFileStream.get();
|
||||
mockAubFileStream->addCommentResult = false;
|
||||
|
||||
bool result = aubCsr->addPatchInfoComments();
|
||||
EXPECT_FALSE(result);
|
||||
EXPECT_EQ(1u, mockAubFileStream->addCommentCalled);
|
||||
}
|
||||
|
||||
HWTEST_F(AddPatchInfoCommentsAubTests, givenAddPatchInfoCommentsCalledWhenSecondAddCommentsFailsThenFunctionReturnsFalse) {
|
||||
|
||||
auto mockAubFileStream = std::make_unique<MockAubFileStream>();
|
||||
auto aubExecutionEnvironment = getEnvironment<AUBCommandStreamReceiverHw<FamilyType>>(false, true, true);
|
||||
auto aubCsr = aubExecutionEnvironment->template getCsr<AUBCommandStreamReceiverHw<FamilyType>>();
|
||||
|
||||
aubCsr->stream = mockAubFileStream.get();
|
||||
|
||||
mockAubFileStream->addCommentResults = {true, false};
|
||||
|
||||
bool result = aubCsr->addPatchInfoComments();
|
||||
EXPECT_FALSE(result);
|
||||
EXPECT_EQ(2u, mockAubFileStream->addCommentCalled);
|
||||
}
|
||||
|
||||
HWTEST_F(AddPatchInfoCommentsAubTests, givenAddPatchInfoCommentsCalledWhenPatchInfoDataObjectsAddedThenCommentsAreNotEmpty) {
|
||||
|
||||
auto mockAubFileStream = std::make_unique<MockAubFileStream>();
|
||||
auto aubExecutionEnvironment = getEnvironment<AUBCommandStreamReceiverHw<FamilyType>>(false, true, true);
|
||||
auto aubCsr = aubExecutionEnvironment->template getCsr<AUBCommandStreamReceiverHw<FamilyType>>();
|
||||
|
||||
aubCsr->stream = mockAubFileStream.get();
|
||||
|
||||
PatchInfoData patchInfoData[2] = {{0xAAAAAAAA, 128u, PatchInfoAllocationType::defaultType, 0xBBBBBBBB, 256u, PatchInfoAllocationType::defaultType},
|
||||
{0xBBBBBBBB, 128u, PatchInfoAllocationType::defaultType, 0xDDDDDDDD, 256u, PatchInfoAllocationType::defaultType}};
|
||||
|
||||
EXPECT_TRUE(aubCsr->getFlatBatchBufferHelper().setPatchInfoData(patchInfoData[0]));
|
||||
EXPECT_TRUE(aubCsr->getFlatBatchBufferHelper().setPatchInfoData(patchInfoData[1]));
|
||||
|
||||
bool result = aubCsr->addPatchInfoComments();
|
||||
EXPECT_TRUE(result);
|
||||
|
||||
ASSERT_EQ(2u, mockAubFileStream->comments.size());
|
||||
|
||||
EXPECT_EQ("PatchInfoData", mockAubFileStream->comments[0].substr(0, 13));
|
||||
EXPECT_EQ("AllocationsList", mockAubFileStream->comments[1].substr(0, 15));
|
||||
|
||||
std::string line;
|
||||
std::istringstream input1;
|
||||
input1.str(mockAubFileStream->comments[0]);
|
||||
|
||||
uint32_t lineNo = 0;
|
||||
while (std::getline(input1, line)) {
|
||||
if (line.substr(0, 13) == "PatchInfoData") {
|
||||
continue;
|
||||
}
|
||||
std::ostringstream ss;
|
||||
ss << std::hex << patchInfoData[lineNo].sourceAllocation << ";" << patchInfoData[lineNo].sourceAllocationOffset << ";" << patchInfoData[lineNo].sourceType << ";";
|
||||
ss << patchInfoData[lineNo].targetAllocation << ";" << patchInfoData[lineNo].targetAllocationOffset << ";" << patchInfoData[lineNo].targetType << ";";
|
||||
|
||||
EXPECT_EQ(ss.str(), line);
|
||||
lineNo++;
|
||||
}
|
||||
|
||||
std::vector<std::string> expectedAddresses = {"aaaaaaaa", "bbbbbbbb", "cccccccc", "dddddddd"};
|
||||
lineNo = 0;
|
||||
|
||||
std::istringstream input2;
|
||||
input2.str(mockAubFileStream->comments[1]);
|
||||
while (std::getline(input2, line)) {
|
||||
if (line.substr(0, 15) == "AllocationsList") {
|
||||
continue;
|
||||
}
|
||||
|
||||
bool foundAddr = false;
|
||||
for (auto &addr : expectedAddresses) {
|
||||
if (line.substr(0, 8) == addr) {
|
||||
foundAddr = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
EXPECT_TRUE(foundAddr);
|
||||
EXPECT_TRUE(line.size() > 9);
|
||||
lineNo++;
|
||||
}
|
||||
EXPECT_EQ(2u, mockAubFileStream->addCommentCalled);
|
||||
}
|
||||
|
||||
HWTEST_F(AddPatchInfoCommentsAubTests, givenAddPatchInfoCommentsCalledWhenSourceAllocationIsNullThenDoNotAddToAllocationsList) {
|
||||
auto mockAubFileStream = std::make_unique<MockAubFileStream>();
|
||||
auto aubExecutionEnvironment = getEnvironment<AUBCommandStreamReceiverHw<FamilyType>>(false, true, true);
|
||||
auto aubCsr = aubExecutionEnvironment->template getCsr<AUBCommandStreamReceiverHw<FamilyType>>();
|
||||
|
||||
aubCsr->stream = mockAubFileStream.get();
|
||||
|
||||
PatchInfoData patchInfoData = {0x0, 0u, PatchInfoAllocationType::defaultType, 0xBBBBBBBB, 0u, PatchInfoAllocationType::defaultType};
|
||||
EXPECT_TRUE(aubCsr->getFlatBatchBufferHelper().setPatchInfoData(patchInfoData));
|
||||
|
||||
bool result = aubCsr->addPatchInfoComments();
|
||||
EXPECT_TRUE(result);
|
||||
|
||||
ASSERT_EQ(2u, mockAubFileStream->comments.size());
|
||||
|
||||
ASSERT_EQ("PatchInfoData", mockAubFileStream->comments[0].substr(0, 13));
|
||||
ASSERT_EQ("AllocationsList", mockAubFileStream->comments[1].substr(0, 15));
|
||||
|
||||
std::string line;
|
||||
std::istringstream input;
|
||||
input.str(mockAubFileStream->comments[1]);
|
||||
|
||||
std::vector<std::string> expectedAddresses = {"bbbbbbbb"};
|
||||
while (std::getline(input, line)) {
|
||||
if (line.substr(0, 15) == "AllocationsList") {
|
||||
continue;
|
||||
}
|
||||
|
||||
bool foundAddr = false;
|
||||
for (auto &addr : expectedAddresses) {
|
||||
if (line.substr(0, 8) == addr) {
|
||||
foundAddr = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
EXPECT_TRUE(foundAddr);
|
||||
EXPECT_TRUE(line.size() > 9);
|
||||
}
|
||||
EXPECT_EQ(2u, mockAubFileStream->addCommentCalled);
|
||||
}
|
||||
|
||||
HWTEST_F(AddPatchInfoCommentsAubTests, givenAddPatchInfoCommentsCalledWhenTargetAllocationIsNullThenDoNotAddToAllocationsList) {
|
||||
auto mockAubFileStream = std::make_unique<MockAubFileStream>();
|
||||
auto aubExecutionEnvironment = getEnvironment<AUBCommandStreamReceiverHw<FamilyType>>(false, true, true);
|
||||
auto aubCsr = aubExecutionEnvironment->template getCsr<AUBCommandStreamReceiverHw<FamilyType>>();
|
||||
|
||||
aubCsr->stream = mockAubFileStream.get();
|
||||
|
||||
PatchInfoData patchInfoData = {0xAAAAAAAA, 0u, PatchInfoAllocationType::defaultType, 0x0, 0u, PatchInfoAllocationType::defaultType};
|
||||
EXPECT_TRUE(aubCsr->getFlatBatchBufferHelper().setPatchInfoData(patchInfoData));
|
||||
|
||||
bool result = aubCsr->addPatchInfoComments();
|
||||
EXPECT_TRUE(result);
|
||||
|
||||
ASSERT_EQ(2u, mockAubFileStream->comments.size());
|
||||
|
||||
ASSERT_EQ("PatchInfoData", mockAubFileStream->comments[0].substr(0, 13));
|
||||
ASSERT_EQ("AllocationsList", mockAubFileStream->comments[1].substr(0, 15));
|
||||
|
||||
std::string line;
|
||||
std::istringstream input;
|
||||
input.str(mockAubFileStream->comments[1]);
|
||||
|
||||
std::vector<std::string> expectedAddresses = {"aaaaaaaa"};
|
||||
while (std::getline(input, line)) {
|
||||
if (line.substr(0, 15) == "AllocationsList") {
|
||||
continue;
|
||||
}
|
||||
|
||||
bool foundAddr = false;
|
||||
for (auto &addr : expectedAddresses) {
|
||||
if (line.substr(0, 8) == addr) {
|
||||
foundAddr = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
EXPECT_TRUE(foundAddr);
|
||||
EXPECT_TRUE(line.size() > 9);
|
||||
}
|
||||
EXPECT_EQ(2u, mockAubFileStream->addCommentCalled);
|
||||
}
|
||||
|
||||
HWTEST2_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenCreateFullFilePathIsCalledForMultipleDevicesThenFileNameIsExtendedWithSuffixToIndicateMultipleDevices, IsAtMostXeHpcCore) {
|
||||
DebugManagerStateRestore stateRestore;
|
||||
|
||||
|
||||
@@ -204,23 +204,15 @@ TEST(RootDeviceEnvironment, givenUseAubStreamFalseWhenGetAubManagerIsCalledThenR
|
||||
auto aubManager = rootDeviceEnvironment->aubCenter->getAubManager();
|
||||
EXPECT_EQ(nullptr, aubManager);
|
||||
}
|
||||
|
||||
TEST(RootDeviceEnvironment, givenExecutionEnvironmentWhenInitializeAubCenterIsCalledThenItIsInitalizedOnce) {
|
||||
MockExecutionEnvironment executionEnvironment{defaultHwInfo.get(), false, 1u};
|
||||
auto rootDeviceEnvironment = executionEnvironment.rootDeviceEnvironments[0].get();
|
||||
rootDeviceEnvironment->initAubCenter(false, "", CommandStreamReceiverType::aub);
|
||||
auto currentAubCenter = rootDeviceEnvironment->aubCenter.get();
|
||||
EXPECT_NE(nullptr, currentAubCenter);
|
||||
auto currentAubStreamProvider = currentAubCenter->getStreamProvider();
|
||||
EXPECT_NE(nullptr, currentAubStreamProvider);
|
||||
auto currentAubFileStream = currentAubStreamProvider->getStream();
|
||||
EXPECT_NE(nullptr, currentAubFileStream);
|
||||
rootDeviceEnvironment->initAubCenter(false, "", CommandStreamReceiverType::aub);
|
||||
EXPECT_EQ(currentAubCenter, rootDeviceEnvironment->aubCenter.get());
|
||||
EXPECT_EQ(currentAubStreamProvider, rootDeviceEnvironment->aubCenter->getStreamProvider());
|
||||
EXPECT_EQ(currentAubFileStream, rootDeviceEnvironment->aubCenter->getStreamProvider()->getStream());
|
||||
}
|
||||
|
||||
TEST(RootDeviceEnvironment, givenRootExecutionEnvironmentWhenGetAssertHandlerIsCalledThenItIsInitalizedOnce) {
|
||||
const HardwareInfo *hwInfo = defaultHwInfo.get();
|
||||
auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(hwInfo));
|
||||
|
||||
Reference in New Issue
Block a user