Revert "feature: bind resources as read only"

This reverts commit f3d36d3350.

Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
Compute-Runtime-Validation
2024-03-27 08:18:44 +01:00
committed by Compute-Runtime-Automation
parent 295b58a11f
commit 8e44a46983
28 changed files with 28 additions and 226 deletions

View File

@@ -560,34 +560,3 @@ TEST(GraphicsAllocationTest, givenGraphicsAllocationsWithFragmentsWhenCallingFor
EXPECT_EQ(residencyData->getFenceValueForContextId(contextId), newFenceValue);
}
}
TEST(GraphicsAllocationTest, givenGraphicsAllocationsWhenAllocationTypeIsKernelIsaThenAllocationHasReadonlyType) {
MockGraphicsAllocation graphicsAllocation;
graphicsAllocation.hasAllocationReadOnlyTypeCallBase = true;
graphicsAllocation.allocationType = AllocationType::kernelIsa;
EXPECT_TRUE(graphicsAllocation.hasAllocationReadOnlyType());
}
TEST(GraphicsAllocationTest, givenGraphicsAllocationsWhenAllocationTypeIsInternalIsaThenAllocationHasReadonlyType) {
MockGraphicsAllocation graphicsAllocation;
graphicsAllocation.hasAllocationReadOnlyTypeCallBase = true;
graphicsAllocation.allocationType = AllocationType::kernelIsaInternal;
EXPECT_TRUE(graphicsAllocation.hasAllocationReadOnlyType());
}
TEST(GraphicsAllocationTest, givenGraphicsAllocationsWhenAllocationTypeIsCommandBufferThenAllocationHasReadonlyType) {
MockGraphicsAllocation graphicsAllocation;
graphicsAllocation.hasAllocationReadOnlyTypeCallBase = true;
graphicsAllocation.allocationType = AllocationType::commandBuffer;
EXPECT_TRUE(graphicsAllocation.hasAllocationReadOnlyType());
}
TEST(GraphicsAllocationTest, givenGraphicsAllocationsWhenAllocationTypeIsLinearStreamThenAllocationHasReadonlyType) {
MockGraphicsAllocation graphicsAllocation;
graphicsAllocation.hasAllocationReadOnlyTypeCallBase = true;
graphicsAllocation.allocationType = AllocationType::linearStream;
EXPECT_TRUE(graphicsAllocation.hasAllocationReadOnlyType());
}
TEST(GraphicsAllocationTest, givenGraphicsAllocationsWhenAllocationTypeIsBufferThenAllocationHasNotReadonlyType) {
MockGraphicsAllocation graphicsAllocation;
graphicsAllocation.hasAllocationReadOnlyTypeCallBase = true;
graphicsAllocation.allocationType = AllocationType::buffer;
EXPECT_FALSE(graphicsAllocation.hasAllocationReadOnlyType());
}

View File

@@ -18,7 +18,6 @@
#include "shared/test/common/mocks/mock_graphics_allocation.h"
#include "shared/test/common/mocks/mock_memory_manager.h"
#include "shared/test/common/mocks/mock_os_context.h"
#include "shared/test/common/mocks/mock_product_helper.h"
#include "shared/test/common/mocks/ult_device_factory.h"
#include "shared/test/common/test_macros/hw_test.h"
@@ -1014,90 +1013,6 @@ TEST(MemoryManagerTest, givenPropertiesWithGpuAddressWhenGetAllocationDataIsCall
EXPECT_EQ(properties.gpuAddress, allocData.gpuAddress);
}
TEST(MemoryManagerTest, givenMemoryManagerWhenAllocationTypeAndPlatrormSupportReadOnlyAllocationAndBliterTransferNotRequiredThenAllocationIsSetAsReadOnly) {
MockExecutionEnvironment executionEnvironment(defaultHwInfo.get());
auto mockProductHelper = std::make_unique<MockProductHelper>();
mockProductHelper->isBlitCopyRequiredForLocalMemoryResult = false;
mockProductHelper->supportReadOnlyAllocationsResult = true;
std::unique_ptr<ProductHelper> productHelper = std::move(mockProductHelper);
std::swap(executionEnvironment.rootDeviceEnvironments[0]->productHelper, productHelper);
MockMemoryManager memoryManager(false, true, executionEnvironment);
MockGraphicsAllocation mockGa;
mockGa.hasAllocationReadOnlyTypeResult = true;
memoryManager.mockGa = &mockGa;
memoryManager.returnMockGAFromDevicePool = true;
auto allocation = memoryManager.allocateGraphicsMemoryInPreferredPool({mockRootDeviceIndex, MemoryConstants::pageSize, AllocationType::buffer, mockDeviceBitfield},
nullptr);
EXPECT_EQ(allocation, &mockGa);
EXPECT_EQ(mockGa.setAsReadOnlyCalled, 1u);
}
TEST(MemoryManagerTest, givenMemoryManagerWhenAllocationTypeAndSupportReadOnlyButPtlatformDoesNotAndBliterTransferNotRequiredThenAllocationIsNotSetAsReadOnly) {
MockExecutionEnvironment executionEnvironment(defaultHwInfo.get());
auto mockProductHelper = std::make_unique<MockProductHelper>();
mockProductHelper->isBlitCopyRequiredForLocalMemoryResult = false;
mockProductHelper->supportReadOnlyAllocationsResult = false;
std::unique_ptr<ProductHelper> productHelper = std::move(mockProductHelper);
std::swap(executionEnvironment.rootDeviceEnvironments[0]->productHelper, productHelper);
MockMemoryManager memoryManager(false, true, executionEnvironment);
MockGraphicsAllocation mockGa;
mockGa.hasAllocationReadOnlyTypeResult = true;
memoryManager.mockGa = &mockGa;
memoryManager.returnMockGAFromDevicePool = true;
auto allocation = memoryManager.allocateGraphicsMemoryInPreferredPool({mockRootDeviceIndex, MemoryConstants::pageSize, AllocationType::buffer, mockDeviceBitfield},
nullptr);
EXPECT_EQ(allocation, &mockGa);
EXPECT_EQ(mockGa.setAsReadOnlyCalled, 0u);
}
TEST(MemoryManagerTest, givenMemoryManagerWhenAllocationTypeAndPlatrormSupportReadOnlyAllocationAndBliterTransferRequiredThenAllocationIsNotSetAsReadOnly) {
MockExecutionEnvironment executionEnvironment(defaultHwInfo.get());
auto mockProductHelper = std::make_unique<MockProductHelper>();
mockProductHelper->isBlitCopyRequiredForLocalMemoryResult = true;
mockProductHelper->supportReadOnlyAllocationsResult = true;
std::unique_ptr<ProductHelper> productHelper = std::move(mockProductHelper);
std::swap(executionEnvironment.rootDeviceEnvironments[0]->productHelper, productHelper);
MockMemoryManager memoryManager(false, true, executionEnvironment);
MockGraphicsAllocation mockGa;
mockGa.hasAllocationReadOnlyTypeResult = true;
memoryManager.mockGa = &mockGa;
memoryManager.returnMockGAFromDevicePool = true;
auto allocation = memoryManager.allocateGraphicsMemoryInPreferredPool({mockRootDeviceIndex, MemoryConstants::pageSize, AllocationType::buffer, mockDeviceBitfield},
nullptr);
EXPECT_EQ(allocation, &mockGa);
EXPECT_EQ(mockGa.setAsReadOnlyCalled, 0u);
}
TEST(MemoryManagerTest, givenMemoryManagerWhenAllocationTypeAndDoesNotSupportReadOnlyButPtlatformDoesAndBliterTransferNotRequiredThenAllocationIsNotSetAsReadOnly) {
MockExecutionEnvironment executionEnvironment(defaultHwInfo.get());
auto mockProductHelper = std::make_unique<MockProductHelper>();
mockProductHelper->isBlitCopyRequiredForLocalMemoryResult = false;
mockProductHelper->supportReadOnlyAllocationsResult = true;
std::unique_ptr<ProductHelper> productHelper = std::move(mockProductHelper);
std::swap(executionEnvironment.rootDeviceEnvironments[0]->productHelper, productHelper);
MockMemoryManager memoryManager(false, true, executionEnvironment);
MockGraphicsAllocation mockGa;
mockGa.hasAllocationReadOnlyTypeResult = false;
memoryManager.mockGa = &mockGa;
memoryManager.returnMockGAFromDevicePool = true;
auto allocation = memoryManager.allocateGraphicsMemoryInPreferredPool({mockRootDeviceIndex, MemoryConstants::pageSize, AllocationType::buffer, mockDeviceBitfield},
nullptr);
EXPECT_EQ(allocation, &mockGa);
EXPECT_EQ(mockGa.setAsReadOnlyCalled, 0u);
}
TEST(MemoryManagerTest, givenEnableLocalMemoryAndMemoryManagerWhenBufferTypeIsPassedThenAllocateGraphicsMemoryInPreferredPool) {
MockExecutionEnvironment executionEnvironment(defaultHwInfo.get());
MockMemoryManager memoryManager(false, true, executionEnvironment);