2018-03-30 23:57:51 +08:00
|
|
|
/*
|
2022-01-04 01:29:57 +08:00
|
|
|
* Copyright (C) 2018-2022 Intel Corporation
|
2018-03-30 23:57:51 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2018-03-30 23:57:51 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2022-06-24 21:56:25 +08:00
|
|
|
#include "shared/source/gen8/hw_cmds.h"
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/gen8/hw_info.h"
|
2020-02-24 17:22:30 +08:00
|
|
|
|
2021-08-03 19:48:35 +08:00
|
|
|
#include "opencl/source/command_queue/gpgpu_walker_bdw_and_later.inl"
|
|
|
|
#include "opencl/source/command_queue/hardware_interface_bdw_and_later.inl"
|
2018-03-30 23:57:51 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2018-03-30 23:57:51 +08:00
|
|
|
|
|
|
|
template <>
|
2022-07-25 23:30:11 +08:00
|
|
|
void GpgpuWalkerHelper<Gen8Family>::applyWADisableLSQCROPERFforOCL(NEO::LinearStream *pCommandStream, const Kernel &kernel, bool disablePerfMode) {
|
2018-03-30 23:57:51 +08:00
|
|
|
if (disablePerfMode) {
|
2021-03-22 23:26:03 +08:00
|
|
|
if (kernel.getKernelInfo().kernelDescriptor.kernelAttributes.flags.usesFencesForReadWriteImages) {
|
2018-03-30 23:57:51 +08:00
|
|
|
// Set bit L3SQC_BIT_LQSC_RO_PERF_DIS in L3SQC_REG4
|
2022-07-25 23:30:11 +08:00
|
|
|
GpgpuWalkerHelper<Gen8Family>::addAluReadModifyWriteRegister(pCommandStream, L3SQC_REG4, AluRegisters::OPCODE_OR, L3SQC_BIT_LQSC_RO_PERF_DIS);
|
2018-03-30 23:57:51 +08:00
|
|
|
}
|
|
|
|
} else {
|
2021-03-22 23:26:03 +08:00
|
|
|
if (kernel.getKernelInfo().kernelDescriptor.kernelAttributes.flags.usesFencesForReadWriteImages) {
|
2018-03-30 23:57:51 +08:00
|
|
|
// Add PIPE_CONTROL with CS_Stall to wait till GPU finishes its work
|
2022-07-25 23:30:11 +08:00
|
|
|
typedef typename Gen8Family::PIPE_CONTROL PIPE_CONTROL;
|
2021-07-09 20:14:05 +08:00
|
|
|
auto pipeControlSpace = reinterpret_cast<PIPE_CONTROL *>(pCommandStream->getSpace(sizeof(PIPE_CONTROL)));
|
2022-07-25 23:30:11 +08:00
|
|
|
auto pipeControl = Gen8Family::cmdInitPipeControl;
|
2021-07-09 20:14:05 +08:00
|
|
|
pipeControl.setCommandStreamerStallEnable(true);
|
|
|
|
*pipeControlSpace = pipeControl;
|
2018-03-30 23:57:51 +08:00
|
|
|
// Clear bit L3SQC_BIT_LQSC_RO_PERF_DIS in L3SQC_REG4
|
2022-07-25 23:30:11 +08:00
|
|
|
GpgpuWalkerHelper<Gen8Family>::addAluReadModifyWriteRegister(pCommandStream, L3SQC_REG4, AluRegisters::OPCODE_AND, ~L3SQC_BIT_LQSC_RO_PERF_DIS);
|
2018-03-30 23:57:51 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
template <>
|
2022-07-25 23:30:11 +08:00
|
|
|
size_t GpgpuWalkerHelper<Gen8Family>::getSizeForWADisableLSQCROPERFforOCL(const Kernel *pKernel) {
|
|
|
|
typedef typename Gen8Family::MI_LOAD_REGISTER_REG MI_LOAD_REGISTER_REG;
|
|
|
|
typedef typename Gen8Family::MI_LOAD_REGISTER_IMM MI_LOAD_REGISTER_IMM;
|
|
|
|
typedef typename Gen8Family::PIPE_CONTROL PIPE_CONTROL;
|
|
|
|
typedef typename Gen8Family::MI_MATH MI_MATH;
|
|
|
|
typedef typename Gen8Family::MI_MATH_ALU_INST_INLINE MI_MATH_ALU_INST_INLINE;
|
2018-03-30 23:57:51 +08:00
|
|
|
size_t n = 0;
|
2021-03-22 23:26:03 +08:00
|
|
|
if (pKernel->getKernelInfo().kernelDescriptor.kernelAttributes.flags.usesFencesForReadWriteImages) {
|
2018-03-30 23:57:51 +08:00
|
|
|
n += sizeof(PIPE_CONTROL) +
|
|
|
|
(2 * sizeof(MI_LOAD_REGISTER_REG) +
|
|
|
|
sizeof(MI_LOAD_REGISTER_IMM) +
|
|
|
|
sizeof(PIPE_CONTROL) +
|
|
|
|
sizeof(MI_MATH) +
|
|
|
|
NUM_ALU_INST_FOR_READ_MODIFY_WRITE * sizeof(MI_MATH_ALU_INST_INLINE)) *
|
|
|
|
2; // For 2 WADisableLSQCROPERFforOCL WAs
|
|
|
|
}
|
|
|
|
return n;
|
|
|
|
}
|
|
|
|
|
2022-07-25 23:30:11 +08:00
|
|
|
template class HardwareInterface<Gen8Family>;
|
2018-09-27 21:22:36 +08:00
|
|
|
|
2022-07-25 23:30:11 +08:00
|
|
|
template class GpgpuWalkerHelper<Gen8Family>;
|
2018-03-30 23:57:51 +08:00
|
|
|
|
2022-07-25 23:30:11 +08:00
|
|
|
template struct EnqueueOperation<Gen8Family>;
|
2018-04-09 22:39:32 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|