Refactor: don't use global ProductHelper getter in ocl files 2/n
Related-To: NEO-6853 Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
parent
59c8c14d52
commit
7c23ea3928
|
@ -86,9 +86,9 @@ CommandQueue::CommandQueue(Context *context, ClDevice *device, const cl_queue_pr
|
|||
if (device) {
|
||||
auto &hwInfo = device->getHardwareInfo();
|
||||
auto &gfxCoreHelper = device->getGfxCoreHelper();
|
||||
auto productHelper = ProductHelper::get(hwInfo.platform.eProductFamily);
|
||||
auto &productHelper = device->getProductHelper();
|
||||
|
||||
bcsAllowed = productHelper->isBlitterFullySupported(hwInfo) &&
|
||||
bcsAllowed = productHelper.isBlitterFullySupported(hwInfo) &&
|
||||
gfxCoreHelper.isSubDeviceEngineSupported(hwInfo, device->getDeviceBitfield(), aub_stream::EngineType::ENGINE_BCS);
|
||||
|
||||
if (bcsAllowed || device->getDefaultEngine().commandStreamReceiver->peekTimestampPacketWriteEnabled()) {
|
||||
|
@ -182,7 +182,7 @@ void CommandQueue::initializeGpgpu() const {
|
|||
|
||||
void CommandQueue::initializeGpgpuInternals() const {
|
||||
auto &hwInfo = device->getDevice().getHardwareInfo();
|
||||
const auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily);
|
||||
auto &productHelper = device->getProductHelper();
|
||||
|
||||
if (device->getDevice().getDebugger() && !this->gpgpuEngine->commandStreamReceiver->getDebugSurfaceAllocation()) {
|
||||
auto maxDbgSurfaceSize = NEO::SipKernel::getSipKernel(device->getDevice()).getStateSaveAreaSize(&device->getDevice());
|
||||
|
@ -918,9 +918,8 @@ size_t CommandQueue::estimateTimestampPacketNodesCount(const MultiDispatchInfo &
|
|||
bool CommandQueue::bufferCpuCopyAllowed(Buffer *buffer, cl_command_type commandType, cl_bool blocking, size_t size, void *ptr,
|
||||
cl_uint numEventsInWaitList, const cl_event *eventWaitList) {
|
||||
|
||||
const auto &hwInfo = device->getHardwareInfo();
|
||||
const auto &productHelper = ProductHelper::get(hwInfo.platform.eProductFamily);
|
||||
if (CL_COMMAND_READ_BUFFER == commandType && productHelper->isCpuCopyNecessary(ptr, buffer->getMemoryManager())) {
|
||||
auto &productHelper = device->getProductHelper();
|
||||
if (CL_COMMAND_READ_BUFFER == commandType && productHelper.isCpuCopyNecessary(ptr, buffer->getMemoryManager())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1019,8 +1018,8 @@ bool CommandQueue::blitEnqueueAllowed(const CsrSelectionArgs &args) const {
|
|||
|
||||
bool CommandQueue::blitEnqueueImageAllowed(const size_t *origin, const size_t *region, const Image &image) const {
|
||||
const auto &hwInfo = device->getHardwareInfo();
|
||||
const auto &productHelper = ProductHelper::get(hwInfo.platform.eProductFamily);
|
||||
auto blitEnqueueImageAllowed = productHelper->isBlitterForImagesSupported();
|
||||
auto &productHelper = device->getProductHelper();
|
||||
auto blitEnqueueImageAllowed = productHelper.isBlitterForImagesSupported();
|
||||
|
||||
if (DebugManager.flags.EnableBlitterForEnqueueImageOperations.get() != -1) {
|
||||
blitEnqueueImageAllowed = DebugManager.flags.EnableBlitterForEnqueueImageOperations.get();
|
||||
|
@ -1033,7 +1032,7 @@ bool CommandQueue::blitEnqueueImageAllowed(const size_t *origin, const size_t *r
|
|||
auto isTile64 = defaultGmm->gmmResourceInfo->getResourceFlags()->Info.Tile64;
|
||||
auto imageType = image.getImageDesc().image_type;
|
||||
if (isTile64 && (imageType == CL_MEM_OBJECT_IMAGE3D)) {
|
||||
blitEnqueueImageAllowed &= productHelper->isTile64With3DSurfaceOnBCSSupported(hwInfo);
|
||||
blitEnqueueImageAllowed &= productHelper.isTile64With3DSurfaceOnBCSSupported(hwInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1185,7 +1184,7 @@ void CommandQueue::assignDataToOverwrittenBcsNode(TagNodeBase *node) {
|
|||
|
||||
bool CommandQueue::isWaitForTimestampsEnabled() const {
|
||||
const auto &gfxCoreHelper = getDevice().getGfxCoreHelper();
|
||||
const auto &productHelper = *ProductHelper::get(getDevice().getHardwareInfo().platform.eProductFamily);
|
||||
auto &productHelper = getDevice().getProductHelper();
|
||||
auto enabled = CommandQueue::isTimestampWaitEnabled();
|
||||
enabled &= gfxCoreHelper.isTimestampWaitSupportedForQueues();
|
||||
enabled &= !productHelper.isDcFlushAllowed();
|
||||
|
|
|
@ -181,12 +181,12 @@ cl_int CommandQueueHw<GfxFamily>::enqueueHandler(Surface **surfacesForResidency,
|
|||
|
||||
const bool enqueueWithBlitAuxTranslation = isBlitAuxTranslationRequired(multiDispatchInfo);
|
||||
const auto &hwInfo = this->getDevice().getHardwareInfo();
|
||||
const auto &productHelper = ProductHelper::get(hwInfo.platform.eProductFamily);
|
||||
auto &productHelper = getDevice().getProductHelper();
|
||||
bool canUsePipeControlInsteadOfSemaphoresForOnCsrDependencies = false;
|
||||
|
||||
if (computeCommandStreamReceiver.peekTimestampPacketWriteEnabled()) {
|
||||
canUsePipeControlInsteadOfSemaphoresForOnCsrDependencies = this->peekLatestSentEnqueueOperation() == EnqueueProperties::Operation::GpuKernel &&
|
||||
productHelper->isResolveDependenciesByPipeControlsSupported(hwInfo, this->isOOQEnabled());
|
||||
productHelper.isResolveDependenciesByPipeControlsSupported(hwInfo, this->isOOQEnabled());
|
||||
if (false == clearDependenciesForSubCapture &&
|
||||
false == canUsePipeControlInsteadOfSemaphoresForOnCsrDependencies) {
|
||||
eventsRequest.fillCsrDependenciesForTimestampPacketContainer(csrDeps, computeCommandStreamReceiver, CsrDependencies::DependenciesType::OnCsr);
|
||||
|
|
|
@ -169,6 +169,8 @@ size_t EnqueueOperation<GfxFamily>::getTotalSizeRequiredCS(uint32_t eventType, c
|
|||
size_t expectedSizeCS = 0;
|
||||
auto &hwInfo = commandQueue.getDevice().getHardwareInfo();
|
||||
auto &gfxCoreHelper = commandQueue.getDevice().getGfxCoreHelper();
|
||||
auto &productHelper = commandQueue.getDevice().getProductHelper();
|
||||
|
||||
auto &commandQueueHw = static_cast<CommandQueueHw<GfxFamily> &>(commandQueue);
|
||||
|
||||
if (blitEnqueue) {
|
||||
|
@ -189,7 +191,7 @@ size_t EnqueueOperation<GfxFamily>::getTotalSizeRequiredCS(uint32_t eventType, c
|
|||
if (commandQueue.getGpgpuCommandStreamReceiver().peekTimestampPacketWriteEnabled()) {
|
||||
expectedSizeCS += TimestampPacketHelper::getRequiredCmdStreamSize<GfxFamily>(csrDeps);
|
||||
expectedSizeCS += EnqueueOperation<GfxFamily>::getSizeRequiredForTimestampPacketWrite();
|
||||
if (ProductHelper::get(hwInfo.platform.eProductFamily)->isResolveDependenciesByPipeControlsSupported(hwInfo, commandQueue.isOOQEnabled())) {
|
||||
if (productHelper.isResolveDependenciesByPipeControlsSupported(hwInfo, commandQueue.isOOQEnabled())) {
|
||||
expectedSizeCS += MemorySynchronizationCommands<GfxFamily>::getSizeForSingleBarrier(false);
|
||||
}
|
||||
if (isMarkerWithProfiling) {
|
||||
|
|
|
@ -478,8 +478,7 @@ bool Context::BufferPoolAllocator::isAggregatedSmallBuffersEnabled(Context *cont
|
|||
bool isSupportedForSingleDeviceContexts = false;
|
||||
bool isSupportedForAllContexts = false;
|
||||
if (context->getNumDevices() > 0) {
|
||||
auto &hwInfo = context->getDevices()[0]->getHardwareInfo();
|
||||
auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily);
|
||||
auto &productHelper = context->getDevices()[0]->getProductHelper();
|
||||
isSupportedForSingleDeviceContexts = productHelper.isBufferPoolAllocatorSupported();
|
||||
}
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ size_t HardwareCommandsHelper<GfxFamily>::sendInterfaceDescriptorData(
|
|||
|
||||
EncodeDispatchKernel<GfxFamily>::setGrfInfo(&interfaceDescriptor, kernelDescriptor.kernelAttributes.numGrfRequired,
|
||||
sizeCrossThreadData, sizePerThreadData, hardwareInfo);
|
||||
auto &productHelper = *ProductHelper::get(hardwareInfo.platform.eProductFamily);
|
||||
auto &productHelper = device.getProductHelper();
|
||||
productHelper.updateIddCommand(&interfaceDescriptor, kernelDescriptor.kernelAttributes.numGrfRequired,
|
||||
kernelDescriptor.kernelAttributes.threadArbitrationPolicy);
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ Kernel::Kernel(Program *programArg, const KernelInfo &kernelInfoArg, ClDevice &c
|
|||
imageTransformer.reset(new ImageTransformer);
|
||||
auto &deviceInfo = getDevice().getDevice().getDeviceInfo();
|
||||
if (kernelInfoArg.kernelDescriptor.kernelAttributes.simdSize == 1u) {
|
||||
auto &productHelper = *ProductHelper::get(getHardwareInfo().platform.eProductFamily);
|
||||
auto &productHelper = getDevice().getProductHelper();
|
||||
maxKernelWorkGroupSize = productHelper.getMaxThreadsForWorkgroupInDSSOrSS(getHardwareInfo(), static_cast<uint32_t>(deviceInfo.maxNumEUsPerSubSlice), static_cast<uint32_t>(deviceInfo.maxNumEUsPerDualSubSlice));
|
||||
} else {
|
||||
maxKernelWorkGroupSize = static_cast<uint32_t>(deviceInfo.maxWorkGroupSize);
|
||||
|
@ -1949,7 +1949,7 @@ std::unique_ptr<KernelObjsForAuxTranslation> Kernel::fillWithKernelObjsForAuxTra
|
|||
}
|
||||
}
|
||||
}
|
||||
const auto &productHelper = *ProductHelper::get(getDevice().getHardwareInfo().platform.eProductFamily);
|
||||
const auto &productHelper = getDevice().getProductHelper();
|
||||
if (productHelper.allowStatelessCompression(getDevice().getHardwareInfo())) {
|
||||
for (auto gfxAllocation : kernelUnifiedMemoryGfxAllocations) {
|
||||
if (gfxAllocation->isCompressionEnabled()) {
|
||||
|
@ -2273,7 +2273,7 @@ bool Kernel::requiresCacheFlushCommand(const CommandQueue &commandQueue) const {
|
|||
}
|
||||
|
||||
void Kernel::updateAuxTranslationRequired() {
|
||||
const auto &productHelper = *ProductHelper::get(getDevice().getHardwareInfo().platform.eProductFamily);
|
||||
const auto &productHelper = getDevice().getProductHelper();
|
||||
if (productHelper.allowStatelessCompression(getDevice().getHardwareInfo())) {
|
||||
if (hasDirectStatelessAccessToHostMemory() ||
|
||||
hasIndirectStatelessAccessToHostMemory() ||
|
||||
|
|
|
@ -182,7 +182,7 @@ bool inline copyHostPointer(Buffer *buffer,
|
|||
auto context = buffer->getContext();
|
||||
auto &device = context->getDevice(0u)->getDevice();
|
||||
auto &hwInfo = device.getHardwareInfo();
|
||||
auto productHelper = ProductHelper::get(hwInfo.platform.eProductFamily);
|
||||
auto &productHelper = device.getProductHelper();
|
||||
|
||||
auto &osInterface = device.getRootDeviceEnvironment().osInterface;
|
||||
bool isLockable = true;
|
||||
|
@ -193,7 +193,7 @@ bool inline copyHostPointer(Buffer *buffer,
|
|||
bool copyOnCpuAllowed = implicitScalingEnabled == false &&
|
||||
size <= Buffer::maxBufferSizeForCopyOnCpu &&
|
||||
isCompressionEnabled == false &&
|
||||
productHelper->getLocalMemoryAccessMode(hwInfo) != LocalMemoryAccessMode::CpuAccessDisallowed &&
|
||||
productHelper.getLocalMemoryAccessMode(hwInfo) != LocalMemoryAccessMode::CpuAccessDisallowed &&
|
||||
isLockable;
|
||||
if (DebugManager.flags.CopyHostPtrOnCpu.get() != -1) {
|
||||
copyOnCpuAllowed = DebugManager.flags.CopyHostPtrOnCpu.get() == 1;
|
||||
|
@ -206,7 +206,7 @@ bool inline copyHostPointer(Buffer *buffer,
|
|||
} else {
|
||||
auto blitMemoryToAllocationResult = BlitOperationResult::Unsupported;
|
||||
|
||||
if (productHelper->isBlitterFullySupported(hwInfo) && isLocalMemory) {
|
||||
if (productHelper.isBlitterFullySupported(hwInfo) && isLocalMemory) {
|
||||
blitMemoryToAllocationResult = BlitHelperFunctions::blitMemoryToAllocation(device, memory, buffer->getOffset(), hostPtr, {size, 1, 1});
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ void PrintfHandler::prepareDispatch(const MultiDispatchInfo &multiDispatchInfo)
|
|||
printfSurface = device.getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, printfSurfaceSize, AllocationType::PRINTF_SURFACE, device.getDeviceBitfield()});
|
||||
|
||||
auto &hwInfo = device.getHardwareInfo();
|
||||
const auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily);
|
||||
const auto &productHelper = device.getProductHelper();
|
||||
|
||||
MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(hwInfo, *printfSurface),
|
||||
device, printfSurface, 0, printfSurfaceInitialDataSizePtr.get(),
|
||||
|
@ -80,7 +80,7 @@ bool PrintfHandler::printEnqueueOutput() {
|
|||
auto &hwInfo = device.getHardwareInfo();
|
||||
|
||||
auto usesStringMap = kernel->getDescriptor().kernelAttributes.usesStringMap();
|
||||
const auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily);
|
||||
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;
|
||||
|
|
|
@ -144,7 +144,7 @@ cl_int Program::linkBinary(Device *pDevice, const void *constantsInitData, size_
|
|||
auto &kernHeapInfo = kernelInfo->heapInfo;
|
||||
auto segmentId = &kernelInfo - &kernelInfoArray[0];
|
||||
auto &hwInfo = pDevice->getHardwareInfo();
|
||||
const auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily);
|
||||
const auto &productHelper = pDevice->getProductHelper();
|
||||
MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(hwInfo, *kernelInfo->getGraphicsAllocation()),
|
||||
*pDevice, kernelInfo->getGraphicsAllocation(), 0, isaSegmentsForPatching[segmentId].hostPointer,
|
||||
static_cast<size_t>(kernHeapInfo.KernelHeapSize));
|
||||
|
|
|
@ -84,7 +84,7 @@ std::string Program::getInternalOptions() const {
|
|||
CompilerOptions::concatenateAppend(internalOptions, CompilerOptions::hasBufferOffsetArg);
|
||||
}
|
||||
|
||||
const auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily);
|
||||
const auto &productHelper = pClDevice->getProductHelper();
|
||||
if (productHelper.isForceEmuInt32DivRemSPWARequired(hwInfo)) {
|
||||
CompilerOptions::concatenateAppend(internalOptions, CompilerOptions::forceEmuInt32DivRemSP);
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@ Image *D3DTexture<D3D>::create2d(Context *context, D3DTexture2d *d3dTexture, cl_
|
|||
}
|
||||
|
||||
if (alloc->getDefaultGmm()->unifiedAuxTranslationCapable()) {
|
||||
const auto &productHelper = *ProductHelper::get(hwInfo->platform.eProductFamily);
|
||||
const auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
|
||||
alloc->getDefaultGmm()->isCompressionEnabled = productHelper.isPageTableManagerSupported(*hwInfo) ? memoryManager->mapAuxGpuVA(alloc)
|
||||
: true;
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ Image *D3DTexture<D3D>::create3d(Context *context, D3DTexture3d *d3dTexture, cl_
|
|||
imgInfo.surfaceFormat = &clSurfaceFormat->surfaceFormat;
|
||||
|
||||
if (alloc->getDefaultGmm()->unifiedAuxTranslationCapable()) {
|
||||
const auto &productHelper = *ProductHelper::get(hwInfo->platform.eProductFamily);
|
||||
const auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
|
||||
alloc->getDefaultGmm()->isCompressionEnabled = productHelper.isPageTableManagerSupported(*hwInfo) ? memoryManager->mapAuxGpuVA(alloc)
|
||||
: true;
|
||||
}
|
||||
|
|
|
@ -151,7 +151,7 @@ Image *GlTexture::createSharedGlTexture(Context *context, cl_mem_flags flags, cl
|
|||
|
||||
if (texInfo.isAuxEnabled && alloc->getDefaultGmm()->unifiedAuxTranslationCapable()) {
|
||||
const auto &hwInfo = context->getDevice(0)->getHardwareInfo();
|
||||
const auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily);
|
||||
const auto &productHelper = context->getDevice(0)->getProductHelper();
|
||||
alloc->getDefaultGmm()->isCompressionEnabled = productHelper.isPageTableManagerSupported(hwInfo) ? memoryManager->mapAuxGpuVA(alloc)
|
||||
: true;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ Image *UnifiedImage::createSharedUnifiedImage(Context *context, cl_mem_flags fla
|
|||
auto &memoryManager = *context->getMemoryManager();
|
||||
if (graphicsAllocation->getDefaultGmm()->unifiedAuxTranslationCapable()) {
|
||||
const auto &hwInfo = context->getDevice(0)->getHardwareInfo();
|
||||
const auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily);
|
||||
const auto &productHelper = context->getDevice(0)->getProductHelper();
|
||||
graphicsAllocation->getDefaultGmm()->isCompressionEnabled = productHelper.isPageTableManagerSupported(hwInfo) ? memoryManager.mapAuxGpuVA(graphicsAllocation) : true;
|
||||
}
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ class ProductHelper {
|
|||
virtual uint32_t getMaxThreadsForWorkgroup(const HardwareInfo &hwInfo, uint32_t maxNumEUsPerSubSlice) const = 0;
|
||||
virtual void setForceNonCoherent(void *const commandPtr, const StateComputeModeProperties &properties) = 0;
|
||||
virtual void updateScmCommand(void *const commandPtr, const StateComputeModeProperties &properties) = 0;
|
||||
virtual void updateIddCommand(void *const commandPtr, uint32_t numGrf, int32_t threadArbitrationPolicy) = 0;
|
||||
virtual void updateIddCommand(void *const commandPtr, uint32_t numGrf, int32_t threadArbitrationPolicy) const = 0;
|
||||
virtual bool obtainBlitterPreference(const HardwareInfo &hwInfo) const = 0;
|
||||
virtual bool isBlitterFullySupported(const HardwareInfo &hwInfo) const = 0;
|
||||
virtual bool isPageTableManagerSupported(const HardwareInfo &hwInfo) const = 0;
|
||||
|
@ -222,7 +222,7 @@ class ProductHelperHw : public ProductHelper {
|
|||
uint32_t getMaxThreadsForWorkgroup(const HardwareInfo &hwInfo, uint32_t maxNumEUsPerSubSlice) const override;
|
||||
void setForceNonCoherent(void *const commandPtr, const StateComputeModeProperties &properties) override;
|
||||
void updateScmCommand(void *const commandPtr, const StateComputeModeProperties &properties) override;
|
||||
void updateIddCommand(void *const commandPtr, uint32_t numGrf, int32_t threadArbitrationPolicy) override;
|
||||
void updateIddCommand(void *const commandPtr, uint32_t numGrf, int32_t threadArbitrationPolicy) const override;
|
||||
bool obtainBlitterPreference(const HardwareInfo &hwInfo) const override;
|
||||
bool isBlitterFullySupported(const HardwareInfo &hwInfo) const override;
|
||||
bool isPageTableManagerSupported(const HardwareInfo &hwInfo) const override;
|
||||
|
|
|
@ -177,7 +177,7 @@ template <PRODUCT_FAMILY gfxProduct>
|
|||
void ProductHelperHw<gfxProduct>::updateScmCommand(void *const commandPtr, const StateComputeModeProperties &properties) {}
|
||||
|
||||
template <PRODUCT_FAMILY gfxProduct>
|
||||
void ProductHelperHw<gfxProduct>::updateIddCommand(void *const commandPtr, uint32_t numGrf, int32_t threadArbitrationPolicy) {}
|
||||
void ProductHelperHw<gfxProduct>::updateIddCommand(void *const commandPtr, uint32_t numGrf, int32_t threadArbitrationPolicy) const {}
|
||||
|
||||
template <PRODUCT_FAMILY gfxProduct>
|
||||
bool ProductHelperHw<gfxProduct>::isPageTableManagerSupported(const HardwareInfo &hwInfo) const {
|
||||
|
|
|
@ -348,7 +348,7 @@ void ProductHelperHw<IGFX_UNKNOWN>::updateScmCommand(void *const commandPtr, con
|
|||
}
|
||||
|
||||
template <>
|
||||
void ProductHelperHw<IGFX_UNKNOWN>::updateIddCommand(void *const commandPtr, uint32_t numGrf, int32_t threadArbitrationPolicy) {
|
||||
void ProductHelperHw<IGFX_UNKNOWN>::updateIddCommand(void *const commandPtr, uint32_t numGrf, int32_t threadArbitrationPolicy) const {
|
||||
}
|
||||
|
||||
template <>
|
||||
|
|
Loading…
Reference in New Issue