1 /*
2  * Copyright (C) 2018-2021 Intel Corporation
3  *
4  * SPDX-License-Identifier: MIT
5  *
6  */
7 
8 #include "shared/source/command_container/command_encoder.h"
9 #include "shared/source/gen9/hw_cmds.h"
10 #include "shared/source/helpers/populate_factory.h"
11 
12 #include "opencl/source/device_queue/device_queue_hw.h"
13 #include "opencl/source/device_queue/device_queue_hw_profiling.inl"
14 #include "opencl/source/device_queue/device_queue_hw_skl_and_later.inl"
15 
16 namespace NEO {
17 typedef SKLFamily Family;
18 static auto gfxCore = IGFX_GEN9_CORE;
19 
20 template <>
populateFactoryTable()21 void populateFactoryTable<DeviceQueueHw<Family>>() {
22     extern DeviceQueueCreateFunc deviceQueueFactory[IGFX_MAX_CORE];
23     deviceQueueFactory[gfxCore] = DeviceQueueHw<Family>::create;
24 }
25 
26 template <>
getWaCommandsSize()27 size_t DeviceQueueHw<Family>::getWaCommandsSize() {
28     return sizeof(Family::MI_ARB_CHECK) +
29            sizeof(Family::MI_ATOMIC) +
30            sizeof(Family::MI_ARB_CHECK) +
31            sizeof(Family::PIPE_CONTROL) +
32            sizeof(Family::PIPE_CONTROL);
33 }
34 
35 template <>
addArbCheckCmdWa()36 void DeviceQueueHw<Family>::addArbCheckCmdWa() {
37     auto arbCheck = slbCS.getSpaceForCmd<Family::MI_ARB_CHECK>();
38     *arbCheck = Family::cmdInitArbCheck;
39 }
40 
41 template <>
addMiAtomicCmdWa(uint64_t atomicOpPlaceholder)42 void DeviceQueueHw<Family>::addMiAtomicCmdWa(uint64_t atomicOpPlaceholder) {
43     EncodeAtomic<Family>::programMiAtomic(slbCS,
44                                           atomicOpPlaceholder,
45                                           Family::MI_ATOMIC::ATOMIC_OPCODES::ATOMIC_8B_INCREMENT,
46                                           Family::MI_ATOMIC::DATA_SIZE::DATA_SIZE_QWORD,
47                                           0x1u, 0x1u, 0x0u, 0x0u);
48 }
49 
50 template <>
addLriCmdWa(bool setArbCheck)51 void DeviceQueueHw<Family>::addLriCmdWa(bool setArbCheck) {}
52 
53 template <>
addPipeControlCmdWa(bool isNoopCmd)54 void DeviceQueueHw<Family>::addPipeControlCmdWa(bool isNoopCmd) {
55     auto pipeControl = slbCS.getSpaceForCmd<Family::PIPE_CONTROL>();
56     if (isNoopCmd)
57         memset(pipeControl, 0x0, sizeof(Family::PIPE_CONTROL));
58     else
59         initPipeControl(pipeControl);
60 }
61 
62 template class DeviceQueueHw<Family>;
63 } // namespace NEO
64