mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 23:03:02 +08:00
Make residency in graphics allocation OsContext dependent.
- Graphics Allocation now holds residency control per OsContext. Change-Id: Ie0a0d3aa9fdaf542fdd42dee3aba236a5af635c7
This commit is contained in:
committed by
sys_ocldev
parent
c39f9c0c66
commit
78f828fcd1
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user