Use dedicated helper to detect ISA placement requirement

Change-Id: I701c64b52fddfef1e493f4adaef4edc28f5ffdf0
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski 2020-09-21 18:08:07 +02:00 committed by sys_ocldev
parent 6c2fb0b25e
commit 8db8b09339
4 changed files with 22 additions and 2 deletions

View File

@ -994,6 +994,12 @@ TEST(HwInfoConfigCommonHelperTest, givenBlitterPreferenceWhenEnablingBlitterOper
EXPECT_EQ(expectedBlitterSupport, hardwareInfo.capabilityTable.blitterOperationsSupported); 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) { TEST(HwInfoConfigCommonHelperTest, givenDebugFlagSetWhenEnablingBlitterOperationsSupportThenHonorTheFlag) {
DebugManagerStateRestore restore{}; DebugManagerStateRestore restore{};
HardwareInfo hardwareInfo = *defaultHwInfo; HardwareInfo hardwareInfo = *defaultHwInfo;

View File

@ -124,6 +124,7 @@ class HwHelper {
virtual uint32_t getDefaultThreadArbitrationPolicy() const = 0; virtual uint32_t getDefaultThreadArbitrationPolicy() const = 0;
virtual bool heapInLocalMem(const HardwareInfo &hwInfo) const = 0; virtual bool heapInLocalMem(const HardwareInfo &hwInfo) const = 0;
virtual bool useOnlyGlobalTimestamps() 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 getSubDevicesCount(const HardwareInfo *pHwInfo);
static uint32_t getEnginesCount(const HardwareInfo &hwInfo); static uint32_t getEnginesCount(const HardwareInfo &hwInfo);
@ -306,6 +307,8 @@ class HwHelperHw : public HwHelper {
bool useOnlyGlobalTimestamps() const override; bool useOnlyGlobalTimestamps() const override;
bool useSystemMemoryPlacementForISA(const HardwareInfo &hwInfo) const override;
protected: protected:
LocalMemoryAccessMode getDefaultLocalMemoryAccessMode(const HardwareInfo &hwInfo) const override; LocalMemoryAccessMode getDefaultLocalMemoryAccessMode(const HardwareInfo &hwInfo) const override;

View File

@ -491,4 +491,9 @@ template <typename GfxFamily>
bool HwHelperHw<GfxFamily>::useOnlyGlobalTimestamps() const { bool HwHelperHw<GfxFamily>::useOnlyGlobalTimestamps() const {
return false; return false;
} }
template <typename GfxFamily>
bool HwHelperHw<GfxFamily>::useSystemMemoryPlacementForISA(const HardwareInfo &hwInfo) const {
return false;
}
} // namespace NEO } // namespace NEO

View File

@ -255,6 +255,9 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo
UNRECOVERABLE_IF(hostPtr == nullptr && !properties.flags.allocateMemory); UNRECOVERABLE_IF(hostPtr == nullptr && !properties.flags.allocateMemory);
UNRECOVERABLE_IF(properties.allocationType == GraphicsAllocation::AllocationType::UNKNOWN); 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 allow64KbPages = false;
bool allow32Bit = false; bool allow32Bit = false;
bool forcePin = properties.flags.forcePin; bool forcePin = properties.flags.forcePin;
@ -339,6 +342,10 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo
break; break;
} }
if (properties.allocationType == GraphicsAllocation::AllocationType::KERNEL_ISA) {
allocationData.flags.useSystemMemory = hwHelper.useSystemMemoryPlacementForISA(*hwInfo);
}
switch (properties.allocationType) { switch (properties.allocationType) {
case GraphicsAllocation::AllocationType::COMMAND_BUFFER: case GraphicsAllocation::AllocationType::COMMAND_BUFFER:
case GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER: case GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER:
@ -388,8 +395,7 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo
allocationData.osContext = properties.osContext; allocationData.osContext = properties.osContext;
allocationData.rootDeviceIndex = properties.rootDeviceIndex; allocationData.rootDeviceIndex = properties.rootDeviceIndex;
auto hwInfo = executionEnvironment.rootDeviceEnvironments[properties.rootDeviceIndex]->getHardwareInfo(); hwHelper.setExtraAllocationData(allocationData, properties, *hwInfo);
HwHelper::get(hwInfo->platform.eRenderCoreFamily).setExtraAllocationData(allocationData, properties, *hwInfo);
return true; return true;
} }