Skip to content

Commit ad21b76

Browse files
Use hwInfo from root device environment [1/N]
Related-To: NEO-3857 Change-Id: I270e53fb5334c39d41d38b4d2a75c7a3cd05aa56 Signed-off-by: Jobczyk, Lukasz <lukasz.jobczyk@intel.com>
1 parent 70322b8 commit ad21b76

File tree

50 files changed

+173
-153
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+173
-153
lines changed

core/command_stream/scratch_space_controller.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "core/command_stream/scratch_space_controller.h"
99

1010
#include "core/execution_environment/execution_environment.h"
11+
#include "core/execution_environment/root_device_environment.h"
1112
#include "core/helpers/hw_helper.h"
1213
#include "core/memory_manager/graphics_allocation.h"
1314
#include "core/memory_manager/internal_allocation_storage.h"
@@ -16,7 +17,7 @@
1617
namespace NEO {
1718
ScratchSpaceController::ScratchSpaceController(uint32_t rootDeviceIndex, ExecutionEnvironment &environment, InternalAllocationStorage &allocationStorage)
1819
: rootDeviceIndex(rootDeviceIndex), executionEnvironment(environment), csrAllocationStorage(allocationStorage) {
19-
auto hwInfo = executionEnvironment.getHardwareInfo();
20+
auto hwInfo = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getHardwareInfo();
2021
auto &hwHelper = HwHelper::get(hwInfo->platform.eRenderCoreFamily);
2122
computeUnitsUsedForScratch = hwHelper.getComputeUnitsUsedForScratch(hwInfo);
2223
}

core/device/device.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ bool Device::createEngine(uint32_t deviceCsrIndex, aub_stream::EngineType engine
152152
return true;
153153
}
154154

155-
const HardwareInfo &Device::getHardwareInfo() const { return *executionEnvironment->getHardwareInfo(); }
155+
const HardwareInfo &Device::getHardwareInfo() const { return *getRootDeviceEnvironment().getHardwareInfo(); }
156156

157157
const DeviceInfo &Device::getDeviceInfo() const {
158158
return deviceInfo;

core/execution_environment/execution_environment.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,14 @@ void ExecutionEnvironment::initDebugger() {
7171
}
7272

7373
void ExecutionEnvironment::calculateMaxOsContextCount() {
74-
auto &hwHelper = HwHelper::get(this->hwInfo->platform.eRenderCoreFamily);
75-
auto osContextCount = hwHelper.getGpgpuEngineInstances().size();
76-
auto subDevicesCount = HwHelper::getSubDevicesCount(this->getHardwareInfo());
77-
auto rootDevicesCount = this->rootDeviceEnvironments.size();
78-
bool hasRootCsr = subDevicesCount > 1;
74+
for (const auto &rootDeviceEnvironment : this->rootDeviceEnvironments) {
75+
auto &hwHelper = HwHelper::get(rootDeviceEnvironment->getHardwareInfo()->platform.eRenderCoreFamily);
76+
auto osContextCount = hwHelper.getGpgpuEngineInstances().size();
77+
auto subDevicesCount = HwHelper::getSubDevicesCount(rootDeviceEnvironment->getHardwareInfo());
78+
bool hasRootCsr = subDevicesCount > 1;
7979

80-
MemoryManager::maxOsContextCount = static_cast<uint32_t>(rootDevicesCount * (osContextCount * subDevicesCount + hasRootCsr));
80+
MemoryManager::maxOsContextCount += static_cast<uint32_t>(osContextCount * subDevicesCount + hasRootCsr);
81+
}
8182
}
8283

8384
GmmHelper *ExecutionEnvironment::getGmmHelper() const {

core/execution_environment/root_device_environment.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ RootDeviceEnvironment::~RootDeviceEnvironment() = default;
2020

2121
void RootDeviceEnvironment::initAubCenter(bool localMemoryEnabled, const std::string &aubFileName, CommandStreamReceiverType csrType) {
2222
if (!aubCenter) {
23-
aubCenter.reset(new AubCenter(executionEnvironment.getHardwareInfo(), localMemoryEnabled, aubFileName, csrType));
23+
aubCenter.reset(new AubCenter(getHardwareInfo(), localMemoryEnabled, aubFileName, csrType));
2424
}
2525
}
2626
const HardwareInfo *RootDeviceEnvironment::getHardwareInfo() const {

core/unit_tests/gen12lp/test_preamble_gen12lp.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ TGLLPTEST_F(Gen12LpPreambleVfeState, WaOff) {
6060
typedef typename FamilyType::PIPE_CONTROL PIPE_CONTROL;
6161
testWaTable->waSendMIFLUSHBeforeVFE = 0;
6262
LinearStream &cs = linearStream;
63-
PreambleHelper<FamilyType>::programVFEState(&linearStream, *pPlatform->peekExecutionEnvironment()->getHardwareInfo(), 0, 0, 672u, aub_stream::EngineType::ENGINE_RCS);
63+
PreambleHelper<FamilyType>::programVFEState(&linearStream, pPlatform->getDevice(0)->getHardwareInfo(), 0, 0, 672u, aub_stream::EngineType::ENGINE_RCS);
6464

6565
parseCommands<FamilyType>(cs);
6666

@@ -79,7 +79,7 @@ TGLLPTEST_F(Gen12LpPreambleVfeState, givenCcsEngineWhenWaIsSetThenAppropriatePip
7979
testWaTable->waSendMIFLUSHBeforeVFE = 1;
8080
LinearStream &cs = linearStream;
8181

82-
PreambleHelper<FamilyType>::programVFEState(&linearStream, *pPlatform->peekExecutionEnvironment()->getHardwareInfo(), 0, 0, 672u, aub_stream::EngineType::ENGINE_CCS);
82+
PreambleHelper<FamilyType>::programVFEState(&linearStream, pPlatform->getDevice(0)->getHardwareInfo(), 0, 0, 672u, aub_stream::EngineType::ENGINE_CCS);
8383

8484
parseCommands<FamilyType>(cs);
8585

@@ -98,7 +98,7 @@ TGLLPTEST_F(Gen12LpPreambleVfeState, givenRcsEngineWhenWaIsSetThenAppropriatePip
9898
testWaTable->waSendMIFLUSHBeforeVFE = 1;
9999
LinearStream &cs = linearStream;
100100

101-
PreambleHelper<FamilyType>::programVFEState(&linearStream, *pPlatform->peekExecutionEnvironment()->getHardwareInfo(), 0, 0, 672u, aub_stream::EngineType::ENGINE_RCS);
101+
PreambleHelper<FamilyType>::programVFEState(&linearStream, pPlatform->getDevice(0)->getHardwareInfo(), 0, 0, 672u, aub_stream::EngineType::ENGINE_RCS);
102102

103103
parseCommands<FamilyType>(cs);
104104

runtime/command_queue/command_queue.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ CommandQueue::CommandQueue(Context *context, ClDevice *device, const cl_queue_pr
7272
if (gpgpuEngine->commandStreamReceiver->peekTimestampPacketWriteEnabled()) {
7373
timestampPacketContainer = std::make_unique<TimestampPacketContainer>();
7474
}
75-
auto hwInfo = device->getExecutionEnvironment()->getHardwareInfo();
76-
if (hwInfo->capabilityTable.blitterOperationsSupported) {
77-
bcsEngine = &device->getDeviceById(0)->getEngine(EngineHelpers::getBcsEngineType(*hwInfo), false);
75+
auto hwInfo = device->getHardwareInfo();
76+
if (hwInfo.capabilityTable.blitterOperationsSupported) {
77+
bcsEngine = &device->getDeviceById(0)->getEngine(EngineHelpers::getBcsEngineType(hwInfo), false);
7878
}
7979
}
8080

@@ -563,7 +563,7 @@ bool CommandQueue::queueDependenciesClearRequired() const {
563563
}
564564

565565
bool CommandQueue::blitEnqueueAllowed(cl_command_type cmdType) const {
566-
bool blitAllowed = device->getExecutionEnvironment()->getHardwareInfo()->capabilityTable.blitterOperationsSupported;
566+
bool blitAllowed = device->getHardwareInfo().capabilityTable.blitterOperationsSupported;
567567

568568
if (DebugManager.flags.EnableBlitterOperationsForReadWriteBuffers.get() != -1) {
569569
blitAllowed &= !!DebugManager.flags.EnableBlitterOperationsForReadWriteBuffers.get();

runtime/command_stream/aub_command_stream_receiver.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "runtime/command_stream/aub_command_stream_receiver.h"
99

1010
#include "core/execution_environment/execution_environment.h"
11+
#include "core/execution_environment/root_device_environment.h"
1112
#include "core/helpers/debug_helpers.h"
1213
#include "core/helpers/hw_helper.h"
1314
#include "core/helpers/hw_info.h"
@@ -50,7 +51,7 @@ std::string AUBCommandStreamReceiver::createFullFilePath(const HardwareInfo &hwI
5051
}
5152

5253
CommandStreamReceiver *AUBCommandStreamReceiver::create(const std::string &baseName, bool standalone, ExecutionEnvironment &executionEnvironment, uint32_t rootDeviceIndex) {
53-
auto hwInfo = executionEnvironment.getHardwareInfo();
54+
auto hwInfo = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getHardwareInfo();
5455
std::string filePath = AUBCommandStreamReceiver::createFullFilePath(*hwInfo, baseName);
5556
if (DebugManager.flags.AUBDumpCaptureFileName.get() != "unk") {
5657
filePath.assign(DebugManager.flags.AUBDumpCaptureFileName.get());

runtime/command_stream/command_stream_receiver.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ bool CommandStreamReceiver::createGlobalFenceAllocation() {
396396
}
397397

398398
bool CommandStreamReceiver::createPreemptionAllocation() {
399-
auto hwInfo = executionEnvironment.getHardwareInfo();
399+
auto hwInfo = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getHardwareInfo();
400400
AllocationProperties properties{rootDeviceIndex, true, hwInfo->capabilityTable.requiredPreemptionSurfaceSize, GraphicsAllocation::AllocationType::PREEMPTION, false};
401401
properties.flags.uncacheable = hwInfo->workaroundTable.waCSRUncachable;
402402
properties.alignment = 256 * MemoryConstants::kiloByte;
@@ -479,7 +479,7 @@ int32_t CommandStreamReceiver::expectMemory(const void *gfxAddress, const void *
479479
}
480480

481481
bool CommandStreamReceiver::needsPageTableManager(aub_stream::EngineType engineType) const {
482-
auto hwInfo = executionEnvironment.getHardwareInfo();
482+
auto hwInfo = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getHardwareInfo();
483483
auto defaultEngineType = getChosenEngineType(*hwInfo);
484484
if (engineType != defaultEngineType) {
485485
return false;

runtime/command_stream/command_stream_receiver_hw.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class CommandStreamReceiverHw : public CommandStreamReceiver {
5757
void adjustComputeMode(LinearStream &csr, DispatchFlags &dispatchFlags, void *const stateComputeMode);
5858

5959
void waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, bool forcePowerSavingMode) override;
60-
const HardwareInfo &peekHwInfo() const { return *executionEnvironment.getHardwareInfo(); }
60+
const HardwareInfo &peekHwInfo() const;
6161

6262
void collectStateBaseAddresPatchInfo(
6363
uint64_t commandBufferAddress,

runtime/command_stream/command_stream_receiver_hw_base.inl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
341341

342342
DBG_LOG(LogTaskCounts, __FUNCTION__, "Line: ", __LINE__, "this->taskLevel", (uint32_t)this->taskLevel);
343343

344-
if (executionEnvironment.getHardwareInfo()->workaroundTable.waSamplerCacheFlushBetweenRedescribedSurfaceReads) {
344+
if (executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getHardwareInfo()->workaroundTable.waSamplerCacheFlushBetweenRedescribedSurfaceReads) {
345345
if (this->samplerCacheFlushRequired != SamplerCacheFlushState::samplerCacheFlushNotRequired) {
346346
auto pCmd = addPipeControlCmd(commandStreamCSR);
347347
pCmd->setTextureCacheInvalidationEnable(true);
@@ -649,7 +649,7 @@ size_t CommandStreamReceiverHw<GfxFamily>::getRequiredCmdStreamSize(const Dispat
649649
size += getCmdSizeForEpilogue(dispatchFlags);
650650
size += getCmdSizeForPrologue(dispatchFlags);
651651

652-
if (executionEnvironment.getHardwareInfo()->workaroundTable.waSamplerCacheFlushBetweenRedescribedSurfaceReads) {
652+
if (executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getHardwareInfo()->workaroundTable.waSamplerCacheFlushBetweenRedescribedSurfaceReads) {
653653
if (this->samplerCacheFlushRequired != SamplerCacheFlushState::samplerCacheFlushNotRequired) {
654654
size += sizeof(typename GfxFamily::PIPE_CONTROL);
655655
}
@@ -714,6 +714,11 @@ inline void CommandStreamReceiverHw<GfxFamily>::waitForTaskCountWithKmdNotifyFal
714714
}
715715
}
716716

717+
template <typename GfxFamily>
718+
inline const HardwareInfo &CommandStreamReceiverHw<GfxFamily>::peekHwInfo() const {
719+
return *executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getHardwareInfo();
720+
}
721+
717722
template <typename GfxFamily>
718723
inline void CommandStreamReceiverHw<GfxFamily>::programPreemption(LinearStream &csr, DispatchFlags &dispatchFlags) {
719724
PreemptionHelper::programCmdStream<GfxFamily>(csr, dispatchFlags.preemptionMode, this->lastPreemptionMode, preemptionAllocation);

0 commit comments

Comments
 (0)