Skip to content

Commit b16bd14

Browse files
Change virtual class HardwareInterface to static
Change-Id: I4f1f59ecb51b95041dc6dcc6c606b94595813f53 Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
1 parent f3b1d73 commit b16bd14

20 files changed

+268
-342
lines changed

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,6 @@ include_directories(${IGDRCL_SOURCE_DIR}/runtime/gen_common/reg_configs${BRANCH_
534534
include_directories(${IGDRCL_SOURCE_DIR}/runtime/gmm_helper/${BRANCH_DIR_SUFFIX})
535535
include_directories(${IGDRCL_SOURCE_DIR}/runtime/gmm_helper/client_context${BRANCH_DIR_SUFFIX})
536536
include_directories(${IGDRCL_SOURCE_DIR}/runtime/gmm_helper/gmm_memory${BRANCH_DIR_SUFFIX})
537-
include_directories(${IGDRCL_SOURCE_DIR}/runtime/command_queue/hardware_interface${BRANCH_DIR_SUFFIX})
538537

539538
set(HW_SRC_INCLUDE_PATH ${IGDRCL_SOURCE_DIR}/runtime/gen_common)
540539

runtime/command_queue/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ set(RUNTIME_SRCS_COMMAND_QUEUE
3434
${CMAKE_CURRENT_SOURCE_DIR}/flush.h
3535
${CMAKE_CURRENT_SOURCE_DIR}/gpgpu_walker.h
3636
${CMAKE_CURRENT_SOURCE_DIR}/gpgpu_walker.inl
37+
${CMAKE_CURRENT_SOURCE_DIR}/hardware_interface.h
38+
${CMAKE_CURRENT_SOURCE_DIR}/hardware_interface.inl
3739
${CMAKE_CURRENT_SOURCE_DIR}/local_id_gen.cpp
3840
${CMAKE_CURRENT_SOURCE_DIR}/local_id_gen.h
3941
${CMAKE_CURRENT_SOURCE_DIR}/local_id_gen.inl
4042
${CMAKE_CURRENT_SOURCE_DIR}/local_id_gen_avx2.cpp
4143
${CMAKE_CURRENT_SOURCE_DIR}/local_id_gen_sse4.cpp
4244
${CMAKE_CURRENT_SOURCE_DIR}/local_work_size.cpp
43-
${CMAKE_CURRENT_SOURCE_DIR}/hardware_interface${BRANCH_DIR_SUFFIX}/hardware_interface.h
44-
${CMAKE_CURRENT_SOURCE_DIR}/hardware_interface${BRANCH_DIR_SUFFIX}/hardware_interface.inl
4545
)
4646
target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_COMMAND_QUEUE})
4747
set_property(GLOBAL PROPERTY RUNTIME_SRCS_COMMAND_QUEUE ${RUNTIME_SRCS_COMMAND_QUEUE})

runtime/command_queue/enqueue_common.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "runtime/builtin_kernels_simulation/scheduler_simulation.h"
1313
#include "runtime/command_queue/command_queue_hw.h"
1414
#include "runtime/command_queue/gpgpu_walker.h"
15+
#include "runtime/command_queue/hardware_interface.h"
1516
#include "runtime/command_stream/command_stream_receiver.h"
1617
#include "runtime/event/event_builder.h"
1718
#include "runtime/gtpin/gtpin_notify.h"
@@ -266,7 +267,7 @@ void CommandQueueHw<GfxFamily>::enqueueHandler(Surface **surfacesForResidency,
266267
}
267268
}
268269

269-
GpgpuWalkerHelper<GfxFamily>::dispatchWalker(
270+
HardwareInterface<GfxFamily>::dispatchWalker(
270271
*this,
271272
multiDispatchInfo,
272273
numEventsInWaitList,

runtime/command_queue/gpgpu_walker.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ using WALKER_HANDLE = void *;
3131
template <typename GfxFamily>
3232
using WALKER_TYPE = typename GfxFamily::WALKER_TYPE;
3333

34-
template <typename GfxFamily>
35-
using HARDWARE_INTERFACE = typename GfxFamily::HARDWARE_INTERFACE;
36-
3734
constexpr int32_t NUM_ALU_INST_FOR_READ_MODIFY_WRITE = 4;
3835

3936
constexpr int32_t L3SQC_BIT_LQSC_RO_PERF_DIS = 0x08000000;
@@ -188,20 +185,6 @@ class GpgpuWalkerHelper {
188185
OCLRT::HwPerfCounter &hwPerfCounter,
189186
OCLRT::LinearStream *commandStream);
190187

191-
static void dispatchWalker(
192-
CommandQueue &commandQueue,
193-
const MultiDispatchInfo &multiDispatchInfo,
194-
cl_uint numEventsInWaitList,
195-
const cl_event *eventWaitList,
196-
KernelOperation **blockedCommandsData,
197-
HwTimeStamps *hwTimeStamps,
198-
OCLRT::HwPerfCounter *hwPerfCounter,
199-
TagNode<TimestampPacket> *previousTimestampPacketNode,
200-
TimestampPacket *currentTimestampPacket,
201-
PreemptionMode preemptionMode,
202-
bool blockQueue,
203-
uint32_t commandType = 0);
204-
205188
static void setupTimestampPacket(
206189
LinearStream *cmdStream,
207190
WALKER_HANDLE walkerHandle,

runtime/command_queue/gpgpu_walker.inl

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
#pragma once
99
#include "runtime/command_queue/gpgpu_walker.h"
10-
#include "hardware_interface.h"
11-
#include "hardware_interface.inl"
1210
#include "runtime/command_queue/command_queue.h"
1311
#include "runtime/command_queue/local_id_gen.h"
1412
#include "runtime/command_stream/command_stream_receiver.h"
@@ -416,37 +414,6 @@ void GpgpuWalkerHelper<GfxFamily>::dispatchPerfCountersCommandsEnd(
416414
perfCounters->setCpuTimestamp();
417415
}
418416

419-
template <typename GfxFamily>
420-
void GpgpuWalkerHelper<GfxFamily>::dispatchWalker(
421-
CommandQueue &commandQueue,
422-
const MultiDispatchInfo &multiDispatchInfo,
423-
cl_uint numEventsInWaitList,
424-
const cl_event *eventWaitList,
425-
KernelOperation **blockedCommandsData,
426-
HwTimeStamps *hwTimeStamps,
427-
OCLRT::HwPerfCounter *hwPerfCounter,
428-
TagNode<TimestampPacket> *previousTimestampPacketNode,
429-
TimestampPacket *currentTimestampPacket,
430-
PreemptionMode preemptionMode,
431-
bool blockQueue,
432-
uint32_t commandType) {
433-
434-
HARDWARE_INTERFACE<GfxFamily> hardwareInterface;
435-
hardwareInterface.dispatchWalker(
436-
commandQueue,
437-
multiDispatchInfo,
438-
numEventsInWaitList,
439-
eventWaitList,
440-
blockedCommandsData,
441-
hwTimeStamps,
442-
hwPerfCounter,
443-
previousTimestampPacketNode,
444-
currentTimestampPacket,
445-
preemptionMode,
446-
blockQueue,
447-
commandType);
448-
}
449-
450417
template <typename GfxFamily>
451418
inline void GpgpuWalkerHelper<GfxFamily>::dispatchOnDeviceWaitlistSemaphores(LinearStream *commandStream, Device &currentDevice,
452419
cl_uint numEventsInWaitList, const cl_event *eventWaitList) {
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
/*
2+
* Copyright (C) 2018 Intel Corporation
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*
6+
*/
7+
8+
#pragma once
9+
#include "CL/cl.h"
10+
#include <cstdint>
11+
12+
namespace OCLRT {
13+
14+
class CommandQueue;
15+
class DispatchInfo;
16+
class IndirectHeap;
17+
class Kernel;
18+
class LinearStream;
19+
class TimestampPacket;
20+
enum class PreemptionMode : uint32_t;
21+
struct HwPerfCounter;
22+
struct HwTimeStamps;
23+
struct KernelOperation;
24+
struct MultiDispatchInfo;
25+
26+
template <class T>
27+
struct TagNode;
28+
29+
using WALKER_HANDLE = void *;
30+
31+
template <typename GfxFamily>
32+
class HardwareInterface {
33+
public:
34+
using INTERFACE_DESCRIPTOR_DATA = typename GfxFamily::INTERFACE_DESCRIPTOR_DATA;
35+
36+
static void dispatchWalker(
37+
CommandQueue &commandQueue,
38+
const MultiDispatchInfo &multiDispatchInfo,
39+
cl_uint numEventsInWaitList,
40+
const cl_event *eventWaitList,
41+
KernelOperation **blockedCommandsData,
42+
HwTimeStamps *hwTimeStamps,
43+
HwPerfCounter *hwPerfCounter,
44+
TagNode<TimestampPacket> *previousTimestampPacketNode,
45+
TimestampPacket *currentTimestampPacket,
46+
PreemptionMode preemptionMode,
47+
bool blockQueue,
48+
uint32_t commandType = 0);
49+
50+
static void getDefaultDshSpace(
51+
const size_t &offsetInterfaceDescriptorTable,
52+
CommandQueue &commandQueue,
53+
const MultiDispatchInfo &multiDispatchInfo,
54+
size_t &totalInterfaceDescriptorTableSize,
55+
Kernel *parentKernel,
56+
IndirectHeap *dsh,
57+
LinearStream *commandStream);
58+
59+
static INTERFACE_DESCRIPTOR_DATA *obtainInterfaceDescriptorData(
60+
WALKER_HANDLE pCmdData);
61+
62+
static void setOffsetCrossThreadData(
63+
WALKER_HANDLE pCmdData,
64+
size_t &offsetCrossThreadData,
65+
uint32_t &interfaceDescriptorIndex);
66+
67+
static void dispatchWorkarounds(
68+
LinearStream *commandStream,
69+
CommandQueue &commandQueue,
70+
Kernel &kernel,
71+
const bool &enable);
72+
73+
static void dispatchProfilingPerfStartCommands(
74+
const DispatchInfo &dispatchInfo,
75+
const MultiDispatchInfo &multiDispatchInfo,
76+
HwTimeStamps *hwTimeStamps,
77+
HwPerfCounter *hwPerfCounter,
78+
LinearStream *commandStream,
79+
CommandQueue &commandQueue);
80+
81+
static void dispatchProfilingPerfEndCommands(
82+
HwTimeStamps *hwTimeStamps,
83+
HwPerfCounter *hwPerfCounter,
84+
LinearStream *commandStream,
85+
CommandQueue &commandQueue);
86+
};
87+
88+
} // namespace OCLRT

runtime/command_queue/hardware_interface/hardware_interface.inl renamed to runtime/command_queue/hardware_interface.inl

Lines changed: 6 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
*/
77

88
#pragma once
9-
#include "runtime/command_queue/hardware_interface/hardware_interface.h"
10-
#include "runtime/utilities/tag_allocator.h"
9+
#include "runtime/command_queue/hardware_interface.h"
10+
#include "runtime/helpers/kernel_commands.h"
11+
#include "runtime/helpers/task_information.h"
1112

1213
namespace OCLRT {
1314

@@ -19,15 +20,15 @@ void HardwareInterface<GfxFamily>::dispatchWalker(
1920
const cl_event *eventWaitList,
2021
KernelOperation **blockedCommandsData,
2122
HwTimeStamps *hwTimeStamps,
22-
OCLRT::HwPerfCounter *hwPerfCounter,
23+
HwPerfCounter *hwPerfCounter,
2324
TagNode<TimestampPacket> *previousTimestampPacketNode,
2425
TimestampPacket *currentTimestampPacket,
2526
PreemptionMode preemptionMode,
2627
bool blockQueue,
2728
uint32_t commandType) {
2829

29-
OCLRT::LinearStream *commandStream = nullptr;
30-
OCLRT::IndirectHeap *dsh = nullptr, *ioh = nullptr, *ssh = nullptr;
30+
LinearStream *commandStream = nullptr;
31+
IndirectHeap *dsh = nullptr, *ioh = nullptr, *ssh = nullptr;
3132
auto parentKernel = multiDispatchInfo.peekParentKernel();
3233

3334
for (auto &dispatchInfo : multiDispatchInfo) {
@@ -245,97 +246,4 @@ void HardwareInterface<GfxFamily>::dispatchWalker(
245246
dispatchProfilingPerfEndCommands(hwTimeStamps, hwPerfCounter, commandStream, commandQueue);
246247
}
247248

248-
template <typename GfxFamily>
249-
inline void BaseInterfaceVersion<GfxFamily>::getDefaultDshSpace(
250-
const size_t &offsetInterfaceDescriptorTable,
251-
CommandQueue &commandQueue,
252-
const MultiDispatchInfo &multiDispatchInfo,
253-
size_t &totalInterfaceDescriptorTableSize,
254-
OCLRT::Kernel *parentKernel,
255-
OCLRT::IndirectHeap *dsh,
256-
OCLRT::LinearStream *commandStream) {
257-
258-
size_t numDispatches = multiDispatchInfo.size();
259-
totalInterfaceDescriptorTableSize *= numDispatches;
260-
261-
if (!parentKernel) {
262-
dsh->getSpace(totalInterfaceDescriptorTableSize);
263-
} else {
264-
dsh->getSpace(commandQueue.getContext().getDefaultDeviceQueue()->getDshOffset() - dsh->getUsed());
265-
}
266-
}
267-
268-
template <typename GfxFamily>
269-
inline typename BaseInterfaceVersion<GfxFamily>::INTERFACE_DESCRIPTOR_DATA *
270-
BaseInterfaceVersion<GfxFamily>::obtainInterfaceDescriptorData(
271-
WALKER_HANDLE pCmdData) {
272-
273-
return nullptr;
274-
}
275-
276-
template <typename GfxFamily>
277-
inline void BaseInterfaceVersion<GfxFamily>::setOffsetCrossThreadData(
278-
WALKER_HANDLE pCmdData,
279-
size_t &offsetCrossThreadData,
280-
uint32_t &interfaceDescriptorIndex) {
281-
282-
WALKER_TYPE<GfxFamily> *pCmd = static_cast<WALKER_TYPE<GfxFamily> *>(pCmdData);
283-
pCmd->setIndirectDataStartAddress(static_cast<uint32_t>(offsetCrossThreadData));
284-
pCmd->setInterfaceDescriptorOffset(interfaceDescriptorIndex++);
285-
}
286-
287-
template <typename GfxFamily>
288-
inline void BaseInterfaceVersion<GfxFamily>::dispatchWorkarounds(
289-
OCLRT::LinearStream *commandStream,
290-
CommandQueue &commandQueue,
291-
OCLRT::Kernel &kernel,
292-
const bool &enable) {
293-
294-
if (enable) {
295-
PreemptionHelper::applyPreemptionWaCmdsBegin<GfxFamily>(commandStream, commandQueue.getDevice());
296-
// Implement enabling special WA DisableLSQCROPERFforOCL if needed
297-
GpgpuWalkerHelper<GfxFamily>::applyWADisableLSQCROPERFforOCL(commandStream, kernel, enable);
298-
} else {
299-
// Implement disabling special WA DisableLSQCROPERFforOCL if needed
300-
GpgpuWalkerHelper<GfxFamily>::applyWADisableLSQCROPERFforOCL(commandStream, kernel, enable);
301-
PreemptionHelper::applyPreemptionWaCmdsEnd<GfxFamily>(commandStream, commandQueue.getDevice());
302-
}
303-
}
304-
305-
template <typename GfxFamily>
306-
inline void BaseInterfaceVersion<GfxFamily>::dispatchProfilingPerfStartCommands(
307-
const OCLRT::DispatchInfo &dispatchInfo,
308-
const MultiDispatchInfo &multiDispatchInfo,
309-
HwTimeStamps *hwTimeStamps,
310-
OCLRT::HwPerfCounter *hwPerfCounter,
311-
OCLRT::LinearStream *commandStream,
312-
CommandQueue &commandQueue) {
313-
314-
if (&dispatchInfo == &*multiDispatchInfo.begin()) {
315-
// If hwTimeStampAlloc is passed (not nullptr), then we know that profiling is enabled
316-
if (hwTimeStamps != nullptr) {
317-
GpgpuWalkerHelper<GfxFamily>::dispatchProfilingCommandsStart(*hwTimeStamps, commandStream);
318-
}
319-
if (hwPerfCounter != nullptr) {
320-
GpgpuWalkerHelper<GfxFamily>::dispatchPerfCountersCommandsStart(commandQueue, *hwPerfCounter, commandStream);
321-
}
322-
}
323-
}
324-
325-
template <typename GfxFamily>
326-
inline void BaseInterfaceVersion<GfxFamily>::dispatchProfilingPerfEndCommands(
327-
HwTimeStamps *hwTimeStamps,
328-
OCLRT::HwPerfCounter *hwPerfCounter,
329-
OCLRT::LinearStream *commandStream,
330-
CommandQueue &commandQueue) {
331-
332-
// If hwTimeStamps is passed (not nullptr), then we know that profiling is enabled
333-
if (hwTimeStamps != nullptr) {
334-
GpgpuWalkerHelper<GfxFamily>::dispatchProfilingCommandsEnd(*hwTimeStamps, commandStream);
335-
}
336-
if (hwPerfCounter != nullptr) {
337-
GpgpuWalkerHelper<GfxFamily>::dispatchPerfCountersCommandsEnd(commandQueue, *hwPerfCounter, commandStream);
338-
}
339-
}
340-
341249
} // namespace OCLRT

0 commit comments

Comments
 (0)