Graphics Allocation cleanup.
- remove one constructor - start using mock graphics allocation in tests Change-Id: Idb8f4a35dbc2cae8d6bf667bab5542d8e91d6e0d
This commit is contained in:
parent
f9ba697587
commit
7ece16ee7a
|
@ -644,7 +644,7 @@ bool AUBCommandStreamReceiverHw<GfxFamily>::writeMemory(GraphicsAllocation &gfxA
|
|||
|
||||
template <typename GfxFamily>
|
||||
bool AUBCommandStreamReceiverHw<GfxFamily>::writeMemory(AllocationView &allocationView) {
|
||||
GraphicsAllocation gfxAllocation(reinterpret_cast<void *>(allocationView.first), allocationView.second);
|
||||
GraphicsAllocation gfxAllocation(reinterpret_cast<void *>(allocationView.first), allocationView.first, 0llu, allocationView.second);
|
||||
return writeMemory(gfxAllocation);
|
||||
}
|
||||
|
||||
|
|
|
@ -84,10 +84,6 @@ class GraphicsAllocation : public IDNode<GraphicsAllocation> {
|
|||
virtual ~GraphicsAllocation() = default;
|
||||
GraphicsAllocation &operator=(const GraphicsAllocation &) = delete;
|
||||
GraphicsAllocation(const GraphicsAllocation &) = delete;
|
||||
GraphicsAllocation(void *cpuPtrIn, size_t sizeIn) : size(sizeIn),
|
||||
cpuPtr(cpuPtrIn),
|
||||
gpuAddress(castToUint64(cpuPtrIn)),
|
||||
sharedHandle(Sharing::nonSharedResource) {}
|
||||
|
||||
GraphicsAllocation(void *cpuPtrIn, uint64_t gpuAddress, uint64_t baseAddress, size_t sizeIn) : size(sizeIn),
|
||||
cpuPtr(cpuPtrIn),
|
||||
|
|
|
@ -17,7 +17,7 @@ struct OsHandle {
|
|||
|
||||
class DrmAllocation : public GraphicsAllocation {
|
||||
public:
|
||||
DrmAllocation(BufferObject *bo, void *ptrIn, size_t sizeIn, MemoryPool::Type pool) : GraphicsAllocation(ptrIn, sizeIn), bo(bo) {
|
||||
DrmAllocation(BufferObject *bo, void *ptrIn, size_t sizeIn, MemoryPool::Type pool) : GraphicsAllocation(ptrIn, castToUint64(ptrIn), 0llu, sizeIn), bo(bo) {
|
||||
this->memoryPool = pool;
|
||||
}
|
||||
DrmAllocation(BufferObject *bo, void *ptrIn, size_t sizeIn, osHandle sharedHandle, MemoryPool::Type pool) : GraphicsAllocation(ptrIn, sizeIn, sharedHandle), bo(bo) {
|
||||
|
|
|
@ -32,7 +32,7 @@ class WddmAllocation : public GraphicsAllocation {
|
|||
|
||||
D3DGPU_VIRTUAL_ADDRESS gpuPtr; // set by mapGpuVA
|
||||
WddmAllocation(void *cpuPtrIn, size_t sizeIn, void *alignedCpuPtr, void *reservedAddr, MemoryPool::Type pool, size_t osContextsCount)
|
||||
: GraphicsAllocation(cpuPtrIn, sizeIn),
|
||||
: GraphicsAllocation(cpuPtrIn, castToUint64(cpuPtrIn), 0llu, sizeIn),
|
||||
handle(0),
|
||||
gpuPtr(0),
|
||||
alignedCpuPtr(alignedCpuPtr),
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "unit_tests/mocks/mock_aub_subcapture_manager.h"
|
||||
#include "unit_tests/mocks/mock_csr.h"
|
||||
#include "unit_tests/mocks/mock_gmm.h"
|
||||
#include "unit_tests/mocks/mock_graphics_allocation.h"
|
||||
#include "unit_tests/mocks/mock_kernel.h"
|
||||
#include "unit_tests/mocks/mock_mdi.h"
|
||||
|
||||
|
@ -728,7 +729,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenGraphic
|
|||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenGraphicsAllocationSizeIsZeroThenWriteMemoryIsNotAllowed) {
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], "", true, *pDevice->executionEnvironment));
|
||||
GraphicsAllocation gfxAllocation((void *)0x1234, 0);
|
||||
MockGraphicsAllocation gfxAllocation((void *)0x1234, 0);
|
||||
|
||||
EXPECT_FALSE(aubCsr->writeMemory(gfxAllocation));
|
||||
}
|
||||
|
|
|
@ -821,7 +821,7 @@ HWTEST_F(CommandStreamReceiverCQFlushTaskTests, getCSShouldReturnACSWithEnoughSi
|
|||
EXPECT_GE(commandStream.getAvailableSpace(), sizeRequested);
|
||||
commandStream.getSpace(sizeRequested - sizeCQReserves);
|
||||
|
||||
GraphicsAllocation allocation((void *)MemoryConstants::pageSize, 1);
|
||||
MockGraphicsAllocation allocation((void *)MemoryConstants::pageSize, 1);
|
||||
IndirectHeap linear(&allocation);
|
||||
|
||||
auto blocking = true;
|
||||
|
@ -2136,7 +2136,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeAndThreeReco
|
|||
mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator);
|
||||
|
||||
auto memorySize = (size_t)pDevice->getDeviceInfo().globalMemSize;
|
||||
GraphicsAllocation largeAllocation(nullptr, memorySize);
|
||||
MockGraphicsAllocation largeAllocation(nullptr, memorySize);
|
||||
|
||||
DispatchFlags dispatchFlags;
|
||||
dispatchFlags.guardCommandBufferWithPipeControl = true;
|
||||
|
@ -2565,7 +2565,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenSusbsequ
|
|||
|
||||
auto additionalSize = 1234;
|
||||
|
||||
GraphicsAllocation graphicsAllocation(nullptr, additionalSize);
|
||||
MockGraphicsAllocation graphicsAllocation(nullptr, additionalSize);
|
||||
mockCsr->makeResident(graphicsAllocation);
|
||||
|
||||
mockCsr->flushTask(commandStream,
|
||||
|
@ -2627,7 +2627,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenTotalRes
|
|||
EXPECT_EQ(expectedUsed, mockCsr->peekTotalMemoryUsed());
|
||||
|
||||
auto budgetSize = (size_t)pDevice->getDeviceInfo().globalMemSize;
|
||||
GraphicsAllocation hugeAllocation(nullptr, budgetSize / 4);
|
||||
MockGraphicsAllocation hugeAllocation(nullptr, budgetSize / 4);
|
||||
mockCsr->makeResident(hugeAllocation);
|
||||
|
||||
mockCsr->flushTask(commandStream,
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "unit_tests/mocks/mock_builtins.h"
|
||||
#include "unit_tests/mocks/mock_context.h"
|
||||
#include "unit_tests/mocks/mock_csr.h"
|
||||
#include "unit_tests/mocks/mock_graphics_allocation.h"
|
||||
#include "unit_tests/mocks/mock_memory_manager.h"
|
||||
#include "unit_tests/mocks/mock_program.h"
|
||||
|
||||
|
@ -279,21 +280,21 @@ HWTEST_F(CommandStreamReceiverTest, whenCsrIsCreatedThenUseTimestampPacketWriteI
|
|||
TEST(CommandStreamReceiverSimpleTest, givenCSRWithTagAllocationSetWhenGetTagAllocationIsCalledThenCorrectAllocationIsReturned) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
MockCommandStreamReceiver csr(executionEnvironment);
|
||||
GraphicsAllocation allocation(reinterpret_cast<void *>(0x1000), 0x1000);
|
||||
MockGraphicsAllocation allocation(reinterpret_cast<void *>(0x1000), 0x1000);
|
||||
csr.setTagAllocation(&allocation);
|
||||
EXPECT_EQ(&allocation, csr.getTagAllocation());
|
||||
}
|
||||
|
||||
TEST(CommandStreamReceiverSimpleTest, givenCommandStreamReceiverWhenItIsDestroyedThenItDestroysTagAllocation) {
|
||||
struct MockGraphicsAllocation : public GraphicsAllocation {
|
||||
struct MockGraphicsAllocationWithDestructorTracing : public GraphicsAllocation {
|
||||
using GraphicsAllocation::GraphicsAllocation;
|
||||
~MockGraphicsAllocation() override { *destructorCalled = true; }
|
||||
~MockGraphicsAllocationWithDestructorTracing() override { *destructorCalled = true; }
|
||||
bool *destructorCalled = nullptr;
|
||||
};
|
||||
|
||||
bool destructorCalled = false;
|
||||
|
||||
auto mockGraphicsAllocation = new MockGraphicsAllocation(nullptr, 1u);
|
||||
auto mockGraphicsAllocation = new MockGraphicsAllocationWithDestructorTracing(nullptr, 0llu, 0llu, 1u);
|
||||
mockGraphicsAllocation->destructorCalled = &destructorCalled;
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
executionEnvironment.commandStreamReceivers.push_back(std::make_unique<MockCommandStreamReceiver>(executionEnvironment));
|
||||
|
@ -337,7 +338,7 @@ TEST(CommandStreamReceiverSimpleTest, givenCSRWhenWaitBeforeMakingNonResidentWhe
|
|||
ExecutionEnvironment executionEnvironment;
|
||||
MockCommandStreamReceiver csr(executionEnvironment);
|
||||
uint32_t tag = 0;
|
||||
GraphicsAllocation allocation(&tag, sizeof(tag));
|
||||
MockGraphicsAllocation allocation(&tag, sizeof(tag));
|
||||
csr.latestFlushedTaskCount = 3;
|
||||
csr.setTagAllocation(&allocation);
|
||||
csr.waitBeforeMakingNonResidentWhenRequired();
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "runtime/command_stream/linear_stream.h"
|
||||
#include "runtime/memory_manager/graphics_allocation.h"
|
||||
#include "unit_tests/command_stream/linear_stream_fixture.h"
|
||||
#include "unit_tests/mocks/mock_graphics_allocation.h"
|
||||
|
||||
using namespace OCLRT;
|
||||
|
||||
|
@ -93,8 +94,8 @@ TEST_F(LinearStreamTest, givenNewGraphicsAllocationWhenReplaceIsCalledThenLinear
|
|||
auto graphicsAllocation = linearStream.getGraphicsAllocation();
|
||||
EXPECT_NE(nullptr, graphicsAllocation);
|
||||
auto address = (void *)0x100000;
|
||||
GraphicsAllocation newGraphicsAllocation(address, 4096);
|
||||
MockGraphicsAllocation newGraphicsAllocation(address, 4096);
|
||||
EXPECT_NE(&newGraphicsAllocation, graphicsAllocation);
|
||||
linearStream.replaceGraphicsAllocation(&newGraphicsAllocation);
|
||||
EXPECT_EQ(&newGraphicsAllocation, linearStream.getGraphicsAllocation());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "unit_tests/mocks/mock_kernel.h"
|
||||
#include "unit_tests/mocks/mock_csr.h"
|
||||
#include "unit_tests/mocks/mock_command_queue.h"
|
||||
#include "unit_tests/mocks/mock_graphics_allocation.h"
|
||||
|
||||
using namespace OCLRT;
|
||||
|
||||
|
@ -49,12 +50,12 @@ TEST(SubmissionsAggregator, givenTwoCommandBuffersWhenMergeResourcesIsCalledThen
|
|||
CommandBuffer *cmdBuffer = new CommandBuffer(*device);
|
||||
CommandBuffer *cmdBuffer2 = new CommandBuffer(*device);
|
||||
|
||||
GraphicsAllocation alloc1(nullptr, 1);
|
||||
GraphicsAllocation alloc2(nullptr, 2);
|
||||
GraphicsAllocation alloc3(nullptr, 3);
|
||||
GraphicsAllocation alloc4(nullptr, 4);
|
||||
GraphicsAllocation alloc5(nullptr, 5);
|
||||
GraphicsAllocation alloc6(nullptr, 6);
|
||||
MockGraphicsAllocation alloc1(nullptr, 1);
|
||||
MockGraphicsAllocation alloc2(nullptr, 2);
|
||||
MockGraphicsAllocation alloc3(nullptr, 3);
|
||||
MockGraphicsAllocation alloc4(nullptr, 4);
|
||||
MockGraphicsAllocation alloc5(nullptr, 5);
|
||||
MockGraphicsAllocation alloc6(nullptr, 6);
|
||||
|
||||
cmdBuffer->surfaces.push_back(&alloc1);
|
||||
cmdBuffer->surfaces.push_back(&alloc6);
|
||||
|
@ -109,13 +110,13 @@ TEST(SubmissionsAggregator, givenSubmissionAggregatorWhenThreeCommandBuffersAreS
|
|||
CommandBuffer *cmdBuffer2 = new CommandBuffer(*device);
|
||||
CommandBuffer *cmdBuffer3 = new CommandBuffer(*device);
|
||||
|
||||
GraphicsAllocation alloc1(nullptr, 1);
|
||||
GraphicsAllocation alloc2(nullptr, 2);
|
||||
GraphicsAllocation alloc3(nullptr, 3);
|
||||
GraphicsAllocation alloc4(nullptr, 4);
|
||||
GraphicsAllocation alloc5(nullptr, 5);
|
||||
GraphicsAllocation alloc6(nullptr, 6);
|
||||
GraphicsAllocation alloc7(nullptr, 7);
|
||||
MockGraphicsAllocation alloc1(nullptr, 1);
|
||||
MockGraphicsAllocation alloc2(nullptr, 2);
|
||||
MockGraphicsAllocation alloc3(nullptr, 3);
|
||||
MockGraphicsAllocation alloc4(nullptr, 4);
|
||||
MockGraphicsAllocation alloc5(nullptr, 5);
|
||||
MockGraphicsAllocation alloc6(nullptr, 6);
|
||||
MockGraphicsAllocation alloc7(nullptr, 7);
|
||||
|
||||
cmdBuffer->surfaces.push_back(&alloc5);
|
||||
cmdBuffer->surfaces.push_back(&alloc6);
|
||||
|
@ -173,13 +174,13 @@ TEST(SubmissionsAggregator, givenMultipleCommandBuffersWhenTheyAreAggreagateWith
|
|||
CommandBuffer *cmdBuffer2 = new CommandBuffer(*device);
|
||||
CommandBuffer *cmdBuffer3 = new CommandBuffer(*device);
|
||||
|
||||
GraphicsAllocation alloc1(nullptr, 1);
|
||||
GraphicsAllocation alloc2(nullptr, 2);
|
||||
GraphicsAllocation alloc3(nullptr, 3);
|
||||
GraphicsAllocation alloc4(nullptr, 4);
|
||||
GraphicsAllocation alloc5(nullptr, 5);
|
||||
GraphicsAllocation alloc6(nullptr, 6);
|
||||
GraphicsAllocation alloc7(nullptr, 7);
|
||||
MockGraphicsAllocation alloc1(nullptr, 1);
|
||||
MockGraphicsAllocation alloc2(nullptr, 2);
|
||||
MockGraphicsAllocation alloc3(nullptr, 3);
|
||||
MockGraphicsAllocation alloc4(nullptr, 4);
|
||||
MockGraphicsAllocation alloc5(nullptr, 5);
|
||||
MockGraphicsAllocation alloc6(nullptr, 6);
|
||||
MockGraphicsAllocation alloc7(nullptr, 7);
|
||||
|
||||
//14 bytes consumed
|
||||
cmdBuffer->surfaces.push_back(&alloc5);
|
||||
|
@ -229,13 +230,13 @@ TEST(SubmissionsAggregator, givenMultipleCommandBuffersWhenAggregateIsCalledMult
|
|||
CommandBuffer *cmdBuffer2 = new CommandBuffer(*device);
|
||||
CommandBuffer *cmdBuffer3 = new CommandBuffer(*device);
|
||||
|
||||
GraphicsAllocation alloc1(nullptr, 1);
|
||||
GraphicsAllocation alloc2(nullptr, 2);
|
||||
GraphicsAllocation alloc3(nullptr, 3);
|
||||
GraphicsAllocation alloc4(nullptr, 4);
|
||||
GraphicsAllocation alloc5(nullptr, 5);
|
||||
GraphicsAllocation alloc6(nullptr, 6);
|
||||
GraphicsAllocation alloc7(nullptr, 7);
|
||||
MockGraphicsAllocation alloc1(nullptr, 1);
|
||||
MockGraphicsAllocation alloc2(nullptr, 2);
|
||||
MockGraphicsAllocation alloc3(nullptr, 3);
|
||||
MockGraphicsAllocation alloc4(nullptr, 4);
|
||||
MockGraphicsAllocation alloc5(nullptr, 5);
|
||||
MockGraphicsAllocation alloc6(nullptr, 6);
|
||||
MockGraphicsAllocation alloc7(nullptr, 7);
|
||||
|
||||
//14 bytes consumed
|
||||
cmdBuffer->surfaces.push_back(&alloc5);
|
||||
|
@ -292,10 +293,10 @@ TEST(SubmissionsAggregator, givenMultipleCommandBuffersWithDifferentGraphicsAllo
|
|||
CommandBuffer *cmdBuffer = new CommandBuffer(*device);
|
||||
CommandBuffer *cmdBuffer2 = new CommandBuffer(*device);
|
||||
|
||||
GraphicsAllocation alloc1(nullptr, 1);
|
||||
GraphicsAllocation alloc2(nullptr, 2);
|
||||
GraphicsAllocation alloc5(nullptr, 5);
|
||||
GraphicsAllocation alloc7(nullptr, 7);
|
||||
MockGraphicsAllocation alloc1(nullptr, 1);
|
||||
MockGraphicsAllocation alloc2(nullptr, 2);
|
||||
MockGraphicsAllocation alloc5(nullptr, 5);
|
||||
MockGraphicsAllocation alloc7(nullptr, 7);
|
||||
|
||||
//5 bytes consumed
|
||||
cmdBuffer->surfaces.push_back(&alloc5);
|
||||
|
@ -325,10 +326,10 @@ TEST(SubmissionsAggregator, givenTwoCommandBufferWhereSecondContainsFirstOnResou
|
|||
CommandBuffer *cmdBuffer = new CommandBuffer(*device);
|
||||
CommandBuffer *cmdBuffer2 = new CommandBuffer(*device);
|
||||
|
||||
GraphicsAllocation cmdBufferAllocation1(nullptr, 1);
|
||||
GraphicsAllocation cmdBufferAllocation2(nullptr, 2);
|
||||
GraphicsAllocation alloc5(nullptr, 5);
|
||||
GraphicsAllocation alloc7(nullptr, 7);
|
||||
MockGraphicsAllocation cmdBufferAllocation1(nullptr, 1);
|
||||
MockGraphicsAllocation cmdBufferAllocation2(nullptr, 2);
|
||||
MockGraphicsAllocation alloc5(nullptr, 5);
|
||||
MockGraphicsAllocation alloc7(nullptr, 7);
|
||||
|
||||
cmdBuffer->batchBuffer.commandBufferAllocation = &cmdBufferAllocation1;
|
||||
cmdBuffer2->batchBuffer.commandBufferAllocation = &cmdBufferAllocation2;
|
||||
|
@ -360,9 +361,9 @@ TEST(SubmissionsAggregator, givenTwoCommandBufferWhereSecondContainsTheFirstComm
|
|||
CommandBuffer *cmdBuffer = new CommandBuffer(*device);
|
||||
CommandBuffer *cmdBuffer2 = new CommandBuffer(*device);
|
||||
|
||||
GraphicsAllocation cmdBufferAllocation1(nullptr, 1);
|
||||
GraphicsAllocation alloc5(nullptr, 5);
|
||||
GraphicsAllocation alloc7(nullptr, 7);
|
||||
MockGraphicsAllocation cmdBufferAllocation1(nullptr, 1);
|
||||
MockGraphicsAllocation alloc5(nullptr, 5);
|
||||
MockGraphicsAllocation alloc7(nullptr, 7);
|
||||
|
||||
cmdBuffer->batchBuffer.commandBufferAllocation = &cmdBufferAllocation1;
|
||||
cmdBuffer2->batchBuffer.commandBufferAllocation = &cmdBufferAllocation1;
|
||||
|
@ -392,8 +393,8 @@ TEST(SubmissionsAggregator, givenCommandBuffersRequiringDifferentCoherencySettin
|
|||
CommandBuffer *cmdBuffer = new CommandBuffer(*device);
|
||||
CommandBuffer *cmdBuffer2 = new CommandBuffer(*device);
|
||||
|
||||
GraphicsAllocation alloc1(nullptr, 1);
|
||||
GraphicsAllocation alloc7(nullptr, 7);
|
||||
MockGraphicsAllocation alloc1(nullptr, 1);
|
||||
MockGraphicsAllocation alloc7(nullptr, 7);
|
||||
|
||||
cmdBuffer->batchBuffer.requiresCoherency = true;
|
||||
cmdBuffer2->batchBuffer.requiresCoherency = false;
|
||||
|
@ -421,8 +422,8 @@ TEST(SubmissionsAggregator, givenCommandBuffersRequiringDifferentThrottleSetting
|
|||
CommandBuffer *cmdBuffer = new CommandBuffer(*device);
|
||||
CommandBuffer *cmdBuffer2 = new CommandBuffer(*device);
|
||||
|
||||
GraphicsAllocation alloc1(nullptr, 1);
|
||||
GraphicsAllocation alloc7(nullptr, 7);
|
||||
MockGraphicsAllocation alloc1(nullptr, 1);
|
||||
MockGraphicsAllocation alloc7(nullptr, 7);
|
||||
|
||||
cmdBuffer->batchBuffer.throttle = QueueThrottle::LOW;
|
||||
cmdBuffer2->batchBuffer.throttle = QueueThrottle::MEDIUM;
|
||||
|
@ -450,8 +451,8 @@ TEST(SubmissionsAggregator, givenCommandBuffersRequiringDifferentPrioritySetting
|
|||
CommandBuffer *cmdBuffer = new CommandBuffer(*device);
|
||||
CommandBuffer *cmdBuffer2 = new CommandBuffer(*device);
|
||||
|
||||
GraphicsAllocation alloc1(nullptr, 1);
|
||||
GraphicsAllocation alloc7(nullptr, 7);
|
||||
MockGraphicsAllocation alloc1(nullptr, 1);
|
||||
MockGraphicsAllocation alloc7(nullptr, 7);
|
||||
|
||||
cmdBuffer->batchBuffer.low_priority = true;
|
||||
cmdBuffer2->batchBuffer.low_priority = false;
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "unit_tests/command_queue/command_queue_fixture.h"
|
||||
#include "unit_tests/fixtures/device_fixture.h"
|
||||
#include "unit_tests/helpers/debug_manager_state_restore.h"
|
||||
#include "unit_tests/mocks/mock_graphics_allocation.h"
|
||||
#include "test.h"
|
||||
#include <cstdint>
|
||||
|
||||
|
@ -79,7 +80,7 @@ TEST_F(TbxCommandStreamTests, DISABLED_makeResident) {
|
|||
}
|
||||
|
||||
TEST_F(TbxCommandStreamTests, DISABLED_makeResidentOnZeroSizedBufferShouldDoNothing) {
|
||||
GraphicsAllocation graphicsAllocation(nullptr, 0);
|
||||
MockGraphicsAllocation graphicsAllocation(nullptr, 0);
|
||||
|
||||
pCommandStreamReceiver->makeResident(graphicsAllocation);
|
||||
pCommandStreamReceiver->makeNonResident(graphicsAllocation);
|
||||
|
@ -213,7 +214,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenWriteMemoryIsCa
|
|||
|
||||
HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenWriteMemoryIsCalledForGraphicsAllocationWithZeroSizeThenItShouldReturnFalse) {
|
||||
TbxCommandStreamReceiverHw<FamilyType> *tbxCsr = (TbxCommandStreamReceiverHw<FamilyType> *)pCommandStreamReceiver;
|
||||
GraphicsAllocation graphicsAllocation((void *)0x1234, 0);
|
||||
MockGraphicsAllocation graphicsAllocation((void *)0x1234, 0);
|
||||
|
||||
EXPECT_FALSE(tbxCsr->writeMemory(graphicsAllocation));
|
||||
}
|
||||
|
|
|
@ -472,7 +472,7 @@ TEST_F(InternalsEventTest, processBlockedCommandsKernelOperation) {
|
|||
auto &csr = pDevice->getCommandStreamReceiver();
|
||||
std::vector<Surface *> v;
|
||||
SurfaceMock *surface = new SurfaceMock;
|
||||
surface->graphicsAllocation = new GraphicsAllocation((void *)0x1234, 100u);
|
||||
surface->graphicsAllocation = new MockGraphicsAllocation((void *)0x1234, 100u);
|
||||
PreemptionMode preemptionMode = pDevice->getPreemptionMode();
|
||||
v.push_back(surface);
|
||||
auto cmd = new CommandComputeKernel(cmdQ, std::unique_ptr<KernelOperation>(blockedCommandsData), v, false, false, false, nullptr, preemptionMode, pKernel, 1);
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "unit_tests/fixtures/device_fixture.h"
|
||||
#include "unit_tests/helpers/hw_parse.h"
|
||||
#include "unit_tests/libult/ult_command_stream_receiver.h"
|
||||
#include "unit_tests/mocks/mock_graphics_allocation.h"
|
||||
|
||||
namespace OCLRT {
|
||||
|
||||
|
@ -38,20 +39,20 @@ struct UltCommandStreamReceiverTest
|
|||
ASSERT_NE(nullptr, sshBuffer);
|
||||
|
||||
commandStream.replaceBuffer(cmdBuffer, sizeStream);
|
||||
auto graphicsAllocation = new GraphicsAllocation(cmdBuffer, sizeStream);
|
||||
auto graphicsAllocation = new MockGraphicsAllocation(cmdBuffer, sizeStream);
|
||||
commandStream.replaceGraphicsAllocation(graphicsAllocation);
|
||||
|
||||
dsh.replaceBuffer(dshBuffer, sizeStream);
|
||||
graphicsAllocation = new GraphicsAllocation(dshBuffer, sizeStream);
|
||||
graphicsAllocation = new MockGraphicsAllocation(dshBuffer, sizeStream);
|
||||
dsh.replaceGraphicsAllocation(graphicsAllocation);
|
||||
|
||||
ioh.replaceBuffer(iohBuffer, sizeStream);
|
||||
|
||||
graphicsAllocation = new GraphicsAllocation(iohBuffer, sizeStream);
|
||||
graphicsAllocation = new MockGraphicsAllocation(iohBuffer, sizeStream);
|
||||
ioh.replaceGraphicsAllocation(graphicsAllocation);
|
||||
|
||||
ssh.replaceBuffer(sshBuffer, sizeStream);
|
||||
graphicsAllocation = new GraphicsAllocation(sshBuffer, sizeStream);
|
||||
graphicsAllocation = new MockGraphicsAllocation(sshBuffer, sizeStream);
|
||||
ssh.replaceGraphicsAllocation(graphicsAllocation);
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ struct CnlPreambleWaCmds : public PreambleFixture {
|
|||
DeviceFixture::SetUpImpl(pHwInfo);
|
||||
HardwareParse::SetUp();
|
||||
if (pDevice->getPreemptionMode() == PreemptionMode::MidThread) {
|
||||
preemptionLocation.reset(new GraphicsAllocation(nullptr, 0));
|
||||
preemptionLocation.reset(new GraphicsAllocation(nullptr, 0llu, 0llu, 0));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "unit_tests/libult/mock_gfx_family.h"
|
||||
#include "unit_tests/mocks/mock_device.h"
|
||||
#include "unit_tests/mocks/mock_gmm.h"
|
||||
#include "unit_tests/mocks/mock_graphics_allocation.h"
|
||||
#include "runtime/platform/platform.h"
|
||||
|
||||
#include "GL/gl.h"
|
||||
|
@ -253,7 +254,7 @@ TEST_F(GmmTests, givenTilableImageWhenEnableForceLinearImagesThenYTilingIsDisabl
|
|||
}
|
||||
|
||||
TEST_F(GmmTests, givenZeroRowPitchWhenQueryImgFromBufferParamsThenCalculate) {
|
||||
GraphicsAllocation bufferAllocation(nullptr, 4096);
|
||||
MockGraphicsAllocation bufferAllocation(nullptr, 4096);
|
||||
|
||||
cl_image_desc imgDesc{};
|
||||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
|
@ -269,7 +270,7 @@ TEST_F(GmmTests, givenZeroRowPitchWhenQueryImgFromBufferParamsThenCalculate) {
|
|||
}
|
||||
|
||||
TEST_F(GmmTests, givenNonZeroRowPitchWhenQueryImgFromBufferParamsThenUseUserValue) {
|
||||
GraphicsAllocation bufferAllocation(nullptr, 4096);
|
||||
MockGraphicsAllocation bufferAllocation(nullptr, 4096);
|
||||
|
||||
cl_image_desc imgDesc{};
|
||||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "runtime/indirect_heap/indirect_heap.h"
|
||||
#include "runtime/memory_manager/graphics_allocation.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "unit_tests/mocks/mock_graphics_allocation.h"
|
||||
#include <memory>
|
||||
|
||||
namespace DirtyStateHelpers {
|
||||
|
@ -33,7 +34,7 @@ struct HeapDirtyStateTests : ::testing::Test {
|
|||
ASSERT_EQ(heapAllocation.getUnderlyingBufferSize(), stream->getMaxAvailableSpace());
|
||||
}
|
||||
|
||||
GraphicsAllocation heapAllocation = {buffer, bufferSize};
|
||||
MockGraphicsAllocation heapAllocation = {buffer, bufferSize};
|
||||
|
||||
std::unique_ptr<IndirectHeap> stream;
|
||||
MockHeapDirtyState mockHeapDirtyState;
|
||||
|
@ -109,8 +110,8 @@ TEST_F(HeapDirtyStateTests, givenNonDirtyObjectWhenSizeAndBufferChangedThenRetur
|
|||
}
|
||||
|
||||
TEST(DirtyStateHelpers, givenDirtyStateHelperWhenTwoDifferentIndirectHeapsAreCheckedButWithTheSame4GBbaseThenStateIsNotDirty) {
|
||||
GraphicsAllocation firstHeapAllocation(reinterpret_cast<void *>(0x1234), 4192);
|
||||
GraphicsAllocation secondHeapAllocation(reinterpret_cast<void *>(0x9345), 1234);
|
||||
MockGraphicsAllocation firstHeapAllocation(reinterpret_cast<void *>(0x1234), 4192);
|
||||
MockGraphicsAllocation secondHeapAllocation(reinterpret_cast<void *>(0x9345), 1234);
|
||||
uint64_t commonBase = 0x8123456;
|
||||
firstHeapAllocation.gpuBaseAddress = commonBase;
|
||||
secondHeapAllocation.gpuBaseAddress = commonBase;
|
||||
|
|
|
@ -879,7 +879,7 @@ TEST_F(DispatchInfoBuilderTest, setKernelArg) {
|
|||
char data[128];
|
||||
void *svmPtr = &data;
|
||||
EXPECT_EQ(CL_SUCCESS, diBuilder->setArgSvm(1, sizeof(svmPtr), svmPtr));
|
||||
GraphicsAllocation svmAlloc(svmPtr, 128);
|
||||
MockGraphicsAllocation svmAlloc(svmPtr, 128);
|
||||
EXPECT_EQ(CL_SUCCESS, diBuilder->setArgSvmAlloc(2, svmPtr, &svmAlloc));
|
||||
|
||||
for (auto &dispatchInfo : multiDispatchInfo) {
|
||||
|
@ -990,7 +990,7 @@ TEST_F(DispatchInfoBuilderTest, setKernelArgNullKernel) {
|
|||
auto pVal = &val;
|
||||
char data[128];
|
||||
void *svmPtr = &data;
|
||||
GraphicsAllocation svmAlloc(svmPtr, 128);
|
||||
MockGraphicsAllocation svmAlloc(svmPtr, 128);
|
||||
|
||||
DispatchInfoBuilder<SplitDispatch::Dim::d3D, SplitDispatch::SplitMode::NoSplit> *diBuilder = new DispatchInfoBuilder<SplitDispatch::Dim::d3D, SplitDispatch::SplitMode::NoSplit>();
|
||||
ASSERT_NE(nullptr, diBuilder);
|
||||
|
|
|
@ -700,12 +700,12 @@ HWCMDTEST_F(IGFX_GEN8_CORE, KernelCommandsTest, usedBindingTableStatePointersFor
|
|||
|
||||
// setup global memory
|
||||
char globalBuffer[16];
|
||||
GraphicsAllocation gfxGlobalAlloc(globalBuffer, sizeof(globalBuffer));
|
||||
GraphicsAllocation gfxGlobalAlloc(globalBuffer, castToUint64(globalBuffer), 0llu, sizeof(globalBuffer));
|
||||
program.setGlobalSurface(&gfxGlobalAlloc);
|
||||
|
||||
// setup constant memory
|
||||
char constBuffer[16];
|
||||
GraphicsAllocation gfxConstAlloc(constBuffer, sizeof(constBuffer));
|
||||
GraphicsAllocation gfxConstAlloc(constBuffer, castToUint64(constBuffer), 0llu, sizeof(constBuffer));
|
||||
program.setConstantSurface(&gfxConstAlloc);
|
||||
|
||||
// create kernel
|
||||
|
|
|
@ -88,7 +88,7 @@ TEST_F(IndirectHeapTest, givenIndirectHeapWhenGetCpuBaseIsCalledThenCpuAddressIs
|
|||
|
||||
TEST(IndirectHeapWith4GbAllocatorTest, givenIndirectHeapNotSupporting4GbModeWhenAskedForHeapGpuStartOffsetThenZeroIsReturned) {
|
||||
auto cpuBaseAddress = reinterpret_cast<void *>(0x3000);
|
||||
GraphicsAllocation graphicsAllocation(cpuBaseAddress, 4096u);
|
||||
MockGraphicsAllocation graphicsAllocation(cpuBaseAddress, 4096u);
|
||||
graphicsAllocation.gpuBaseAddress = 4096u;
|
||||
IndirectHeap indirectHeap(&graphicsAllocation, false);
|
||||
|
||||
|
@ -97,7 +97,7 @@ TEST(IndirectHeapWith4GbAllocatorTest, givenIndirectHeapNotSupporting4GbModeWhen
|
|||
|
||||
TEST(IndirectHeapWith4GbAllocatorTest, givenIndirectHeapSupporting4GbModeWhenAskedForHeapGpuStartOffsetThenZeroIsReturned) {
|
||||
auto cpuBaseAddress = reinterpret_cast<void *>(0x3000);
|
||||
GraphicsAllocation graphicsAllocation(cpuBaseAddress, 4096u);
|
||||
MockGraphicsAllocation graphicsAllocation(cpuBaseAddress, 4096u);
|
||||
graphicsAllocation.gpuBaseAddress = 4096u;
|
||||
IndirectHeap indirectHeap(&graphicsAllocation, true);
|
||||
|
||||
|
@ -106,7 +106,7 @@ TEST(IndirectHeapWith4GbAllocatorTest, givenIndirectHeapSupporting4GbModeWhenAsk
|
|||
|
||||
TEST(IndirectHeapWith4GbAllocatorTest, givenIndirectHeapSupporting4GbModeWhenAskedForHeapBaseThenGpuBaseIsReturned) {
|
||||
auto cpuBaseAddress = reinterpret_cast<void *>(0x2000);
|
||||
GraphicsAllocation graphicsAllocation(cpuBaseAddress, 4096u);
|
||||
MockGraphicsAllocation graphicsAllocation(cpuBaseAddress, 4096u);
|
||||
graphicsAllocation.gpuBaseAddress = 4096u;
|
||||
IndirectHeap indirectHeap(&graphicsAllocation, true);
|
||||
|
||||
|
@ -115,7 +115,7 @@ TEST(IndirectHeapWith4GbAllocatorTest, givenIndirectHeapSupporting4GbModeWhenAsk
|
|||
|
||||
TEST(IndirectHeapWith4GbAllocatorTest, givenIndirectHeapNotSupporting4GbModeWhenAskedForHeapBaseThenGpuAddressIsReturned) {
|
||||
auto cpuBaseAddress = reinterpret_cast<void *>(0x2000);
|
||||
GraphicsAllocation graphicsAllocation(cpuBaseAddress, 4096u);
|
||||
MockGraphicsAllocation graphicsAllocation(cpuBaseAddress, 4096u);
|
||||
graphicsAllocation.gpuBaseAddress = 4096u;
|
||||
IndirectHeap indirectHeap(&graphicsAllocation, false);
|
||||
|
||||
|
@ -124,7 +124,7 @@ TEST(IndirectHeapWith4GbAllocatorTest, givenIndirectHeapNotSupporting4GbModeWhen
|
|||
|
||||
TEST(IndirectHeapWith4GbAllocatorTest, givenIndirectHeapNotSupporting4GbModeWhenAskedForHeapSizeThenGraphicsAllocationSizeInPagesIsReturned) {
|
||||
auto cpuBaseAddress = reinterpret_cast<void *>(0x2000);
|
||||
GraphicsAllocation graphicsAllocation(cpuBaseAddress, 4096u);
|
||||
MockGraphicsAllocation graphicsAllocation(cpuBaseAddress, 4096u);
|
||||
graphicsAllocation.gpuBaseAddress = 4096u;
|
||||
IndirectHeap indirectHeap(&graphicsAllocation, false);
|
||||
|
||||
|
@ -133,9 +133,9 @@ TEST(IndirectHeapWith4GbAllocatorTest, givenIndirectHeapNotSupporting4GbModeWhen
|
|||
|
||||
TEST(IndirectHeapWith4GbAllocatorTest, givenIndirectHeapSupporting4GbModeWhenAskedForHeapSizeThen4GbSizeInPagesIsReturned) {
|
||||
auto cpuBaseAddress = reinterpret_cast<void *>(0x2000);
|
||||
GraphicsAllocation graphicsAllocation(cpuBaseAddress, 4096u);
|
||||
MockGraphicsAllocation graphicsAllocation(cpuBaseAddress, 4096u);
|
||||
graphicsAllocation.gpuBaseAddress = 4096u;
|
||||
IndirectHeap indirectHeap(&graphicsAllocation, true);
|
||||
|
||||
EXPECT_EQ(MemoryConstants::sizeOf4GBinPageEntities, indirectHeap.getHeapSizeInPages());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -449,7 +449,7 @@ TEST_F(CloneKernelTest, cloneKernelWithArgSvm) {
|
|||
|
||||
TEST_F(CloneKernelTest, cloneKernelWithArgSvmAlloc) {
|
||||
char *svmPtr = new char[256];
|
||||
GraphicsAllocation svmAlloc(svmPtr, 256);
|
||||
MockGraphicsAllocation svmAlloc(svmPtr, 256);
|
||||
|
||||
retVal = pSourceKernel->setArgSvmAlloc(0, svmPtr, &svmAlloc);
|
||||
ASSERT_EQ(CL_SUCCESS, retVal);
|
||||
|
|
|
@ -131,7 +131,7 @@ HWTEST_F(KernelArgSvmTest, SetKernelArgValidSvmPtrStateful) {
|
|||
TEST_F(KernelArgSvmTest, SetKernelArgValidSvmAlloc) {
|
||||
char *svmPtr = new char[256];
|
||||
|
||||
GraphicsAllocation svmAlloc(svmPtr, 256);
|
||||
MockGraphicsAllocation svmAlloc(svmPtr, 256);
|
||||
|
||||
auto retVal = pKernel->setArgSvmAlloc(0, svmPtr, &svmAlloc);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
|
@ -146,7 +146,7 @@ TEST_F(KernelArgSvmTest, SetKernelArgValidSvmAlloc) {
|
|||
TEST_F(KernelArgSvmTest, SetKernelArgValidSvmAllocStateless) {
|
||||
char *svmPtr = new char[256];
|
||||
|
||||
GraphicsAllocation svmAlloc(svmPtr, 256);
|
||||
MockGraphicsAllocation svmAlloc(svmPtr, 256);
|
||||
|
||||
pKernelInfo->usesSsh = false;
|
||||
pKernelInfo->requiresSshForBuffers = false;
|
||||
|
@ -162,7 +162,7 @@ TEST_F(KernelArgSvmTest, SetKernelArgValidSvmAllocStateless) {
|
|||
HWTEST_F(KernelArgSvmTest, SetKernelArgValidSvmAllocStateful) {
|
||||
char *svmPtr = new char[256];
|
||||
|
||||
GraphicsAllocation svmAlloc(svmPtr, 256);
|
||||
MockGraphicsAllocation svmAlloc(svmPtr, 256);
|
||||
|
||||
pKernelInfo->usesSsh = true;
|
||||
pKernelInfo->requiresSshForBuffers = true;
|
||||
|
@ -188,7 +188,7 @@ HWTEST_F(KernelArgSvmTest, givenOffsetedSvmPointerWhenSetArgSvmAllocIsCalledThen
|
|||
|
||||
auto offsetedPtr = svmPtr.get() + 4;
|
||||
|
||||
GraphicsAllocation svmAlloc(svmPtr.get(), 256);
|
||||
MockGraphicsAllocation svmAlloc(svmPtr.get(), 256);
|
||||
pKernelInfo->usesSsh = true;
|
||||
pKernelInfo->requiresSshForBuffers = true;
|
||||
|
||||
|
@ -220,7 +220,7 @@ HWTEST_F(KernelArgSvmTest, PatchWithImplicitSurface) {
|
|||
pKernelInfo->requiresSshForBuffers = true;
|
||||
pKernelInfo->usesSsh = true;
|
||||
{
|
||||
GraphicsAllocation svmAlloc(svmPtr.data(), svmPtr.size());
|
||||
MockGraphicsAllocation svmAlloc(svmPtr.data(), svmPtr.size());
|
||||
|
||||
SPatchAllocateStatelessGlobalMemorySurfaceWithInitialization patch;
|
||||
memset(&patch, 0, sizeof(patch));
|
||||
|
@ -270,7 +270,7 @@ TEST_F(KernelArgSvmTest, patchBufferOffset) {
|
|||
constexpr uint32_t initVal = 7U;
|
||||
constexpr uint32_t svmOffset = 13U;
|
||||
|
||||
GraphicsAllocation svmAlloc(svmPtr.data(), 256);
|
||||
MockGraphicsAllocation svmAlloc(svmPtr.data(), 256);
|
||||
uint32_t *expectedPatchPtr = reinterpret_cast<uint32_t *>(pKernel->getCrossThreadData());
|
||||
|
||||
KernelArgInfo kai;
|
||||
|
@ -371,7 +371,7 @@ HWTEST_TYPED_TEST(KernelArgSvmTestTyped, GivenBufferKernelArgWhenBufferOffsetIsN
|
|||
this->pKernelInfo->requiresSshForBuffers = true;
|
||||
this->pKernelInfo->usesSsh = true;
|
||||
{
|
||||
GraphicsAllocation svmAlloc(svmPtr, svmSize);
|
||||
MockGraphicsAllocation svmAlloc(svmPtr, svmSize);
|
||||
|
||||
constexpr size_t patchOffset = 16;
|
||||
void *ptrToPatch = svmPtr + patchOffset;
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "unit_tests/helpers/debug_manager_state_restore.h"
|
||||
#include "unit_tests/helpers/gtest_helpers.h"
|
||||
#include "test.h"
|
||||
#include "unit_tests/mocks/mock_graphics_allocation.h"
|
||||
#include "unit_tests/mocks/mock_kernel.h"
|
||||
#include "unit_tests/mocks/mock_program.h"
|
||||
#include "unit_tests/mocks/mock_context.h"
|
||||
|
@ -744,7 +745,7 @@ TEST_F(KernelPrivateSurfaceTest, givenStatelessKernelWhenKernelIsCreatedThenPriv
|
|||
|
||||
// setup global memory
|
||||
char buffer[16];
|
||||
GraphicsAllocation gfxAlloc(buffer, sizeof(buffer));
|
||||
MockGraphicsAllocation gfxAlloc(buffer, sizeof(buffer));
|
||||
|
||||
MockContext context;
|
||||
MockProgram program(*pDevice->getExecutionEnvironment(), &context, false);
|
||||
|
@ -942,7 +943,7 @@ HWTEST_F(KernelGlobalSurfaceTest, givenStatefulKernelWhenKernelIsCreatedThenGlob
|
|||
pKernelInfo->patchInfo.pAllocateStatelessGlobalMemorySurfaceWithInitialization = &AllocateStatelessGlobalMemorySurfaceWithInitialization;
|
||||
|
||||
char buffer[16];
|
||||
GraphicsAllocation gfxAlloc(buffer, sizeof(buffer));
|
||||
MockGraphicsAllocation gfxAlloc(buffer, sizeof(buffer));
|
||||
void *bufferAddress = gfxAlloc.getUnderlyingBuffer();
|
||||
|
||||
MockContext context;
|
||||
|
@ -993,7 +994,7 @@ TEST_F(KernelGlobalSurfaceTest, givenStatelessKernelWhenKernelIsCreatedThenGloba
|
|||
|
||||
// setup global memory
|
||||
char buffer[16];
|
||||
GraphicsAllocation gfxAlloc(buffer, sizeof(buffer));
|
||||
MockGraphicsAllocation gfxAlloc(buffer, sizeof(buffer));
|
||||
|
||||
MockProgram program(*pDevice->getExecutionEnvironment());
|
||||
program.setGlobalSurface(&gfxAlloc);
|
||||
|
@ -1116,7 +1117,7 @@ HWTEST_F(KernelConstantSurfaceTest, givenStatefulKernelWhenKernelIsCreatedThenCo
|
|||
pKernelInfo->patchInfo.pAllocateStatelessConstantMemorySurfaceWithInitialization = &AllocateStatelessConstantMemorySurfaceWithInitialization;
|
||||
|
||||
char buffer[16];
|
||||
GraphicsAllocation gfxAlloc(buffer, sizeof(buffer));
|
||||
MockGraphicsAllocation gfxAlloc(buffer, sizeof(buffer));
|
||||
void *bufferAddress = gfxAlloc.getUnderlyingBuffer();
|
||||
|
||||
MockContext context;
|
||||
|
@ -1167,7 +1168,7 @@ TEST_F(KernelConstantSurfaceTest, givenStatelessKernelWhenKernelIsCreatedThenCon
|
|||
|
||||
// setup global memory
|
||||
char buffer[16];
|
||||
GraphicsAllocation gfxAlloc(buffer, sizeof(buffer));
|
||||
MockGraphicsAllocation gfxAlloc(buffer, sizeof(buffer));
|
||||
|
||||
MockProgram program(*pDevice->getExecutionEnvironment());
|
||||
program.setConstantSurface(&gfxAlloc);
|
||||
|
|
|
@ -65,7 +65,7 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily> {
|
|||
UltCommandStreamReceiver(const HardwareInfo &hwInfoIn, ExecutionEnvironment &executionEnvironment) : BaseClass(hwInfoIn, executionEnvironment) {
|
||||
this->storeMakeResidentAllocations = false;
|
||||
if (hwInfoIn.capabilityTable.defaultPreemptionMode == PreemptionMode::MidThread) {
|
||||
tempPreemptionLocation = new GraphicsAllocation(nullptr, 0);
|
||||
tempPreemptionLocation = new GraphicsAllocation(nullptr, 0llu, 0, 0llu);
|
||||
this->preemptionCsrAllocation = tempPreemptionLocation;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -488,7 +488,7 @@ TEST(MemObj, givenNotSharedMemObjectWhenChangingGfxAllocationThenOldAllocationIs
|
|||
}
|
||||
|
||||
TEST(MemObj, givenGraphicsAllocationWhenCallingIsAllocDumpableThenItReturnsTheCorrectValue) {
|
||||
GraphicsAllocation gfxAllocation(nullptr, 0);
|
||||
MockGraphicsAllocation gfxAllocation(nullptr, 0);
|
||||
EXPECT_FALSE(gfxAllocation.isAllocDumpable());
|
||||
gfxAllocation.setAllocDumpable(true);
|
||||
EXPECT_TRUE(gfxAllocation.isAllocDumpable());
|
||||
|
|
|
@ -62,7 +62,7 @@ TEST(GraphicsAllocationTest, Ctor) {
|
|||
void *cpuPtr = (void *)0x30000;
|
||||
size_t size = 0x1000;
|
||||
|
||||
GraphicsAllocation gfxAllocation(cpuPtr, size);
|
||||
MockGraphicsAllocation gfxAllocation(cpuPtr, size);
|
||||
uint64_t expectedGpuAddr = static_cast<uint64_t>(reinterpret_cast<uintptr_t>(gfxAllocation.getUnderlyingBuffer()));
|
||||
|
||||
EXPECT_EQ(expectedGpuAddr, gfxAllocation.getGpuAddress());
|
||||
|
@ -153,7 +153,7 @@ TEST_F(MemoryAllocatorTest, GivenGraphicsAllocationWhenAddAndRemoveAllocationToH
|
|||
void *cpuPtr = (void *)0x30000;
|
||||
size_t size = 0x1000;
|
||||
|
||||
GraphicsAllocation gfxAllocation(cpuPtr, size);
|
||||
MockGraphicsAllocation gfxAllocation(cpuPtr, size);
|
||||
memoryManager->addAllocationToHostPtrManager(&gfxAllocation);
|
||||
auto fragment = memoryManager->getHostPtrManager()->getFragment(gfxAllocation.getUnderlyingBuffer());
|
||||
EXPECT_NE(fragment, nullptr);
|
||||
|
@ -1369,7 +1369,7 @@ TEST(GraphicsAllocation, givenCpuPointerBasedConstructorWhenGraphicsAllocationIs
|
|||
uintptr_t address = 0xf0000000;
|
||||
void *addressWithTrailingBitSet = reinterpret_cast<void *>(address);
|
||||
uint64_t expectedGpuAddress = 0xf0000000;
|
||||
GraphicsAllocation graphicsAllocation(addressWithTrailingBitSet, 1u);
|
||||
MockGraphicsAllocation graphicsAllocation(addressWithTrailingBitSet, 1u);
|
||||
EXPECT_EQ(expectedGpuAddress, graphicsAllocation.getGpuAddress());
|
||||
}
|
||||
|
||||
|
@ -1383,7 +1383,7 @@ TEST(GraphicsAllocation, givenSharedHandleBasedConstructorWhenGraphicsAllocation
|
|||
}
|
||||
|
||||
TEST(GraphicsAllocation, givenGraphicsAllocationCreatedWithDefaultConstructorThenItIsNotResidentInAllContexts) {
|
||||
GraphicsAllocation graphicsAllocation(nullptr, 1u);
|
||||
MockGraphicsAllocation graphicsAllocation(nullptr, 1u);
|
||||
for (uint32_t index = 0u; index < maxOsContextCount; index++) {
|
||||
EXPECT_EQ(ObjectNotResident, graphicsAllocation.residencyTaskCount[index]);
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ class SurfaceTest : public ::testing::Test {
|
|||
public:
|
||||
char data[10];
|
||||
MockBuffer buffer;
|
||||
GraphicsAllocation gfxAllocation{nullptr, 0};
|
||||
MockGraphicsAllocation gfxAllocation{nullptr, 0};
|
||||
};
|
||||
|
||||
TYPED_TEST_CASE(SurfaceTest, SurfaceTypes);
|
||||
|
|
|
@ -13,7 +13,7 @@ class MockGraphicsAllocation : public GraphicsAllocation {
|
|||
using GraphicsAllocation::GraphicsAllocation;
|
||||
|
||||
public:
|
||||
MockGraphicsAllocation(void *buffer, size_t sizeIn) : GraphicsAllocation(buffer, sizeIn) {
|
||||
MockGraphicsAllocation(void *buffer, size_t sizeIn) : GraphicsAllocation(buffer, castToUint64(buffer), 0llu, sizeIn) {
|
||||
}
|
||||
void resetInspectionId() {
|
||||
this->inspectionId = 0;
|
||||
|
|
|
@ -1,36 +1,22 @@
|
|||
/*
|
||||
* Copyright (c) 2017, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
* Copyright (C) 2017-2018 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "runtime/memory_manager/graphics_allocation.h"
|
||||
#include "runtime/program/kernel_info.h"
|
||||
|
||||
#include "unit_tests/mocks/mock_block_kernel_manager.h"
|
||||
#include "unit_tests/mocks/mock_graphics_allocation.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace OCLRT;
|
||||
|
||||
TEST(BlockKernelManagerTest, pushPrivateSurfaceResizesArray) {
|
||||
GraphicsAllocation allocation(0, 0);
|
||||
MockGraphicsAllocation allocation(0, 0);
|
||||
KernelInfo *blockInfo = new KernelInfo;
|
||||
MockBlockKernelManager blockManager;
|
||||
|
||||
|
@ -44,8 +30,8 @@ TEST(BlockKernelManagerTest, pushPrivateSurfaceResizesArray) {
|
|||
}
|
||||
|
||||
TEST(BlockKernelManagerTest, pushPrivateSurfacePlacesAllocationInCorrectPosition) {
|
||||
GraphicsAllocation allocation1(0, 0);
|
||||
GraphicsAllocation allocation2(0, 0);
|
||||
MockGraphicsAllocation allocation1(0, 0);
|
||||
MockGraphicsAllocation allocation2(0, 0);
|
||||
KernelInfo *blockInfo = new KernelInfo;
|
||||
KernelInfo *blockInfo2 = new KernelInfo;
|
||||
MockBlockKernelManager blockManager;
|
||||
|
@ -63,7 +49,7 @@ TEST(BlockKernelManagerTest, pushPrivateSurfacePlacesAllocationInCorrectPosition
|
|||
}
|
||||
|
||||
TEST(BlockKernelManagerTest, pushPrivateSurfaceSetsPrivateSurfaceArrayToNullptrOnFirstCall) {
|
||||
GraphicsAllocation allocation(0, 0);
|
||||
MockGraphicsAllocation allocation(0, 0);
|
||||
KernelInfo *blockInfo = new KernelInfo;
|
||||
KernelInfo *blockInfo2 = new KernelInfo;
|
||||
KernelInfo *blockInfo3 = new KernelInfo;
|
||||
|
@ -82,7 +68,7 @@ TEST(BlockKernelManagerTest, pushPrivateSurfaceSetsPrivateSurfaceArrayToNullptrO
|
|||
}
|
||||
|
||||
TEST(BlockKernelManagerTest, getPrivateSurface) {
|
||||
GraphicsAllocation allocation(0, 0);
|
||||
MockGraphicsAllocation allocation(0, 0);
|
||||
KernelInfo *blockInfo = new KernelInfo;
|
||||
|
||||
MockBlockKernelManager blockManager;
|
||||
|
@ -100,4 +86,4 @@ TEST(BlockKernelManagerTest, getPrivateSurfaceWithOutOfBoundOrdinalRetunrsNullpt
|
|||
MockBlockKernelManager blockManager;
|
||||
EXPECT_EQ(nullptr, blockManager.getPrivateSurface(0));
|
||||
EXPECT_EQ(nullptr, blockManager.getPrivateSurface(10));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "unit_tests/mocks/mock_builtins.h"
|
||||
#include "unit_tests/mocks/mock_csr.h"
|
||||
#include "unit_tests/mocks/mock_device.h"
|
||||
#include "unit_tests/mocks/mock_graphics_allocation.h"
|
||||
|
||||
#include "test.h"
|
||||
#include <memory>
|
||||
|
@ -33,7 +34,7 @@ HWTEST_F(CommandStreamReceiverWithActiveDebuggerTest, givenCsrWithActiveDebugger
|
|||
|
||||
void *buffer = alignedMalloc(MemoryConstants::pageSize, MemoryConstants::pageSize64k);
|
||||
|
||||
std::unique_ptr<GraphicsAllocation> allocation(new GraphicsAllocation(buffer, MemoryConstants::pageSize));
|
||||
std::unique_ptr<MockGraphicsAllocation> allocation(new MockGraphicsAllocation(buffer, MemoryConstants::pageSize));
|
||||
std::unique_ptr<IndirectHeap> heap(new IndirectHeap(allocation.get()));
|
||||
|
||||
mockCsr->flushTask(commandStream,
|
||||
|
|
Loading…
Reference in New Issue