mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-28 16:48:45 +08:00
Change virtual class HardwareInterface to static
Change-Id: I4f1f59ecb51b95041dc6dcc6c606b94595813f53 Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
f3b1d73e88
commit
b16bd14f37
@@ -34,14 +34,14 @@ set(RUNTIME_SRCS_COMMAND_QUEUE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/flush.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gpgpu_walker.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gpgpu_walker.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware_interface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware_interface.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/local_id_gen.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/local_id_gen.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/local_id_gen.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/local_id_gen_avx2.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/local_id_gen_sse4.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/local_work_size.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware_interface${BRANCH_DIR_SUFFIX}/hardware_interface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware_interface${BRANCH_DIR_SUFFIX}/hardware_interface.inl
|
||||
)
|
||||
target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_COMMAND_QUEUE})
|
||||
set_property(GLOBAL PROPERTY RUNTIME_SRCS_COMMAND_QUEUE ${RUNTIME_SRCS_COMMAND_QUEUE})
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "runtime/builtin_kernels_simulation/scheduler_simulation.h"
|
||||
#include "runtime/command_queue/command_queue_hw.h"
|
||||
#include "runtime/command_queue/gpgpu_walker.h"
|
||||
#include "runtime/command_queue/hardware_interface.h"
|
||||
#include "runtime/command_stream/command_stream_receiver.h"
|
||||
#include "runtime/event/event_builder.h"
|
||||
#include "runtime/gtpin/gtpin_notify.h"
|
||||
@@ -266,7 +267,7 @@ void CommandQueueHw<GfxFamily>::enqueueHandler(Surface **surfacesForResidency,
|
||||
}
|
||||
}
|
||||
|
||||
GpgpuWalkerHelper<GfxFamily>::dispatchWalker(
|
||||
HardwareInterface<GfxFamily>::dispatchWalker(
|
||||
*this,
|
||||
multiDispatchInfo,
|
||||
numEventsInWaitList,
|
||||
|
||||
@@ -31,9 +31,6 @@ using WALKER_HANDLE = void *;
|
||||
template <typename GfxFamily>
|
||||
using WALKER_TYPE = typename GfxFamily::WALKER_TYPE;
|
||||
|
||||
template <typename GfxFamily>
|
||||
using HARDWARE_INTERFACE = typename GfxFamily::HARDWARE_INTERFACE;
|
||||
|
||||
constexpr int32_t NUM_ALU_INST_FOR_READ_MODIFY_WRITE = 4;
|
||||
|
||||
constexpr int32_t L3SQC_BIT_LQSC_RO_PERF_DIS = 0x08000000;
|
||||
@@ -188,20 +185,6 @@ class GpgpuWalkerHelper {
|
||||
OCLRT::HwPerfCounter &hwPerfCounter,
|
||||
OCLRT::LinearStream *commandStream);
|
||||
|
||||
static void dispatchWalker(
|
||||
CommandQueue &commandQueue,
|
||||
const MultiDispatchInfo &multiDispatchInfo,
|
||||
cl_uint numEventsInWaitList,
|
||||
const cl_event *eventWaitList,
|
||||
KernelOperation **blockedCommandsData,
|
||||
HwTimeStamps *hwTimeStamps,
|
||||
OCLRT::HwPerfCounter *hwPerfCounter,
|
||||
TagNode<TimestampPacket> *previousTimestampPacketNode,
|
||||
TimestampPacket *currentTimestampPacket,
|
||||
PreemptionMode preemptionMode,
|
||||
bool blockQueue,
|
||||
uint32_t commandType = 0);
|
||||
|
||||
static void setupTimestampPacket(
|
||||
LinearStream *cmdStream,
|
||||
WALKER_HANDLE walkerHandle,
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
|
||||
#pragma once
|
||||
#include "runtime/command_queue/gpgpu_walker.h"
|
||||
#include "hardware_interface.h"
|
||||
#include "hardware_interface.inl"
|
||||
#include "runtime/command_queue/command_queue.h"
|
||||
#include "runtime/command_queue/local_id_gen.h"
|
||||
#include "runtime/command_stream/command_stream_receiver.h"
|
||||
@@ -416,37 +414,6 @@ void GpgpuWalkerHelper<GfxFamily>::dispatchPerfCountersCommandsEnd(
|
||||
perfCounters->setCpuTimestamp();
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
void GpgpuWalkerHelper<GfxFamily>::dispatchWalker(
|
||||
CommandQueue &commandQueue,
|
||||
const MultiDispatchInfo &multiDispatchInfo,
|
||||
cl_uint numEventsInWaitList,
|
||||
const cl_event *eventWaitList,
|
||||
KernelOperation **blockedCommandsData,
|
||||
HwTimeStamps *hwTimeStamps,
|
||||
OCLRT::HwPerfCounter *hwPerfCounter,
|
||||
TagNode<TimestampPacket> *previousTimestampPacketNode,
|
||||
TimestampPacket *currentTimestampPacket,
|
||||
PreemptionMode preemptionMode,
|
||||
bool blockQueue,
|
||||
uint32_t commandType) {
|
||||
|
||||
HARDWARE_INTERFACE<GfxFamily> hardwareInterface;
|
||||
hardwareInterface.dispatchWalker(
|
||||
commandQueue,
|
||||
multiDispatchInfo,
|
||||
numEventsInWaitList,
|
||||
eventWaitList,
|
||||
blockedCommandsData,
|
||||
hwTimeStamps,
|
||||
hwPerfCounter,
|
||||
previousTimestampPacketNode,
|
||||
currentTimestampPacket,
|
||||
preemptionMode,
|
||||
blockQueue,
|
||||
commandType);
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline void GpgpuWalkerHelper<GfxFamily>::dispatchOnDeviceWaitlistSemaphores(LinearStream *commandStream, Device ¤tDevice,
|
||||
cl_uint numEventsInWaitList, const cl_event *eventWaitList) {
|
||||
|
||||
88
runtime/command_queue/hardware_interface.h
Normal file
88
runtime/command_queue/hardware_interface.h
Normal file
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "CL/cl.h"
|
||||
#include <cstdint>
|
||||
|
||||
namespace OCLRT {
|
||||
|
||||
class CommandQueue;
|
||||
class DispatchInfo;
|
||||
class IndirectHeap;
|
||||
class Kernel;
|
||||
class LinearStream;
|
||||
class TimestampPacket;
|
||||
enum class PreemptionMode : uint32_t;
|
||||
struct HwPerfCounter;
|
||||
struct HwTimeStamps;
|
||||
struct KernelOperation;
|
||||
struct MultiDispatchInfo;
|
||||
|
||||
template <class T>
|
||||
struct TagNode;
|
||||
|
||||
using WALKER_HANDLE = void *;
|
||||
|
||||
template <typename GfxFamily>
|
||||
class HardwareInterface {
|
||||
public:
|
||||
using INTERFACE_DESCRIPTOR_DATA = typename GfxFamily::INTERFACE_DESCRIPTOR_DATA;
|
||||
|
||||
static void dispatchWalker(
|
||||
CommandQueue &commandQueue,
|
||||
const MultiDispatchInfo &multiDispatchInfo,
|
||||
cl_uint numEventsInWaitList,
|
||||
const cl_event *eventWaitList,
|
||||
KernelOperation **blockedCommandsData,
|
||||
HwTimeStamps *hwTimeStamps,
|
||||
HwPerfCounter *hwPerfCounter,
|
||||
TagNode<TimestampPacket> *previousTimestampPacketNode,
|
||||
TimestampPacket *currentTimestampPacket,
|
||||
PreemptionMode preemptionMode,
|
||||
bool blockQueue,
|
||||
uint32_t commandType = 0);
|
||||
|
||||
static void getDefaultDshSpace(
|
||||
const size_t &offsetInterfaceDescriptorTable,
|
||||
CommandQueue &commandQueue,
|
||||
const MultiDispatchInfo &multiDispatchInfo,
|
||||
size_t &totalInterfaceDescriptorTableSize,
|
||||
Kernel *parentKernel,
|
||||
IndirectHeap *dsh,
|
||||
LinearStream *commandStream);
|
||||
|
||||
static INTERFACE_DESCRIPTOR_DATA *obtainInterfaceDescriptorData(
|
||||
WALKER_HANDLE pCmdData);
|
||||
|
||||
static void setOffsetCrossThreadData(
|
||||
WALKER_HANDLE pCmdData,
|
||||
size_t &offsetCrossThreadData,
|
||||
uint32_t &interfaceDescriptorIndex);
|
||||
|
||||
static void dispatchWorkarounds(
|
||||
LinearStream *commandStream,
|
||||
CommandQueue &commandQueue,
|
||||
Kernel &kernel,
|
||||
const bool &enable);
|
||||
|
||||
static void dispatchProfilingPerfStartCommands(
|
||||
const DispatchInfo &dispatchInfo,
|
||||
const MultiDispatchInfo &multiDispatchInfo,
|
||||
HwTimeStamps *hwTimeStamps,
|
||||
HwPerfCounter *hwPerfCounter,
|
||||
LinearStream *commandStream,
|
||||
CommandQueue &commandQueue);
|
||||
|
||||
static void dispatchProfilingPerfEndCommands(
|
||||
HwTimeStamps *hwTimeStamps,
|
||||
HwPerfCounter *hwPerfCounter,
|
||||
LinearStream *commandStream,
|
||||
CommandQueue &commandQueue);
|
||||
};
|
||||
|
||||
} // namespace OCLRT
|
||||
@@ -6,8 +6,9 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "runtime/command_queue/hardware_interface/hardware_interface.h"
|
||||
#include "runtime/utilities/tag_allocator.h"
|
||||
#include "runtime/command_queue/hardware_interface.h"
|
||||
#include "runtime/helpers/kernel_commands.h"
|
||||
#include "runtime/helpers/task_information.h"
|
||||
|
||||
namespace OCLRT {
|
||||
|
||||
@@ -19,15 +20,15 @@ void HardwareInterface<GfxFamily>::dispatchWalker(
|
||||
const cl_event *eventWaitList,
|
||||
KernelOperation **blockedCommandsData,
|
||||
HwTimeStamps *hwTimeStamps,
|
||||
OCLRT::HwPerfCounter *hwPerfCounter,
|
||||
HwPerfCounter *hwPerfCounter,
|
||||
TagNode<TimestampPacket> *previousTimestampPacketNode,
|
||||
TimestampPacket *currentTimestampPacket,
|
||||
PreemptionMode preemptionMode,
|
||||
bool blockQueue,
|
||||
uint32_t commandType) {
|
||||
|
||||
OCLRT::LinearStream *commandStream = nullptr;
|
||||
OCLRT::IndirectHeap *dsh = nullptr, *ioh = nullptr, *ssh = nullptr;
|
||||
LinearStream *commandStream = nullptr;
|
||||
IndirectHeap *dsh = nullptr, *ioh = nullptr, *ssh = nullptr;
|
||||
auto parentKernel = multiDispatchInfo.peekParentKernel();
|
||||
|
||||
for (auto &dispatchInfo : multiDispatchInfo) {
|
||||
@@ -245,97 +246,4 @@ void HardwareInterface<GfxFamily>::dispatchWalker(
|
||||
dispatchProfilingPerfEndCommands(hwTimeStamps, hwPerfCounter, commandStream, commandQueue);
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline void BaseInterfaceVersion<GfxFamily>::getDefaultDshSpace(
|
||||
const size_t &offsetInterfaceDescriptorTable,
|
||||
CommandQueue &commandQueue,
|
||||
const MultiDispatchInfo &multiDispatchInfo,
|
||||
size_t &totalInterfaceDescriptorTableSize,
|
||||
OCLRT::Kernel *parentKernel,
|
||||
OCLRT::IndirectHeap *dsh,
|
||||
OCLRT::LinearStream *commandStream) {
|
||||
|
||||
size_t numDispatches = multiDispatchInfo.size();
|
||||
totalInterfaceDescriptorTableSize *= numDispatches;
|
||||
|
||||
if (!parentKernel) {
|
||||
dsh->getSpace(totalInterfaceDescriptorTableSize);
|
||||
} else {
|
||||
dsh->getSpace(commandQueue.getContext().getDefaultDeviceQueue()->getDshOffset() - dsh->getUsed());
|
||||
}
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline typename BaseInterfaceVersion<GfxFamily>::INTERFACE_DESCRIPTOR_DATA *
|
||||
BaseInterfaceVersion<GfxFamily>::obtainInterfaceDescriptorData(
|
||||
WALKER_HANDLE pCmdData) {
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline void BaseInterfaceVersion<GfxFamily>::setOffsetCrossThreadData(
|
||||
WALKER_HANDLE pCmdData,
|
||||
size_t &offsetCrossThreadData,
|
||||
uint32_t &interfaceDescriptorIndex) {
|
||||
|
||||
WALKER_TYPE<GfxFamily> *pCmd = static_cast<WALKER_TYPE<GfxFamily> *>(pCmdData);
|
||||
pCmd->setIndirectDataStartAddress(static_cast<uint32_t>(offsetCrossThreadData));
|
||||
pCmd->setInterfaceDescriptorOffset(interfaceDescriptorIndex++);
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline void BaseInterfaceVersion<GfxFamily>::dispatchWorkarounds(
|
||||
OCLRT::LinearStream *commandStream,
|
||||
CommandQueue &commandQueue,
|
||||
OCLRT::Kernel &kernel,
|
||||
const bool &enable) {
|
||||
|
||||
if (enable) {
|
||||
PreemptionHelper::applyPreemptionWaCmdsBegin<GfxFamily>(commandStream, commandQueue.getDevice());
|
||||
// Implement enabling special WA DisableLSQCROPERFforOCL if needed
|
||||
GpgpuWalkerHelper<GfxFamily>::applyWADisableLSQCROPERFforOCL(commandStream, kernel, enable);
|
||||
} else {
|
||||
// Implement disabling special WA DisableLSQCROPERFforOCL if needed
|
||||
GpgpuWalkerHelper<GfxFamily>::applyWADisableLSQCROPERFforOCL(commandStream, kernel, enable);
|
||||
PreemptionHelper::applyPreemptionWaCmdsEnd<GfxFamily>(commandStream, commandQueue.getDevice());
|
||||
}
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline void BaseInterfaceVersion<GfxFamily>::dispatchProfilingPerfStartCommands(
|
||||
const OCLRT::DispatchInfo &dispatchInfo,
|
||||
const MultiDispatchInfo &multiDispatchInfo,
|
||||
HwTimeStamps *hwTimeStamps,
|
||||
OCLRT::HwPerfCounter *hwPerfCounter,
|
||||
OCLRT::LinearStream *commandStream,
|
||||
CommandQueue &commandQueue) {
|
||||
|
||||
if (&dispatchInfo == &*multiDispatchInfo.begin()) {
|
||||
// If hwTimeStampAlloc is passed (not nullptr), then we know that profiling is enabled
|
||||
if (hwTimeStamps != nullptr) {
|
||||
GpgpuWalkerHelper<GfxFamily>::dispatchProfilingCommandsStart(*hwTimeStamps, commandStream);
|
||||
}
|
||||
if (hwPerfCounter != nullptr) {
|
||||
GpgpuWalkerHelper<GfxFamily>::dispatchPerfCountersCommandsStart(commandQueue, *hwPerfCounter, commandStream);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline void BaseInterfaceVersion<GfxFamily>::dispatchProfilingPerfEndCommands(
|
||||
HwTimeStamps *hwTimeStamps,
|
||||
OCLRT::HwPerfCounter *hwPerfCounter,
|
||||
OCLRT::LinearStream *commandStream,
|
||||
CommandQueue &commandQueue) {
|
||||
|
||||
// If hwTimeStamps is passed (not nullptr), then we know that profiling is enabled
|
||||
if (hwTimeStamps != nullptr) {
|
||||
GpgpuWalkerHelper<GfxFamily>::dispatchProfilingCommandsEnd(*hwTimeStamps, commandStream);
|
||||
}
|
||||
if (hwPerfCounter != nullptr) {
|
||||
GpgpuWalkerHelper<GfxFamily>::dispatchPerfCountersCommandsEnd(commandQueue, *hwPerfCounter, commandStream);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace OCLRT
|
||||
@@ -1,129 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "runtime/command_queue/command_queue.h"
|
||||
#include "runtime/built_ins/built_ins.h"
|
||||
#include "runtime/context/context.h"
|
||||
#include "runtime/event/perf_counter.h"
|
||||
#include "runtime/indirect_heap/indirect_heap.h"
|
||||
#include "runtime/kernel/kernel.h"
|
||||
#include "runtime/command_stream/linear_stream.h"
|
||||
#include "runtime/event/hw_timestamps.h"
|
||||
#include "runtime/command_stream/preemption.h"
|
||||
#include "runtime/device_queue/device_queue_hw.h"
|
||||
#include "runtime/helpers/dispatch_info.h"
|
||||
#include "runtime/helpers/kernel_commands.h"
|
||||
#include "runtime/helpers/task_information.h"
|
||||
#include "runtime/helpers/timestamp_packet.h"
|
||||
#include "runtime/program/kernel_info.h"
|
||||
#include "runtime/utilities/vec.h"
|
||||
|
||||
namespace OCLRT {
|
||||
|
||||
using WALKER_HANDLE = void *;
|
||||
|
||||
template <typename GfxFamily>
|
||||
class HardwareInterface {
|
||||
public:
|
||||
using INTERFACE_DESCRIPTOR_DATA = typename GfxFamily::INTERFACE_DESCRIPTOR_DATA;
|
||||
|
||||
void dispatchWalker(
|
||||
CommandQueue &commandQueue,
|
||||
const MultiDispatchInfo &multiDispatchInfo,
|
||||
cl_uint numEventsInWaitList,
|
||||
const cl_event *eventWaitList,
|
||||
KernelOperation **blockedCommandsData,
|
||||
HwTimeStamps *hwTimeStamps,
|
||||
OCLRT::HwPerfCounter *hwPerfCounter,
|
||||
TagNode<TimestampPacket> *previousTimestampPacketNode,
|
||||
TimestampPacket *currentTimestampPacket,
|
||||
PreemptionMode preemptionMode,
|
||||
bool blockQueue,
|
||||
uint32_t commandType = 0);
|
||||
|
||||
virtual void getDefaultDshSpace(
|
||||
const size_t &offsetInterfaceDescriptorTable,
|
||||
CommandQueue &commandQueue,
|
||||
const MultiDispatchInfo &multiDispatchInfo,
|
||||
size_t &totalInterfaceDescriptorTableSize,
|
||||
OCLRT::Kernel *parentKernel,
|
||||
OCLRT::IndirectHeap *dsh,
|
||||
OCLRT::LinearStream *commandStream) = 0;
|
||||
|
||||
virtual INTERFACE_DESCRIPTOR_DATA *obtainInterfaceDescriptorData(
|
||||
WALKER_HANDLE pCmdData) = 0;
|
||||
|
||||
virtual void setOffsetCrossThreadData(
|
||||
WALKER_HANDLE pCmdData,
|
||||
size_t &offsetCrossThreadData,
|
||||
uint32_t &interfaceDescriptorIndex) = 0;
|
||||
|
||||
virtual void dispatchWorkarounds(
|
||||
OCLRT::LinearStream *commandStream,
|
||||
CommandQueue &commandQueue,
|
||||
OCLRT::Kernel &kernel,
|
||||
const bool &enable) = 0;
|
||||
|
||||
virtual void dispatchProfilingPerfStartCommands(
|
||||
const OCLRT::DispatchInfo &dispatchInfo,
|
||||
const MultiDispatchInfo &multiDispatchInfo,
|
||||
HwTimeStamps *hwTimeStamps,
|
||||
OCLRT::HwPerfCounter *hwPerfCounter,
|
||||
OCLRT::LinearStream *commandStream,
|
||||
CommandQueue &commandQueue) = 0;
|
||||
|
||||
virtual void dispatchProfilingPerfEndCommands(
|
||||
HwTimeStamps *hwTimeStamps,
|
||||
OCLRT::HwPerfCounter *hwPerfCounter,
|
||||
OCLRT::LinearStream *commandStream,
|
||||
CommandQueue &commandQueue) = 0;
|
||||
};
|
||||
|
||||
template <typename GfxFamily>
|
||||
class BaseInterfaceVersion : public HardwareInterface<GfxFamily> {
|
||||
using INTERFACE_DESCRIPTOR_DATA = typename GfxFamily::INTERFACE_DESCRIPTOR_DATA;
|
||||
|
||||
void getDefaultDshSpace(
|
||||
const size_t &offsetInterfaceDescriptorTable,
|
||||
CommandQueue &commandQueue,
|
||||
const MultiDispatchInfo &multiDispatchInfo,
|
||||
size_t &totalInterfaceDescriptorTableSize,
|
||||
OCLRT::Kernel *parentKernel,
|
||||
OCLRT::IndirectHeap *dsh,
|
||||
OCLRT::LinearStream *commandStream) override;
|
||||
|
||||
INTERFACE_DESCRIPTOR_DATA *obtainInterfaceDescriptorData(
|
||||
WALKER_HANDLE pCmdData) override;
|
||||
|
||||
void setOffsetCrossThreadData(
|
||||
WALKER_HANDLE pCmdData,
|
||||
size_t &offsetCrossThreadData,
|
||||
uint32_t &interfaceDescriptorIndex) override;
|
||||
|
||||
void dispatchWorkarounds(
|
||||
OCLRT::LinearStream *commandStream,
|
||||
CommandQueue &commandQueue,
|
||||
OCLRT::Kernel &kernel,
|
||||
const bool &enable) override;
|
||||
|
||||
void dispatchProfilingPerfStartCommands(
|
||||
const OCLRT::DispatchInfo &dispatchInfo,
|
||||
const MultiDispatchInfo &multiDispatchInfo,
|
||||
HwTimeStamps *hwTimeStamps,
|
||||
OCLRT::HwPerfCounter *hwPerfCounter,
|
||||
OCLRT::LinearStream *commandStream,
|
||||
CommandQueue &commandQueue) override;
|
||||
|
||||
void dispatchProfilingPerfEndCommands(
|
||||
HwTimeStamps *hwTimeStamps,
|
||||
OCLRT::HwPerfCounter *hwPerfCounter,
|
||||
OCLRT::LinearStream *commandStream,
|
||||
CommandQueue &commandQueue) override;
|
||||
};
|
||||
|
||||
} // namespace OCLRT
|
||||
106
runtime/command_queue/hardware_interface_base.inl
Normal file
106
runtime/command_queue/hardware_interface_base.inl
Normal file
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "runtime/command_queue/hardware_interface.h"
|
||||
|
||||
namespace OCLRT {
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline void HardwareInterface<GfxFamily>::getDefaultDshSpace(
|
||||
const size_t &offsetInterfaceDescriptorTable,
|
||||
CommandQueue &commandQueue,
|
||||
const MultiDispatchInfo &multiDispatchInfo,
|
||||
size_t &totalInterfaceDescriptorTableSize,
|
||||
Kernel *parentKernel,
|
||||
IndirectHeap *dsh,
|
||||
LinearStream *commandStream) {
|
||||
|
||||
size_t numDispatches = multiDispatchInfo.size();
|
||||
totalInterfaceDescriptorTableSize *= numDispatches;
|
||||
|
||||
if (!parentKernel) {
|
||||
dsh->getSpace(totalInterfaceDescriptorTableSize);
|
||||
} else {
|
||||
dsh->getSpace(commandQueue.getContext().getDefaultDeviceQueue()->getDshOffset() - dsh->getUsed());
|
||||
}
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline typename HardwareInterface<GfxFamily>::INTERFACE_DESCRIPTOR_DATA *
|
||||
HardwareInterface<GfxFamily>::obtainInterfaceDescriptorData(
|
||||
WALKER_HANDLE pCmdData) {
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline void HardwareInterface<GfxFamily>::setOffsetCrossThreadData(
|
||||
WALKER_HANDLE pCmdData,
|
||||
size_t &offsetCrossThreadData,
|
||||
uint32_t &interfaceDescriptorIndex) {
|
||||
|
||||
WALKER_TYPE<GfxFamily> *pCmd = static_cast<WALKER_TYPE<GfxFamily> *>(pCmdData);
|
||||
pCmd->setIndirectDataStartAddress(static_cast<uint32_t>(offsetCrossThreadData));
|
||||
pCmd->setInterfaceDescriptorOffset(interfaceDescriptorIndex++);
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline void HardwareInterface<GfxFamily>::dispatchWorkarounds(
|
||||
LinearStream *commandStream,
|
||||
CommandQueue &commandQueue,
|
||||
Kernel &kernel,
|
||||
const bool &enable) {
|
||||
|
||||
if (enable) {
|
||||
PreemptionHelper::applyPreemptionWaCmdsBegin<GfxFamily>(commandStream, commandQueue.getDevice());
|
||||
// Implement enabling special WA DisableLSQCROPERFforOCL if needed
|
||||
GpgpuWalkerHelper<GfxFamily>::applyWADisableLSQCROPERFforOCL(commandStream, kernel, enable);
|
||||
} else {
|
||||
// Implement disabling special WA DisableLSQCROPERFforOCL if needed
|
||||
GpgpuWalkerHelper<GfxFamily>::applyWADisableLSQCROPERFforOCL(commandStream, kernel, enable);
|
||||
PreemptionHelper::applyPreemptionWaCmdsEnd<GfxFamily>(commandStream, commandQueue.getDevice());
|
||||
}
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline void HardwareInterface<GfxFamily>::dispatchProfilingPerfStartCommands(
|
||||
const DispatchInfo &dispatchInfo,
|
||||
const MultiDispatchInfo &multiDispatchInfo,
|
||||
HwTimeStamps *hwTimeStamps,
|
||||
HwPerfCounter *hwPerfCounter,
|
||||
LinearStream *commandStream,
|
||||
CommandQueue &commandQueue) {
|
||||
|
||||
if (&dispatchInfo == &*multiDispatchInfo.begin()) {
|
||||
// If hwTimeStampAlloc is passed (not nullptr), then we know that profiling is enabled
|
||||
if (hwTimeStamps != nullptr) {
|
||||
GpgpuWalkerHelper<GfxFamily>::dispatchProfilingCommandsStart(*hwTimeStamps, commandStream);
|
||||
}
|
||||
if (hwPerfCounter != nullptr) {
|
||||
GpgpuWalkerHelper<GfxFamily>::dispatchPerfCountersCommandsStart(commandQueue, *hwPerfCounter, commandStream);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline void HardwareInterface<GfxFamily>::dispatchProfilingPerfEndCommands(
|
||||
HwTimeStamps *hwTimeStamps,
|
||||
HwPerfCounter *hwPerfCounter,
|
||||
LinearStream *commandStream,
|
||||
CommandQueue &commandQueue) {
|
||||
|
||||
// If hwTimeStamps is passed (not nullptr), then we know that profiling is enabled
|
||||
if (hwTimeStamps != nullptr) {
|
||||
GpgpuWalkerHelper<GfxFamily>::dispatchProfilingCommandsEnd(*hwTimeStamps, commandStream);
|
||||
}
|
||||
if (hwPerfCounter != nullptr) {
|
||||
GpgpuWalkerHelper<GfxFamily>::dispatchPerfCountersCommandsEnd(commandQueue, *hwPerfCounter, commandStream);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace OCLRT
|
||||
Reference in New Issue
Block a user