mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-21 09:14:47 +08:00
refactor: don't use global ProductHelper 14/n
Related-To: NEO-6853 Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
414dbed5d9
commit
445706361d
@@ -1110,7 +1110,8 @@ Device *Device::create(DriverHandle *driverHandle, NEO::Device *neoDevice, bool
|
||||
neoDevice->incRefInternal();
|
||||
|
||||
auto &hwInfo = neoDevice->getHardwareInfo();
|
||||
auto &gfxCoreHelper = neoDevice->getRootDeviceEnvironment().getHelper<NEO::GfxCoreHelper>();
|
||||
auto &rootDeviceEnvironment = neoDevice->getRootDeviceEnvironment();
|
||||
auto &gfxCoreHelper = rootDeviceEnvironment.getHelper<NEO::GfxCoreHelper>();
|
||||
|
||||
device->execEnvironment = (void *)neoDevice->getExecutionEnvironment();
|
||||
device->allocationsForReuse = std::make_unique<NEO::AllocationsList>();
|
||||
@@ -1122,7 +1123,7 @@ Device *Device::create(DriverHandle *driverHandle, NEO::Device *neoDevice, bool
|
||||
device->cacheReservation = CacheReservation::create(*device);
|
||||
device->maxNumHwThreads = NEO::GfxCoreHelper::getMaxThreadsForVfe(hwInfo);
|
||||
|
||||
auto osInterface = neoDevice->getRootDeviceEnvironment().osInterface.get();
|
||||
auto osInterface = rootDeviceEnvironment.osInterface.get();
|
||||
device->driverInfo.reset(NEO::DriverInfo::create(&hwInfo, osInterface));
|
||||
|
||||
auto debugSurfaceSize = gfxCoreHelper.getSipKernelMaxDbgSurfaceSize(hwInfo);
|
||||
@@ -1154,8 +1155,8 @@ Device *Device::create(DriverHandle *driverHandle, NEO::Device *neoDevice, bool
|
||||
}
|
||||
|
||||
if (debugSurface && stateSaveAreaHeader.size() > 0) {
|
||||
const auto &productHelper = neoDevice->getRootDeviceEnvironment().getHelper<NEO::ProductHelper>();
|
||||
NEO::MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(hwInfo, *debugSurface),
|
||||
const auto &productHelper = rootDeviceEnvironment.getHelper<NEO::ProductHelper>();
|
||||
NEO::MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, *debugSurface),
|
||||
*neoDevice, debugSurface, 0, stateSaveAreaHeader.data(),
|
||||
stateSaveAreaHeader.size());
|
||||
}
|
||||
@@ -1208,7 +1209,7 @@ Device *Device::create(DriverHandle *driverHandle, NEO::Device *neoDevice, bool
|
||||
}
|
||||
|
||||
if (device->getSourceLevelDebugger()) {
|
||||
auto osInterface = neoDevice->getRootDeviceEnvironment().osInterface.get();
|
||||
auto osInterface = rootDeviceEnvironment.osInterface.get();
|
||||
device->getSourceLevelDebugger()
|
||||
->notifyNewDevice(osInterface ? osInterface->getDriverModel()->getDeviceHandle() : 0);
|
||||
}
|
||||
|
||||
@@ -809,7 +809,6 @@ ze_result_t KernelImp::initialize(const ze_kernel_desc_t *desc) {
|
||||
auto isaAllocation = this->kernelImmData->getIsaGraphicsAllocation();
|
||||
|
||||
auto neoDevice = module->getDevice()->getNEODevice();
|
||||
auto &hwInfo = neoDevice->getHardwareInfo();
|
||||
const auto &productHelper = neoDevice->getProductHelper();
|
||||
auto &kernelDescriptor = kernelImmData->getDescriptor();
|
||||
auto ret = NEO::KernelHelper::checkIfThereIsSpaceForScratchOrPrivate(kernelDescriptor.kernelAttributes, neoDevice);
|
||||
@@ -822,7 +821,7 @@ ze_result_t KernelImp::initialize(const ze_kernel_desc_t *desc) {
|
||||
UNRECOVERABLE_IF(!this->kernelImmData->getKernelInfo()->heapInfo.pKernelHeap);
|
||||
|
||||
if (isaAllocation->getAllocationType() == NEO::AllocationType::KERNEL_ISA_INTERNAL) {
|
||||
NEO::MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(hwInfo, *isaAllocation),
|
||||
NEO::MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(neoDevice->getRootDeviceEnvironment(), *isaAllocation),
|
||||
*neoDevice,
|
||||
isaAllocation,
|
||||
0,
|
||||
|
||||
@@ -580,13 +580,13 @@ ze_result_t ModuleImp::initialize(const ze_module_desc_t *desc, NEO::Device *neo
|
||||
this->updateBuildLog(neoDevice);
|
||||
verifyDebugCapabilities();
|
||||
|
||||
auto &hwInfo = neoDevice->getHardwareInfo();
|
||||
auto &rootDeviceEnvironment = neoDevice->getRootDeviceEnvironment();
|
||||
auto containsStatefulAccess = NEO::AddressingModeHelper::containsStatefulAccess(translationUnit->programInfo.kernelInfos);
|
||||
auto isUserKernel = (type == ModuleType::User);
|
||||
|
||||
auto failBuildProgram = containsStatefulAccess &&
|
||||
isUserKernel &&
|
||||
NEO::AddressingModeHelper::failBuildProgramWithStatefulAccess(neoDevice->getRootDeviceEnvironment());
|
||||
NEO::AddressingModeHelper::failBuildProgramWithStatefulAccess(rootDeviceEnvironment);
|
||||
|
||||
if (failBuildProgram) {
|
||||
result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE;
|
||||
@@ -638,7 +638,7 @@ ze_result_t ModuleImp::initialize(const ze_module_desc_t *desc, NEO::Device *neo
|
||||
|
||||
if (!ki->isIsaCopiedToAllocation()) {
|
||||
|
||||
NEO::MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(hwInfo, *ki->getIsaGraphicsAllocation()),
|
||||
NEO::MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, *ki->getIsaGraphicsAllocation()),
|
||||
*neoDevice, ki->getIsaGraphicsAllocation(), 0, ki->getKernelInfo()->heapInfo.pKernelHeap,
|
||||
static_cast<size_t>(ki->getKernelInfo()->heapInfo.KernelHeapSize));
|
||||
|
||||
@@ -841,7 +841,7 @@ ze_result_t ModuleImp::getDebugInfo(size_t *pDebugDataSize, uint8_t *pDebugData)
|
||||
|
||||
void ModuleImp::copyPatchedSegments(const NEO::Linker::PatchableSegments &isaSegmentsForPatching) {
|
||||
if (this->translationUnit->programInfo.linkerInput && this->translationUnit->programInfo.linkerInput->getTraits().requiresPatchingOfInstructionSegments) {
|
||||
const auto &hwInfo = this->device->getNEODevice()->getHardwareInfo();
|
||||
auto &rootDeviceEnvironment = device->getNEODevice()->getRootDeviceEnvironment();
|
||||
const auto &productHelper = this->device->getProductHelper();
|
||||
|
||||
for (auto &kernelImmData : this->kernelImmDatas) {
|
||||
@@ -855,14 +855,14 @@ void ModuleImp::copyPatchedSegments(const NEO::Linker::PatchableSegments &isaSeg
|
||||
kernelImmData->getIsaGraphicsAllocation()->setAubWritable(true, std::numeric_limits<uint32_t>::max());
|
||||
auto segmentId = &kernelImmData - &this->kernelImmDatas[0];
|
||||
|
||||
NEO::MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(hwInfo, *kernelImmData->getIsaGraphicsAllocation()),
|
||||
NEO::MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, *kernelImmData->getIsaGraphicsAllocation()),
|
||||
*device->getNEODevice(), kernelImmData->getIsaGraphicsAllocation(), 0, isaSegmentsForPatching[segmentId].hostPointer,
|
||||
isaSegmentsForPatching[segmentId].segmentSize);
|
||||
|
||||
kernelImmData->setIsaCopiedToAllocation();
|
||||
|
||||
if (device->getL0Debugger()) {
|
||||
NEO::MemoryOperationsHandler *memoryOperationsIface = device->getNEODevice()->getRootDeviceEnvironment().memoryOperationsInterface.get();
|
||||
NEO::MemoryOperationsHandler *memoryOperationsIface = rootDeviceEnvironment.memoryOperationsInterface.get();
|
||||
auto allocation = kernelImmData->getIsaGraphicsAllocation();
|
||||
if (memoryOperationsIface) {
|
||||
memoryOperationsIface->makeResident(device->getNEODevice(), ArrayRef<NEO::GraphicsAllocation *>(&allocation, 1));
|
||||
|
||||
@@ -145,7 +145,7 @@ HWTEST_F(ModuleTest, givenBlitterAvailableWhenCopyingPatchedSegmentsThenIsaIsTra
|
||||
|
||||
ModuleBuildLog *moduleBuildLog = nullptr;
|
||||
|
||||
auto module = std::unique_ptr<L0::ModuleImp>(new L0::ModuleImp(&device, moduleBuildLog, ModuleType::User));
|
||||
auto module = std::make_unique<L0::ModuleImp>(&device, moduleBuildLog, ModuleType::User);
|
||||
ASSERT_NE(nullptr, module.get());
|
||||
|
||||
auto linkerInput = std::make_unique<::WhiteBox<NEO::LinkerInput>>();
|
||||
@@ -159,7 +159,8 @@ HWTEST_F(ModuleTest, givenBlitterAvailableWhenCopyingPatchedSegmentsThenIsaIsTra
|
||||
}
|
||||
|
||||
auto &productHelper = device.getProductHelper();
|
||||
if (productHelper.isBlitCopyRequiredForLocalMemory(hwInfo, *module->getKernelImmutableDataVector()[0]->getIsaGraphicsAllocation())) {
|
||||
auto &rootDeviceEnvironment = device.getNEODevice()->getRootDeviceEnvironment();
|
||||
if (productHelper.isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, *module->getKernelImmutableDataVector()[0]->getIsaGraphicsAllocation())) {
|
||||
EXPECT_EQ(zebinData->numOfKernels, blitterCalled);
|
||||
} else {
|
||||
EXPECT_EQ(0u, blitterCalled);
|
||||
|
||||
@@ -197,7 +197,7 @@ void CommandQueue::initializeGpgpu() const {
|
||||
}
|
||||
|
||||
void CommandQueue::initializeGpgpuInternals() const {
|
||||
auto &hwInfo = device->getDevice().getHardwareInfo();
|
||||
auto &rootDeviceEnvironment = device->getDevice().getRootDeviceEnvironment();
|
||||
auto &productHelper = device->getProductHelper();
|
||||
|
||||
if (device->getDevice().getDebugger() && !this->gpgpuEngine->commandStreamReceiver->getDebugSurfaceAllocation()) {
|
||||
@@ -207,7 +207,7 @@ void CommandQueue::initializeGpgpuInternals() const {
|
||||
|
||||
auto &stateSaveAreaHeader = SipKernel::getSipKernel(device->getDevice()).getStateSaveAreaHeader();
|
||||
if (stateSaveAreaHeader.size() > 0) {
|
||||
NEO::MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(hwInfo, *debugSurface),
|
||||
NEO::MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, *debugSurface),
|
||||
device->getDevice(), debugSurface, 0, stateSaveAreaHeader.data(),
|
||||
stateSaveAreaHeader.size());
|
||||
}
|
||||
|
||||
@@ -751,13 +751,13 @@ void Kernel::substituteKernelHeap(void *newKernelHeap, size_t newKernelHeapSize)
|
||||
|
||||
auto currentAllocationSize = pKernelInfo->kernelAllocation->getUnderlyingBufferSize();
|
||||
bool status = false;
|
||||
auto &helper = clDevice.getRootDeviceEnvironment().getHelper<GfxCoreHelper>();
|
||||
auto &rootDeviceEnvironment = clDevice.getRootDeviceEnvironment();
|
||||
auto &helper = rootDeviceEnvironment.getHelper<GfxCoreHelper>();
|
||||
size_t isaPadding = helper.getPaddingForISAAllocation();
|
||||
|
||||
if (currentAllocationSize >= newKernelHeapSize + isaPadding) {
|
||||
auto &hwInfo = clDevice.getDevice().getHardwareInfo();
|
||||
auto &productHelper = clDevice.getRootDeviceEnvironment().getHelper<ProductHelper>();
|
||||
auto useBlitter = productHelper.isBlitCopyRequiredForLocalMemory(hwInfo, *pKernelInfo->getGraphicsAllocation());
|
||||
auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
|
||||
auto useBlitter = productHelper.isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, *pKernelInfo->getGraphicsAllocation());
|
||||
status = MemoryTransferHelper::transferMemoryToAllocation(useBlitter,
|
||||
clDevice.getDevice(), pKernelInfo->getGraphicsAllocation(), 0, newKernelHeap,
|
||||
static_cast<size_t>(newKernelHeapSize));
|
||||
|
||||
@@ -52,10 +52,10 @@ void PrintfHandler::prepareDispatch(const MultiDispatchInfo &multiDispatchInfo)
|
||||
kernel = multiDispatchInfo.peekMainKernel();
|
||||
printfSurface = device.getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, printfSurfaceSize, AllocationType::PRINTF_SURFACE, device.getDeviceBitfield()});
|
||||
|
||||
auto &hwInfo = device.getHardwareInfo();
|
||||
auto &rootDeviceEnvironment = device.getRootDeviceEnvironment();
|
||||
const auto &productHelper = device.getProductHelper();
|
||||
|
||||
MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(hwInfo, *printfSurface),
|
||||
MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, *printfSurface),
|
||||
device, printfSurface, 0, printfSurfaceInitialDataSizePtr.get(),
|
||||
sizeof(*printfSurfaceInitialDataSizePtr.get()));
|
||||
|
||||
@@ -81,18 +81,17 @@ void PrintfHandler::makeResident(CommandStreamReceiver &commandStreamReceiver) {
|
||||
}
|
||||
|
||||
bool PrintfHandler::printEnqueueOutput() {
|
||||
auto &hwInfo = device.getHardwareInfo();
|
||||
|
||||
auto &rootDeviceEnvironment = device.getRootDeviceEnvironment();
|
||||
auto usesStringMap = kernel->getDescriptor().kernelAttributes.usesStringMap();
|
||||
const auto &productHelper = device.getProductHelper();
|
||||
auto printfOutputBuffer = reinterpret_cast<const uint8_t *>(printfSurface->getUnderlyingBuffer());
|
||||
auto printfOutputSize = static_cast<uint32_t>(printfSurface->getUnderlyingBufferSize());
|
||||
std::unique_ptr<uint8_t[]> printfOutputDecompressed;
|
||||
|
||||
if (CompressionSelector::allowStatelessCompression() || productHelper.isBlitCopyRequiredForLocalMemory(hwInfo, *printfSurface)) {
|
||||
if (CompressionSelector::allowStatelessCompression() || productHelper.isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, *printfSurface)) {
|
||||
printfOutputDecompressed = std::make_unique<uint8_t[]>(printfOutputSize);
|
||||
printfOutputBuffer = printfOutputDecompressed.get();
|
||||
auto &bcsEngine = device.getEngine(EngineHelpers::getBcsEngineType(device.getRootDeviceEnvironment(), device.getDeviceBitfield(), device.getSelectorCopyEngine(), true), EngineUsage::Regular);
|
||||
auto &bcsEngine = device.getEngine(EngineHelpers::getBcsEngineType(rootDeviceEnvironment, device.getDeviceBitfield(), device.getSelectorCopyEngine(), true), EngineUsage::Regular);
|
||||
|
||||
BlitPropertiesContainer blitPropertiesContainer;
|
||||
blitPropertiesContainer.push_back(
|
||||
|
||||
@@ -145,9 +145,9 @@ cl_int Program::linkBinary(Device *pDevice, const void *constantsInitData, size_
|
||||
const auto &kernelInfo = kernelInfoArray[kernelId];
|
||||
auto &kernHeapInfo = kernelInfo->heapInfo;
|
||||
auto segmentId = &kernelInfo - &kernelInfoArray[0];
|
||||
auto &hwInfo = pDevice->getHardwareInfo();
|
||||
auto &rootDeviceEnvironment = pDevice->getRootDeviceEnvironment();
|
||||
const auto &productHelper = pDevice->getProductHelper();
|
||||
MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(hwInfo, *kernelInfo->getGraphicsAllocation()),
|
||||
MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, *kernelInfo->getGraphicsAllocation()),
|
||||
*pDevice, kernelInfo->getGraphicsAllocation(), 0, isaSegmentsForPatching[segmentId].hostPointer,
|
||||
static_cast<size_t>(kernHeapInfo.KernelHeapSize));
|
||||
}
|
||||
|
||||
@@ -666,7 +666,7 @@ XE_HPC_CORETEST_F(ProductHelperTestXeHpcCore, givenDefaultProductHelperHwWhenGet
|
||||
MockGraphicsAllocation allocation;
|
||||
allocation.overrideMemoryPool(MemoryPool::LocalMemory);
|
||||
allocation.setAllocationType(AllocationType::BUFFER_HOST_MEMORY);
|
||||
EXPECT_FALSE(productHelper.isBlitCopyRequiredForLocalMemory(*defaultHwInfo, allocation));
|
||||
EXPECT_FALSE(productHelper.isBlitCopyRequiredForLocalMemory(pDevice->getRootDeviceEnvironment(), allocation));
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(ProductHelperTestXeHpcCore, givenDebugVariableSetWhenConfigureIsCalledThenSetupBlitterOperationsSupportedFlag) {
|
||||
|
||||
@@ -48,11 +48,11 @@ const SipKernel &BuiltIns::getSipKernel(SipKernelType type, Device &device) {
|
||||
|
||||
auto sipAllocation = device.getMemoryManager()->allocateGraphicsMemoryWithProperties(properties);
|
||||
|
||||
auto &hwInfo = device.getHardwareInfo();
|
||||
auto &rootDeviceEnvironment = device.getRootDeviceEnvironment();
|
||||
auto &productHelper = device.getProductHelper();
|
||||
|
||||
if (sipAllocation) {
|
||||
MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(hwInfo, *sipAllocation),
|
||||
MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, *sipAllocation),
|
||||
device, sipAllocation, 0, sipBinary.data(),
|
||||
sipBinary.size());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2022 Intel Corporation
|
||||
* Copyright (C) 2018-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -119,7 +119,9 @@ bool SipKernel::initRawBinaryFromFileKernel(SipKernelType type, Device &device,
|
||||
uint32_t sipIndex = static_cast<uint32_t>(type);
|
||||
uint32_t rootDeviceIndex = device.getRootDeviceIndex();
|
||||
|
||||
if (device.getExecutionEnvironment()->rootDeviceEnvironments[rootDeviceIndex]->sipKernels[sipIndex].get() != nullptr) {
|
||||
auto &rootDeviceEnvironment = device.getRootDeviceEnvironment();
|
||||
|
||||
if (rootDeviceEnvironment.sipKernels[sipIndex].get() != nullptr) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -140,10 +142,9 @@ bool SipKernel::initRawBinaryFromFileKernel(SipKernelType type, Device &device,
|
||||
return false;
|
||||
}
|
||||
|
||||
auto &hwInfo = device.getHardwareInfo();
|
||||
auto &productHelper = device.getProductHelper();
|
||||
|
||||
MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(hwInfo, *sipAllocation),
|
||||
MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, *sipAllocation),
|
||||
device, sipAllocation, 0, alignedBuffer,
|
||||
bytesRead);
|
||||
|
||||
@@ -191,7 +192,7 @@ bool SipKernel::initHexadecimalArraySipKernel(SipKernelType type, Device &device
|
||||
|
||||
uint32_t *sipKernelBinary = nullptr;
|
||||
size_t kernelBinarySize = 0u;
|
||||
auto &hwInfo = device.getHardwareInfo();
|
||||
auto &rootDeviceEnvironment = device.getRootDeviceEnvironment();
|
||||
auto &gfxCoreHelper = device.getGfxCoreHelper();
|
||||
|
||||
gfxCoreHelper.setSipKernelData(sipKernelBinary, kernelBinarySize);
|
||||
@@ -204,7 +205,7 @@ bool SipKernel::initHexadecimalArraySipKernel(SipKernelType type, Device &device
|
||||
return false;
|
||||
}
|
||||
auto &productHelper = device.getProductHelper();
|
||||
MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(hwInfo, *sipAllocation),
|
||||
MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, *sipAllocation),
|
||||
device, sipAllocation, 0, sipKernelBinary,
|
||||
kernelBinarySize);
|
||||
|
||||
|
||||
@@ -480,14 +480,14 @@ void Linker::patchDataSegments(const SegmentInfo &globalVariablesSegInfo, const
|
||||
}
|
||||
|
||||
if (isAnySymbolRelocated) {
|
||||
auto &hwInfo = pDevice->getHardwareInfo();
|
||||
auto &rootDeviceEnvironment = pDevice->getRootDeviceEnvironment();
|
||||
auto &productHelper = pDevice->getProductHelper();
|
||||
if (globalConstantsSeg) {
|
||||
bool useBlitter = productHelper.isBlitCopyRequiredForLocalMemory(hwInfo, *globalConstantsSeg);
|
||||
bool useBlitter = productHelper.isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, *globalConstantsSeg);
|
||||
MemoryTransferHelper::transferMemoryToAllocation(useBlitter, *pDevice, globalConstantsSeg, 0, constantsInitDataCopy.data(), constantsInitDataCopy.size());
|
||||
}
|
||||
if (globalVariablesSeg) {
|
||||
bool useBlitter = productHelper.isBlitCopyRequiredForLocalMemory(hwInfo, *globalVariablesSeg);
|
||||
bool useBlitter = productHelper.isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, *globalVariablesSeg);
|
||||
MemoryTransferHelper::transferMemoryToAllocation(useBlitter, *pDevice, globalVariablesSeg, 0, variablesInitDataCopy.data(), variablesInitDataCopy.size());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
* Copyright (C) 2020-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -77,7 +77,9 @@ void DebuggerL0::initialize() {
|
||||
|
||||
{
|
||||
auto &hwInfo = device->getHardwareInfo();
|
||||
auto &gfxCoreHelper = device->getRootDeviceEnvironment().getHelper<GfxCoreHelper>();
|
||||
auto &rootDeviceEnvironment = device->getRootDeviceEnvironment();
|
||||
|
||||
auto &gfxCoreHelper = rootDeviceEnvironment.getHelper<GfxCoreHelper>();
|
||||
NEO::AllocationProperties properties{device->getRootDeviceIndex(), true, MemoryConstants::pageSize64k,
|
||||
NEO::AllocationType::DEBUG_MODULE_AREA,
|
||||
false,
|
||||
@@ -92,13 +94,13 @@ void DebuggerL0::initialize() {
|
||||
debugArea.scratchBegin = sizeof(DebugAreaHeader);
|
||||
debugArea.scratchEnd = MemoryConstants::pageSize64k - sizeof(DebugAreaHeader);
|
||||
|
||||
NEO::MemoryOperationsHandler *memoryOperationsIface = device->getRootDeviceEnvironment().memoryOperationsInterface.get();
|
||||
NEO::MemoryOperationsHandler *memoryOperationsIface = rootDeviceEnvironment.memoryOperationsInterface.get();
|
||||
if (memoryOperationsIface) {
|
||||
memoryOperationsIface->makeResident(device, ArrayRef<NEO::GraphicsAllocation *>(&moduleDebugArea, 1));
|
||||
}
|
||||
|
||||
const auto &productHelper = device->getProductHelper();
|
||||
NEO::MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(hwInfo, *moduleDebugArea),
|
||||
NEO::MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, *moduleDebugArea),
|
||||
*device, moduleDebugArea, 0, &debugArea,
|
||||
sizeof(DebugAreaHeader));
|
||||
if (gfxCoreHelper.disableL3CacheForDebug(hwInfo, productHelper)) {
|
||||
|
||||
@@ -894,7 +894,7 @@ void Device::allocateRTDispatchGlobals(uint32_t maxBvhLevels) {
|
||||
uint32_t *dispatchGlobalsAsArray = reinterpret_cast<uint32_t *>(&dispatchGlobals);
|
||||
dispatchGlobalsAsArray[7] = 1;
|
||||
|
||||
MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(this->getHardwareInfo(), *dispatchGlobalsArrayAllocation),
|
||||
MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(this->getRootDeviceEnvironment(), *dispatchGlobalsArrayAllocation),
|
||||
*this,
|
||||
dispatchGlobalsArrayAllocation,
|
||||
tile * dispatchGlobalsStride,
|
||||
|
||||
@@ -135,7 +135,7 @@ class ProductHelper {
|
||||
virtual bool allowMemoryPrefetch(const HardwareInfo &hwInfo) const = 0;
|
||||
virtual bool isBcsReportWaRequired(const HardwareInfo &hwInfo) const = 0;
|
||||
virtual bool isBlitSplitEnqueueWARequired(const HardwareInfo &hwInfo) const = 0;
|
||||
virtual bool isBlitCopyRequiredForLocalMemory(const HardwareInfo &hwInfo, const GraphicsAllocation &allocation) const = 0;
|
||||
virtual bool isBlitCopyRequiredForLocalMemory(const RootDeviceEnvironment &rootDeviceEnvironment, const GraphicsAllocation &allocation) const = 0;
|
||||
virtual bool isImplicitScalingSupported(const HardwareInfo &hwInfo) const = 0;
|
||||
virtual bool isCpuCopyNecessary(const void *ptr, MemoryManager *memoryManager) const = 0;
|
||||
virtual bool isAdjustWalkOrderAvailable(const HardwareInfo &hwInfo) const = 0;
|
||||
@@ -282,7 +282,7 @@ class ProductHelperHw : public ProductHelper {
|
||||
bool isBlitSplitEnqueueWARequired(const HardwareInfo &hwInfo) const override;
|
||||
bool allowMemoryPrefetch(const HardwareInfo &hwInfo) const override;
|
||||
bool isBcsReportWaRequired(const HardwareInfo &hwInfo) const override;
|
||||
bool isBlitCopyRequiredForLocalMemory(const HardwareInfo &hwInfo, const GraphicsAllocation &allocation) const override;
|
||||
bool isBlitCopyRequiredForLocalMemory(const RootDeviceEnvironment &rootDeviceEnvironment, const GraphicsAllocation &allocation) const override;
|
||||
bool isImplicitScalingSupported(const HardwareInfo &hwInfo) const override;
|
||||
bool isCpuCopyNecessary(const void *ptr, MemoryManager *memoryManager) const override;
|
||||
bool isAdjustWalkOrderAvailable(const HardwareInfo &hwInfo) const override;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "shared/source/aub_mem_dump/aub_mem_dump.h"
|
||||
#include "shared/source/command_stream/stream_properties.h"
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#include "shared/source/execution_environment/root_device_environment.h"
|
||||
#include "shared/source/helpers/api_specific_config.h"
|
||||
#include "shared/source/helpers/cache_policy.h"
|
||||
#include "shared/source/helpers/constants.h"
|
||||
@@ -470,9 +471,11 @@ bool ProductHelperHw<gfxProduct>::isBlitSplitEnqueueWARequired(const HardwareInf
|
||||
}
|
||||
|
||||
template <PRODUCT_FAMILY gfxProduct>
|
||||
bool ProductHelperHw<gfxProduct>::isBlitCopyRequiredForLocalMemory(const HardwareInfo &hwInfo, const GraphicsAllocation &allocation) const {
|
||||
bool ProductHelperHw<gfxProduct>::isBlitCopyRequiredForLocalMemory(const RootDeviceEnvironment &rootDeviceEnvironment, const GraphicsAllocation &allocation) const {
|
||||
auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
|
||||
auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo();
|
||||
return allocation.isAllocatedInLocalMemoryPool() &&
|
||||
(ProductHelper::get(hwInfo.platform.eProductFamily)->getLocalMemoryAccessMode(hwInfo) == LocalMemoryAccessMode::CpuAccessDisallowed ||
|
||||
(productHelper.getLocalMemoryAccessMode(hwInfo) == LocalMemoryAccessMode::CpuAccessDisallowed ||
|
||||
!allocation.isAllocationLockable());
|
||||
}
|
||||
|
||||
|
||||
@@ -67,10 +67,10 @@ bool KernelInfo::createKernelAllocation(const Device &device, bool internalIsa)
|
||||
if (kernelAllocations != storedAllocations.end()) {
|
||||
kernelAllocation = kernelAllocations->second.kernelAllocation;
|
||||
kernelAllocations->second.reuseCounter++;
|
||||
auto &hwInfo = device.getHardwareInfo();
|
||||
auto &rootDeviceEnvironment = device.getRootDeviceEnvironment();
|
||||
auto &productHelper = device.getProductHelper();
|
||||
|
||||
return MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(hwInfo, *kernelAllocation),
|
||||
return MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, *kernelAllocation),
|
||||
device, kernelAllocation, 0, heapInfo.pKernelHeap,
|
||||
static_cast<size_t>(kernelIsaSize));
|
||||
} else {
|
||||
@@ -85,10 +85,10 @@ bool KernelInfo::createKernelAllocation(const Device &device, bool internalIsa)
|
||||
return false;
|
||||
}
|
||||
|
||||
auto &hwInfo = device.getHardwareInfo();
|
||||
auto &rootDeviceEnvironment = device.getRootDeviceEnvironment();
|
||||
auto &productHelper = device.getProductHelper();
|
||||
|
||||
return MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(hwInfo, *kernelAllocation),
|
||||
return MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, *kernelAllocation),
|
||||
device, kernelAllocation, 0, heapInfo.pKernelHeap,
|
||||
static_cast<size_t>(kernelIsaSize));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
* Copyright (C) 2020-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -58,10 +58,10 @@ GraphicsAllocation *allocateGlobalsSurface(NEO::SVMAllocsManager *const svmAlloc
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto &hwInfo = device.getHardwareInfo();
|
||||
auto &rootDeviceEnvironment = device.getRootDeviceEnvironment();
|
||||
auto &productHelper = device.getProductHelper();
|
||||
|
||||
auto success = MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(hwInfo, *gpuAllocation),
|
||||
auto success = MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, *gpuAllocation),
|
||||
device, gpuAllocation, 0, initData, size);
|
||||
|
||||
UNRECOVERABLE_IF(!success);
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/execution_environment/root_device_environment.h"
|
||||
|
||||
#include "aubstream/product_family.h"
|
||||
|
||||
namespace NEO {
|
||||
@@ -139,11 +141,12 @@ bool ProductHelperHw<gfxProduct>::isBcsReportWaRequired(const HardwareInfo &hwIn
|
||||
}
|
||||
|
||||
template <>
|
||||
bool ProductHelperHw<gfxProduct>::isBlitCopyRequiredForLocalMemory(const HardwareInfo &hwInfo, const GraphicsAllocation &allocation) const {
|
||||
bool ProductHelperHw<gfxProduct>::isBlitCopyRequiredForLocalMemory(const RootDeviceEnvironment &rootDeviceEnvironment, const GraphicsAllocation &allocation) const {
|
||||
if (!allocation.isAllocatedInLocalMemoryPool()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo();
|
||||
if (getLocalMemoryAccessMode(hwInfo) == LocalMemoryAccessMode::CpuAccessDisallowed) {
|
||||
// Regular L3 WA
|
||||
return true;
|
||||
|
||||
@@ -415,22 +415,24 @@ HWTEST_F(ProductHelperTest, givenLockableAllocationWhenGettingIsBlitCopyRequired
|
||||
graphicsAllocation.overrideMemoryPool(MemoryPool::LocalMemory);
|
||||
|
||||
auto expectedDefaultValue = (productHelper->getLocalMemoryAccessMode(pInHwInfo) == LocalMemoryAccessMode::CpuAccessDisallowed);
|
||||
EXPECT_EQ(expectedDefaultValue, productHelper->isBlitCopyRequiredForLocalMemory(pInHwInfo, graphicsAllocation));
|
||||
auto &rootDeviceEnvironment = *executionEnvironment->rootDeviceEnvironments[0];
|
||||
|
||||
EXPECT_EQ(expectedDefaultValue, productHelper->isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, graphicsAllocation));
|
||||
|
||||
DebugManager.flags.ForceLocalMemoryAccessMode.set(0);
|
||||
EXPECT_FALSE(productHelper->isBlitCopyRequiredForLocalMemory(pInHwInfo, graphicsAllocation));
|
||||
EXPECT_FALSE(productHelper->isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, graphicsAllocation));
|
||||
DebugManager.flags.ForceLocalMemoryAccessMode.set(1);
|
||||
EXPECT_FALSE(productHelper->isBlitCopyRequiredForLocalMemory(pInHwInfo, graphicsAllocation));
|
||||
EXPECT_FALSE(productHelper->isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, graphicsAllocation));
|
||||
|
||||
DebugManager.flags.ForceLocalMemoryAccessMode.set(3);
|
||||
EXPECT_TRUE(productHelper->isBlitCopyRequiredForLocalMemory(pInHwInfo, graphicsAllocation));
|
||||
EXPECT_TRUE(productHelper->isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, graphicsAllocation));
|
||||
pInHwInfo.capabilityTable.blitterOperationsSupported = false;
|
||||
EXPECT_TRUE(productHelper->isBlitCopyRequiredForLocalMemory(pInHwInfo, graphicsAllocation));
|
||||
EXPECT_TRUE(productHelper->isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, graphicsAllocation));
|
||||
|
||||
graphicsAllocation.overrideMemoryPool(MemoryPool::System64KBPages);
|
||||
EXPECT_FALSE(productHelper->isBlitCopyRequiredForLocalMemory(pInHwInfo, graphicsAllocation));
|
||||
EXPECT_FALSE(productHelper->isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, graphicsAllocation));
|
||||
pInHwInfo.capabilityTable.blitterOperationsSupported = true;
|
||||
EXPECT_FALSE(productHelper->isBlitCopyRequiredForLocalMemory(pInHwInfo, graphicsAllocation));
|
||||
EXPECT_FALSE(productHelper->isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, graphicsAllocation));
|
||||
}
|
||||
|
||||
HWTEST_F(ProductHelperTest, givenNotLockableAllocationWhenGettingIsBlitCopyRequiredForLocalMemoryThenCorrectValuesAreReturned) {
|
||||
@@ -453,31 +455,34 @@ HWTEST_F(ProductHelperTest, givenNotLockableAllocationWhenGettingIsBlitCopyRequi
|
||||
mockGmm.resourceParams.Flags.Info.NotLockable = true;
|
||||
graphicsAllocation.setDefaultGmm(&mockGmm);
|
||||
|
||||
EXPECT_TRUE(productHelper->isBlitCopyRequiredForLocalMemory(hwInfo, graphicsAllocation));
|
||||
auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0];
|
||||
|
||||
EXPECT_TRUE(productHelper->isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, graphicsAllocation));
|
||||
|
||||
DebugManager.flags.ForceLocalMemoryAccessMode.set(0);
|
||||
EXPECT_TRUE(productHelper->isBlitCopyRequiredForLocalMemory(hwInfo, graphicsAllocation));
|
||||
EXPECT_TRUE(productHelper->isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, graphicsAllocation));
|
||||
DebugManager.flags.ForceLocalMemoryAccessMode.set(1);
|
||||
EXPECT_TRUE(productHelper->isBlitCopyRequiredForLocalMemory(hwInfo, graphicsAllocation));
|
||||
EXPECT_TRUE(productHelper->isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, graphicsAllocation));
|
||||
|
||||
DebugManager.flags.ForceLocalMemoryAccessMode.set(3);
|
||||
EXPECT_TRUE(productHelper->isBlitCopyRequiredForLocalMemory(hwInfo, graphicsAllocation));
|
||||
EXPECT_TRUE(productHelper->isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, graphicsAllocation));
|
||||
hwInfo.capabilityTable.blitterOperationsSupported = false;
|
||||
EXPECT_TRUE(productHelper->isBlitCopyRequiredForLocalMemory(hwInfo, graphicsAllocation));
|
||||
EXPECT_TRUE(productHelper->isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, graphicsAllocation));
|
||||
|
||||
graphicsAllocation.overrideMemoryPool(MemoryPool::System64KBPages);
|
||||
EXPECT_FALSE(productHelper->isBlitCopyRequiredForLocalMemory(hwInfo, graphicsAllocation));
|
||||
EXPECT_FALSE(productHelper->isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, graphicsAllocation));
|
||||
hwInfo.capabilityTable.blitterOperationsSupported = true;
|
||||
EXPECT_FALSE(productHelper->isBlitCopyRequiredForLocalMemory(hwInfo, graphicsAllocation));
|
||||
EXPECT_FALSE(productHelper->isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, graphicsAllocation));
|
||||
}
|
||||
|
||||
HWTEST2_F(ProductHelperTest, givenProductHelperWhenGettingIsBlitCopyRequiredForLocalMemoryThenFalseIsReturned, IsAtMostGen11) {
|
||||
auto &rootDeviceEnvironment = *executionEnvironment->rootDeviceEnvironments[0];
|
||||
|
||||
MockGraphicsAllocation graphicsAllocation;
|
||||
graphicsAllocation.overrideMemoryPool(MemoryPool::LocalMemory);
|
||||
graphicsAllocation.setAllocationType(AllocationType::BUFFER_HOST_MEMORY);
|
||||
|
||||
EXPECT_FALSE(productHelper->isBlitCopyRequiredForLocalMemory(pInHwInfo, graphicsAllocation));
|
||||
EXPECT_FALSE(productHelper->isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, graphicsAllocation));
|
||||
}
|
||||
|
||||
HWTEST_F(ProductHelperTest, givenSamplerStateWhenAdjustSamplerStateThenNothingIsChanged) {
|
||||
|
||||
@@ -503,7 +503,8 @@ PVCTEST_F(EngineNodeHelperPvcTests, whenGetGpgpuEnginesThenReturnTwoCccsEnginesA
|
||||
|
||||
PVCTEST_F(EngineNodeHelperPvcTests, givenNonTile0AccessWhenGettingIsBlitCopyRequiredForLocalMemoryThenProperValueIsReturned) {
|
||||
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
auto &rootDeviceEnvironment = pDevice->getRootDeviceEnvironment();
|
||||
auto &hwInfo = *rootDeviceEnvironment.getMutableHardwareInfo();
|
||||
auto &productHelper = getHelper<ProductHelper>();
|
||||
hwInfo.capabilityTable.blitterOperationsSupported = true;
|
||||
MockGraphicsAllocation graphicsAllocation;
|
||||
@@ -516,23 +517,23 @@ PVCTEST_F(EngineNodeHelperPvcTests, givenNonTile0AccessWhenGettingIsBlitCopyRequ
|
||||
|
||||
graphicsAllocation.storageInfo.cloningOfPageTables = false;
|
||||
graphicsAllocation.storageInfo.memoryBanks = 0b11;
|
||||
EXPECT_EQ(expectedRetVal, productHelper.isBlitCopyRequiredForLocalMemory(hwInfo, graphicsAllocation));
|
||||
EXPECT_EQ(expectedRetVal, productHelper.isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, graphicsAllocation));
|
||||
graphicsAllocation.storageInfo.memoryBanks = 0b10;
|
||||
EXPECT_EQ(expectedRetVal, productHelper.isBlitCopyRequiredForLocalMemory(hwInfo, graphicsAllocation));
|
||||
EXPECT_EQ(expectedRetVal, productHelper.isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, graphicsAllocation));
|
||||
|
||||
{
|
||||
VariableBackup<unsigned short> revisionId{&hwInfo.platform.usRevId};
|
||||
revisionId = 0b111000;
|
||||
EXPECT_FALSE(productHelper.isBlitCopyRequiredForLocalMemory(hwInfo, graphicsAllocation));
|
||||
EXPECT_FALSE(productHelper.isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, graphicsAllocation));
|
||||
}
|
||||
{
|
||||
VariableBackup<bool> cloningOfPageTables{&graphicsAllocation.storageInfo.cloningOfPageTables};
|
||||
cloningOfPageTables = true;
|
||||
EXPECT_EQ(expectedRetVal, productHelper.isBlitCopyRequiredForLocalMemory(hwInfo, graphicsAllocation));
|
||||
EXPECT_EQ(expectedRetVal, productHelper.isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, graphicsAllocation));
|
||||
}
|
||||
{
|
||||
VariableBackup<DeviceBitfield> memoryBanks{&graphicsAllocation.storageInfo.memoryBanks};
|
||||
memoryBanks = 0b1;
|
||||
EXPECT_FALSE(productHelper.isBlitCopyRequiredForLocalMemory(hwInfo, graphicsAllocation));
|
||||
EXPECT_FALSE(productHelper.isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, graphicsAllocation));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user