2017-12-21 00:45:38 +01:00
|
|
|
/*
|
2024-04-19 14:20:27 +00:00
|
|
|
* Copyright (C) 2019-2024 Intel Corporation
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
2018-09-18 09:11:08 +02:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/command_stream/linear_stream.h"
|
|
|
|
|
#include "shared/source/command_stream/preemption.h"
|
|
|
|
|
#include "shared/source/device/device.h"
|
2023-01-27 16:02:13 +00:00
|
|
|
#include "shared/source/execution_environment/root_device_environment.h"
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/helpers/aligned_memory.h"
|
2023-02-01 16:23:01 +00:00
|
|
|
#include "shared/source/helpers/gfx_core_helper.h"
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/helpers/preamble.h"
|
2020-06-24 14:53:51 +02:00
|
|
|
#include "shared/source/helpers/register_offsets.h"
|
2020-02-24 10:22:30 +01:00
|
|
|
|
2019-02-27 11:39:32 +01:00
|
|
|
#include "reg_configs_common.h"
|
|
|
|
|
|
2017-12-21 00:45:38 +01:00
|
|
|
#include <cstddef>
|
|
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
namespace NEO {
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2021-09-09 08:32:45 +00:00
|
|
|
template <typename GfxFamily>
|
2022-03-07 17:00:26 +00:00
|
|
|
std::vector<int32_t> PreambleHelper<GfxFamily>::getSupportedThreadArbitrationPolicies() {
|
|
|
|
|
return {};
|
2021-09-09 08:32:45 +00:00
|
|
|
}
|
|
|
|
|
|
2017-12-21 00:45:38 +01:00
|
|
|
template <typename GfxFamily>
|
|
|
|
|
void PreambleHelper<GfxFamily>::programGenSpecificPreambleWorkArounds(LinearStream *pCommandStream, const HardwareInfo &hwInfo) {
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-24 14:53:51 +02:00
|
|
|
template <typename GfxFamily>
|
2024-04-19 14:20:27 +00:00
|
|
|
void PreambleHelper<GfxFamily>::programSemaphoreDelay(LinearStream *pCommandStream, bool isBcs) {
|
2023-11-30 08:32:25 +00:00
|
|
|
if (debugManager.flags.ForceSemaphoreDelayBetweenWaits.get() > -1) {
|
|
|
|
|
uint32_t valueOfNewSemaphoreDelay = debugManager.flags.ForceSemaphoreDelayBetweenWaits.get();
|
2020-06-24 14:53:51 +02:00
|
|
|
LriHelper<GfxFamily>::program(pCommandStream,
|
2023-12-04 13:53:09 +00:00
|
|
|
RegisterOffsets::semaWaitPoll,
|
2020-06-24 14:53:51 +02:00
|
|
|
valueOfNewSemaphoreDelay,
|
2024-04-19 14:20:27 +00:00
|
|
|
true,
|
|
|
|
|
isBcs);
|
2020-06-24 14:53:51 +02:00
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
|
size_t PreambleHelper<GfxFamily>::getSemaphoreDelayCommandSize() {
|
|
|
|
|
return sizeof(MI_LOAD_REGISTER_IMM);
|
|
|
|
|
}
|
|
|
|
|
|
2017-12-21 00:45:38 +01:00
|
|
|
template <typename GfxFamily>
|
2018-02-20 08:11:24 +01:00
|
|
|
size_t PreambleHelper<GfxFamily>::getAdditionalCommandsSize(const Device &device) {
|
2018-11-05 11:52:19 +01:00
|
|
|
size_t totalSize = PreemptionHelper::getRequiredPreambleSize<GfxFamily>(device);
|
2023-08-04 09:19:46 +00:00
|
|
|
bool debuggingEnabled = device.getDebugger() != nullptr;
|
2020-10-27 16:00:56 +01:00
|
|
|
totalSize += getKernelDebuggingCommandsSize(debuggingEnabled);
|
2018-04-13 11:50:57 +02:00
|
|
|
return totalSize;
|
2017-12-21 00:45:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
2018-03-29 09:06:33 +02:00
|
|
|
void PreambleHelper<GfxFamily>::programPreamble(LinearStream *pCommandStream, Device &device, uint32_t l3Config,
|
2024-04-19 14:20:27 +00:00
|
|
|
GraphicsAllocation *preemptionCsr, bool isBcs) {
|
|
|
|
|
programL3(pCommandStream, l3Config, isBcs);
|
2023-09-12 17:51:43 +00:00
|
|
|
programPreemption(pCommandStream, device, preemptionCsr);
|
2018-01-08 15:58:02 +01:00
|
|
|
programGenSpecificPreambleWorkArounds(pCommandStream, device.getHardwareInfo());
|
2024-04-19 14:20:27 +00:00
|
|
|
programSemaphoreDelay(pCommandStream, isBcs);
|
2018-01-08 15:58:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
2023-09-12 17:51:43 +00:00
|
|
|
void PreambleHelper<GfxFamily>::programPreemption(LinearStream *pCommandStream, Device &device, GraphicsAllocation *preemptionCsr) {
|
|
|
|
|
PreemptionHelper::programCsrBaseAddress<GfxFamily>(*pCommandStream, device, preemptionCsr);
|
2017-12-21 00:45:38 +01:00
|
|
|
}
|
|
|
|
|
|
2018-04-13 11:50:57 +02:00
|
|
|
template <typename GfxFamily>
|
|
|
|
|
size_t PreambleHelper<GfxFamily>::getKernelDebuggingCommandsSize(bool debuggingActive) {
|
|
|
|
|
if (debuggingActive) {
|
|
|
|
|
return 2 * sizeof(MI_LOAD_REGISTER_IMM);
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-06 11:54:04 +02:00
|
|
|
template <typename GfxFamily>
|
|
|
|
|
uint32_t PreambleHelper<GfxFamily>::getScratchSizeValueToProgramMediaVfeState(uint32_t scratchSize) {
|
|
|
|
|
scratchSize >>= static_cast<uint32_t>(MemoryConstants::kiloByteShiftSize);
|
|
|
|
|
uint32_t valueToProgram = 0;
|
|
|
|
|
while (scratchSize >>= 1) {
|
|
|
|
|
valueToProgram++;
|
|
|
|
|
}
|
|
|
|
|
return valueToProgram;
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-14 13:03:02 +00:00
|
|
|
template <typename GfxFamily>
|
2023-01-27 16:02:13 +00:00
|
|
|
bool PreambleHelper<GfxFamily>::isSystolicModeConfigurable(const RootDeviceEnvironment &rootDeviceEnvironment) {
|
|
|
|
|
const auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
|
|
|
|
|
auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo();
|
2022-12-12 16:43:41 +00:00
|
|
|
return productHelper.isSystolicModeConfigurable(hwInfo);
|
2022-09-14 13:03:02 +00:00
|
|
|
}
|
|
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
} // namespace NEO
|