/* * Copyright (C) 2020-2021 Intel Corporation * * SPDX-License-Identifier: MIT * */ #include "shared/source/command_container/command_encoder.h" #include "shared/source/command_stream/stream_properties.h" #include "shared/source/gen12lp/hw_cmds_base.h" #include "shared/source/gen12lp/reg_configs.h" #include "shared/source/helpers/preamble.h" using Family = NEO::TGLLPFamily; #include "shared/source/command_container/command_encoder.inl" #include "shared/source/command_container/command_encoder_bdw_and_later.inl" #include "shared/source/command_container/encode_compute_mode_tgllp_and_later.inl" #include "shared/source/command_container/image_surface_state/compression_params_bdw_and_later.inl" #include "shared/source/command_container/image_surface_state/compression_params_tgllp_and_later.inl" #include "shared/source/command_stream/command_stream_receiver.h" namespace NEO { template <> size_t EncodeWA::getAdditionalPipelineSelectSize(Device &device) { size_t size = 0; if (device.getDefaultEngine().commandStreamReceiver->isRcs()) { size += 2 * PreambleHelper::getCmdSizeForPipelineSelect(device.getHardwareInfo()); } return size; } template <> size_t EncodeStates::getAdjustStateComputeModeSize() { return sizeof(typename Family::STATE_COMPUTE_MODE); } template <> void EncodeComputeMode::adjustComputeMode(LinearStream &csr, void *const stateComputeModePtr, StateComputeModeProperties &properties, const HardwareInfo &hwInfo) { using STATE_COMPUTE_MODE = typename Family::STATE_COMPUTE_MODE; using FORCE_NON_COHERENT = typename STATE_COMPUTE_MODE::FORCE_NON_COHERENT; STATE_COMPUTE_MODE stateComputeMode = (stateComputeModePtr) ? *(static_cast(stateComputeModePtr)) : Family::cmdInitStateComputeMode; auto maskBits = stateComputeMode.getMaskBits(); if (properties.isCoherencyRequired.isDirty) { FORCE_NON_COHERENT coherencyValue = !properties.isCoherencyRequired.value ? FORCE_NON_COHERENT::FORCE_NON_COHERENT_FORCE_GPU_NON_COHERENT : FORCE_NON_COHERENT::FORCE_NON_COHERENT_FORCE_DISABLED; stateComputeMode.setForceNonCoherent(coherencyValue); maskBits |= Family::stateComputeModeForceNonCoherentMask; } stateComputeMode.setMaskBits(maskBits); auto buffer = csr.getSpace(sizeof(STATE_COMPUTE_MODE)); *reinterpret_cast(buffer) = stateComputeMode; } template <> void EncodeWA::encodeAdditionalPipelineSelect(Device &device, LinearStream &stream, bool is3DPipeline) { if (device.getDefaultEngine().commandStreamReceiver->isRcs()) { PipelineSelectArgs args; args.is3DPipelineRequired = is3DPipeline; PreambleHelper::programPipelineSelect(&stream, args, device.getHardwareInfo()); } } template <> void EncodeSurfaceState::encodeExtraBufferParams(R_SURFACE_STATE *surfaceState, GraphicsAllocation *allocation, GmmHelper *gmmHelper, bool isReadOnly, uint32_t numAvailableDevices, bool useGlobalAtomics, bool areMultipleSubDevicesInContext) { const bool isL3Allowed = surfaceState->getMemoryObjectControlState() == gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER); if (isL3Allowed) { const bool isConstantSurface = allocation && allocation->getAllocationType() == GraphicsAllocation::AllocationType::CONSTANT_SURFACE; bool useL1 = isReadOnly || isConstantSurface; if (DebugManager.flags.ForceL1Caching.get() != 1) { useL1 = false; } if (useL1) { surfaceState->setMemoryObjectControlState(gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST)); } } } template <> bool EncodeSurfaceState::doBindingTablePrefetch() { return false; } template <> void EncodeL3State::encode(CommandContainer &container, bool enableSLM) { } template struct EncodeDispatchKernel; template struct EncodeStates; template struct EncodeMath; template struct EncodeMathMMIO; template struct EncodeIndirectParams; template struct EncodeSetMMIO; template struct EncodeL3State; template struct EncodeMediaInterfaceDescriptorLoad; template struct EncodeStateBaseAddress; template struct EncodeStoreMMIO; template struct EncodeSurfaceState; template struct EncodeAtomic; template struct EncodeSempahore; template struct EncodeBatchBufferStartOrEnd; template struct EncodeMiFlushDW; template struct EncodeWA; template struct EncodeMemoryPrefetch; template struct EncodeMiArbCheck; template struct EncodeComputeMode; template struct EncodeEnableRayTracing; } // namespace NEO