2020-01-17 08:56:05 +01:00
|
|
|
/*
|
2021-01-27 19:55:34 +01:00
|
|
|
* Copyright (C) 2020-2021 Intel Corporation
|
2020-01-17 08:56:05 +01:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/command_container/command_encoder.h"
|
2021-05-18 02:46:21 +00:00
|
|
|
#include "shared/source/command_stream/stream_properties.h"
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/gen12lp/hw_cmds_base.h"
|
2020-03-03 11:59:49 +01:00
|
|
|
#include "shared/source/gen12lp/reg_configs.h"
|
2021-10-21 01:30:53 +00:00
|
|
|
#include "shared/source/gmm_helper/gmm_helper.h"
|
2020-03-25 10:04:42 +01:00
|
|
|
#include "shared/source/helpers/preamble.h"
|
2020-01-17 08:56:05 +01:00
|
|
|
|
2020-07-31 08:40:52 +02:00
|
|
|
using Family = NEO::TGLLPFamily;
|
2020-01-17 08:56:05 +01:00
|
|
|
|
2020-07-31 08:40:52 +02:00
|
|
|
#include "shared/source/command_container/command_encoder.inl"
|
2021-08-03 11:48:35 +00:00
|
|
|
#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"
|
2020-10-07 14:22:26 +02:00
|
|
|
#include "shared/source/command_stream/command_stream_receiver.h"
|
2020-03-25 10:04:42 +01:00
|
|
|
|
2020-07-31 08:40:52 +02:00
|
|
|
namespace NEO {
|
2021-10-21 01:30:53 +00:00
|
|
|
|
2020-03-25 10:04:42 +01:00
|
|
|
template <>
|
2020-07-31 08:40:52 +02:00
|
|
|
size_t EncodeWA<Family>::getAdditionalPipelineSelectSize(Device &device) {
|
2020-03-25 10:04:42 +01:00
|
|
|
size_t size = 0;
|
|
|
|
|
if (device.getDefaultEngine().commandStreamReceiver->isRcs()) {
|
|
|
|
|
size += 2 * PreambleHelper<Family>::getCmdSizeForPipelineSelect(device.getHardwareInfo());
|
|
|
|
|
}
|
|
|
|
|
return size;
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-17 08:56:05 +01:00
|
|
|
template <>
|
|
|
|
|
size_t EncodeStates<Family>::getAdjustStateComputeModeSize() {
|
|
|
|
|
return sizeof(typename Family::STATE_COMPUTE_MODE);
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-19 10:29:36 +01:00
|
|
|
template <>
|
2021-07-06 13:29:10 +00:00
|
|
|
void EncodeComputeMode<Family>::adjustComputeMode(LinearStream &csr, void *const stateComputeModePtr, StateComputeModeProperties &properties, const HardwareInfo &hwInfo) {
|
2021-05-18 02:46:21 +00:00
|
|
|
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<STATE_COMPUTE_MODE *>(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);
|
|
|
|
|
|
2020-03-19 10:29:36 +01:00
|
|
|
auto buffer = csr.getSpace(sizeof(STATE_COMPUTE_MODE));
|
2021-05-18 02:46:21 +00:00
|
|
|
*reinterpret_cast<STATE_COMPUTE_MODE *>(buffer) = stateComputeMode;
|
2020-03-19 10:29:36 +01:00
|
|
|
}
|
|
|
|
|
|
2020-03-25 10:04:42 +01:00
|
|
|
template <>
|
2020-07-31 08:40:52 +02:00
|
|
|
void EncodeWA<Family>::encodeAdditionalPipelineSelect(Device &device, LinearStream &stream, bool is3DPipeline) {
|
2020-03-25 10:04:42 +01:00
|
|
|
if (device.getDefaultEngine().commandStreamReceiver->isRcs()) {
|
|
|
|
|
PipelineSelectArgs args;
|
|
|
|
|
args.is3DPipelineRequired = is3DPipeline;
|
|
|
|
|
PreambleHelper<Family>::programPipelineSelect(&stream, args, device.getHardwareInfo());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-01 12:22:54 +02:00
|
|
|
template <>
|
2021-10-21 01:30:53 +00:00
|
|
|
void EncodeSurfaceState<Family>::encodeExtraBufferParams(EncodeSurfaceStateArgs &args) {
|
|
|
|
|
auto surfaceState = reinterpret_cast<R_SURFACE_STATE *>(args.outMemory);
|
|
|
|
|
const bool isL3Allowed = surfaceState->getMemoryObjectControlState() == args.gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
|
2020-10-01 12:22:54 +02:00
|
|
|
if (isL3Allowed) {
|
2021-10-21 01:30:53 +00:00
|
|
|
const bool isConstantSurface = args.allocation && args.allocation->getAllocationType() == GraphicsAllocation::AllocationType::CONSTANT_SURFACE;
|
|
|
|
|
bool useL1 = args.isReadOnly || isConstantSurface;
|
2020-10-01 12:22:54 +02:00
|
|
|
|
2020-10-12 10:13:29 +02:00
|
|
|
if (DebugManager.flags.ForceL1Caching.get() != 1) {
|
|
|
|
|
useL1 = false;
|
2020-10-01 12:22:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (useL1) {
|
2021-10-21 01:30:53 +00:00
|
|
|
surfaceState->setMemoryObjectControlState(args.gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST));
|
2020-10-01 12:22:54 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-07 14:22:26 +02:00
|
|
|
template <>
|
|
|
|
|
bool EncodeSurfaceState<Family>::doBindingTablePrefetch() {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-12 12:39:32 +02:00
|
|
|
template <>
|
|
|
|
|
void EncodeL3State<Family>::encode(CommandContainer &container, bool enableSLM) {
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-17 08:56:05 +01:00
|
|
|
template struct EncodeDispatchKernel<Family>;
|
|
|
|
|
template struct EncodeStates<Family>;
|
2020-02-25 10:23:04 -08:00
|
|
|
template struct EncodeMath<Family>;
|
2020-01-17 08:56:05 +01:00
|
|
|
template struct EncodeMathMMIO<Family>;
|
|
|
|
|
template struct EncodeIndirectParams<Family>;
|
|
|
|
|
template struct EncodeSetMMIO<Family>;
|
|
|
|
|
template struct EncodeL3State<Family>;
|
|
|
|
|
template struct EncodeMediaInterfaceDescriptorLoad<Family>;
|
|
|
|
|
template struct EncodeStateBaseAddress<Family>;
|
|
|
|
|
template struct EncodeStoreMMIO<Family>;
|
|
|
|
|
template struct EncodeSurfaceState<Family>;
|
2020-01-24 14:58:15 +01:00
|
|
|
template struct EncodeAtomic<Family>;
|
|
|
|
|
template struct EncodeSempahore<Family>;
|
2020-01-28 13:50:19 +01:00
|
|
|
template struct EncodeBatchBufferStartOrEnd<Family>;
|
2020-02-21 15:35:08 +01:00
|
|
|
template struct EncodeMiFlushDW<Family>;
|
2020-03-25 10:04:42 +01:00
|
|
|
template struct EncodeWA<Family>;
|
2020-04-03 17:38:09 +02:00
|
|
|
template struct EncodeMemoryPrefetch<Family>;
|
2020-11-16 17:12:08 +00:00
|
|
|
template struct EncodeMiArbCheck<Family>;
|
2021-05-18 02:46:21 +00:00
|
|
|
template struct EncodeComputeMode<Family>;
|
2021-02-26 22:02:57 +00:00
|
|
|
template struct EncodeEnableRayTracing<Family>;
|
2020-01-24 14:58:15 +01:00
|
|
|
} // namespace NEO
|