2020-01-17 08:56:05 +01:00
|
|
|
/*
|
2023-01-05 16:57:56 +00:00
|
|
|
* Copyright (C) 2020-2023 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"
|
2023-07-18 11:48:29 +00:00
|
|
|
#include "shared/source/release_helper/release_helper.h"
|
2020-01-17 08:56:05 +01:00
|
|
|
|
2022-12-29 12:27:52 +00:00
|
|
|
#include "encode_surface_state_args.h"
|
|
|
|
|
|
2022-07-25 15:30:11 +00:00
|
|
|
using Family = NEO::Gen12LpFamily;
|
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"
|
2022-03-18 11:06:51 +00:00
|
|
|
#include "shared/source/command_container/command_encoder_tgllp_and_later.inl"
|
2021-08-03 11:48:35 +00:00
|
|
|
#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 <>
|
2022-08-17 14:58:27 +00:00
|
|
|
size_t EncodeWA<Family>::getAdditionalPipelineSelectSize(Device &device, bool isRcs) {
|
2020-03-25 10:04:42 +01:00
|
|
|
size_t size = 0;
|
2022-12-28 23:30:03 +00:00
|
|
|
const auto &productHelper = device.getProductHelper();
|
2022-12-12 16:43:41 +00:00
|
|
|
if (isRcs && productHelper.is3DPipelineSelectWARequired()) {
|
2023-01-26 03:58:18 +00:00
|
|
|
size += 2 * PreambleHelper<Family>::getCmdSizeForPipelineSelect(device.getRootDeviceEnvironment());
|
2020-03-25 10:04:42 +01:00
|
|
|
}
|
|
|
|
|
return size;
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-19 10:29:36 +01:00
|
|
|
template <>
|
2023-09-12 17:51:43 +00:00
|
|
|
void EncodeComputeMode<Family>::programComputeModeCommand(LinearStream &csr, StateComputeModeProperties &properties, const RootDeviceEnvironment &rootDeviceEnvironment) {
|
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;
|
|
|
|
|
|
2021-12-08 19:03:42 +00:00
|
|
|
STATE_COMPUTE_MODE stateComputeMode = Family::cmdInitStateComputeMode;
|
2021-05-18 02:46:21 +00:00
|
|
|
auto maskBits = stateComputeMode.getMaskBits();
|
|
|
|
|
|
2022-03-07 14:31:53 +00:00
|
|
|
FORCE_NON_COHERENT coherencyValue = (properties.isCoherencyRequired.value == 1) ? FORCE_NON_COHERENT::FORCE_NON_COHERENT_FORCE_DISABLED
|
|
|
|
|
: FORCE_NON_COHERENT::FORCE_NON_COHERENT_FORCE_GPU_NON_COHERENT;
|
|
|
|
|
stateComputeMode.setForceNonCoherent(coherencyValue);
|
|
|
|
|
maskBits |= Family::stateComputeModeForceNonCoherentMask;
|
2021-05-18 02:46:21 +00:00
|
|
|
|
|
|
|
|
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 <>
|
2022-03-09 17:15:48 +00:00
|
|
|
void EncodeWA<Family>::encodeAdditionalPipelineSelect(LinearStream &stream, const PipelineSelectArgs &args,
|
2023-01-26 03:58:18 +00:00
|
|
|
bool is3DPipeline, const RootDeviceEnvironment &rootDeviceEnvironment, bool isRcs) {
|
|
|
|
|
const auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
|
2022-12-12 16:43:41 +00:00
|
|
|
if (productHelper.is3DPipelineSelectWARequired() && isRcs) {
|
2022-03-09 17:15:48 +00:00
|
|
|
PipelineSelectArgs pipelineSelectArgs = args;
|
|
|
|
|
pipelineSelectArgs.is3DPipelineRequired = is3DPipeline;
|
2023-01-26 03:58:18 +00:00
|
|
|
PreambleHelper<Family>::programPipelineSelect(&stream, pipelineSelectArgs, rootDeviceEnvironment);
|
2020-03-25 10:04:42 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
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) {
|
2023-12-11 14:24:36 +00:00
|
|
|
const bool isConstantSurface = args.allocation && args.allocation->getAllocationType() == AllocationType::constantSurface;
|
2021-10-21 01:30:53 +00:00
|
|
|
bool useL1 = args.isReadOnly || isConstantSurface;
|
2020-10-01 12:22:54 +02:00
|
|
|
|
2023-11-30 08:32:25 +00:00
|
|
|
if (debugManager.flags.ForceL1Caching.get() != 1) {
|
2020-10-12 10:13:29 +02:00
|
|
|
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 <>
|
2022-09-13 12:47:58 +00:00
|
|
|
bool EncodeSurfaceState<Family>::isBindingTablePrefetchPreferred() {
|
2020-10-07 14:22:26 +02:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-12 12:39:32 +02:00
|
|
|
template <>
|
|
|
|
|
void EncodeL3State<Family>::encode(CommandContainer &container, bool enableSLM) {
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-06 12:35:32 +00:00
|
|
|
template <>
|
|
|
|
|
void EncodeStoreMMIO<Family>::appendFlags(MI_STORE_REGISTER_MEM *storeRegMem, bool workloadPartition) {
|
|
|
|
|
storeRegMem->setMmioRemapEnable(true);
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-15 01:10:00 +00:00
|
|
|
template <>
|
|
|
|
|
void EncodeComputeMode<Family>::adjustPipelineSelect(CommandContainer &container, const NEO::KernelDescriptor &kernelDescriptor) {
|
|
|
|
|
|
|
|
|
|
PipelineSelectArgs pipelineSelectArgs;
|
|
|
|
|
pipelineSelectArgs.systolicPipelineSelectMode = kernelDescriptor.kernelAttributes.flags.usesSystolicPipelineSelectMode;
|
2023-03-16 10:09:21 +00:00
|
|
|
pipelineSelectArgs.systolicPipelineSelectSupport = container.systolicModeSupportRef();
|
2022-09-15 01:10:00 +00:00
|
|
|
|
|
|
|
|
PreambleHelper<Family>::programPipelineSelect(container.getCommandStream(),
|
|
|
|
|
pipelineSelectArgs,
|
2023-01-26 03:58:18 +00:00
|
|
|
container.getDevice()->getRootDeviceEnvironment());
|
2022-09-15 01:10:00 +00:00
|
|
|
}
|
|
|
|
|
|
2023-12-21 12:10:25 +00:00
|
|
|
} // namespace NEO
|
2023-11-23 13:58:58 +00:00
|
|
|
|
2023-12-21 12:10:25 +00:00
|
|
|
#include "shared/source/command_container/command_encoder_enablers.inl"
|
2023-12-21 13:16:43 +00:00
|
|
|
|
2023-12-21 12:10:25 +00:00
|
|
|
namespace NEO {
|
2020-01-17 08:56:05 +01:00
|
|
|
template struct EncodeL3State<Family>;
|
2023-12-21 12:10:25 +00:00
|
|
|
|
|
|
|
|
template void EncodeDispatchKernel<Family>::programBarrierEnable<Family::INTERFACE_DESCRIPTOR_DATA>(Family::INTERFACE_DESCRIPTOR_DATA &interfaceDescriptor, uint32_t value, const HardwareInfo &hwInfo);
|
|
|
|
|
template void InOrderPatchCommandHelpers::PatchCmd<Family>::patchComputeWalker(uint64_t appendCounterValue);
|
2020-01-24 14:58:15 +01:00
|
|
|
} // namespace NEO
|