diff --git a/shared/source/memory_manager/graphics_allocation.cpp b/shared/source/memory_manager/graphics_allocation.cpp index 4a4cd13578..a5dc3b5920 100644 --- a/shared/source/memory_manager/graphics_allocation.cpp +++ b/shared/source/memory_manager/graphics_allocation.cpp @@ -138,16 +138,6 @@ void GraphicsAllocation::updateCompletionDataForAllocationAndFragments(uint64_t } } -bool GraphicsAllocation::hasAllocationReadOnlyType() { - if (getAllocationType() == AllocationType::kernelIsa || - getAllocationType() == AllocationType::kernelIsaInternal || - getAllocationType() == AllocationType::commandBuffer || - getAllocationType() == AllocationType::linearStream) { - return true; - } - return false; -} - constexpr TaskCountType GraphicsAllocation::objectNotUsed; constexpr TaskCountType GraphicsAllocation::objectNotResident; constexpr TaskCountType GraphicsAllocation::objectAlwaysResident; diff --git a/shared/source/memory_manager/graphics_allocation.h b/shared/source/memory_manager/graphics_allocation.h index b81f90cef1..c9ff1c19ec 100644 --- a/shared/source/memory_manager/graphics_allocation.h +++ b/shared/source/memory_manager/graphics_allocation.h @@ -155,7 +155,6 @@ class GraphicsAllocation : public IDNode { AllocationType getAllocationType() const { return allocationType; } MemoryPool getMemoryPool() const { return memoryPool; } - virtual void setAsReadOnly(){}; bool isUsed() const { return registeredContextsNum > 0; } bool isUsedByManyOsContexts() const { return registeredContextsNum > 1u; } @@ -317,7 +316,6 @@ class GraphicsAllocation : public IDNode { MOCKABLE_VIRTUAL void updateCompletionDataForAllocationAndFragments(uint64_t newFenceValue, uint32_t contextId); void setShareableHostMemory(bool shareableHostMemory) { this->shareableHostMemory = shareableHostMemory; } bool isShareableHostMemory() const { return shareableHostMemory; } - MOCKABLE_VIRTUAL bool hasAllocationReadOnlyType(); OsHandleStorage fragmentsStorage; StorageInfo storageInfo = {}; diff --git a/shared/source/memory_manager/memory_manager.cpp b/shared/source/memory_manager/memory_manager.cpp index 371502e132..7c51194d3d 100644 --- a/shared/source/memory_manager/memory_manager.cpp +++ b/shared/source/memory_manager/memory_manager.cpp @@ -642,14 +642,6 @@ GraphicsAllocation *MemoryManager::allocateGraphicsMemoryInPreferredPool(const A return nullptr; } - auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[properties.rootDeviceIndex]; - auto &productHelper = rootDeviceEnvironment.getProductHelper(); - if (productHelper.supportReadOnlyAllocations() && - allocation->hasAllocationReadOnlyType() && - !productHelper.isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, *allocation)) { - allocation->setAsReadOnly(); - } - fileLoggerInstance().logAllocation(allocation); registerAllocationInOs(allocation); return allocation; diff --git a/shared/source/os_interface/linux/drm_allocation.cpp b/shared/source/os_interface/linux/drm_allocation.cpp index d4d2d26d1f..b29cfd94b6 100644 --- a/shared/source/os_interface/linux/drm_allocation.cpp +++ b/shared/source/os_interface/linux/drm_allocation.cpp @@ -339,15 +339,6 @@ void DrmAllocation::registerBOBindExtHandle(Drm *drm) { drm->getIoctlHelper()->registerBOBindHandle(drm, this); } -void DrmAllocation::setAsReadOnly() { - auto &bos = getBOs(); - for (auto bo : bos) { - if (bo) { - bo->setAsReadOnly(true); - } - } -} - void DrmAllocation::linkWithRegisteredHandle(uint32_t handle) { auto &bos = getBOs(); for (auto bo : bos) { diff --git a/shared/source/os_interface/linux/drm_allocation.h b/shared/source/os_interface/linux/drm_allocation.h index 9916b386be..19837a2212 100644 --- a/shared/source/os_interface/linux/drm_allocation.h +++ b/shared/source/os_interface/linux/drm_allocation.h @@ -148,7 +148,6 @@ class DrmAllocation : public GraphicsAllocation { MOCKABLE_VIRTUAL void markForCapture(); MOCKABLE_VIRTUAL bool shouldAllocationPageFault(const Drm *drm); void registerMemoryToUnmap(void *pointer, size_t size, MemoryUnmapFunction unmapFunction); - void setAsReadOnly() override; protected: OsContextLinux *osContext = nullptr; diff --git a/shared/source/os_interface/linux/drm_buffer_object.h b/shared/source/os_interface/linux/drm_buffer_object.h index 4254e40519..b6596be8c7 100644 --- a/shared/source/os_interface/linux/drm_buffer_object.h +++ b/shared/source/os_interface/linux/drm_buffer_object.h @@ -164,14 +164,6 @@ class BufferObject { bool isImmediateBindingRequired() { return requiresImmediateBinding; } - bool isReadOnlyGpuResource() { - return readOnlyGpuResource; - } - - void setAsReadOnly(bool isReadOnly) { - readOnlyGpuResource = isReadOnly; - } - void requireImmediateBinding(bool required) { requiresImmediateBinding = required; } @@ -268,6 +260,5 @@ class BufferObject { bool requiresExplicitResidency = false; bool chunked = false; bool isReused = false; - bool readOnlyGpuResource = false; }; } // namespace NEO diff --git a/shared/source/os_interface/linux/drm_neo.cpp b/shared/source/os_interface/linux/drm_neo.cpp index 6f7a814fa8..e23e8965fc 100644 --- a/shared/source/os_interface/linux/drm_neo.cpp +++ b/shared/source/os_interface/linux/drm_neo.cpp @@ -1309,13 +1309,11 @@ int changeBufferObjectBinding(Drm *drm, OsContext *osContext, uint32_t vmHandleI bool bindCapture = bo->isMarkedForCapture(); bool bindImmediate = bo->isImmediateBindingRequired(); bool bindMakeResident = false; - bool readOnlyResource = bo->isReadOnlyGpuResource(); - if (drm->useVMBindImmediate()) { bindMakeResident = bo->isExplicitResidencyRequired(); bindImmediate = true; } - flags |= ioctlHelper->getFlagsForVmBind(bindCapture, bindImmediate, bindMakeResident, readOnlyResource); + flags |= ioctlHelper->getFlagsForVmBind(bindCapture, bindImmediate, bindMakeResident); } auto &bindAddresses = bo->getColourAddresses(); diff --git a/shared/source/os_interface/linux/ioctl_helper.h b/shared/source/os_interface/linux/ioctl_helper.h index 4806247a58..3bfc3a8dd4 100644 --- a/shared/source/os_interface/linux/ioctl_helper.h +++ b/shared/source/os_interface/linux/ioctl_helper.h @@ -116,7 +116,7 @@ class IoctlHelper { virtual bool getGemTiling(void *setTiling) = 0; virtual uint32_t getDirectSubmissionFlag() = 0; virtual std::unique_ptr prepareVmBindExt(const StackVec &bindExtHandles) = 0; - virtual uint64_t getFlagsForVmBind(bool bindCapture, bool bindImmediate, bool bindMakeResident, bool readOnlyResource) = 0; + virtual uint64_t getFlagsForVmBind(bool bindCapture, bool bindImmediate, bool bindMakeResident) = 0; virtual int queryDistances(std::vector &queryItems, std::vector &distanceInfos) = 0; virtual uint16_t getWaitUserFenceSoftFlag() = 0; virtual int execBuffer(ExecBuffer *execBuffer, uint64_t completionGpuAddress, TaskCountType counterValue) = 0; @@ -259,7 +259,7 @@ class IoctlHelperUpstream : public IoctlHelperI915 { bool setVmPrefetch(uint64_t start, uint64_t length, uint32_t region, uint32_t vmId) override; uint32_t getDirectSubmissionFlag() override; std::unique_ptr prepareVmBindExt(const StackVec &bindExtHandles) override; - uint64_t getFlagsForVmBind(bool bindCapture, bool bindImmediate, bool bindMakeResident, bool readOnlyResource) override; + uint64_t getFlagsForVmBind(bool bindCapture, bool bindImmediate, bool bindMakeResident) override; int queryDistances(std::vector &queryItems, std::vector &distanceInfos) override; uint16_t getWaitUserFenceSoftFlag() override; int execBuffer(ExecBuffer *execBuffer, uint64_t completionGpuAddress, TaskCountType counterValue) override; @@ -336,7 +336,7 @@ class IoctlHelperPrelim20 : public IoctlHelperI915 { bool setVmPrefetch(uint64_t start, uint64_t length, uint32_t region, uint32_t vmId) override; uint32_t getDirectSubmissionFlag() override; std::unique_ptr prepareVmBindExt(const StackVec &bindExtHandles) override; - uint64_t getFlagsForVmBind(bool bindCapture, bool bindImmediate, bool bindMakeResident, bool readOnlyResource) override; + uint64_t getFlagsForVmBind(bool bindCapture, bool bindImmediate, bool bindMakeResident) override; int queryDistances(std::vector &queryItems, std::vector &distanceInfos) override; uint16_t getWaitUserFenceSoftFlag() override; int execBuffer(ExecBuffer *execBuffer, uint64_t completionGpuAddress, TaskCountType counterValue) override; diff --git a/shared/source/os_interface/linux/ioctl_helper_prelim.cpp b/shared/source/os_interface/linux/ioctl_helper_prelim.cpp index bfce00e61d..59cd64b584 100644 --- a/shared/source/os_interface/linux/ioctl_helper_prelim.cpp +++ b/shared/source/os_interface/linux/ioctl_helper_prelim.cpp @@ -507,7 +507,7 @@ std::unique_ptr IoctlHelperPrelim20::prepareVmBindExt(const StackVec< return extensionsBuffer; } -uint64_t IoctlHelperPrelim20::getFlagsForVmBind(bool bindCapture, bool bindImmediate, bool bindMakeResident, bool readOnlyResource) { +uint64_t IoctlHelperPrelim20::getFlagsForVmBind(bool bindCapture, bool bindImmediate, bool bindMakeResident) { uint64_t flags = 0u; if (bindCapture) { flags |= PRELIM_I915_GEM_VM_BIND_CAPTURE; @@ -518,9 +518,6 @@ uint64_t IoctlHelperPrelim20::getFlagsForVmBind(bool bindCapture, bool bindImmed if (bindMakeResident) { flags |= PRELIM_I915_GEM_VM_BIND_MAKE_RESIDENT; } - if (readOnlyResource) { - flags |= PRELIM_I915_GEM_VM_BIND_READONLY; - } return flags; } diff --git a/shared/source/os_interface/linux/ioctl_helper_upstream.cpp b/shared/source/os_interface/linux/ioctl_helper_upstream.cpp index 1e4cbf9941..839d483526 100644 --- a/shared/source/os_interface/linux/ioctl_helper_upstream.cpp +++ b/shared/source/os_interface/linux/ioctl_helper_upstream.cpp @@ -168,7 +168,7 @@ std::unique_ptr IoctlHelperUpstream::prepareVmBindExt(const StackVec< return {}; } -uint64_t IoctlHelperUpstream::getFlagsForVmBind(bool bindCapture, bool bindImmediate, bool bindMakeResident, bool readOnlyResource) { +uint64_t IoctlHelperUpstream::getFlagsForVmBind(bool bindCapture, bool bindImmediate, bool bindMakeResident) { return 0u; } diff --git a/shared/source/os_interface/linux/xe/ioctl_helper_xe.cpp b/shared/source/os_interface/linux/xe/ioctl_helper_xe.cpp index 2d26bdd50e..29a7878493 100644 --- a/shared/source/os_interface/linux/xe/ioctl_helper_xe.cpp +++ b/shared/source/os_interface/linux/xe/ioctl_helper_xe.cpp @@ -730,9 +730,9 @@ bool IoctlHelperXe::completionFenceExtensionSupported(const bool isVmBindAvailab return isVmBindAvailable; } -uint64_t IoctlHelperXe::getFlagsForVmBind(bool bindCapture, bool bindImmediate, bool bindMakeResident, bool readOnlyResource) { +uint64_t IoctlHelperXe::getFlagsForVmBind(bool bindCapture, bool bindImmediate, bool bindMakeResident) { uint64_t ret = 0; - xeLog(" -> IoctlHelperXe::%s %d %d %d\n", __FUNCTION__, bindCapture, bindImmediate, bindMakeResident, readOnlyResource); + xeLog(" -> IoctlHelperXe::%s %d %d %d\n", __FUNCTION__, bindCapture, bindImmediate, bindMakeResident); if (bindCapture) { ret |= XE_NEO_BIND_CAPTURE_FLAG; } diff --git a/shared/source/os_interface/linux/xe/ioctl_helper_xe.h b/shared/source/os_interface/linux/xe/ioctl_helper_xe.h index f59c06c20d..f959b37218 100644 --- a/shared/source/os_interface/linux/xe/ioctl_helper_xe.h +++ b/shared/source/os_interface/linux/xe/ioctl_helper_xe.h @@ -67,7 +67,7 @@ class IoctlHelperXe : public IoctlHelper { bool getGemTiling(void *setTiling) override; uint32_t getDirectSubmissionFlag() override; std::unique_ptr prepareVmBindExt(const StackVec &bindExtHandles) override; - uint64_t getFlagsForVmBind(bool bindCapture, bool bindImmediate, bool bindMakeResident, bool readOnlyResource) override; + uint64_t getFlagsForVmBind(bool bindCapture, bool bindImmediate, bool bindMakeResident) override; int queryDistances(std::vector &queryItems, std::vector &distanceInfos) override; uint16_t getWaitUserFenceSoftFlag() override; int execBuffer(ExecBuffer *execBuffer, uint64_t completionGpuAddress, TaskCountType counterValue) override; diff --git a/shared/source/os_interface/product_helper.h b/shared/source/os_interface/product_helper.h index 1eb80ab66e..2238764946 100644 --- a/shared/source/os_interface/product_helper.h +++ b/shared/source/os_interface/product_helper.h @@ -231,7 +231,6 @@ class ProductHelper { virtual bool isCachingOnCpuAvailable() const = 0; virtual bool isNewCoherencyModelSupported() const = 0; virtual const std::vector getSupportedLocalDispatchSizes() const = 0; - virtual bool supportReadOnlyAllocations() const = 0; virtual ~ProductHelper() = default; diff --git a/shared/source/os_interface/product_helper.inl b/shared/source/os_interface/product_helper.inl index 9b6b9d85d5..f48c8f6b0e 100644 --- a/shared/source/os_interface/product_helper.inl +++ b/shared/source/os_interface/product_helper.inl @@ -867,11 +867,6 @@ bool ProductHelperHw::isNewCoherencyModelSupported() const { return false; } -template -bool ProductHelperHw::supportReadOnlyAllocations() const { - return false; -} - template const std::vector ProductHelperHw::getSupportedLocalDispatchSizes() const { return {}; diff --git a/shared/source/os_interface/product_helper_hw.h b/shared/source/os_interface/product_helper_hw.h index 39114de276..b338ec42e1 100644 --- a/shared/source/os_interface/product_helper_hw.h +++ b/shared/source/os_interface/product_helper_hw.h @@ -175,7 +175,6 @@ class ProductHelperHw : public ProductHelper { std::optional getPreferredAllocationMethod(AllocationType allocationType) const override; bool isCachingOnCpuAvailable() const override; bool isNewCoherencyModelSupported() const override; - bool supportReadOnlyAllocations() const override; const std::vector getSupportedLocalDispatchSizes() const override; ~ProductHelperHw() override = default; diff --git a/shared/source/xe_hpc_core/pvc/os_agnostic_product_helper_pvc.inl b/shared/source/xe_hpc_core/pvc/os_agnostic_product_helper_pvc.inl index ac49ce8aa3..8e7a0b0a06 100644 --- a/shared/source/xe_hpc_core/pvc/os_agnostic_product_helper_pvc.inl +++ b/shared/source/xe_hpc_core/pvc/os_agnostic_product_helper_pvc.inl @@ -237,9 +237,4 @@ bool ProductHelperHw::isSkippingStatefulInformationRequired(const Ke return isGeneratedByNgen; } -template <> -bool ProductHelperHw::supportReadOnlyAllocations() const { - return true; -} - } // namespace NEO diff --git a/shared/test/common/mocks/mock_graphics_allocation.h b/shared/test/common/mocks/mock_graphics_allocation.h index 2043d9b3bd..552ce3f4a0 100644 --- a/shared/test/common/mocks/mock_graphics_allocation.h +++ b/shared/test/common/mocks/mock_graphics_allocation.h @@ -19,7 +19,6 @@ inline constexpr DeviceBitfield mockDeviceBitfield(0b1); class MockGraphicsAllocation : public MemoryAllocation { public: - using BaseClass = MemoryAllocation; using MemoryAllocation::allocationOffset; using MemoryAllocation::allocationType; using MemoryAllocation::aubInfo; @@ -63,8 +62,6 @@ class MockGraphicsAllocation : public MemoryAllocation { updateCompletionDataForAllocationAndFragmentsCalledtimes++; MemoryAllocation::updateCompletionDataForAllocationAndFragments(newFenceValue, contextId); } - ADDMETHOD(hasAllocationReadOnlyType, bool, false, false, (), ()); - ADDMETHOD_VOIDRETURN(setAsReadOnly, false, (), ()); uint64_t updateCompletionDataForAllocationAndFragmentsCalledtimes = 0; int peekInternalHandleResult = 0; diff --git a/shared/test/common/mocks/mock_memory_manager.cpp b/shared/test/common/mocks/mock_memory_manager.cpp index 038f545084..3e44ac7712 100644 --- a/shared/test/common/mocks/mock_memory_manager.cpp +++ b/shared/test/common/mocks/mock_memory_manager.cpp @@ -143,10 +143,6 @@ GraphicsAllocation *MockMemoryManager::allocateGraphicsMemory64kb(const Allocati } GraphicsAllocation *MockMemoryManager::allocateGraphicsMemoryInDevicePool(const AllocationData &allocationData, AllocationStatus &status) { - if (returnMockGAFromDevicePool) { - status = AllocationStatus::Success; - return mockGa; - } if (failInDevicePool) { status = AllocationStatus::RetryInNonDevicePool; return nullptr; diff --git a/shared/test/common/mocks/mock_memory_manager.h b/shared/test/common/mocks/mock_memory_manager.h index 2ad1e40330..d0f6c83bcd 100644 --- a/shared/test/common/mocks/mock_memory_manager.h +++ b/shared/test/common/mocks/mock_memory_manager.h @@ -11,7 +11,6 @@ #include "shared/source/memory_manager/multi_graphics_allocation.h" #include "shared/source/memory_manager/os_agnostic_memory_manager.h" #include "shared/test/common/mocks/mock_execution_environment.h" -#include "shared/test/common/mocks/mock_graphics_allocation.h" #include "shared/test/common/test_macros/mock_method_macros.h" namespace NEO { @@ -213,7 +212,6 @@ class MockMemoryManager : public MemoryManagerCreate { return OsAgnosticMemoryManager::mapPhysicalToVirtualMemory(physicalAllocation, gpuRange, bufferSize); }; - MockGraphicsAllocation *mockGa; uint32_t copyMemoryToAllocationBanksCalled = 0u; uint32_t populateOsHandlesCalled = 0u; uint32_t allocateGraphicsMemoryForNonSvmHostPtrCalled = 0u; @@ -263,7 +261,6 @@ class MockMemoryManager : public MemoryManagerCreate { bool callBasePopulateOsHandles = true; bool callBaseAllocateGraphicsMemoryForNonSvmHostPtr = true; bool failMapPhysicalToVirtualMemory = false; - bool returnMockGAFromDevicePool = false; std::unique_ptr mockExecutionEnvironment; DeviceBitfield recentlyPassedDeviceBitfield{}; std::unique_ptr waitAllocations = nullptr; diff --git a/shared/test/common/mocks/mock_product_helper.h b/shared/test/common/mocks/mock_product_helper.h index 438f90ec05..b779e82bdf 100644 --- a/shared/test/common/mocks/mock_product_helper.h +++ b/shared/test/common/mocks/mock_product_helper.h @@ -18,7 +18,5 @@ struct MockProductHelper : ProductHelperHw { ADDMETHOD_CONST_NOBASE(is48bResourceNeededForRayTracing, bool, true, ()); ADDMETHOD_CONST_NOBASE(overrideAllocationCacheable, bool, false, (const AllocationData &allocationData)); ADDMETHOD_NOBASE(configureHwInfoWddm, int, 0, (const HardwareInfo *inHwInfo, HardwareInfo *outHwInfo, const RootDeviceEnvironment &rootDeviceEnvironment)); - ADDMETHOD_CONST_NOBASE(supportReadOnlyAllocations, bool, false, ()); - ADDMETHOD_CONST_NOBASE(isBlitCopyRequiredForLocalMemory, bool, true, (const RootDeviceEnvironment &rootDeviceEnvironment, const GraphicsAllocation &allocation)); }; } // namespace NEO diff --git a/shared/test/unit_test/memory_manager/graphics_allocation_tests.cpp b/shared/test/unit_test/memory_manager/graphics_allocation_tests.cpp index 6decfe6b65..662c9498b3 100644 --- a/shared/test/unit_test/memory_manager/graphics_allocation_tests.cpp +++ b/shared/test/unit_test/memory_manager/graphics_allocation_tests.cpp @@ -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()); -} \ No newline at end of file diff --git a/shared/test/unit_test/memory_manager/memory_manager_allocate_in_preferred_pool_tests.cpp b/shared/test/unit_test/memory_manager/memory_manager_allocate_in_preferred_pool_tests.cpp index 2f8edf53a5..b26b6a1a60 100644 --- a/shared/test/unit_test/memory_manager/memory_manager_allocate_in_preferred_pool_tests.cpp +++ b/shared/test/unit_test/memory_manager/memory_manager_allocate_in_preferred_pool_tests.cpp @@ -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->isBlitCopyRequiredForLocalMemoryResult = false; - mockProductHelper->supportReadOnlyAllocationsResult = true; - std::unique_ptr 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->isBlitCopyRequiredForLocalMemoryResult = false; - mockProductHelper->supportReadOnlyAllocationsResult = false; - std::unique_ptr 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->isBlitCopyRequiredForLocalMemoryResult = true; - mockProductHelper->supportReadOnlyAllocationsResult = true; - std::unique_ptr 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->isBlitCopyRequiredForLocalMemoryResult = false; - mockProductHelper->supportReadOnlyAllocationsResult = true; - std::unique_ptr 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); diff --git a/shared/test/unit_test/os_interface/linux/ioctl_helper_tests_prelim.cpp b/shared/test/unit_test/os_interface/linux/ioctl_helper_tests_prelim.cpp index 8b95cd0ef8..0b494985f9 100644 --- a/shared/test/unit_test/os_interface/linux/ioctl_helper_tests_prelim.cpp +++ b/shared/test/unit_test/os_interface/linux/ioctl_helper_tests_prelim.cpp @@ -266,26 +266,20 @@ TEST_F(IoctlPrelimHelperTests, whenGettingFlagsForVmBindThenProperValuesAreRetur for (auto &bindCapture : ::testing::Bool()) { for (auto &bindImmediate : ::testing::Bool()) { for (auto &bindMakeResident : ::testing::Bool()) { - for (auto &readOnlyResource : ::testing::Bool()) { - auto flags = ioctlHelper.getFlagsForVmBind(bindCapture, bindImmediate, bindMakeResident, readOnlyResource); - if (bindCapture) { - EXPECT_EQ(PRELIM_I915_GEM_VM_BIND_CAPTURE, (flags & PRELIM_I915_GEM_VM_BIND_CAPTURE)); - } - if (bindImmediate) { - EXPECT_EQ(PRELIM_I915_GEM_VM_BIND_IMMEDIATE, (flags & PRELIM_I915_GEM_VM_BIND_IMMEDIATE)); - } - if (bindMakeResident) { - EXPECT_EQ(PRELIM_I915_GEM_VM_BIND_MAKE_RESIDENT, (flags & PRELIM_I915_GEM_VM_BIND_MAKE_RESIDENT)); - } - if (readOnlyResource) { - EXPECT_EQ(PRELIM_I915_GEM_VM_BIND_READONLY, (flags & PRELIM_I915_GEM_VM_BIND_READONLY)); - } - if (flags == 0) { - EXPECT_FALSE(bindCapture); - EXPECT_FALSE(bindImmediate); - EXPECT_FALSE(bindMakeResident); - EXPECT_FALSE(readOnlyResource); - } + auto flags = ioctlHelper.getFlagsForVmBind(bindCapture, bindImmediate, bindMakeResident); + if (bindCapture) { + EXPECT_EQ(PRELIM_I915_GEM_VM_BIND_CAPTURE, (flags & PRELIM_I915_GEM_VM_BIND_CAPTURE)); + } + if (bindImmediate) { + EXPECT_EQ(PRELIM_I915_GEM_VM_BIND_IMMEDIATE, (flags & PRELIM_I915_GEM_VM_BIND_IMMEDIATE)); + } + if (bindMakeResident) { + EXPECT_EQ(PRELIM_I915_GEM_VM_BIND_MAKE_RESIDENT, (flags & PRELIM_I915_GEM_VM_BIND_MAKE_RESIDENT)); + } + if (flags == 0) { + EXPECT_FALSE(bindCapture); + EXPECT_FALSE(bindImmediate); + EXPECT_FALSE(bindMakeResident); } } } diff --git a/shared/test/unit_test/os_interface/linux/ioctl_helper_tests_upstream.cpp b/shared/test/unit_test/os_interface/linux/ioctl_helper_tests_upstream.cpp index d5d2321965..8f3a079c32 100644 --- a/shared/test/unit_test/os_interface/linux/ioctl_helper_tests_upstream.cpp +++ b/shared/test/unit_test/os_interface/linux/ioctl_helper_tests_upstream.cpp @@ -318,10 +318,8 @@ TEST(IoctlHelperUpstreamTest, whenGettingFlagsForVmBindThenZeroIsReturned) { for (auto &bindCapture : ::testing::Bool()) { for (auto &bindImmediate : ::testing::Bool()) { for (auto &bindMakeResident : ::testing::Bool()) { - for (auto &readOnlyResource : ::testing::Bool()) { - auto flags = ioctlHelper.getFlagsForVmBind(bindCapture, bindImmediate, bindMakeResident, readOnlyResource); - EXPECT_EQ(0u, flags); - } + auto flags = ioctlHelper.getFlagsForVmBind(bindCapture, bindImmediate, bindMakeResident); + EXPECT_EQ(0u, flags); } } } diff --git a/shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.cpp b/shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.cpp index 25e371d2c7..3e396101c0 100644 --- a/shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.cpp @@ -261,7 +261,8 @@ TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingAnyMethodThenDummyValueIsRe EXPECT_EQ(0u, xeIoctlHelper->getDirectSubmissionFlag()); - EXPECT_EQ(0u, xeIoctlHelper->getFlagsForVmBind(false, false, false, false)); + EXPECT_EQ(0u, xeIoctlHelper->getFlagsForVmBind(false, false, false)); + std::vector queryItems; std::vector distanceInfos; EXPECT_EQ(0, xeIoctlHelper->queryDistances(queryItems, distanceInfos)); @@ -408,7 +409,7 @@ TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingAnyMethodThenDummyValueIsRe EXPECT_EQ(static_cast(XE_NEO_BIND_CAPTURE_FLAG | XE_NEO_BIND_IMMEDIATE_FLAG | XE_NEO_BIND_MAKERESIDENT_FLAG), - xeIoctlHelper->getFlagsForVmBind(true, true, true, true)); + xeIoctlHelper->getFlagsForVmBind(true, true, true)); uint32_t fabricId = 0, latency = 0, bandwidth = 0; EXPECT_FALSE(xeIoctlHelper->getFabricLatency(fabricId, latency, bandwidth)); diff --git a/shared/test/unit_test/os_interface/product_helper_tests.cpp b/shared/test/unit_test/os_interface/product_helper_tests.cpp index 5486a519fc..c7a826c1fd 100644 --- a/shared/test/unit_test/os_interface/product_helper_tests.cpp +++ b/shared/test/unit_test/os_interface/product_helper_tests.cpp @@ -912,7 +912,4 @@ HWTEST_F(ProductHelperTest, givenProductHelperWhenAskingForExtraKerneCapabilitie uint32_t extraKernelCapabilities = 0u; productHelper->getKernelCapabilitiesExtra(extraKernelCapabilities); EXPECT_EQ(0u, extraKernelCapabilities); -} -HWTEST_F(ProductHelperTest, givenProductHelperWhenAskingForReadOnlyResourceSupportThenFalseReturned) { - EXPECT_FALSE(productHelper->supportReadOnlyAllocations()); } \ No newline at end of file diff --git a/shared/test/unit_test/xe_hpc_core/excludes_xe_hpc_core.cpp b/shared/test/unit_test/xe_hpc_core/excludes_xe_hpc_core.cpp index 82e4d69dae..d1c8b8f0cd 100644 --- a/shared/test/unit_test/xe_hpc_core/excludes_xe_hpc_core.cpp +++ b/shared/test/unit_test/xe_hpc_core/excludes_xe_hpc_core.cpp @@ -46,4 +46,3 @@ HWTEST_EXCLUDE_PRODUCT(GetAllocationDataTestHw, givenSemaphoreBufferAllocationWh HWTEST_EXCLUDE_PRODUCT(MemoryManagerGetAlloctionDataTests, givenCommandBufferAllocationTypeWhenGetAllocationDataIsCalledThenSystemMemoryIsRequested, IGFX_XE_HPC_CORE); HWTEST_EXCLUDE_PRODUCT(ProductHelperTest, givenProductHelperWhenAskedIfPatIndexProgrammingSupportedThenReturnFalse, IGFX_XE_HPC_CORE); HWTEST_EXCLUDE_PRODUCT(ProductHelperTest, givenProductHelperWhenAskedIfPageFaultIsSupportedThenReturnFalse, IGFX_XE_HPC_CORE); -HWTEST_EXCLUDE_PRODUCT(ProductHelperTest, givenProductHelperWhenAskingForReadOnlyResourceSupportThenFalseReturned, IGFX_XE_HPC_CORE); diff --git a/shared/test/unit_test/xe_hpc_core/pvc/test_product_helper_pvc.cpp b/shared/test/unit_test/xe_hpc_core/pvc/test_product_helper_pvc.cpp index 504cd77d2a..0ca0c2002a 100644 --- a/shared/test/unit_test/xe_hpc_core/pvc/test_product_helper_pvc.cpp +++ b/shared/test/unit_test/xe_hpc_core/pvc/test_product_helper_pvc.cpp @@ -332,6 +332,3 @@ PVCTEST_F(PvcProductHelper, whenQueryingMaxNumSamplersThenReturnZero) { PVCTEST_F(PvcProductHelper, whenCheckingIfDummyBlitWaIsRequiredThenTrueIsReturned) { EXPECT_TRUE(productHelper->isDummyBlitWaRequired()); } -PVCTEST_F(PvcProductHelper, givenProductHelperWhenAskingForReadOnlyResourceSupportThenTrueReturned) { - EXPECT_TRUE(productHelper->supportReadOnlyAllocations()); -}