Add gfx core helper getters to device and command stream receiver

Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski 2022-12-09 14:37:32 +00:00 committed by Compute-Runtime-Automation
parent 0ee5310033
commit fba5e99c48
4 changed files with 27 additions and 11 deletions

View File

@ -71,7 +71,8 @@ CommandStreamReceiver::CommandStreamReceiver(ExecutionEnvironment &executionEnvi
internalAllocationStorage = std::make_unique<InternalAllocationStorage>(*this);
const auto &hwInfo = peekHwInfo();
uint32_t subDeviceCount = static_cast<uint32_t>(deviceBitfield.count());
bool platformImplicitScaling = GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily).platformSupportsImplicitScaling(hwInfo);
auto &gfxCoreHelper = getGfxCoreHelper();
bool platformImplicitScaling = gfxCoreHelper.platformSupportsImplicitScaling(hwInfo);
if (NEO::ImplicitScalingHelper::isImplicitScalingEnabled(deviceBitfield, platformImplicitScaling) &&
subDeviceCount > 1 &&
DebugManager.flags.EnableStaticPartitioning.get() != 0) {
@ -241,7 +242,8 @@ void CommandStreamReceiver::ensureCommandBufferAllocation(LinearStream &commandS
}
void CommandStreamReceiver::fillReusableAllocationsList() {
auto amountToFill = GfxCoreHelper::get(peekHwInfo().platform.eRenderCoreFamily).getAmountOfAllocationsToFill();
auto &gfxCoreHelper = getGfxCoreHelper();
auto amountToFill = gfxCoreHelper.getAmountOfAllocationsToFill();
for (auto i = 0u; i < amountToFill; i++) {
const AllocationProperties commandStreamAllocationProperties{rootDeviceIndex, true, MemoryConstants::pageSize64k, AllocationType::COMMAND_BUFFER,
isMultiOsContextCapable(), false, deviceBitfield};
@ -743,9 +745,8 @@ bool CommandStreamReceiver::createWorkPartitionAllocation(const Device &device)
}
bool CommandStreamReceiver::createGlobalFenceAllocation() {
auto &rootDevicEnvironment = *executionEnvironment.rootDeviceEnvironments[rootDeviceIndex].get();
auto &gfxCoreHelper = rootDevicEnvironment.getHelper<GfxCoreHelper>();
auto &hwInfo = *rootDevicEnvironment.getHardwareInfo();
auto &gfxCoreHelper = getGfxCoreHelper();
auto &hwInfo = peekHwInfo();
if (!gfxCoreHelper.isFenceAllocationRequired(hwInfo)) {
return true;
}
@ -757,13 +758,14 @@ bool CommandStreamReceiver::createGlobalFenceAllocation() {
bool CommandStreamReceiver::createPreemptionAllocation() {
auto hwInfo = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getHardwareInfo();
auto &gfxCoreHelper = getGfxCoreHelper();
size_t preemptionSurfaceSize = hwInfo->capabilityTable.requiredPreemptionSurfaceSize;
if (DebugManager.flags.OverrideCsrAllocationSize.get() > 0) {
preemptionSurfaceSize = DebugManager.flags.OverrideCsrAllocationSize.get();
}
AllocationProperties properties{rootDeviceIndex, true, preemptionSurfaceSize, AllocationType::PREEMPTION, isMultiOsContextCapable(), false, deviceBitfield};
properties.flags.uncacheable = hwInfo->workaroundTable.flags.waCSRUncachable;
properties.alignment = GfxCoreHelper::get(hwInfo->platform.eRenderCoreFamily).getPreemptionAllocationAlignment();
properties.alignment = gfxCoreHelper.getPreemptionAllocationAlignment();
this->preemptionAllocation = getMemoryManager()->allocateGraphicsMemoryWithProperties(properties);
return this->preemptionAllocation != nullptr;
}
@ -913,6 +915,10 @@ const RootDeviceEnvironment &CommandStreamReceiver::peekRootDeviceEnvironment()
return *executionEnvironment.rootDeviceEnvironments[rootDeviceIndex];
}
const GfxCoreHelper &CommandStreamReceiver::getGfxCoreHelper() const {
return peekRootDeviceEnvironment().getHelper<GfxCoreHelper>();
}
TaskCountType CommandStreamReceiver::getCompletionValue(const GraphicsAllocation &gfxAllocation) {
if (completionFenceValuePointer) {
return *completionFenceValuePointer;

View File

@ -52,6 +52,7 @@ class GmmHelper;
class TagAllocatorBase;
class LogicalStateHelper;
class KmdNotifyHelper;
class GfxCoreHelper;
template <typename TSize>
class TimestampPackets;
@ -332,6 +333,8 @@ class CommandStreamReceiver {
const HardwareInfo &peekHwInfo() const;
const RootDeviceEnvironment &peekRootDeviceEnvironment() const;
const GfxCoreHelper &getGfxCoreHelper() const;
MOCKABLE_VIRTUAL bool isGpuHangDetected() const;
MOCKABLE_VIRTUAL bool checkGpuHangDetected(TimeType currentTime, TimeType &lastHangCheckTime) const;

View File

@ -214,7 +214,7 @@ bool Device::createDeviceImpl() {
this->executionEnvironment->rootDeviceEnvironments[getRootDeviceIndex()]->initDebugger();
}
auto &gfxCoreHelper = GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily);
auto &gfxCoreHelper = getGfxCoreHelper();
if (getDebugger() && gfxCoreHelper.disableL3CacheForDebug(hwInfo)) {
getGmmHelper()->forceAllResourcesUncached();
}
@ -269,7 +269,7 @@ bool Device::createDeviceImpl() {
uuid.isValid = false;
if (DebugManager.flags.EnableChipsetUniqueUUID.get() != 0) {
if (GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily).isChipsetUniqueUUIDSupported()) {
if (gfxCoreHelper.isChipsetUniqueUUIDSupported()) {
uuid.isValid = HwInfoConfig::get(hardwareInfo->platform.eProductFamily)->getUuid(this, uuid.id);
}
}
@ -289,7 +289,8 @@ bool Device::createEngines() {
}
auto &hwInfo = getHardwareInfo();
auto gpgpuEngines = GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily).getGpgpuEngineInstances(hwInfo);
auto &gfxCoreHelper = getGfxCoreHelper();
auto gpgpuEngines = gfxCoreHelper.getGpgpuEngineInstances(hwInfo);
uint32_t deviceCsrIndex = 0;
for (auto &engine : gpgpuEngines) {
@ -302,7 +303,7 @@ bool Device::createEngines() {
void Device::addEngineToEngineGroup(EngineControl &engine) {
const HardwareInfo &hardwareInfo = this->getHardwareInfo();
const GfxCoreHelper &gfxCoreHelper = NEO::GfxCoreHelper::get(hardwareInfo.platform.eRenderCoreFamily);
auto &gfxCoreHelper = getGfxCoreHelper();
const EngineGroupType engineGroupType = gfxCoreHelper.getEngineGroupType(engine.getEngineType(), engine.getEngineUsage(), hardwareInfo);
if (!gfxCoreHelper.isSubDeviceEngineSupported(hardwareInfo, getDeviceBitfield(), engine.getEngineType())) {
@ -591,7 +592,7 @@ EngineControl &Device::getNextEngineForCommandQueue() {
const auto &defaultEngine = this->getDefaultEngine();
const auto &hardwareInfo = this->getHardwareInfo();
const auto &gfxCoreHelper = NEO::GfxCoreHelper::get(hardwareInfo.platform.eRenderCoreFamily);
const auto &gfxCoreHelper = getGfxCoreHelper();
const auto engineGroupType = gfxCoreHelper.getEngineGroupType(defaultEngine.getEngineType(), defaultEngine.getEngineUsage(), hardwareInfo);
const auto defaultEngineGroupIndex = this->getEngineGroupIndexFromEngineGroupType(engineGroupType);
@ -746,6 +747,10 @@ void Device::getAdapterMask(uint32_t &nodeMask) {
}
}
const GfxCoreHelper &Device::getGfxCoreHelper() const {
return getRootDeviceEnvironment().getHelper<GfxCoreHelper>();
}
void Device::allocateRTDispatchGlobals(uint32_t maxBvhLevels) {
UNRECOVERABLE_IF(rtDispatchGlobalsInfos.size() < maxBvhLevels + 1);
UNRECOVERABLE_IF(rtDispatchGlobalsInfos[maxBvhLevels] != nullptr);

View File

@ -23,6 +23,7 @@ class OSTime;
class SourceLevelDebugger;
class SubDevice;
struct PhysicalDevicePciBusInfo;
class GfxCoreHelper;
struct SelectorCopyEngine : NonCopyableOrMovableClass {
std::atomic<bool> isMainUsed = false;
@ -144,6 +145,7 @@ class Device : public ReferenceTrackedObject<Device> {
void getAdapterLuid(std::array<uint8_t, HwInfoConfig::luidSize> &luid);
MOCKABLE_VIRTUAL bool verifyAdapterLuid();
void getAdapterMask(uint32_t &nodeMask);
const GfxCoreHelper &getGfxCoreHelper() const;
std::atomic<uint32_t> debugExecutionCounter = 0;