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