1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
|
/*
* Copyright (C) 2019-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/command_stream/linear_stream.h"
#include "shared/source/command_stream/preemption.h"
#include "shared/source/device/device.h"
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/source/gen_common/reg_configs_common.h"
#include "shared/source/helpers/aligned_memory.h"
#include "shared/source/helpers/gfx_core_helper.h"
#include "shared/source/helpers/preamble.h"
#include "shared/source/helpers/register_offsets.h"
#include <cstddef>
namespace NEO {
template <typename GfxFamily>
std::vector<int32_t> PreambleHelper<GfxFamily>::getSupportedThreadArbitrationPolicies() {
return {};
}
template <typename GfxFamily>
void PreambleHelper<GfxFamily>::programGenSpecificPreambleWorkArounds(LinearStream *pCommandStream, const HardwareInfo &hwInfo) {
}
template <typename GfxFamily>
void PreambleHelper<GfxFamily>::programSemaphoreDelay(LinearStream *pCommandStream, bool isBcs) {
if (debugManager.flags.ForceSemaphoreDelayBetweenWaits.get() > -1) {
uint32_t valueOfNewSemaphoreDelay = debugManager.flags.ForceSemaphoreDelayBetweenWaits.get();
LriHelper<GfxFamily>::program(pCommandStream,
RegisterOffsets::semaWaitPoll,
valueOfNewSemaphoreDelay,
true,
isBcs);
};
}
template <typename GfxFamily>
size_t PreambleHelper<GfxFamily>::getSemaphoreDelayCommandSize() {
return sizeof(MI_LOAD_REGISTER_IMM);
}
template <typename GfxFamily>
size_t PreambleHelper<GfxFamily>::getAdditionalCommandsSize(const Device &device) {
size_t totalSize = PreemptionHelper::getRequiredPreambleSize<GfxFamily>(device);
bool debuggingEnabled = device.getDebugger() != nullptr;
totalSize += getKernelDebuggingCommandsSize(debuggingEnabled);
return totalSize;
}
template <typename GfxFamily>
void PreambleHelper<GfxFamily>::programPreamble(LinearStream *pCommandStream, Device &device, uint32_t l3Config,
GraphicsAllocation *preemptionCsr, bool isBcs) {
programL3(pCommandStream, l3Config, isBcs);
programPreemption(pCommandStream, device, preemptionCsr);
programGenSpecificPreambleWorkArounds(pCommandStream, device.getHardwareInfo());
programSemaphoreDelay(pCommandStream, isBcs);
}
template <typename GfxFamily>
void PreambleHelper<GfxFamily>::programPreemption(LinearStream *pCommandStream, Device &device, GraphicsAllocation *preemptionCsr) {
if (preemptionCsr) {
PreemptionHelper::programCsrBaseAddress<GfxFamily>(*pCommandStream, device, preemptionCsr);
}
}
template <typename GfxFamily>
size_t PreambleHelper<GfxFamily>::getKernelDebuggingCommandsSize(bool debuggingActive) {
if (debuggingActive) {
return 2 * sizeof(MI_LOAD_REGISTER_IMM);
}
return 0;
}
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;
}
template <typename GfxFamily>
bool PreambleHelper<GfxFamily>::isSystolicModeConfigurable(const RootDeviceEnvironment &rootDeviceEnvironment) {
const auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo();
return productHelper.isSystolicModeConfigurable(hwInfo);
}
} // namespace NEO
|