Make residency in graphics allocation OsContext dependent.

- Graphics Allocation now holds residency control per OsContext.

Change-Id: Ie0a0d3aa9fdaf542fdd42dee3aba236a5af635c7
This commit is contained in:
Mrozek, Michal
2018-09-19 20:54:29 -07:00
committed by sys_ocldev
parent c39f9c0c66
commit 78f828fcd1
21 changed files with 181 additions and 366 deletions

View File

@@ -304,7 +304,7 @@ FlushStamp AUBCommandStreamReceiverHw<GfxFamily>::flush(BatchBuffer &batchBuffer
}
} else {
allocationsForResidency->push_back(batchBuffer.commandBufferAllocation);
batchBuffer.commandBufferAllocation->residencyTaskCount = this->taskCount;
batchBuffer.commandBufferAllocation->residencyTaskCount[this->deviceIndex] = this->taskCount;
}
UNRECOVERABLE_IF(allocationsForResidency == nullptr);
processResidency(*allocationsForResidency, osContext);
@@ -598,7 +598,7 @@ void AUBCommandStreamReceiverHw<GfxFamily>::processResidency(ResidencyContainer
if (!writeMemory(*gfxAllocation)) {
DEBUG_BREAK_IF(!((gfxAllocation->getUnderlyingBufferSize() == 0) || !gfxAllocation->isAubWritable()));
}
gfxAllocation->residencyTaskCount = this->taskCount + 1;
gfxAllocation->residencyTaskCount[this->deviceIndex] = this->taskCount + 1;
}
dumpAubNonWritable = false;
@@ -606,9 +606,9 @@ void AUBCommandStreamReceiverHw<GfxFamily>::processResidency(ResidencyContainer
template <typename GfxFamily>
void AUBCommandStreamReceiverHw<GfxFamily>::makeNonResident(GraphicsAllocation &gfxAllocation) {
if (gfxAllocation.residencyTaskCount != ObjectNotResident) {
if (gfxAllocation.residencyTaskCount[this->deviceIndex] != ObjectNotResident) {
this->pushAllocationForEviction(&gfxAllocation);
gfxAllocation.residencyTaskCount = ObjectNotResident;
gfxAllocation.residencyTaskCount[this->deviceIndex] = ObjectNotResident;
}
}

View File

@@ -1,23 +1,8 @@
/*
* Copyright (c) 2018, Intel Corporation
* Copyright (C) 2018 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:
* SPDX-License-Identifier: MIT
*
* 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.
*/
#include "runtime/command_stream/command_stream_receiver.h"
@@ -69,14 +54,14 @@ CommandStreamReceiver::~CommandStreamReceiver() {
void CommandStreamReceiver::makeResident(GraphicsAllocation &gfxAllocation) {
auto submissionTaskCount = this->taskCount + 1;
if (gfxAllocation.residencyTaskCount < (int)submissionTaskCount) {
if (gfxAllocation.residencyTaskCount[deviceIndex] < (int)submissionTaskCount) {
this->pushAllocationForResidency(&gfxAllocation);
gfxAllocation.taskCount = submissionTaskCount;
if (gfxAllocation.residencyTaskCount == ObjectNotResident) {
if (gfxAllocation.residencyTaskCount[deviceIndex] == ObjectNotResident) {
this->totalMemoryUsed += gfxAllocation.getUnderlyingBufferSize();
}
}
gfxAllocation.residencyTaskCount = submissionTaskCount;
gfxAllocation.residencyTaskCount[deviceIndex] = submissionTaskCount;
}
void CommandStreamReceiver::processEviction() {
@@ -84,7 +69,7 @@ void CommandStreamReceiver::processEviction() {
}
void CommandStreamReceiver::makeNonResident(GraphicsAllocation &gfxAllocation) {
if (gfxAllocation.residencyTaskCount != ObjectNotResident) {
if (gfxAllocation.residencyTaskCount[deviceIndex] != ObjectNotResident) {
makeCoherent(gfxAllocation);
if (gfxAllocation.peekEvictable()) {
this->pushAllocationForEviction(&gfxAllocation);
@@ -93,7 +78,7 @@ void CommandStreamReceiver::makeNonResident(GraphicsAllocation &gfxAllocation) {
}
}
gfxAllocation.residencyTaskCount = ObjectNotResident;
gfxAllocation.residencyTaskCount[deviceIndex] = ObjectNotResident;
}
void CommandStreamReceiver::makeSurfacePackNonResident(ResidencyContainer *allocationsForResidency) {

View File

@@ -1,23 +1,8 @@
/*
* Copyright (c) 2018, Intel Corporation
* Copyright (C) 2018 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:
* SPDX-License-Identifier: MIT
*
* 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.
*/
#pragma once
@@ -167,6 +152,8 @@ class CommandStreamReceiver {
size_t defaultSshSize;
void setDeviceIndex(uint32_t deviceIndex) { this->deviceIndex = deviceIndex; }
protected:
void setDisableL3Cache(bool val) {
disableL3Cache = val;
@@ -226,6 +213,7 @@ class CommandStreamReceiver {
MutexType ownershipMutex;
std::unique_ptr<KmdNotifyHelper> kmdNotifyHelper;
ExecutionEnvironment &executionEnvironment;
uint32_t deviceIndex = 0u;
};
typedef CommandStreamReceiver *(*CommandStreamReceiverCreateFunc)(const HardwareInfo &hwInfoIn, bool withAubDump, ExecutionEnvironment &executionEnvironment);

View File

@@ -369,7 +369,7 @@ void TbxCommandStreamReceiverHw<GfxFamily>::processResidency(ResidencyContainer
if (!writeMemory(*gfxAllocation)) {
DEBUG_BREAK_IF(!(gfxAllocation->getUnderlyingBufferSize() == 0));
}
gfxAllocation->residencyTaskCount = this->taskCount + 1;
gfxAllocation->residencyTaskCount[this->deviceIndex] = this->taskCount + 1;
}
}

View File

@@ -1,24 +1,9 @@
/*
* Copyright (c) 2018, 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) 2018 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "runtime/execution_environment/execution_environment.h"
#include "runtime/command_stream/command_stream_receiver.h"
@@ -56,6 +41,7 @@ bool ExecutionEnvironment::initializeCommandStreamReceiver(const HardwareInfo *p
if (pHwInfo->capabilityTable.ftrRenderCompressedBuffers || pHwInfo->capabilityTable.ftrRenderCompressedImages) {
commandStreamReceiver->createPageTableManager();
}
commandStreamReceiver->setDeviceIndex(deviceIndex);
this->commandStreamReceivers[deviceIndex] = std::move(commandStreamReceiver);
return true;
}

View File

@@ -1,23 +1,8 @@
/*
* Copyright (c) 2017 - 2018, Intel Corporation
* Copyright (C) 2017-2018 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:
* SPDX-License-Identifier: MIT
*
* 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.
*/
#pragma once
@@ -39,6 +24,7 @@ namespace Sharing {
constexpr auto nonSharedResource = 0u;
}
constexpr uint32_t maxOsContextCount = 4u;
const int ObjectNotResident = -1;
const uint32_t ObjectNotUsed = (uint32_t)-1;
@@ -63,7 +49,7 @@ class GraphicsAllocation : public IDNode<GraphicsAllocation> {
uint64_t gpuBaseAddress = 0;
Gmm *gmm = nullptr;
uint64_t allocationOffset = 0u;
int residencyTaskCount = ObjectNotResident;
int residencyTaskCount[maxOsContextCount] = {ObjectNotResident};
bool cpuPtrAllocated = false; // flag indicating if cpuPtr is driver-allocated
enum class AllocationType {
@@ -145,7 +131,7 @@ class GraphicsAllocation : public IDNode<GraphicsAllocation> {
void setEvictable(bool evictable) { this->evictable = evictable; }
bool peekEvictable() const { return evictable; }
bool isResident() const { return residencyTaskCount != ObjectNotResident; }
bool isResident(uint32_t contextId) const { return residencyTaskCount[contextId] != ObjectNotResident; }
void setLocked(bool locked) { this->locked = locked; }
bool isLocked() const { return locked; }

View File

@@ -1,23 +1,8 @@
/*
* Copyright (c) 2017 - 2018, Intel Corporation
* Copyright (C) 2017-2018 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:
* SPDX-License-Identifier: MIT
*
* 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.
*/
#include "runtime/command_stream/linear_stream.h"
@@ -144,7 +129,7 @@ void DrmCommandStreamReceiver<GfxFamily>::makeNonResident(GraphicsAllocation &gf
// Vector is moved to command buffer inside flush.
// If flush wasn't called we need to make all objects non-resident.
// If makeNonResident is called before flush, vector will be cleared.
if (gfxAllocation.residencyTaskCount != ObjectNotResident) {
if (gfxAllocation.residencyTaskCount[this->deviceIndex] != ObjectNotResident) {
for (auto &surface : residency) {
surface->setIsResident(false);
}
@@ -158,7 +143,7 @@ void DrmCommandStreamReceiver<GfxFamily>::makeNonResident(GraphicsAllocation &gf
}
}
}
gfxAllocation.residencyTaskCount = ObjectNotResident;
gfxAllocation.residencyTaskCount[this->deviceIndex] = ObjectNotResident;
}
template <typename GfxFamily>

View File

@@ -1,23 +1,8 @@
/*
* Copyright (c) 2017 - 2018, Intel Corporation
* Copyright (C) 2017-2018 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:
* SPDX-License-Identifier: MIT
*
* 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.
*/
// Need to suppress warining 4005 caused by hw_cmds.h and wddm.h order.
@@ -103,7 +88,7 @@ FlushStamp WddmCommandStreamReceiver<GfxFamily>::flush(BatchBuffer &batchBuffer,
makeResident(*batchBuffer.commandBufferAllocation);
} else {
allocationsForResidency->push_back(batchBuffer.commandBufferAllocation);
batchBuffer.commandBufferAllocation->residencyTaskCount = this->taskCount;
batchBuffer.commandBufferAllocation->residencyTaskCount[this->deviceIndex] = this->taskCount;
}
UNRECOVERABLE_IF(allocationsForResidency == nullptr);

View File

@@ -259,26 +259,26 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWhenMakeResidentC
// First makeResident marks the allocation resident
aubCsr->makeResident(*gfxAllocation);
EXPECT_NE(ObjectNotResident, gfxAllocation->residencyTaskCount);
EXPECT_NE(ObjectNotResident, gfxAllocation->residencyTaskCount[0u]);
EXPECT_EQ(aubCsr->peekTaskCount() + 1, gfxAllocation->taskCount);
EXPECT_EQ((int)aubCsr->peekTaskCount() + 1, gfxAllocation->residencyTaskCount);
EXPECT_EQ((int)aubCsr->peekTaskCount() + 1, gfxAllocation->residencyTaskCount[0u]);
EXPECT_EQ(1u, aubCsr->getResidencyAllocations().size());
// Second makeResident should have no impact
aubCsr->makeResident(*gfxAllocation);
EXPECT_NE(ObjectNotResident, gfxAllocation->residencyTaskCount);
EXPECT_NE(ObjectNotResident, gfxAllocation->residencyTaskCount[0u]);
EXPECT_EQ(aubCsr->peekTaskCount() + 1, gfxAllocation->taskCount);
EXPECT_EQ((int)aubCsr->peekTaskCount() + 1, gfxAllocation->residencyTaskCount);
EXPECT_EQ((int)aubCsr->peekTaskCount() + 1, gfxAllocation->residencyTaskCount[0u]);
EXPECT_EQ(1u, aubCsr->getResidencyAllocations().size());
// First makeNonResident marks the allocation as nonresident
aubCsr->makeNonResident(*gfxAllocation);
EXPECT_EQ(ObjectNotResident, gfxAllocation->residencyTaskCount);
EXPECT_EQ(ObjectNotResident, gfxAllocation->residencyTaskCount[0u]);
EXPECT_EQ(1u, aubCsr->getEvictionAllocations().size());
// Second makeNonResident should have no impact
aubCsr->makeNonResident(*gfxAllocation);
EXPECT_EQ(ObjectNotResident, gfxAllocation->residencyTaskCount);
EXPECT_EQ(ObjectNotResident, gfxAllocation->residencyTaskCount[0u]);
EXPECT_EQ(1u, aubCsr->getEvictionAllocations().size());
memoryManager->freeGraphicsMemoryImpl(gfxAllocation);
@@ -470,17 +470,17 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInStandalon
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, cs.getUsed(), &cs};
auto engineType = OCLRT::ENGINE_RCS;
EXPECT_EQ(ObjectNotResident, commandBuffer->residencyTaskCount);
EXPECT_EQ(ObjectNotResident, commandBuffer->residencyTaskCount[0u]);
aubCsr->overrideDispatchPolicy(DispatchMode::ImmediateDispatch);
aubCsr->flush(batchBuffer, engineType, &allocationsForResidency, *pDevice->getOsContext());
EXPECT_NE(ObjectNotResident, commandBuffer->residencyTaskCount);
EXPECT_EQ((int)aubCsr->peekTaskCount() + 1, commandBuffer->residencyTaskCount);
EXPECT_NE(ObjectNotResident, commandBuffer->residencyTaskCount[0u]);
EXPECT_EQ((int)aubCsr->peekTaskCount() + 1, commandBuffer->residencyTaskCount[0u]);
aubCsr->makeSurfacePackNonResident(nullptr);
EXPECT_EQ(ObjectNotResident, commandBuffer->residencyTaskCount);
EXPECT_EQ(ObjectNotResident, commandBuffer->residencyTaskCount[0u]);
}
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInNoneStandaloneModeWhenFlushIsCalledThenItShouldNotCallMakeResidentOnCommandBufferAllocation) {
@@ -492,11 +492,11 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInNoneStand
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, cs.getUsed(), &cs};
auto engineType = OCLRT::ENGINE_RCS;
EXPECT_EQ(ObjectNotResident, aubExecutionEnvironment->commandBuffer->residencyTaskCount);
EXPECT_EQ(ObjectNotResident, aubExecutionEnvironment->commandBuffer->residencyTaskCount[0u]);
aubCsr->flush(batchBuffer, engineType, &allocationsForResidency, *pDevice->getOsContext());
EXPECT_EQ(ObjectNotResident, aubExecutionEnvironment->commandBuffer->residencyTaskCount);
EXPECT_EQ(ObjectNotResident, aubExecutionEnvironment->commandBuffer->residencyTaskCount[0u]);
}
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInStandaloneModeWhenFlushIsCalledThenItShouldCallMakeResidentOnResidencyAllocations) {
@@ -513,22 +513,22 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInStandalon
auto engineType = OCLRT::ENGINE_RCS;
ResidencyContainer allocationsForResidency = {gfxAllocation};
EXPECT_EQ(ObjectNotResident, gfxAllocation->residencyTaskCount);
EXPECT_EQ(ObjectNotResident, commandBuffer->residencyTaskCount);
EXPECT_EQ(ObjectNotResident, gfxAllocation->residencyTaskCount[0u]);
EXPECT_EQ(ObjectNotResident, commandBuffer->residencyTaskCount[0u]);
aubCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
aubCsr->flush(batchBuffer, engineType, &allocationsForResidency, *pDevice->getOsContext());
EXPECT_NE(ObjectNotResident, gfxAllocation->residencyTaskCount);
EXPECT_EQ((int)aubCsr->peekTaskCount() + 1, gfxAllocation->residencyTaskCount);
EXPECT_NE(ObjectNotResident, gfxAllocation->residencyTaskCount[0u]);
EXPECT_EQ((int)aubCsr->peekTaskCount() + 1, gfxAllocation->residencyTaskCount[0u]);
EXPECT_NE(ObjectNotResident, commandBuffer->residencyTaskCount);
EXPECT_EQ((int)aubCsr->peekTaskCount() + 1, commandBuffer->residencyTaskCount);
EXPECT_NE(ObjectNotResident, commandBuffer->residencyTaskCount[0u]);
EXPECT_EQ((int)aubCsr->peekTaskCount() + 1, commandBuffer->residencyTaskCount[0u]);
aubCsr->makeSurfacePackNonResident(&allocationsForResidency);
EXPECT_EQ(ObjectNotResident, gfxAllocation->residencyTaskCount);
EXPECT_EQ(ObjectNotResident, commandBuffer->residencyTaskCount);
EXPECT_EQ(ObjectNotResident, gfxAllocation->residencyTaskCount[0u]);
EXPECT_EQ(ObjectNotResident, commandBuffer->residencyTaskCount[0u]);
memoryManager->freeGraphicsMemory(gfxAllocation);
}
@@ -546,13 +546,13 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInNoneStand
auto engineType = OCLRT::ENGINE_RCS;
ResidencyContainer allocationsForResidency = {gfxAllocation};
EXPECT_EQ(ObjectNotResident, gfxAllocation->residencyTaskCount);
EXPECT_EQ(ObjectNotResident, commandBuffer->residencyTaskCount);
EXPECT_EQ(ObjectNotResident, gfxAllocation->residencyTaskCount[0u]);
EXPECT_EQ(ObjectNotResident, commandBuffer->residencyTaskCount[0u]);
aubCsr->flush(batchBuffer, engineType, &allocationsForResidency, *pDevice->getOsContext());
EXPECT_EQ(ObjectNotResident, gfxAllocation->residencyTaskCount);
EXPECT_EQ(ObjectNotResident, commandBuffer->residencyTaskCount);
EXPECT_EQ(ObjectNotResident, gfxAllocation->residencyTaskCount[0u]);
EXPECT_EQ(ObjectNotResident, commandBuffer->residencyTaskCount[0u]);
memoryManager->freeGraphicsMemoryImpl(gfxAllocation);
}
@@ -582,22 +582,22 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInStandalon
auto engineType = OCLRT::ENGINE_RCS;
ResidencyContainer allocationsForResidency = {gfxAllocation};
EXPECT_EQ(ObjectNotResident, gfxAllocation->residencyTaskCount);
EXPECT_EQ(ObjectNotResident, commandBuffer->residencyTaskCount);
EXPECT_EQ(ObjectNotResident, gfxAllocation->residencyTaskCount[0u]);
EXPECT_EQ(ObjectNotResident, commandBuffer->residencyTaskCount[0u]);
aubCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
aubCsr->flush(batchBuffer, engineType, &allocationsForResidency, *pDevice->getOsContext());
EXPECT_NE(ObjectNotResident, gfxAllocation->residencyTaskCount);
EXPECT_EQ((int)aubCsr->peekTaskCount() + 1, gfxAllocation->residencyTaskCount);
EXPECT_NE(ObjectNotResident, gfxAllocation->residencyTaskCount[0u]);
EXPECT_EQ((int)aubCsr->peekTaskCount() + 1, gfxAllocation->residencyTaskCount[0u]);
EXPECT_NE(ObjectNotResident, commandBuffer->residencyTaskCount);
EXPECT_EQ((int)aubCsr->peekTaskCount() + 1, commandBuffer->residencyTaskCount);
EXPECT_NE(ObjectNotResident, commandBuffer->residencyTaskCount[0u]);
EXPECT_EQ((int)aubCsr->peekTaskCount() + 1, commandBuffer->residencyTaskCount[0u]);
aubCsr->makeSurfacePackNonResident(&allocationsForResidency);
EXPECT_EQ(ObjectNotResident, gfxAllocation->residencyTaskCount);
EXPECT_EQ(ObjectNotResident, commandBuffer->residencyTaskCount);
EXPECT_EQ(ObjectNotResident, gfxAllocation->residencyTaskCount[0u]);
EXPECT_EQ(ObjectNotResident, commandBuffer->residencyTaskCount[0u]);
memoryManager->freeGraphicsMemory(gfxAllocation);
}

View File

@@ -1,23 +1,8 @@
/*
* Copyright (c) 2018, Intel Corporation
* Copyright (C) 2018 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:
* SPDX-License-Identifier: MIT
*
* 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.
*/
#include "reg_configs_common.h"
@@ -2326,8 +2311,8 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenRecorded
std::vector<GraphicsAllocation *> residentSurfaces = cmdBuffer->surfaces;
for (auto &graphicsAllocation : residentSurfaces) {
EXPECT_TRUE(graphicsAllocation->isResident());
EXPECT_EQ(1, graphicsAllocation->residencyTaskCount);
EXPECT_TRUE(graphicsAllocation->isResident(0u));
EXPECT_EQ(1, graphicsAllocation->residencyTaskCount[0u]);
}
mockCsr->flushBatchedSubmissions();
@@ -2343,7 +2328,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenRecorded
EXPECT_EQ(0u, surfacesForResidency.size());
for (auto &graphicsAllocation : residentSurfaces) {
EXPECT_FALSE(graphicsAllocation->isResident());
EXPECT_FALSE(graphicsAllocation->isResident(0u));
}
}

View File

@@ -1,23 +1,8 @@
/*
* Copyright (c) 2018, Intel Corporation
* Copyright (C) 2018 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:
* SPDX-License-Identifier: MIT
*
* 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.
*/
#include "runtime/command_stream/command_stream_receiver.h"
@@ -127,11 +112,11 @@ TEST_F(CommandStreamReceiverTest, makeResident_setsBufferResidencyFlag) {
srcMemory,
retVal);
ASSERT_NE(nullptr, buffer);
EXPECT_FALSE(buffer->getGraphicsAllocation()->isResident());
EXPECT_FALSE(buffer->getGraphicsAllocation()->isResident(0u));
commandStreamReceiver->makeResident(*buffer->getGraphicsAllocation());
EXPECT_TRUE(buffer->getGraphicsAllocation()->isResident());
EXPECT_TRUE(buffer->getGraphicsAllocation()->isResident(0u));
delete buffer;
}
@@ -415,3 +400,35 @@ TEST(CommandStreamReceiverSimpleTest, givenCSRWhenWaitBeforeMakingNonResidentWhe
EXPECT_EQ(0u, tag);
}
TEST(CommandStreamReceiverMultiContextTests, givenMultipleCsrsWhenSameResourcesAreUsedThenResidencyIsProperlyHandled) {
auto executionEnvironment = new ExecutionEnvironment;
std::unique_ptr<Device> device0(Device::create<Device>(nullptr, executionEnvironment, 0u));
std::unique_ptr<Device> device1(Device::create<Device>(nullptr, executionEnvironment, 1u));
auto &commandStreamReceiver0 = device0->getCommandStreamReceiver();
auto &commandStreamReceiver1 = device1->getCommandStreamReceiver();
auto graphicsAllocation = executionEnvironment->memoryManager->allocateGraphicsMemory(4096u);
commandStreamReceiver0.makeResident(*graphicsAllocation);
commandStreamReceiver1.makeResident(*graphicsAllocation);
EXPECT_EQ(1u, commandStreamReceiver0.getResidencyAllocations().size());
EXPECT_EQ(1u, commandStreamReceiver1.getResidencyAllocations().size());
EXPECT_EQ(1, graphicsAllocation->residencyTaskCount[0u]);
EXPECT_EQ(1, graphicsAllocation->residencyTaskCount[1u]);
commandStreamReceiver0.makeNonResident(*graphicsAllocation);
commandStreamReceiver1.makeNonResident(*graphicsAllocation);
EXPECT_EQ(ObjectNotResident, graphicsAllocation->residencyTaskCount[0u]);
EXPECT_EQ(ObjectNotResident, graphicsAllocation->residencyTaskCount[1u]);
EXPECT_EQ(1u, commandStreamReceiver0.getEvictionAllocations().size());
EXPECT_EQ(1u, commandStreamReceiver1.getEvictionAllocations().size());
executionEnvironment->memoryManager->freeGraphicsMemory(graphicsAllocation);
}

View File

@@ -225,13 +225,13 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenProcessResidenc
auto graphicsAllocation = memoryManager->allocateGraphicsMemory(4096);
ASSERT_NE(nullptr, graphicsAllocation);
EXPECT_EQ(ObjectNotResident, graphicsAllocation->residencyTaskCount);
EXPECT_EQ(ObjectNotResident, graphicsAllocation->residencyTaskCount[0u]);
tbxCsr->pushAllocationForResidency(graphicsAllocation);
tbxCsr->processResidency(tbxCsr->getResidencyAllocations(), *pDevice->getOsContext());
EXPECT_NE(ObjectNotResident, graphicsAllocation->residencyTaskCount);
EXPECT_EQ((int)tbxCsr->peekTaskCount() + 1, graphicsAllocation->residencyTaskCount);
EXPECT_NE(ObjectNotResident, graphicsAllocation->residencyTaskCount[0u]);
EXPECT_EQ((int)tbxCsr->peekTaskCount() + 1, graphicsAllocation->residencyTaskCount[0u]);
memoryManager->freeGraphicsMemory(graphicsAllocation);
}
@@ -244,13 +244,13 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenProcessResidenc
auto graphicsAllocation = memoryManager->allocateGraphicsMemory(4096);
ASSERT_NE(nullptr, graphicsAllocation);
EXPECT_EQ(ObjectNotResident, graphicsAllocation->residencyTaskCount);
EXPECT_EQ(ObjectNotResident, graphicsAllocation->residencyTaskCount[0u]);
ResidencyContainer allocationsForResidency = {graphicsAllocation};
tbxCsr->processResidency(allocationsForResidency, *pDevice->getOsContext());
EXPECT_NE(ObjectNotResident, graphicsAllocation->residencyTaskCount);
EXPECT_EQ((int)tbxCsr->peekTaskCount() + 1, graphicsAllocation->residencyTaskCount);
EXPECT_NE(ObjectNotResident, graphicsAllocation->residencyTaskCount[0u]);
EXPECT_EQ((int)tbxCsr->peekTaskCount() + 1, graphicsAllocation->residencyTaskCount[0u]);
memoryManager->freeGraphicsMemory(graphicsAllocation);
}
@@ -271,12 +271,12 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenFlushIsCalledTh
auto engineType = OCLRT::ENGINE_RCS;
ResidencyContainer allocationsForResidency = {graphicsAllocation};
EXPECT_EQ(ObjectNotResident, graphicsAllocation->residencyTaskCount);
EXPECT_EQ(ObjectNotResident, graphicsAllocation->residencyTaskCount[0u]);
tbxCsr->flush(batchBuffer, engineType, &allocationsForResidency, *pDevice->getOsContext());
EXPECT_NE(ObjectNotResident, graphicsAllocation->residencyTaskCount);
EXPECT_EQ((int)tbxCsr->peekTaskCount() + 1, graphicsAllocation->residencyTaskCount);
EXPECT_NE(ObjectNotResident, graphicsAllocation->residencyTaskCount[0u]);
EXPECT_EQ((int)tbxCsr->peekTaskCount() + 1, graphicsAllocation->residencyTaskCount[0u]);
memoryManager->freeGraphicsMemory(commandBuffer);
memoryManager->freeGraphicsMemory(graphicsAllocation);

View File

@@ -1,23 +1,8 @@
/*
* Copyright (c) 2017 - 2018, Intel Corporation
* Copyright (C) 2017-2018 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:
* SPDX-License-Identifier: MIT
*
* 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.
*/
#include "event_fixture.h"
@@ -476,7 +461,7 @@ TEST_F(InternalsEventTest, processBlockedCommandsKernelOperation) {
delete pCmdQ;
EXPECT_EQ(surface->resident, 1u);
EXPECT_FALSE(surface->graphicsAllocation->isResident());
EXPECT_FALSE(surface->graphicsAllocation->isResident(0u));
delete surface->graphicsAllocation;
}
@@ -567,7 +552,7 @@ TEST_F(InternalsEventTest, givenBlockedKernelWithPrintfWhenSubmittedThenPrintOut
std::string output = testing::internal::GetCapturedStdout();
EXPECT_STREQ("test", output.c_str());
EXPECT_FALSE(surface->isResident());
EXPECT_FALSE(surface->isResident(0u));
delete pPrintfSurface;
delete pCmdQ;

View File

@@ -1,23 +1,8 @@
/*
* Copyright (c) 2017 - 2018, Intel Corporation
* Copyright (C) 2017-2018 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:
* SPDX-License-Identifier: MIT
*
* 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.
*/
#include "runtime/command_queue/gpgpu_walker.h"
@@ -129,7 +114,7 @@ HWTEST_P(ParentKernelEnqueueTest, GivenParentKernelWithPrivateSurfaceWhenEnqueue
pKernel->getProgram()->getBlockKernelManager()->pushPrivateSurface(privateSurface, 0);
pCmdQ->enqueueKernel(pKernel, 1, offset, gws, gws, 0, nullptr, nullptr);
EXPECT_NE(ObjectNotResident, privateSurface->residencyTaskCount);
EXPECT_NE(ObjectNotResident, privateSurface->residencyTaskCount[0u]);
}
}

View File

@@ -1669,11 +1669,11 @@ TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenKernelIsCreatedThenAllKerne
auto pBuffer1 = castToObject<Buffer>(gtpinBuffer1);
GraphicsAllocation *pGfxAlloc1 = pBuffer1->getGraphicsAllocation();
CommandStreamReceiver &csr = pCmdQueue->getDevice().getCommandStreamReceiver();
EXPECT_FALSE(pGfxAlloc0->isResident());
EXPECT_FALSE(pGfxAlloc1->isResident());
EXPECT_FALSE(pGfxAlloc0->isResident(0u));
EXPECT_FALSE(pGfxAlloc1->isResident(0u));
gtpinNotifyMakeResident(pKernel, &csr);
EXPECT_TRUE(pGfxAlloc0->isResident());
EXPECT_FALSE(pGfxAlloc1->isResident());
EXPECT_TRUE(pGfxAlloc0->isResident(0u));
EXPECT_FALSE(pGfxAlloc1->isResident(0u));
// Cancel information about second submitted kernel
kernelExecQueue.pop_back();
@@ -1840,24 +1840,24 @@ TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenOneKernelIsSubmittedSeveral
GraphicsAllocation *pGfxAlloc1 = pBuffer1->getGraphicsAllocation();
CommandStreamReceiver &csr = pCmdQueue->getDevice().getCommandStreamReceiver();
// Make resident resource of first submitted kernel
EXPECT_FALSE(pGfxAlloc0->isResident());
EXPECT_FALSE(pGfxAlloc1->isResident());
EXPECT_FALSE(pGfxAlloc0->isResident(0u));
EXPECT_FALSE(pGfxAlloc1->isResident(0u));
gtpinNotifyMakeResident(pKernel, &csr);
EXPECT_TRUE(pGfxAlloc0->isResident());
EXPECT_FALSE(pGfxAlloc1->isResident());
EXPECT_TRUE(pGfxAlloc0->isResident(0u));
EXPECT_FALSE(pGfxAlloc1->isResident(0u));
// Make resident resource of second submitted kernel
gtpinNotifyMakeResident(pKernel, &csr);
EXPECT_TRUE(pGfxAlloc0->isResident());
EXPECT_TRUE(pGfxAlloc1->isResident());
EXPECT_TRUE(pGfxAlloc0->isResident(0u));
EXPECT_TRUE(pGfxAlloc1->isResident(0u));
// Verify that correct GT-Pin resource is added to residency list.
// This simulates enqueuing blocked kernels
kernelExecQueue[0].isResourceResident = false;
kernelExecQueue[1].isResourceResident = false;
pGfxAlloc0->residencyTaskCount = ObjectNotResident;
pGfxAlloc1->residencyTaskCount = ObjectNotResident;
EXPECT_FALSE(pGfxAlloc0->isResident());
EXPECT_FALSE(pGfxAlloc1->isResident());
pGfxAlloc0->residencyTaskCount[0u] = ObjectNotResident;
pGfxAlloc1->residencyTaskCount[0u] = ObjectNotResident;
EXPECT_FALSE(pGfxAlloc0->isResident(0u));
EXPECT_FALSE(pGfxAlloc1->isResident(0u));
std::vector<Surface *> residencyVector;
EXPECT_EQ(0u, residencyVector.size());
// Add to residency list resource of first submitted kernel
@@ -1866,16 +1866,16 @@ TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenOneKernelIsSubmittedSeveral
// Make resident first resource on residency list
GeneralSurface *pSurf1 = (GeneralSurface *)residencyVector[0];
pSurf1->makeResident(csr);
EXPECT_TRUE(pGfxAlloc0->isResident());
EXPECT_FALSE(pGfxAlloc1->isResident());
EXPECT_TRUE(pGfxAlloc0->isResident(0u));
EXPECT_FALSE(pGfxAlloc1->isResident(0u));
// Add to residency list resource of second submitted kernel
gtpinNotifyUpdateResidencyList(pKernel, &residencyVector);
EXPECT_EQ(2u, residencyVector.size());
// Make resident second resource on residency list
GeneralSurface *pSurf2 = (GeneralSurface *)residencyVector[1];
pSurf2->makeResident(csr);
EXPECT_TRUE(pGfxAlloc0->isResident());
EXPECT_TRUE(pGfxAlloc1->isResident());
EXPECT_TRUE(pGfxAlloc0->isResident(0u));
EXPECT_TRUE(pGfxAlloc1->isResident(0u));
// Cleanup
delete pSurf1;

View File

@@ -636,18 +636,18 @@ TEST_P(ValidHostPtr, isResident_defaultsToFalseAfterCreate) {
buffer = createBuffer();
ASSERT_NE(nullptr, buffer);
EXPECT_FALSE(buffer->getGraphicsAllocation()->isResident());
EXPECT_FALSE(buffer->getGraphicsAllocation()->isResident(0u));
}
TEST_P(ValidHostPtr, isResident_returnsValueFromSetResident) {
buffer = createBuffer();
ASSERT_NE(nullptr, buffer);
buffer->getGraphicsAllocation()->residencyTaskCount = 1;
EXPECT_TRUE(buffer->getGraphicsAllocation()->isResident());
buffer->getGraphicsAllocation()->residencyTaskCount[0u] = 1;
EXPECT_TRUE(buffer->getGraphicsAllocation()->isResident(0u));
buffer->getGraphicsAllocation()->residencyTaskCount = ObjectNotResident;
EXPECT_FALSE(buffer->getGraphicsAllocation()->isResident());
buffer->getGraphicsAllocation()->residencyTaskCount[0u] = ObjectNotResident;
EXPECT_FALSE(buffer->getGraphicsAllocation()->isResident(0u));
}
TEST_P(ValidHostPtr, getAddress) {

View File

@@ -1,23 +1,8 @@
/*
* Copyright (c) 2017 - 2018, Intel Corporation
* Copyright (C) 2017-2018 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:
* SPDX-License-Identifier: MIT
*
* 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.
*/
#include "runtime/built_ins/built_ins.h"
@@ -515,18 +500,18 @@ TEST_P(CreateImageHostPtr, isResidentDefaultsToFalseAfterCreate) {
image = createImage(retVal);
ASSERT_NE(nullptr, image);
EXPECT_FALSE(image->getGraphicsAllocation()->isResident());
EXPECT_FALSE(image->getGraphicsAllocation()->isResident(0u));
}
TEST_P(CreateImageHostPtr, isResidentReturnsValueFromSetResident) {
image = createImage(retVal);
ASSERT_NE(nullptr, image);
image->getGraphicsAllocation()->residencyTaskCount = 1;
EXPECT_TRUE(image->getGraphicsAllocation()->isResident());
image->getGraphicsAllocation()->residencyTaskCount[0u] = 1;
EXPECT_TRUE(image->getGraphicsAllocation()->isResident(0u));
image->getGraphicsAllocation()->residencyTaskCount = ObjectNotResident;
EXPECT_FALSE(image->getGraphicsAllocation()->isResident());
image->getGraphicsAllocation()->residencyTaskCount[0u] = ObjectNotResident;
EXPECT_FALSE(image->getGraphicsAllocation()->isResident(0u));
}
TEST_P(CreateImageHostPtr, getAddress) {

View File

@@ -1,23 +1,8 @@
/*
* Copyright (c) 2017 - 2018, Intel Corporation
* Copyright (C) 2017-2018 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:
* SPDX-License-Identifier: MIT
*
* 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.
*/
#include "runtime/command_stream/command_stream_receiver.h"
@@ -73,11 +58,11 @@ TEST(MemObj, useCount) {
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, CL_MEM_USE_HOST_PTR,
sizeof(buffer), buffer, buffer, mockAllocation, true, false, false);
EXPECT_EQ(ObjectNotResident, memObj.getGraphicsAllocation()->residencyTaskCount);
memObj.getGraphicsAllocation()->residencyTaskCount = 1;
EXPECT_EQ(1, memObj.getGraphicsAllocation()->residencyTaskCount);
memObj.getGraphicsAllocation()->residencyTaskCount--;
EXPECT_EQ(0, memObj.getGraphicsAllocation()->residencyTaskCount);
EXPECT_EQ(ObjectNotResident, memObj.getGraphicsAllocation()->residencyTaskCount[0u]);
memObj.getGraphicsAllocation()->residencyTaskCount[0u] = 1;
EXPECT_EQ(1, memObj.getGraphicsAllocation()->residencyTaskCount[0u]);
memObj.getGraphicsAllocation()->residencyTaskCount[0u]--;
EXPECT_EQ(0, memObj.getGraphicsAllocation()->residencyTaskCount[0u]);
}
TEST(MemObj, GivenMemObjWhenInititalizedFromHostPtrThenInitializeFields) {

View File

@@ -1,23 +1,8 @@
/*
* Copyright (c) 2018, Intel Corporation
* Copyright (C) 2018 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:
* SPDX-License-Identifier: MIT
*
* 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.
*/
#pragma once
@@ -59,7 +44,7 @@ class MockCsrBase : public UltCommandStreamReceiver<GfxFamily> {
if (this->getMemoryManager()) {
this->getResidencyAllocations().push_back(&gfxAllocation);
}
gfxAllocation.residencyTaskCount = this->taskCount;
gfxAllocation.residencyTaskCount[this->deviceIndex] = this->taskCount;
}
void makeNonResident(GraphicsAllocation &gfxAllocation) override {
madeNonResidentGfxAllocations.push_back(&gfxAllocation);

View File

@@ -1,24 +1,10 @@
/*
* Copyright (c) 2017 - 2018, Intel Corporation
* Copyright (C) 2017-2018 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:
* SPDX-License-Identifier: MIT
*
* 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.
*/
#include "runtime/context/context.h"
#include "runtime/helpers/hash.h"
#include "runtime/program/create.inl"
@@ -47,7 +33,9 @@ cl_int GlobalMockSipProgram::processGenBinaryOnce() {
return ret;
}
void GlobalMockSipProgram::resetAllocationState() {
this->kernelInfoArray[0]->kernelAllocation->residencyTaskCount = 0xffffffff;
for (uint32_t index = 0u; index < maxOsContextCount; index++) {
this->kernelInfoArray[0]->kernelAllocation->residencyTaskCount[index] = 0xffffffff;
}
static_cast<MockGraphicsAllocation *>(this->kernelInfoArray[0]->kernelAllocation)->resetInspectionId();
}
void GlobalMockSipProgram::initSipProgram() {

View File

@@ -1,23 +1,8 @@
/*
* Copyright (c) 2017 - 2018, Intel Corporation
* Copyright (C) 2017-2018 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:
* SPDX-License-Identifier: MIT
*
* 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.
*/
#include "hw_cmds.h"
@@ -1091,7 +1076,7 @@ TEST_F(DrmCommandStreamBatchingTests, givenRecordedCommandBufferWhenItIsSubmitte
EXPECT_TRUE(cmdBuffers.peekIsEmpty());
auto commandBufferGraphicsAllocation = submittedCommandBuffer.getGraphicsAllocation();
EXPECT_FALSE(commandBufferGraphicsAllocation->isResident());
EXPECT_FALSE(commandBufferGraphicsAllocation->isResident(0u));
//preemption allocation
size_t csrSurfaceCount = (device->getPreemptionMode() == PreemptionMode::MidThread) ? 2 : 0;
@@ -1664,7 +1649,7 @@ TEST_F(DrmCommandStreamLeaksTest, givenMultipleMakeResidentWhenMakeNonResidentIs
csr->makeSurfacePackNonResident(nullptr);
EXPECT_EQ(0u, csr->getResidencyAllocations().size());
EXPECT_FALSE(allocation1->isResident());
EXPECT_FALSE(allocation1->isResident(0u));
mm->freeGraphicsMemory(allocation1);
}
@@ -1715,24 +1700,24 @@ class DrmMockBuffer : public Buffer {
TEST_F(DrmCommandStreamLeaksTest, BufferResidency) {
std::unique_ptr<Buffer> buffer(DrmMockBuffer::create());
ASSERT_FALSE(buffer->getGraphicsAllocation()->isResident());
ASSERT_EQ(ObjectNotResident, buffer->getGraphicsAllocation()->residencyTaskCount);
ASSERT_FALSE(buffer->getGraphicsAllocation()->isResident(0u));
ASSERT_EQ(ObjectNotResident, buffer->getGraphicsAllocation()->residencyTaskCount[0u]);
ASSERT_GT(buffer->getSize(), 0u);
//make it resident 8 times
for (int c = 0; c < 8; c++) {
csr->makeResident(*buffer->getGraphicsAllocation());
csr->processResidency(csr->getResidencyAllocations(), *osContext);
EXPECT_TRUE(buffer->getGraphicsAllocation()->isResident());
EXPECT_EQ(buffer->getGraphicsAllocation()->residencyTaskCount, (int)csr->peekTaskCount() + 1);
EXPECT_TRUE(buffer->getGraphicsAllocation()->isResident(0u));
EXPECT_EQ(buffer->getGraphicsAllocation()->residencyTaskCount[0u], (int)csr->peekTaskCount() + 1);
}
csr->makeNonResident(*buffer->getGraphicsAllocation());
EXPECT_FALSE(buffer->getGraphicsAllocation()->isResident());
EXPECT_FALSE(buffer->getGraphicsAllocation()->isResident(0u));
csr->makeNonResident(*buffer->getGraphicsAllocation());
EXPECT_FALSE(buffer->getGraphicsAllocation()->isResident());
EXPECT_EQ(ObjectNotResident, buffer->getGraphicsAllocation()->residencyTaskCount);
EXPECT_FALSE(buffer->getGraphicsAllocation()->isResident(0u));
EXPECT_EQ(ObjectNotResident, buffer->getGraphicsAllocation()->residencyTaskCount[0u]);
}
typedef Test<DrmCommandStreamEnhancedFixture> DrmCommandStreamMemoryManagerTest;