mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-25 13:33:02 +08:00
Refactor: Change decanonize method accessing point
Accessing decanonize method as a member of GmmHelper class object Signed-off-by: Krzysztof Gibala <krzysztof.gibala@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
7bb3bcbc05
commit
2fcda0a528
@@ -16,8 +16,10 @@ void EncodeSurfaceState<Family>::setClearColorParams(R_SURFACE_STATE *surfaceSta
|
||||
if (gmm->gmmResourceInfo->getResourceFlags()->Gpu.IndirectClearColor) {
|
||||
surfaceState->setClearValueAddressEnable(true);
|
||||
|
||||
uint64_t clearColorAddress = gmm->getGmmHelper()->decanonize(surfaceState->getSurfaceBaseAddress() +
|
||||
gmm->gmmResourceInfo->getUnifiedAuxSurfaceOffset(GMM_UNIFIED_AUX_TYPE::GMM_AUX_CC));
|
||||
auto gmmHelper = gmm->getGmmHelper();
|
||||
uint64_t clearColorAddress = gmmHelper->decanonize(surfaceState->getSurfaceBaseAddress() +
|
||||
gmm->gmmResourceInfo->getUnifiedAuxSurfaceOffset(GMM_UNIFIED_AUX_TYPE::GMM_AUX_CC));
|
||||
|
||||
surfaceState->setClearColorAddress(static_cast<uint32_t>(clearColorAddress & 0xFFFFFFFFULL));
|
||||
surfaceState->setClearColorAddressHigh(static_cast<uint32_t>(clearColorAddress >> 32));
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ class AUBCommandStreamReceiverHw : public CommandStreamReceiverSimulatedHw<GfxFa
|
||||
using BaseClass::osContext;
|
||||
|
||||
public:
|
||||
using BaseClass::peekExecutionEnvironment;
|
||||
using CommandStreamReceiverSimulatedCommonHw<GfxFamily>::initAdditionalMMIO;
|
||||
using CommandStreamReceiverSimulatedCommonHw<GfxFamily>::aubManager;
|
||||
using CommandStreamReceiverSimulatedCommonHw<GfxFamily>::hardwareContextController;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
* Copyright (C) 2018-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -33,6 +33,8 @@ class CommandStreamReceiverSimulatedCommonHw : public CommandStreamReceiverHw<Gf
|
||||
MOCKABLE_VIRTUAL uint32_t getDeviceIndex() const;
|
||||
|
||||
public:
|
||||
using CommandStreamReceiverHw<GfxFamily>::peekExecutionEnvironment;
|
||||
|
||||
CommandStreamReceiverSimulatedCommonHw(ExecutionEnvironment &executionEnvironment,
|
||||
uint32_t rootDeviceIndex,
|
||||
const DeviceBitfield deviceBitfield);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2021 Intel Corporation
|
||||
* Copyright (C) 2019-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -47,7 +47,7 @@ void CommandStreamReceiverSimulatedCommonHw<GfxFamily>::setupContext(OsContext &
|
||||
template <typename GfxFamily>
|
||||
bool CommandStreamReceiverSimulatedCommonHw<GfxFamily>::getParametersForWriteMemory(GraphicsAllocation &graphicsAllocation, uint64_t &gpuAddress, void *&cpuAddress, size_t &size) const {
|
||||
cpuAddress = graphicsAllocation.getUnderlyingBuffer();
|
||||
gpuAddress = GmmHelper::decanonize(graphicsAllocation.getGpuAddress());
|
||||
gpuAddress = peekExecutionEnvironment().rootDeviceEnvironments[graphicsAllocation.getRootDeviceIndex()].get()->gmmHelper.get()->decanonize(graphicsAllocation.getGpuAddress());
|
||||
size = graphicsAllocation.getUnderlyingBufferSize();
|
||||
|
||||
if (graphicsAllocation.isCompressionEnabled()) {
|
||||
|
||||
@@ -40,6 +40,7 @@ class TbxCommandStreamReceiverHw : public CommandStreamReceiverSimulatedHw<GfxFa
|
||||
using CommandStreamReceiverSimulatedCommonHw<GfxFamily>::hardwareContextController;
|
||||
using CommandStreamReceiverSimulatedCommonHw<GfxFamily>::engineInfo;
|
||||
using CommandStreamReceiverSimulatedCommonHw<GfxFamily>::stream;
|
||||
using CommandStreamReceiverSimulatedCommonHw<GfxFamily>::peekExecutionEnvironment;
|
||||
|
||||
SubmissionStatus flush(BatchBuffer &batchBuffer, ResidencyContainer &allocationsForResidency) override;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
* Copyright (C) 2018-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -64,7 +64,7 @@ void StateBaseAddressHelper<BDWFamily>::programStateBaseAddress(
|
||||
stateBaseAddress->setGeneralStateBaseAddressModifyEnable(true);
|
||||
stateBaseAddress->setGeneralStateBufferSizeModifyEnable(true);
|
||||
// GSH must be set to 0 for stateless
|
||||
stateBaseAddress->setGeneralStateBaseAddress(GmmHelper::decanonize(generalStateBase));
|
||||
stateBaseAddress->setGeneralStateBaseAddress(gmmHelper->decanonize(generalStateBase));
|
||||
stateBaseAddress->setGeneralStateBufferSize(0xfffff);
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ GmmHelper::GmmHelper(OSInterface *osInterface, const HardwareInfo *pHwInfo) : hw
|
||||
}
|
||||
|
||||
bool GmmHelper::isValidCanonicalGpuAddress(uint64_t address) {
|
||||
auto decanonizedAddress = NEO::GmmHelper::decanonize(address);
|
||||
auto decanonizedAddress = this->decanonize(address);
|
||||
auto canonizedAddress = this->canonize(decanonizedAddress);
|
||||
|
||||
if (address == canonizedAddress) {
|
||||
|
||||
@@ -86,7 +86,7 @@ void StateBaseAddressHelper<GfxFamily>::programStateBaseAddress(
|
||||
stateBaseAddress->setGeneralStateBaseAddressModifyEnable(true);
|
||||
stateBaseAddress->setGeneralStateBufferSizeModifyEnable(true);
|
||||
// GSH must be set to 0 for stateless
|
||||
stateBaseAddress->setGeneralStateBaseAddress(GmmHelper::decanonize(generalStateBase));
|
||||
stateBaseAddress->setGeneralStateBaseAddress(gmmHelper->decanonize(generalStateBase));
|
||||
stateBaseAddress->setGeneralStateBufferSize(0xfffff);
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ void StateBaseAddressHelper<GfxFamily>::appendStateBaseAddressParameters(
|
||||
using STATE_BASE_ADDRESS = typename GfxFamily::STATE_BASE_ADDRESS;
|
||||
|
||||
if (setGeneralStateBaseAddress && is64bit) {
|
||||
stateBaseAddress->setGeneralStateBaseAddress(GmmHelper::decanonize(internalHeapBase));
|
||||
stateBaseAddress->setGeneralStateBaseAddress(gmmHelper->decanonize(internalHeapBase));
|
||||
}
|
||||
|
||||
if (overrideBindlessSurfaceStateBase && ssh) {
|
||||
|
||||
@@ -288,9 +288,9 @@ void OsAgnosticMemoryManager::freeGraphicsMemoryImpl(GraphicsAllocation *gfxAllo
|
||||
delete gfxAllocation;
|
||||
return;
|
||||
}
|
||||
|
||||
auto memoryAllocation = static_cast<MemoryAllocation *>(gfxAllocation);
|
||||
auto sizeToFree = memoryAllocation->sizeToFree;
|
||||
auto rootDeviceIndex = gfxAllocation->getRootDeviceIndex();
|
||||
|
||||
if (sizeToFree) {
|
||||
auto gpuAddressToFree = GmmHelper::decanonize(memoryAllocation->getGpuAddress()) & ~MemoryConstants::pageMask;
|
||||
@@ -303,8 +303,6 @@ void OsAgnosticMemoryManager::freeGraphicsMemoryImpl(GraphicsAllocation *gfxAllo
|
||||
releaseReservedCpuAddressRange(gfxAllocation->getReservedAddressPtr(), gfxAllocation->getReservedAddressSize(), gfxAllocation->getRootDeviceIndex());
|
||||
}
|
||||
|
||||
auto rootDeviceIndex = gfxAllocation->getRootDeviceIndex();
|
||||
|
||||
if (executionEnvironment.rootDeviceEnvironments.size() > rootDeviceIndex) {
|
||||
auto aubCenter = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->aubCenter.get();
|
||||
if (aubCenter && aubCenter->getAubManager() && DebugManager.flags.EnableFreeMemory.get()) {
|
||||
@@ -453,7 +451,8 @@ AddressRange OsAgnosticMemoryManager::reserveGpuAddress(size_t size, uint32_t ro
|
||||
|
||||
void OsAgnosticMemoryManager::freeGpuAddress(AddressRange addressRange, uint32_t rootDeviceIndex) {
|
||||
uint64_t graphicsAddress = addressRange.address;
|
||||
graphicsAddress = GmmHelper::decanonize(graphicsAddress);
|
||||
auto gmmHelper = getGmmHelper(rootDeviceIndex);
|
||||
graphicsAddress = gmmHelper->decanonize(graphicsAddress);
|
||||
auto gfxPartition = getGfxPartition(rootDeviceIndex);
|
||||
gfxPartition->freeGpuAddressRange(graphicsAddress, addressRange.size);
|
||||
}
|
||||
|
||||
@@ -209,7 +209,8 @@ uint64_t DrmMemoryManager::acquireGpuRange(size_t &size, uint32_t rootDeviceInde
|
||||
|
||||
void DrmMemoryManager::releaseGpuRange(void *address, size_t unmapSize, uint32_t rootDeviceIndex) {
|
||||
uint64_t graphicsAddress = static_cast<uint64_t>(reinterpret_cast<uintptr_t>(address));
|
||||
graphicsAddress = GmmHelper::decanonize(graphicsAddress);
|
||||
auto gmmHelper = getGmmHelper(rootDeviceIndex);
|
||||
graphicsAddress = gmmHelper->decanonize(graphicsAddress);
|
||||
auto gfxPartition = getGfxPartition(rootDeviceIndex);
|
||||
gfxPartition->freeGpuAddressRange(graphicsAddress, unmapSize);
|
||||
}
|
||||
@@ -1415,7 +1416,8 @@ void DrmMemoryManager::cleanupBeforeReturn(const AllocationData &allocationData,
|
||||
for (auto handleId = 0u; handleId < allocationData.storageInfo.getNumBanks(); handleId++) {
|
||||
delete graphicsAllocation->getGmm(handleId);
|
||||
}
|
||||
gfxPartition->freeGpuAddressRange(GmmHelper::decanonize(gpuAddress), sizeAllocated);
|
||||
auto gmmHelper = getGmmHelper(allocationData.rootDeviceIndex);
|
||||
gfxPartition->freeGpuAddressRange(gmmHelper->decanonize(gpuAddress), sizeAllocated);
|
||||
}
|
||||
|
||||
GraphicsAllocation *DrmMemoryManager::allocateGraphicsMemoryInDevicePool(const AllocationData &allocationData, AllocationStatus &status) {
|
||||
@@ -1492,7 +1494,8 @@ GraphicsAllocation *DrmMemoryManager::allocateGraphicsMemoryInDevicePool(const A
|
||||
for (auto handleId = 0u; handleId < allocationData.storageInfo.getNumBanks(); handleId++) {
|
||||
delete allocation->getGmm(handleId);
|
||||
}
|
||||
gfxPartition->freeGpuAddressRange(GmmHelper::decanonize(gpuAddress), sizeAllocated);
|
||||
auto gmmHelper = getGmmHelper(allocationData.rootDeviceIndex);
|
||||
gfxPartition->freeGpuAddressRange(gmmHelper->decanonize(gpuAddress), sizeAllocated);
|
||||
status = AllocationStatus::Error;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -487,9 +487,8 @@ bool Wddm::freeGpuVirtualAddress(D3DGPU_VIRTUAL_ADDRESS &gpuPtr, uint64_t size)
|
||||
NTSTATUS status = STATUS_SUCCESS;
|
||||
D3DKMT_FREEGPUVIRTUALADDRESS FreeGPUVA = {};
|
||||
FreeGPUVA.hAdapter = getAdapter();
|
||||
FreeGPUVA.BaseAddress = GmmHelper::decanonize(gpuPtr);
|
||||
FreeGPUVA.BaseAddress = rootDeviceEnvironment.getGmmHelper()->decanonize(gpuPtr);
|
||||
FreeGPUVA.Size = size;
|
||||
|
||||
status = getGdi()->freeGpuVirtualAddress(&FreeGPUVA);
|
||||
gpuPtr = static_cast<D3DGPU_VIRTUAL_ADDRESS>(0);
|
||||
|
||||
|
||||
@@ -797,7 +797,7 @@ bool WddmMemoryManager::mapMultiHandleAllocationWithRetry(WddmAllocation *alloca
|
||||
wddm.destroyAllocations(&allocation->getHandles()[0], allocation->getNumGmms(), allocation->resourceHandle);
|
||||
return false;
|
||||
}
|
||||
gpuAddress = GmmHelper::decanonize(gpuAddress);
|
||||
gpuAddress = getGmmHelper(allocation->getRootDeviceIndex())->decanonize(gpuAddress);
|
||||
UNRECOVERABLE_IF(addressToMap != gpuAddress);
|
||||
addressToMap += allocation->getGmm(currentHandle)->gmmResourceInfo->getSizeAllocation();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user