1 /*
2  * Copyright (C) 2019-2021 Intel Corporation
3  *
4  * SPDX-License-Identifier: MIT
5  *
6  */
7 
8 #include "shared/source/gen12lp/hw_info.h"
9 #include "shared/source/gmm_helper/gmm.h"
10 #include "shared/source/gmm_helper/resource_info.h"
11 #include "shared/source/memory_manager/graphics_allocation.h"
12 
13 #include "opencl/source/command_queue/gpgpu_walker_bdw_and_later.inl"
14 #include "opencl/source/command_queue/gpgpu_walker_disabled_device_enqueue.inl"
15 #include "opencl/source/command_queue/hardware_interface_bdw_and_later.inl"
16 
17 namespace NEO {
18 
19 template <>
adjustMiStoreRegMemMode(MI_STORE_REG_MEM<TGLLPFamily> * storeCmd)20 void GpgpuWalkerHelper<TGLLPFamily>::adjustMiStoreRegMemMode(MI_STORE_REG_MEM<TGLLPFamily> *storeCmd) {
21     storeCmd->setMmioRemapEnable(true);
22 }
23 
24 template <>
dispatchWorkarounds(LinearStream * commandStream,CommandQueue & commandQueue,Kernel & kernel,const bool & enable)25 void HardwareInterface<TGLLPFamily>::dispatchWorkarounds(
26     LinearStream *commandStream,
27     CommandQueue &commandQueue,
28     Kernel &kernel,
29     const bool &enable) {
30 
31     using MI_LOAD_REGISTER_IMM = typename TGLLPFamily::MI_LOAD_REGISTER_IMM;
32     using PIPE_CONTROL = typename TGLLPFamily::PIPE_CONTROL;
33 
34     if (kernel.requiresWaDisableRccRhwoOptimization()) {
35 
36         PIPE_CONTROL cmdPipeControl = TGLLPFamily::cmdInitPipeControl;
37         cmdPipeControl.setCommandStreamerStallEnable(true);
38         auto pCmdPipeControl = commandStream->getSpaceForCmd<PIPE_CONTROL>();
39         *pCmdPipeControl = cmdPipeControl;
40 
41         uint32_t value = enable ? 0x40004000 : 0x40000000;
42         NEO::LriHelper<TGLLPFamily>::program(commandStream,
43                                              0x7010,
44                                              value,
45                                              false);
46     }
47 }
48 
49 template <>
getSizeForWaDisableRccRhwoOptimization(const Kernel * pKernel)50 size_t GpgpuWalkerHelper<TGLLPFamily>::getSizeForWaDisableRccRhwoOptimization(const Kernel *pKernel) {
51     if (pKernel->requiresWaDisableRccRhwoOptimization()) {
52         return (2 * (sizeof(TGLLPFamily::PIPE_CONTROL) + sizeof(TGLLPFamily::MI_LOAD_REGISTER_IMM)));
53     }
54     return 0u;
55 }
56 
57 template class HardwareInterface<TGLLPFamily>;
58 
59 template class GpgpuWalkerHelper<TGLLPFamily>;
60 
61 template struct EnqueueOperation<TGLLPFamily>;
62 
63 } // namespace NEO
64