Don't use global getter for L0GfxCoreHelper and GfxCoreHelper in L0 files

Related-To: NEO-6853
Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
Kamil Kopryk
2022-12-20 04:30:24 +00:00
committed by Compute-Runtime-Automation
parent d35f4249cd
commit 4a87266be1
9 changed files with 41 additions and 36 deletions

View File

@@ -108,7 +108,7 @@ CommandList *CommandList::createImmediate(uint32_t productFamily, Device *device
NEO::CommandStreamReceiver *csr = nullptr;
auto deviceImp = static_cast<DeviceImp *>(device);
const auto &hwInfo = device->getHwInfo();
auto &gfxCoreHelper = NEO::GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily);
auto &gfxCoreHelper = device->getGfxCoreHelper();
if (internalUsage) {
if (NEO::EngineHelper::isCopyOnlyEngineType(engineGroupType) && deviceImp->getActiveDevice()->getInternalCopyEngine()) {
csr = deviceImp->getActiveDevice()->getInternalCopyEngine()->commandStreamReceiver;

View File

@@ -601,7 +601,7 @@ ze_result_t ContextImp::openEventPoolIpcHandle(const ze_ipc_event_pool_handle_t
auto neoDevice = device->getNEODevice();
NEO::osHandle osHandle = static_cast<NEO::osHandle>(handle);
eventPool->initializeSizeParameters(this->numDevices, this->deviceHandles.data(), *this->driverHandle, device->getHwInfo());
eventPool->initializeSizeParameters(this->numDevices, this->deviceHandles.data(), *this->driverHandle, neoDevice->getRootDeviceEnvironment());
NEO::AllocationProperties unifiedMemoryProperties{rootDeviceIndex,
eventPool->getEventPoolSize(),

View File

@@ -76,11 +76,11 @@ ze_result_t EventPoolImp::initialize(DriverHandle *driver, Context *context, uin
}
rootDeviceIndices.remove_duplicates();
auto &hwInfo = getDevice()->getHwInfo();
auto &l0GfxCoreHelper = getDevice()->getNEODevice()->getRootDeviceEnvironment().getHelper<L0GfxCoreHelper>();
auto &rootDeviceEnvironment = getDevice()->getNEODevice()->getRootDeviceEnvironment();
auto &l0GfxCoreHelper = rootDeviceEnvironment.getHelper<L0GfxCoreHelper>();
useDeviceAlloc |= l0GfxCoreHelper.alwaysAllocateEventInLocalMem();
initializeSizeParameters(numDevices, phDevices, *driverHandleImp, hwInfo);
initializeSizeParameters(numDevices, phDevices, *driverHandleImp, rootDeviceEnvironment);
NEO::AllocationType allocationType = isEventPoolTimestampFlagSet() ? NEO::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER
: NEO::AllocationType::BUFFER_HOST_MEMORY;
@@ -160,12 +160,14 @@ ze_result_t EventPoolImp::createEvent(const ze_event_desc_t *desc, ze_event_hand
return ZE_RESULT_SUCCESS;
}
void EventPoolImp::initializeSizeParameters(uint32_t numDevices, ze_device_handle_t *deviceHandles, DriverHandleImp &driver, const NEO::HardwareInfo &hwInfo) {
auto &l0GfxCoreHelper = L0GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily);
auto &gfxCoreHelper = NEO::GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily);
void EventPoolImp::initializeSizeParameters(uint32_t numDevices, ze_device_handle_t *deviceHandles, DriverHandleImp &driver, const NEO::RootDeviceEnvironment &rootDeviceEnvironment) {
auto &l0GfxCoreHelper = rootDeviceEnvironment.getHelper<L0GfxCoreHelper>();
auto &gfxCoreHelper = rootDeviceEnvironment.getHelper<NEO::GfxCoreHelper>();
setEventAlignment(static_cast<uint32_t>(gfxCoreHelper.getTimestampPacketAllocatorAlignment()));
auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo();
bool useDynamicEventPackets = l0GfxCoreHelper.useDynamicEventPacketsCount(hwInfo);
eventPackets = EventPacketsCount::eventPackets;
maxKernelCount = EventPacketsCount::maxKernelSplit;

View File

@@ -19,6 +19,10 @@ struct _ze_event_handle_t {};
struct _ze_event_pool_handle_t {};
namespace NEO {
struct RootDeviceEnvironment;
}
namespace L0 {
typedef uint64_t FlushStamp;
struct EventPool;
@@ -338,7 +342,7 @@ struct EventPoolImp : public EventPool {
ze_result_t createEvent(const ze_event_desc_t *desc, ze_event_handle_t *phEvent) override;
void initializeSizeParameters(uint32_t numDevices, ze_device_handle_t *deviceHandles, DriverHandleImp &driver, const NEO::HardwareInfo &hwInfo);
void initializeSizeParameters(uint32_t numDevices, ze_device_handle_t *deviceHandles, DriverHandleImp &driver, const NEO::RootDeviceEnvironment &rootDeviceEnvironment);
Device *getDevice() override { return devices[0]; }

View File

@@ -41,15 +41,6 @@ void AUBFixtureL0::setUp(const NEO::HardwareInfo *hardwareInfo, bool debuggingEn
ASSERT_NE(nullptr, hardwareInfo);
const auto &hwInfo = *hardwareInfo;
auto &gfxCoreHelper = NEO::GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily);
auto engineType = getChosenEngineType(hwInfo);
const ::testing::TestInfo *const testInfo = ::testing::UnitTest::GetInstance()->current_test_info();
std::stringstream strfilename;
strfilename << NEO::ApiSpecificConfig::getAubPrefixForSpecificApi();
strfilename << testInfo->test_case_name() << "_" << testInfo->name() << "_" << gfxCoreHelper.getCsTraits(engineType).name;
executionEnvironment = new NEO::ExecutionEnvironment();
executionEnvironment->prepareRootDeviceEnvironments(1u);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(&hwInfo);
@@ -60,6 +51,15 @@ void AUBFixtureL0::setUp(const NEO::HardwareInfo *hardwareInfo, bool debuggingEn
}
neoDevice = NEO::MockDevice::createWithExecutionEnvironment<NEO::MockDevice>(&hwInfo, executionEnvironment, 0u);
auto &gfxCoreHelper = neoDevice->getGfxCoreHelper();
auto engineType = getChosenEngineType(hwInfo);
const ::testing::TestInfo *const testInfo = ::testing::UnitTest::GetInstance()->current_test_info();
std::stringstream strfilename;
strfilename << NEO::ApiSpecificConfig::getAubPrefixForSpecificApi();
strfilename << testInfo->test_case_name() << "_" << testInfo->name() << "_" << gfxCoreHelper.getCsTraits(engineType).name;
if (NEO::testMode == NEO::TestMode::AubTestsWithTbx) {
this->csr = NEO::TbxCommandStreamReceiver::create(strfilename.str(), true, *executionEnvironment, 0, neoDevice->getDeviceBitfield());
} else {

View File

@@ -94,7 +94,7 @@ HWTEST_F(CommandListAppendEventReset, givenCmdlistWhenResetEventWithTimeStampIsA
}
auto &hwInfo = device->getHwInfo();
auto &l0GfxCoreHelper = L0GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily);
auto &l0GfxCoreHelper = device->getNEODevice()->getRootDeviceEnvironment().getHelper<L0GfxCoreHelper>();
uint32_t maxPackets = EventPacketsCount::eventPackets;
if (l0GfxCoreHelper.useDynamicEventPacketsCount(hwInfo)) {
@@ -279,7 +279,7 @@ HWTEST2_F(CommandListAppendUsedPacketSignalEvent, givenTimestampEventUsedInReset
auto &commandContainer = commandList->commandContainer;
auto &hwInfo = device->getHwInfo();
auto &l0GfxCoreHelper = L0GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily);
auto &l0GfxCoreHelper = device->getNEODevice()->getRootDeviceEnvironment().getHelper<L0GfxCoreHelper>();
ze_event_pool_desc_t eventPoolDesc = {};
eventPoolDesc.count = 1;
@@ -443,7 +443,7 @@ HWTEST2_F(CommandListAppendUsedPacketSignalEvent,
postSyncPipeControlItor++;
ASSERT_NE(cmdList.end(), postSyncPipeControlItor);
//find multi tile barrier section: pipe control + atomic/semaphore
// find multi tile barrier section: pipe control + atomic/semaphore
auto itorPipeControl = find<PIPE_CONTROL *>(postSyncPipeControlItor, cmdList.end());
ASSERT_NE(cmdList.end(), itorPipeControl);

View File

@@ -322,7 +322,7 @@ HWTEST_F(KernelDebugSurfaceTest, givenDebuggerAndBindfulKernelWhenAppendingKerne
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[0]->debugger.reset(debugger);
auto &hwInfo = *NEO::defaultHwInfo.get();
auto &gfxCoreHelper = GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily);
auto &gfxCoreHelper = neoDevice->getGfxCoreHelper();
auto maxDbgSurfaceSize = gfxCoreHelper.getSipKernelMaxDbgSurfaceSize(hwInfo);
auto debugSurface = neoDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties(
{device->getRootDeviceIndex(), true,
@@ -847,7 +847,7 @@ HWTEST_F(NotifyModuleLoadTest, givenDebuggingEnabledWhenModuleIsCreatedAndFullyL
auto debugger = MockDebuggerL0Hw<FamilyType>::allocate(neoDevice);
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[0]->debugger.reset(debugger);
auto elfAdditionalSections = {ZebinTestData::appendElfAdditionalSection::CONSTANT}; //for const surface allocation copy
auto elfAdditionalSections = {ZebinTestData::appendElfAdditionalSection::CONSTANT}; // for const surface allocation copy
auto zebinData = std::make_unique<ZebinTestData::ZebinWithL0TestCommonModule>(device->getHwInfo(), elfAdditionalSections);
const auto &src = zebinData->storage;
@@ -871,7 +871,7 @@ HWTEST_F(NotifyModuleLoadTest, givenDebuggingEnabledWhenModuleIsCreatedAndFullyL
auto numIsaAllocations = static_cast<int>(module->getKernelImmutableDataVector().size());
auto expectedMakeResidentCallsCount = numIsaAllocations + 1; //const surface
auto expectedMakeResidentCallsCount = numIsaAllocations + 1; // const surface
expectedMakeResidentCallsCount += numIsaAllocations;
EXPECT_EQ(expectedMakeResidentCallsCount, memoryOperationsHandler->makeResidentCalledCount);

View File

@@ -162,8 +162,8 @@ HWTEST_F(EventPoolCreate, givenTimestampEventsThenEventSizeSufficientForAllKerne
ASSERT_NE(nullptr, eventPool);
auto &hwInfo = device->getHwInfo();
auto &l0GfxCoreHelper = L0GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily);
auto &gfxCoreHelper = NEO::GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily);
auto &l0GfxCoreHelper = device->getNEODevice()->getRootDeviceEnvironment().getHelper<L0GfxCoreHelper>();
auto &gfxCoreHelper = device->getGfxCoreHelper();
uint32_t maxPacketCount = EventPacketsCount::maxKernelSplit * NEO::TimestampPacketSizeControl::preferredPacketCount;
if (l0GfxCoreHelper.useDynamicEventPacketsCount(hwInfo)) {
@@ -1153,7 +1153,7 @@ TEST_F(TimestampEventCreate, givenEventCreatedWithTimestampThenIsTimestampEventF
TEST_F(TimestampEventCreate, givenEventTimestampsCreatedWhenResetIsInvokeThenCorrectDataAreSet) {
auto &hwInfo = device->getHwInfo();
auto &l0GfxCoreHelper = L0GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily);
auto &l0GfxCoreHelper = device->getNEODevice()->getRootDeviceEnvironment().getHelper<L0GfxCoreHelper>();
uint32_t maxKernelCount = EventPacketsCount::maxKernelSplit;
if (l0GfxCoreHelper.useDynamicEventPacketsCount(hwInfo)) {
@@ -2008,7 +2008,7 @@ HWTEST_F(EventSizeTests, whenCreatingEventPoolThenUseCorrectSizeAndAlignment) {
auto &gfxCoreHelper = device->getGfxCoreHelper();
auto &hwInfo = device->getHwInfo();
auto &l0GfxCoreHelper = L0GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily);
auto &l0GfxCoreHelper = device->getNEODevice()->getRootDeviceEnvironment().getHelper<L0GfxCoreHelper>();
uint32_t packetCount = EventPacketsCount::eventPackets;
if (l0GfxCoreHelper.useDynamicEventPacketsCount(hwInfo)) {
@@ -2044,7 +2044,7 @@ HWTEST_F(EventSizeTests, givenDebugFlagwhenCreatingEventPoolThenUseCorrectSizeAn
auto &hwInfo = device->getHwInfo();
auto expectedAlignment = static_cast<uint32_t>(gfxCoreHelper.getTimestampPacketAllocatorAlignment());
auto &l0GfxCoreHelper = L0GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily);
auto &l0GfxCoreHelper = device->getNEODevice()->getRootDeviceEnvironment().getHelper<L0GfxCoreHelper>();
uint32_t packetCount = EventPacketsCount::eventPackets;
if (l0GfxCoreHelper.useDynamicEventPacketsCount(hwInfo)) {
@@ -2277,7 +2277,6 @@ struct MockEventCompletion : public EventImp<uint32_t> {
MockEventCompletion(L0::EventPool *eventPool, int index, L0::Device *device) : EventImp(eventPool, index, device, false) {
auto neoDevice = device->getNEODevice();
auto &hwInfo = neoDevice->getHardwareInfo();
signalAllEventPackets = L0GfxCoreHelper::useSignalAllEventPackets(hwInfo);
auto alloc = eventPool->getAllocation().getGraphicsAllocation(neoDevice->getRootDeviceIndex());
@@ -2421,8 +2420,8 @@ struct EventDynamicPacketUseFixture : public DeviceFixture {
void testAllDevices() {
auto &hwInfo = device->getHwInfo();
auto &l0GfxCoreHelper = L0GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily);
auto &gfxCoreHelper = NEO::GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily);
auto &l0GfxCoreHelper = device->getNEODevice()->getRootDeviceEnvironment().getHelper<L0GfxCoreHelper>();
auto &gfxCoreHelper = device->getGfxCoreHelper();
ze_event_pool_desc_t eventPoolDesc = {
ZE_STRUCTURE_TYPE_EVENT_POOL_DESC,
@@ -2469,7 +2468,7 @@ struct EventDynamicPacketUseFixture : public DeviceFixture {
ze_result_t result = ZE_RESULT_SUCCESS;
auto &hwInfo = device->getHwInfo();
auto &l0GfxCoreHelper = L0GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily);
auto &l0GfxCoreHelper = device->getNEODevice()->getRootDeviceEnvironment().getHelper<L0GfxCoreHelper>();
auto &gfxCoreHelper = NEO::GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily);
ze_event_pool_desc_t eventPoolDesc = {
@@ -2528,7 +2527,7 @@ struct EventDynamicPacketUseFixture : public DeviceFixture {
ze_result_t result = ZE_RESULT_SUCCESS;
auto &hwInfo = device->getHwInfo();
auto &l0GfxCoreHelper = L0GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily);
auto &l0GfxCoreHelper = device->getNEODevice()->getRootDeviceEnvironment().getHelper<L0GfxCoreHelper>();
ze_event_pool_desc_t eventPoolDesc = {
ZE_STRUCTURE_TYPE_EVENT_POOL_DESC,

View File

@@ -27,7 +27,7 @@ HWTEST2_F(KernelDebugSurfaceDG2Test, givenDebuggerWhenKernelInitializeCalledThen
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[0]->debugger.reset(debugger);
auto &hwInfo = *NEO::defaultHwInfo.get();
auto &gfxCoreHelper = GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily);
auto &gfxCoreHelper = neoDevice->getGfxCoreHelper();
auto maxDbgSurfaceSize = gfxCoreHelper.getSipKernelMaxDbgSurfaceSize(hwInfo);
auto debugSurface = neoDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties(
{device->getRootDeviceIndex(), true,
@@ -83,7 +83,7 @@ HWTEST2_F(KernelDebugSurfaceDG2Test, givenNoDebuggerButDebuggerActiveSetWhenPatc
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[0]->debugger.reset(debugger);
auto &hwInfo = *NEO::defaultHwInfo.get();
auto &gfxCoreHelper = GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily);
auto &gfxCoreHelper = neoDevice->getGfxCoreHelper();
auto maxDbgSurfaceSize = gfxCoreHelper.getSipKernelMaxDbgSurfaceSize(hwInfo);
auto debugSurface = neoDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties(
{device->getRootDeviceIndex(), true,