Support for dsh and ssh on external heap in L0

Related-To: NEO-4724

Change-Id: I85c2effea8a99bebaf9e3db33129641f37dcabe5
Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
This commit is contained in:
Maciej Plewka
2020-08-27 08:55:09 +02:00
committed by sys_ocldev
parent f891708e3f
commit a779e44b52
29 changed files with 356 additions and 46 deletions

View File

@@ -42,6 +42,9 @@ set(NEO_CORE_HELPERS
${CMAKE_CURRENT_SOURCE_DIR}/flush_stamp.h
${CMAKE_CURRENT_SOURCE_DIR}/get_info.h
${CMAKE_CURRENT_SOURCE_DIR}/hash.h
${CMAKE_CURRENT_SOURCE_DIR}/heap_assigner.h
${CMAKE_CURRENT_SOURCE_DIR}/heap_assigner.cpp
${CMAKE_CURRENT_SOURCE_DIR}/heap_assigner_config.h
${CMAKE_CURRENT_SOURCE_DIR}/heap_helper.cpp
${CMAKE_CURRENT_SOURCE_DIR}/heap_helper.h
${CMAKE_CURRENT_SOURCE_DIR}/hw_helper.cpp

View File

@@ -0,0 +1,38 @@
/*
* Copyright (C) 2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/helpers/heap_assigner.h"
#include "shared/source/helpers/heap_assigner_config.h"
#include "shared/source/helpers/hw_info.h"
#include "shared/source/memory_manager/memory_manager.h"
namespace NEO {
HeapAssigner::HeapAssigner() {
apiAllowExternalHeapForSshAndDsh = HeapAssignerConfig::getConfiguration();
}
bool HeapAssigner::useInternal32BitHeap(GraphicsAllocation::AllocationType allocType) {
return allocType == GraphicsAllocation::AllocationType::KERNEL_ISA ||
allocType == GraphicsAllocation::AllocationType::INTERNAL_HEAP;
}
bool HeapAssigner::use32BitHeap(GraphicsAllocation::AllocationType allocType) {
return useExternal32BitHeap(allocType) || useInternal32BitHeap(allocType);
}
HeapIndex HeapAssigner::get32BitHeapIndex(GraphicsAllocation::AllocationType allocType, bool useLocalMem, const HardwareInfo &hwInfo) {
if (useInternal32BitHeap(allocType)) {
return MemoryManager::selectInternalHeap(useLocalMem);
}
return MemoryManager::selectExternalHeap(useLocalMem);
}
bool HeapAssigner::useExternal32BitHeap(GraphicsAllocation::AllocationType allocType) {
if (apiAllowExternalHeapForSshAndDsh) {
return allocType == GraphicsAllocation::AllocationType::LINEAR_STREAM;
}
return false;
}
} // namespace NEO

View File

@@ -0,0 +1,23 @@
/*
* Copyright (C) 2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/source/memory_manager/graphics_allocation.h"
namespace NEO {
struct HardwareInfo;
struct HeapAssigner {
HeapAssigner();
~HeapAssigner() = default;
bool useExternal32BitHeap(GraphicsAllocation::AllocationType allocType);
bool useInternal32BitHeap(GraphicsAllocation::AllocationType allocType);
bool use32BitHeap(GraphicsAllocation::AllocationType allocType);
HeapIndex get32BitHeapIndex(GraphicsAllocation::AllocationType allocType, bool useLocalMem, const HardwareInfo &hwInfo);
bool apiAllowExternalHeapForSshAndDsh = false;
};
} // namespace NEO

View File

@@ -0,0 +1,13 @@
/*
* Copyright (C) 2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
namespace NEO {
struct HeapAssignerConfig {
static bool getConfiguration();
};
} // namespace NEO

View File

@@ -123,6 +123,7 @@ class HwHelper {
virtual uint32_t getGlobalTimeStampBits() const = 0;
virtual uint32_t getDefaultThreadArbitrationPolicy() const = 0;
virtual void adjustPlatformCoreFamilyForIgc(HardwareInfo &hwInfo) = 0;
virtual bool heapInLocalMem(const HardwareInfo &hwInfo) const = 0;
static uint32_t getSubDevicesCount(const HardwareInfo *pHwInfo);
static uint32_t getEnginesCount(const HardwareInfo &hwInfo);
@@ -212,6 +213,8 @@ class HwHelperHw : public HwHelper {
bool isLocalMemoryEnabled(const HardwareInfo &hwInfo) const override;
bool heapInLocalMem(const HardwareInfo &hwInfo) const override;
bool hvAlign4Required() const override;
bool obtainRenderBufferCompressionPreference(const HardwareInfo &hwInfo, const size_t size) const override;

View File

@@ -35,6 +35,11 @@ bool HwHelperHw<GfxFamily>::isLocalMemoryEnabled(const HardwareInfo &hwInfo) con
return false;
}
template <typename GfxFamily>
bool HwHelperHw<GfxFamily>::heapInLocalMem(const HardwareInfo &hwInfo) const {
return false;
}
template <typename GfxFamily>
bool HwHelperHw<GfxFamily>::hvAlign4Required() const {
return true;