From 8db8b09339c74a3d4ce8f4f3f5630d60074b9df7 Mon Sep 17 00:00:00 2001 From: Bartosz Dunajski Date: Mon, 21 Sep 2020 18:08:07 +0200 Subject: [PATCH] Use dedicated helper to detect ISA placement requirement Change-Id: I701c64b52fddfef1e493f4adaef4edc28f5ffdf0 Signed-off-by: Bartosz Dunajski --- opencl/test/unit_test/helpers/hw_helper_tests.cpp | 6 ++++++ shared/source/helpers/hw_helper.h | 3 +++ shared/source/helpers/hw_helper_base.inl | 5 +++++ shared/source/memory_manager/memory_manager.cpp | 10 ++++++++-- 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/opencl/test/unit_test/helpers/hw_helper_tests.cpp b/opencl/test/unit_test/helpers/hw_helper_tests.cpp index 33517ec90b..3bcc580582 100644 --- a/opencl/test/unit_test/helpers/hw_helper_tests.cpp +++ b/opencl/test/unit_test/helpers/hw_helper_tests.cpp @@ -994,6 +994,12 @@ TEST(HwInfoConfigCommonHelperTest, givenBlitterPreferenceWhenEnablingBlitterOper EXPECT_EQ(expectedBlitterSupport, hardwareInfo.capabilityTable.blitterOperationsSupported); } +HWTEST_F(HwHelperTest, givenHwHelperWhenAskingForIsaSystemMemoryPlacementThenReturnFalse) { + HwHelper &hwHelper = HwHelper::get(hardwareInfo.platform.eRenderCoreFamily); + + EXPECT_FALSE(hwHelper.useSystemMemoryPlacementForISA(hardwareInfo)); +} + TEST(HwInfoConfigCommonHelperTest, givenDebugFlagSetWhenEnablingBlitterOperationsSupportThenHonorTheFlag) { DebugManagerStateRestore restore{}; HardwareInfo hardwareInfo = *defaultHwInfo; diff --git a/shared/source/helpers/hw_helper.h b/shared/source/helpers/hw_helper.h index a65e3ac791..4192d41b5a 100644 --- a/shared/source/helpers/hw_helper.h +++ b/shared/source/helpers/hw_helper.h @@ -124,6 +124,7 @@ class HwHelper { virtual uint32_t getDefaultThreadArbitrationPolicy() const = 0; virtual bool heapInLocalMem(const HardwareInfo &hwInfo) const = 0; virtual bool useOnlyGlobalTimestamps() const = 0; + virtual bool useSystemMemoryPlacementForISA(const HardwareInfo &hwInfo) const = 0; static uint32_t getSubDevicesCount(const HardwareInfo *pHwInfo); static uint32_t getEnginesCount(const HardwareInfo &hwInfo); @@ -306,6 +307,8 @@ class HwHelperHw : public HwHelper { bool useOnlyGlobalTimestamps() const override; + bool useSystemMemoryPlacementForISA(const HardwareInfo &hwInfo) const override; + protected: LocalMemoryAccessMode getDefaultLocalMemoryAccessMode(const HardwareInfo &hwInfo) const override; diff --git a/shared/source/helpers/hw_helper_base.inl b/shared/source/helpers/hw_helper_base.inl index 86797c3a72..d96717c045 100644 --- a/shared/source/helpers/hw_helper_base.inl +++ b/shared/source/helpers/hw_helper_base.inl @@ -491,4 +491,9 @@ template bool HwHelperHw::useOnlyGlobalTimestamps() const { return false; } + +template +bool HwHelperHw::useSystemMemoryPlacementForISA(const HardwareInfo &hwInfo) const { + return false; +} } // namespace NEO diff --git a/shared/source/memory_manager/memory_manager.cpp b/shared/source/memory_manager/memory_manager.cpp index cb883c91ee..fe0913c184 100644 --- a/shared/source/memory_manager/memory_manager.cpp +++ b/shared/source/memory_manager/memory_manager.cpp @@ -255,6 +255,9 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo UNRECOVERABLE_IF(hostPtr == nullptr && !properties.flags.allocateMemory); UNRECOVERABLE_IF(properties.allocationType == GraphicsAllocation::AllocationType::UNKNOWN); + auto hwInfo = executionEnvironment.rootDeviceEnvironments[properties.rootDeviceIndex]->getHardwareInfo(); + auto &hwHelper = HwHelper::get(hwInfo->platform.eRenderCoreFamily); + bool allow64KbPages = false; bool allow32Bit = false; bool forcePin = properties.flags.forcePin; @@ -339,6 +342,10 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo break; } + if (properties.allocationType == GraphicsAllocation::AllocationType::KERNEL_ISA) { + allocationData.flags.useSystemMemory = hwHelper.useSystemMemoryPlacementForISA(*hwInfo); + } + switch (properties.allocationType) { case GraphicsAllocation::AllocationType::COMMAND_BUFFER: case GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER: @@ -388,8 +395,7 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo allocationData.osContext = properties.osContext; allocationData.rootDeviceIndex = properties.rootDeviceIndex; - auto hwInfo = executionEnvironment.rootDeviceEnvironments[properties.rootDeviceIndex]->getHardwareInfo(); - HwHelper::get(hwInfo->platform.eRenderCoreFamily).setExtraAllocationData(allocationData, properties, *hwInfo); + hwHelper.setExtraAllocationData(allocationData, properties, *hwInfo); return true; }