Skip to content

Commit 9119a1e

Browse files
MihaauCompute-Runtime-Automation
authored andcommitted
refactor: adjust file names after pre-gen12 removal 6/n
Related-To: NEO-12681 Signed-off-by: Michał Pryba <[email protected]>
1 parent 2cdd9f4 commit 9119a1e

9 files changed

+245
-286
lines changed

opencl/source/gen12lp/hardware_commands_helper_gen12lp.cpp

Lines changed: 108 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,126 @@
11
/*
2-
* Copyright (C) 2019-2024 Intel Corporation
2+
* Copyright (C) 2019-2025 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
66
*/
77

88
#include "shared/source/gen12lp/hw_cmds.h"
9+
#include "shared/source/helpers/flat_batch_buffer_helper.h"
10+
#include "shared/source/helpers/gfx_core_helper.h"
11+
#include "shared/source/helpers/pipe_control_args.h"
912

1013
#include "opencl/source/command_queue/command_queue.h"
1114
#include "opencl/source/helpers/hardware_commands_helper.h"
1215
#include "opencl/source/helpers/hardware_commands_helper_base.inl"
13-
#include "opencl/source/helpers/hardware_commands_helper_bdw_and_later.inl"
16+
#include "opencl/source/kernel/kernel.h"
1417

1518
namespace NEO {
1619
using FamilyType = Gen12LpFamily;
1720

21+
template <typename GfxFamily>
22+
typename HardwareCommandsHelper<GfxFamily>::INTERFACE_DESCRIPTOR_DATA *HardwareCommandsHelper<GfxFamily>::getInterfaceDescriptor(
23+
const IndirectHeap &indirectHeap,
24+
uint64_t offsetInterfaceDescriptor,
25+
HardwareCommandsHelper<GfxFamily>::INTERFACE_DESCRIPTOR_DATA *inlineInterfaceDescriptor) {
26+
return static_cast<INTERFACE_DESCRIPTOR_DATA *>(ptrOffset(indirectHeap.getCpuBase(), (size_t)offsetInterfaceDescriptor));
27+
}
28+
29+
template <typename GfxFamily>
30+
uint32_t HardwareCommandsHelper<GfxFamily>::additionalSizeRequiredDsh() {
31+
return sizeof(INTERFACE_DESCRIPTOR_DATA);
32+
}
33+
34+
template <typename GfxFamily>
35+
size_t HardwareCommandsHelper<GfxFamily>::getSizeRequiredCS() {
36+
size_t size = 2 * sizeof(typename GfxFamily::MEDIA_STATE_FLUSH) +
37+
sizeof(typename GfxFamily::MEDIA_INTERFACE_DESCRIPTOR_LOAD);
38+
return size;
39+
}
40+
41+
template <typename GfxFamily>
42+
void HardwareCommandsHelper<GfxFamily>::sendMediaStateFlush(
43+
LinearStream &commandStream,
44+
size_t offsetInterfaceDescriptorData) {
45+
46+
using MEDIA_STATE_FLUSH = typename GfxFamily::MEDIA_STATE_FLUSH;
47+
auto pCmd = commandStream.getSpaceForCmd<MEDIA_STATE_FLUSH>();
48+
MEDIA_STATE_FLUSH cmd = GfxFamily::cmdInitMediaStateFlush;
49+
50+
cmd.setInterfaceDescriptorOffset(static_cast<uint32_t>(offsetInterfaceDescriptorData));
51+
*pCmd = cmd;
52+
}
53+
54+
template <typename GfxFamily>
55+
void HardwareCommandsHelper<GfxFamily>::sendMediaInterfaceDescriptorLoad(
56+
LinearStream &commandStream,
57+
size_t offsetInterfaceDescriptorData,
58+
size_t sizeInterfaceDescriptorData) {
59+
{
60+
using MEDIA_STATE_FLUSH = typename GfxFamily::MEDIA_STATE_FLUSH;
61+
auto pCmd = commandStream.getSpaceForCmd<MEDIA_STATE_FLUSH>();
62+
*pCmd = GfxFamily::cmdInitMediaStateFlush;
63+
}
64+
65+
{
66+
using MEDIA_INTERFACE_DESCRIPTOR_LOAD = typename GfxFamily::MEDIA_INTERFACE_DESCRIPTOR_LOAD;
67+
auto pCmd = commandStream.getSpaceForCmd<MEDIA_INTERFACE_DESCRIPTOR_LOAD>();
68+
MEDIA_INTERFACE_DESCRIPTOR_LOAD cmd = GfxFamily::cmdInitMediaInterfaceDescriptorLoad;
69+
cmd.setInterfaceDescriptorDataStartAddress(static_cast<uint32_t>(offsetInterfaceDescriptorData));
70+
cmd.setInterfaceDescriptorTotalLength(static_cast<uint32_t>(sizeInterfaceDescriptorData));
71+
*pCmd = cmd;
72+
}
73+
}
74+
75+
template <typename GfxFamily>
76+
template <typename WalkerType>
77+
size_t HardwareCommandsHelper<GfxFamily>::sendCrossThreadData(
78+
IndirectHeap &indirectHeap,
79+
Kernel &kernel,
80+
bool inlineDataProgrammingRequired,
81+
WalkerType *walkerCmd,
82+
uint32_t &sizeCrossThreadData,
83+
uint64_t scratchAddress,
84+
const RootDeviceEnvironment &rootDeviceEnvironment) {
85+
indirectHeap.align(GfxFamily::cacheLineSize);
86+
87+
auto pImplicitArgs = kernel.getImplicitArgs();
88+
if (pImplicitArgs) {
89+
const auto &kernelDescriptor = kernel.getDescriptor();
90+
91+
auto isHwLocalIdGeneration = false;
92+
auto sizeForImplicitArgsProgramming = ImplicitArgsHelper::getSizeForImplicitArgsPatching(pImplicitArgs, kernelDescriptor, isHwLocalIdGeneration, rootDeviceEnvironment);
93+
94+
auto implicitArgsGpuVA = indirectHeap.getGraphicsAllocation()->getGpuAddress() + indirectHeap.getUsed();
95+
auto ptrToPatchImplicitArgs = indirectHeap.getSpace(sizeForImplicitArgsProgramming);
96+
97+
ImplicitArgsHelper::patchImplicitArgs(ptrToPatchImplicitArgs, *pImplicitArgs, kernelDescriptor, {}, rootDeviceEnvironment, nullptr);
98+
99+
auto implicitArgsCrossThreadPtr = ptrOffset(reinterpret_cast<uint64_t *>(kernel.getCrossThreadData()), kernelDescriptor.payloadMappings.implicitArgs.implicitArgsBuffer);
100+
*implicitArgsCrossThreadPtr = implicitArgsGpuVA;
101+
}
102+
auto offsetCrossThreadData = indirectHeap.getUsed();
103+
char *pDest = nullptr;
104+
105+
pDest = static_cast<char *>(indirectHeap.getSpace(sizeCrossThreadData));
106+
memcpy_s(pDest, sizeCrossThreadData, kernel.getCrossThreadData(), sizeCrossThreadData);
107+
108+
if (debugManager.flags.AddPatchInfoCommentsForAUBDump.get()) {
109+
FlatBatchBufferHelper::fixCrossThreadDataInfo(kernel.getPatchInfoDataList(), offsetCrossThreadData, indirectHeap.getGraphicsAllocation()->getGpuAddress());
110+
}
111+
112+
return offsetCrossThreadData + static_cast<size_t>(indirectHeap.getHeapGpuStartOffset());
113+
}
114+
115+
template <typename GfxFamily>
116+
template <typename WalkerType>
117+
void HardwareCommandsHelper<GfxFamily>::setInterfaceDescriptorOffset(
118+
WalkerType *walkerCmd,
119+
uint32_t &interfaceDescriptorIndex) {
120+
121+
walkerCmd->setInterfaceDescriptorOffset(interfaceDescriptorIndex++);
122+
}
123+
18124
template <>
19125
size_t HardwareCommandsHelper<FamilyType>::getSizeRequiredCS() {
20126
size_t size = 2 * sizeof(typename FamilyType::MEDIA_STATE_FLUSH) +

opencl/source/helpers/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ set(RUNTIME_SRCS_HELPERS_BASE
3434
${CMAKE_CURRENT_SOURCE_DIR}/gmm_types_converter.h
3535
${CMAKE_CURRENT_SOURCE_DIR}/hardware_commands_helper.h
3636
${CMAKE_CURRENT_SOURCE_DIR}/hardware_commands_helper_base.inl
37-
${CMAKE_CURRENT_SOURCE_DIR}/hardware_commands_helper_bdw_and_later.inl
3837
${CMAKE_CURRENT_SOURCE_DIR}/helper_options.cpp
3938
${CMAKE_CURRENT_SOURCE_DIR}/implicit_scaling_ocl.cpp
4039
${CMAKE_CURRENT_SOURCE_DIR}/mipmap.cpp

opencl/source/helpers/hardware_commands_helper_bdw_and_later.inl

Lines changed: 0 additions & 122 deletions
This file was deleted.

shared/source/command_stream/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ set(NEO_CORE_COMMAND_STREAM
1818
${CMAKE_CURRENT_SOURCE_DIR}/command_stream_receiver_hw_base.inl
1919
${CMAKE_CURRENT_SOURCE_DIR}/command_stream_receiver_simulated_common_hw.h
2020
${CMAKE_CURRENT_SOURCE_DIR}/command_stream_receiver_simulated_common_hw_base.inl
21-
${CMAKE_CURRENT_SOURCE_DIR}/command_stream_receiver_simulated_common_hw_bdw_and_later.inl
2221
${CMAKE_CURRENT_SOURCE_DIR}/command_stream_receiver_simulated_hw.h
2322
${CMAKE_CURRENT_SOURCE_DIR}/command_stream_receiver_with_aub_dump.h
2423
${CMAKE_CURRENT_SOURCE_DIR}/command_stream_receiver_with_aub_dump.inl

shared/source/command_stream/command_stream_receiver_simulated_common_hw_bdw_and_later.inl

Lines changed: 0 additions & 38 deletions
This file was deleted.

shared/source/gen12lp/command_stream_receiver_simulated_common_hw_gen12lp.cpp

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,42 @@
11
/*
2-
* Copyright (C) 2019-2023 Intel Corporation
2+
* Copyright (C) 2019-2025 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
66
*/
77

8-
#include "shared/source/command_stream/command_stream_receiver_simulated_common_hw_bdw_and_later.inl"
8+
#include "shared/source/command_stream/command_stream_receiver_simulated_common_hw_base.inl"
99

1010
namespace NEO {
1111
typedef Gen12LpFamily Family;
1212

13+
template <typename GfxFamily>
14+
void CommandStreamReceiverSimulatedCommonHw<GfxFamily>::initGlobalMMIO() {
15+
for (auto &mmioPair : AUBFamilyMapper<GfxFamily>::globalMMIO) {
16+
stream->writeMMIO(mmioPair.first, mmioPair.second);
17+
}
18+
}
19+
20+
template <typename GfxFamily>
21+
uint32_t CommandStreamReceiverSimulatedCommonHw<GfxFamily>::getMemoryBankForGtt() const {
22+
return MemoryBanks::getBank(getDeviceIndex());
23+
}
24+
25+
template <typename GfxFamily>
26+
const AubMemDump::LrcaHelper &CommandStreamReceiverSimulatedCommonHw<GfxFamily>::getCsTraits(aub_stream::EngineType engineType) {
27+
return *AUBFamilyMapper<GfxFamily>::csTraits[engineType];
28+
}
29+
30+
template <typename GfxFamily>
31+
void CommandStreamReceiverSimulatedCommonHw<GfxFamily>::initEngineMMIO() {
32+
auto mmioList = AUBFamilyMapper<GfxFamily>::perEngineMMIO[osContext->getEngineType()];
33+
34+
DEBUG_BREAK_IF(!mmioList);
35+
for (auto &mmioPair : *mmioList) {
36+
stream->writeMMIO(mmioPair.first, mmioPair.second);
37+
}
38+
}
39+
1340
template <>
1441
void CommandStreamReceiverSimulatedCommonHw<Family>::initGlobalMMIO() {
1542
for (auto &mmioPair : AUBFamilyMapper<Family>::globalMMIO) {

0 commit comments

Comments
 (0)