mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-09 22:43:00 +08:00
Move hwHelper ownership to RootDeviceEnvironment 4/n
Related-To: NEO-6853 Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com> UseRootDeviceEnvironment getHelper<CoreHelper> for: - isLocalMemoryEnabled - getSipKernelType - is1MbAlignmentSupported
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
62db166cee
commit
211cc8552a
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -8,24 +8,27 @@
|
||||
#include "shared/source/debugger/debugger.h"
|
||||
|
||||
#include "shared/source/built_ins/sip_kernel_type.h"
|
||||
#include "shared/source/execution_environment/root_device_environment.h"
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
#include "shared/source/indirect_heap/indirect_heap.h"
|
||||
#include "shared/source/source_level_debugger/source_level_debugger.h"
|
||||
|
||||
namespace NEO {
|
||||
std::unique_ptr<Debugger> Debugger::create(HardwareInfo *hwInfo) {
|
||||
std::unique_ptr<Debugger> Debugger::create(const RootDeviceEnvironment &rootDeviceEnvironment) {
|
||||
std::unique_ptr<SourceLevelDebugger> sourceLevelDebugger;
|
||||
if (hwInfo->capabilityTable.debuggerSupported || DebugManager.flags.ExperimentalEnableSourceLevelDebugger.get()) {
|
||||
auto &hwInfo = *rootDeviceEnvironment.getMutableHardwareInfo();
|
||||
if (hwInfo.capabilityTable.debuggerSupported || DebugManager.flags.ExperimentalEnableSourceLevelDebugger.get()) {
|
||||
sourceLevelDebugger.reset(SourceLevelDebugger::create());
|
||||
}
|
||||
if (sourceLevelDebugger) {
|
||||
auto &hwHelper = HwHelper::get(hwInfo->platform.eRenderCoreFamily);
|
||||
bool localMemorySipAvailable = (SipKernelType::DbgCsrLocal == hwHelper.getSipKernelType(true));
|
||||
auto &coreHelper = rootDeviceEnvironment.getHelper<CoreHelper>();
|
||||
|
||||
bool localMemorySipAvailable = (SipKernelType::DbgCsrLocal == coreHelper.getSipKernelType(true));
|
||||
sourceLevelDebugger->initialize(localMemorySipAvailable);
|
||||
|
||||
if (sourceLevelDebugger->isDebuggerActive()) {
|
||||
hwInfo->capabilityTable.fusedEuEnabled = false;
|
||||
hwInfo.capabilityTable.fusedEuEnabled = false;
|
||||
}
|
||||
}
|
||||
return sourceLevelDebugger;
|
||||
|
||||
@@ -13,6 +13,7 @@ class LinearStream;
|
||||
class IndirectHeap;
|
||||
struct DebugData;
|
||||
class GraphicsAllocation;
|
||||
struct RootDeviceEnvironment;
|
||||
|
||||
class Debugger {
|
||||
public:
|
||||
@@ -27,7 +28,7 @@ class Debugger {
|
||||
uint64_t BindlessSamplerStateBaseAddress = 0;
|
||||
};
|
||||
|
||||
static std::unique_ptr<Debugger> create(HardwareInfo *hwInfo);
|
||||
static std::unique_ptr<Debugger> create(const NEO::RootDeviceEnvironment &rootDeviceEnvironment);
|
||||
virtual ~Debugger() = default;
|
||||
bool isLegacy() const { return isLegacyMode; }
|
||||
virtual void captureStateBaseAddress(NEO::LinearStream &cmdStream, SbaAddresses sba) = 0;
|
||||
|
||||
@@ -45,7 +45,7 @@ void RootDeviceEnvironment::initAubCenter(bool localMemoryEnabled, const std::st
|
||||
}
|
||||
|
||||
void RootDeviceEnvironment::initDebugger() {
|
||||
debugger = Debugger::create(hwInfo.get());
|
||||
debugger = Debugger::create(*this);
|
||||
}
|
||||
|
||||
void RootDeviceEnvironment::initDebuggerL0(Device *neoDevice) {
|
||||
|
||||
@@ -155,9 +155,10 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocateGraphicsMemoryWithGpuVa(con
|
||||
GraphicsAllocation *OsAgnosticMemoryManager::allocateGraphicsMemory64kb(const AllocationData &allocationData) {
|
||||
AllocationData allocationDataAlign = allocationData;
|
||||
allocationDataAlign.size = alignUp(allocationData.size, MemoryConstants::pageSize64k);
|
||||
auto hwInfo = executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getHardwareInfo();
|
||||
auto &hwHelper = HwHelper::get(hwInfo->platform.eRenderCoreFamily);
|
||||
allocationDataAlign.alignment = hwHelper.is1MbAlignmentSupported(*hwInfo, allocationData.flags.preferCompressed)
|
||||
auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex].get();
|
||||
auto hwInfo = rootDeviceEnvironment.getHardwareInfo();
|
||||
auto &coreHelper = rootDeviceEnvironment.getHelper<CoreHelper>();
|
||||
allocationDataAlign.alignment = coreHelper.is1MbAlignmentSupported(*hwInfo, allocationData.flags.preferCompressed)
|
||||
? MemoryConstants::megaByte
|
||||
: MemoryConstants::pageSize64k;
|
||||
auto memoryAllocation = allocateGraphicsMemoryWithAlignment(allocationDataAlign);
|
||||
|
||||
@@ -36,9 +36,9 @@ GEN9TEST_F(HwHelperTestGen9, WhenAdjustingDefaultEngineTypeThenEngineTypeIsSet)
|
||||
}
|
||||
|
||||
GEN9TEST_F(HwHelperTestGen9, givenDebuggingActiveWhenSipKernelTypeIsQueriedThenDbgCsrLocalTypeIsReturned) {
|
||||
auto &helper = HwHelper::get(renderCoreFamily);
|
||||
auto &coreHelper = getHelper<CoreHelper>();
|
||||
|
||||
auto sipType = helper.getSipKernelType(true);
|
||||
auto sipType = coreHelper.getSipKernelType(true);
|
||||
EXPECT_EQ(SipKernelType::DbgCsrLocal, sipType);
|
||||
}
|
||||
|
||||
|
||||
@@ -123,10 +123,10 @@ HWTEST_F(HwHelperTest, WhenSettingRenderSurfaceStateForBufferThenL1CachePolicyIs
|
||||
}
|
||||
|
||||
TEST_F(HwHelperTest, givenDebuggingInactiveWhenSipKernelTypeIsQueriedThenCsrTypeIsReturned) {
|
||||
auto &helper = HwHelper::get(renderCoreFamily);
|
||||
EXPECT_NE(nullptr, &helper);
|
||||
auto &coreHelper = getHelper<CoreHelper>();
|
||||
EXPECT_NE(nullptr, &coreHelper);
|
||||
|
||||
auto sipType = helper.getSipKernelType(false);
|
||||
auto sipType = coreHelper.getSipKernelType(false);
|
||||
EXPECT_EQ(SipKernelType::Csr, sipType);
|
||||
}
|
||||
|
||||
@@ -767,21 +767,21 @@ HWCMDTEST_F(IGFX_GEN8_CORE, HwHelperTest, givenHwHelperWhenGettingGlobalTimeStam
|
||||
TEST_F(HwHelperTest, givenEnableLocalMemoryDebugVarAndOsEnableLocalMemoryWhenSetThenGetEnableLocalMemoryReturnsCorrectValue) {
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
VariableBackup<bool> orgOsEnableLocalMemory(&OSInterface::osEnableLocalMemory);
|
||||
auto &helper = HwHelper::get(renderCoreFamily);
|
||||
auto &coreHelper = getHelper<CoreHelper>();
|
||||
|
||||
DebugManager.flags.EnableLocalMemory.set(0);
|
||||
EXPECT_FALSE(helper.getEnableLocalMemory(hardwareInfo));
|
||||
EXPECT_FALSE(coreHelper.getEnableLocalMemory(hardwareInfo));
|
||||
|
||||
DebugManager.flags.EnableLocalMemory.set(1);
|
||||
EXPECT_TRUE(helper.getEnableLocalMemory(hardwareInfo));
|
||||
EXPECT_TRUE(coreHelper.getEnableLocalMemory(hardwareInfo));
|
||||
|
||||
DebugManager.flags.EnableLocalMemory.set(-1);
|
||||
|
||||
OSInterface::osEnableLocalMemory = false;
|
||||
EXPECT_FALSE(helper.getEnableLocalMemory(hardwareInfo));
|
||||
EXPECT_FALSE(coreHelper.getEnableLocalMemory(hardwareInfo));
|
||||
|
||||
OSInterface::osEnableLocalMemory = true;
|
||||
EXPECT_EQ(helper.isLocalMemoryEnabled(hardwareInfo), helper.getEnableLocalMemory(hardwareInfo));
|
||||
EXPECT_EQ(coreHelper.isLocalMemoryEnabled(hardwareInfo), coreHelper.getEnableLocalMemory(hardwareInfo));
|
||||
}
|
||||
|
||||
TEST_F(HwHelperTest, givenAUBDumpForceAllToLocalMemoryDebugVarWhenSetThenGetEnableLocalMemoryReturnsCorrectValue) {
|
||||
|
||||
Reference in New Issue
Block a user