2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2019-12-30 21:40:24 +08:00
|
|
|
* Copyright (C) 2017-2020 Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/helpers/engine_control.h"
|
2020-02-24 17:22:30 +08:00
|
|
|
|
2020-02-23 05:50:57 +08:00
|
|
|
#include "opencl/source/event/event.h"
|
|
|
|
#include "opencl/source/helpers/base_object.h"
|
|
|
|
#include "opencl/source/helpers/dispatch_info.h"
|
2020-06-24 19:32:09 +08:00
|
|
|
#include "opencl/source/helpers/enqueue_properties.h"
|
2020-02-23 05:50:57 +08:00
|
|
|
#include "opencl/source/helpers/task_information.h"
|
2019-02-27 18:39:32 +08:00
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
#include <atomic>
|
|
|
|
#include <cstdint>
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2019-03-22 20:40:41 +08:00
|
|
|
class BarrierCommand;
|
2017-12-21 07:45:38 +08:00
|
|
|
class Buffer;
|
|
|
|
class LinearStream;
|
2020-01-14 21:32:11 +08:00
|
|
|
class ClDevice;
|
2017-12-21 07:45:38 +08:00
|
|
|
class Context;
|
|
|
|
class Device;
|
2018-10-29 17:38:53 +08:00
|
|
|
class Event;
|
2018-02-09 05:59:03 +08:00
|
|
|
class EventBuilder;
|
2018-10-29 17:38:53 +08:00
|
|
|
class FlushStampTracker;
|
2017-12-21 07:45:38 +08:00
|
|
|
class Image;
|
|
|
|
class IndirectHeap;
|
|
|
|
class Kernel;
|
|
|
|
class MemObj;
|
2018-10-29 17:38:53 +08:00
|
|
|
class PerformanceCounters;
|
2018-02-02 17:33:31 +08:00
|
|
|
struct CompletionStamp;
|
2019-09-30 17:20:16 +08:00
|
|
|
struct DispatchGlobalsArgs;
|
2018-12-17 22:23:35 +08:00
|
|
|
struct MultiDispatchInfo;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2018-01-24 19:00:27 +08:00
|
|
|
enum class QueuePriority {
|
|
|
|
LOW,
|
|
|
|
MEDIUM,
|
|
|
|
HIGH
|
|
|
|
};
|
|
|
|
|
2018-10-04 04:31:25 +08:00
|
|
|
inline bool shouldFlushDC(uint32_t commandType, PrintfHandler *printfHandler) {
|
|
|
|
return (commandType == CL_COMMAND_READ_BUFFER ||
|
|
|
|
commandType == CL_COMMAND_READ_BUFFER_RECT ||
|
|
|
|
commandType == CL_COMMAND_READ_IMAGE ||
|
|
|
|
commandType == CL_COMMAND_SVM_MAP ||
|
|
|
|
printfHandler);
|
|
|
|
}
|
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
template <>
|
|
|
|
struct OpenCLObjectMapper<_cl_command_queue> {
|
|
|
|
typedef class CommandQueue DerivedType;
|
|
|
|
};
|
|
|
|
|
|
|
|
class CommandQueue : public BaseObject<_cl_command_queue> {
|
|
|
|
public:
|
|
|
|
static const cl_ulong objectMagic = 0x1234567890987654LL;
|
|
|
|
|
2020-01-21 16:35:12 +08:00
|
|
|
static CommandQueue *create(Context *context,
|
|
|
|
ClDevice *device,
|
2017-12-21 07:45:38 +08:00
|
|
|
const cl_queue_properties *properties,
|
2020-01-21 16:35:12 +08:00
|
|
|
bool internalUsage,
|
2017-12-21 07:45:38 +08:00
|
|
|
cl_int &errcodeRet);
|
|
|
|
|
2020-03-04 22:28:58 +08:00
|
|
|
CommandQueue() = delete;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2020-01-14 21:32:11 +08:00
|
|
|
CommandQueue(Context *context, ClDevice *device,
|
2017-12-21 07:45:38 +08:00
|
|
|
const cl_queue_properties *properties);
|
|
|
|
|
|
|
|
CommandQueue &operator=(const CommandQueue &) = delete;
|
|
|
|
CommandQueue(const CommandQueue &) = delete;
|
|
|
|
|
|
|
|
~CommandQueue() override;
|
|
|
|
|
|
|
|
// API entry points
|
2020-03-04 22:28:58 +08:00
|
|
|
virtual cl_int enqueueCopyImage(Image *srcImage, Image *dstImage, const size_t srcOrigin[3], const size_t dstOrigin[3],
|
|
|
|
const size_t region[3], cl_uint numEventsInWaitList, const cl_event *eventWaitList, cl_event *event) = 0;
|
|
|
|
|
|
|
|
virtual cl_int enqueueFillImage(Image *image, const void *fillColor, const size_t *origin, const size_t *region,
|
|
|
|
cl_uint numEventsInWaitList, const cl_event *eventWaitList, cl_event *event) = 0;
|
|
|
|
|
|
|
|
virtual cl_int enqueueFillBuffer(Buffer *buffer, const void *pattern, size_t patternSize, size_t offset,
|
|
|
|
size_t size, cl_uint numEventsInWaitList, const cl_event *eventWaitList, cl_event *event) = 0;
|
|
|
|
|
|
|
|
virtual cl_int enqueueKernel(cl_kernel kernel, cl_uint workDim, const size_t *globalWorkOffset, const size_t *globalWorkSize,
|
|
|
|
const size_t *localWorkSize, cl_uint numEventsInWaitList, const cl_event *eventWaitList, cl_event *event) = 0;
|
|
|
|
|
|
|
|
virtual cl_int enqueueBarrierWithWaitList(cl_uint numEventsInWaitList, const cl_event *eventWaitList, cl_event *event) = 0;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2018-02-09 05:59:03 +08:00
|
|
|
MOCKABLE_VIRTUAL void *enqueueMapBuffer(Buffer *buffer, cl_bool blockingMap,
|
|
|
|
cl_map_flags mapFlags, size_t offset,
|
|
|
|
size_t size, cl_uint numEventsInWaitList,
|
|
|
|
const cl_event *eventWaitList, cl_event *event,
|
|
|
|
cl_int &errcodeRet);
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2018-02-09 05:59:03 +08:00
|
|
|
MOCKABLE_VIRTUAL void *enqueueMapImage(Image *image, cl_bool blockingMap,
|
|
|
|
cl_map_flags mapFlags, const size_t *origin,
|
|
|
|
const size_t *region, size_t *imageRowPitch,
|
|
|
|
size_t *imageSlicePitch, cl_uint numEventsInWaitList,
|
|
|
|
const cl_event *eventWaitList, cl_event *event, cl_int &errcodeRet);
|
|
|
|
|
|
|
|
MOCKABLE_VIRTUAL cl_int enqueueUnmapMemObject(MemObj *memObj, void *mappedPtr, cl_uint numEventsInWaitList,
|
|
|
|
const cl_event *eventWaitList, cl_event *event);
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2020-03-04 22:28:58 +08:00
|
|
|
virtual cl_int enqueueSVMMap(cl_bool blockingMap, cl_map_flags mapFlags, void *svmPtr, size_t size,
|
|
|
|
cl_uint numEventsInWaitList, const cl_event *eventWaitList, cl_event *event, bool externalAppCall) = 0;
|
|
|
|
|
|
|
|
virtual cl_int enqueueSVMUnmap(void *svmPtr, cl_uint numEventsInWaitList, const cl_event *eventWaitList,
|
|
|
|
cl_event *event, bool externalAppCall) = 0;
|
|
|
|
|
|
|
|
virtual cl_int enqueueSVMFree(cl_uint numSvmPointers, void *svmPointers[],
|
2017-12-21 07:45:38 +08:00
|
|
|
void(CL_CALLBACK *pfnFreeFunc)(cl_command_queue queue,
|
|
|
|
cl_uint numSvmPointers,
|
|
|
|
void *svmPointers[],
|
|
|
|
void *userData),
|
2020-03-04 22:28:58 +08:00
|
|
|
void *userData, cl_uint numEventsInWaitList, const cl_event *eventWaitList, cl_event *event) = 0;
|
|
|
|
|
|
|
|
virtual cl_int enqueueSVMMemcpy(cl_bool blockingCopy, void *dstPtr, const void *srcPtr, size_t size, cl_uint numEventsInWaitList,
|
|
|
|
const cl_event *eventWaitList, cl_event *event) = 0;
|
|
|
|
|
|
|
|
virtual cl_int enqueueSVMMemFill(void *svmPtr, const void *pattern, size_t patternSize,
|
|
|
|
size_t size, cl_uint numEventsInWaitList, const cl_event *eventWaitList, cl_event *event) = 0;
|
|
|
|
|
|
|
|
virtual cl_int enqueueMarkerWithWaitList(cl_uint numEventsInWaitList, const cl_event *eventWaitList, cl_event *event) = 0;
|
|
|
|
|
|
|
|
virtual cl_int enqueueMigrateMemObjects(cl_uint numMemObjects, const cl_mem *memObjects, cl_mem_migration_flags flags,
|
|
|
|
cl_uint numEventsInWaitList, const cl_event *eventWaitList, cl_event *event) = 0;
|
|
|
|
|
|
|
|
virtual cl_int enqueueSVMMigrateMem(cl_uint numSvmPointers, const void **svmPointers, const size_t *sizes,
|
|
|
|
const cl_mem_migration_flags flags, cl_uint numEventsInWaitList,
|
|
|
|
const cl_event *eventWaitList, cl_event *event) = 0;
|
|
|
|
|
|
|
|
virtual cl_int enqueueCopyBuffer(Buffer *srcBuffer, Buffer *dstBuffer, size_t srcOffset, size_t dstOffset,
|
|
|
|
size_t size, cl_uint numEventsInWaitList, const cl_event *eventWaitList, cl_event *event) = 0;
|
|
|
|
|
|
|
|
virtual cl_int enqueueReadBuffer(Buffer *buffer, cl_bool blockingRead, size_t offset, size_t size, void *ptr,
|
|
|
|
GraphicsAllocation *mapAllocation, cl_uint numEventsInWaitList,
|
|
|
|
const cl_event *eventWaitList, cl_event *event) = 0;
|
|
|
|
|
|
|
|
virtual cl_int enqueueReadImage(Image *srcImage, cl_bool blockingRead, const size_t *origin, const size_t *region,
|
|
|
|
size_t rowPitch, size_t slicePitch, void *ptr, GraphicsAllocation *mapAllocation,
|
|
|
|
cl_uint numEventsInWaitList, const cl_event *eventWaitList, cl_event *event) = 0;
|
|
|
|
|
|
|
|
virtual cl_int enqueueWriteBuffer(Buffer *buffer, cl_bool blockingWrite, size_t offset, size_t cb,
|
|
|
|
const void *ptr, GraphicsAllocation *mapAllocation, cl_uint numEventsInWaitList,
|
|
|
|
const cl_event *eventWaitList, cl_event *event) = 0;
|
|
|
|
|
|
|
|
virtual cl_int enqueueWriteImage(Image *dstImage, cl_bool blockingWrite, const size_t *origin,
|
|
|
|
const size_t *region, size_t inputRowPitch, size_t inputSlicePitch,
|
|
|
|
const void *ptr, GraphicsAllocation *mapAllocation, cl_uint numEventsInWaitList,
|
|
|
|
const cl_event *eventWaitList, cl_event *event) = 0;
|
|
|
|
|
|
|
|
virtual cl_int enqueueCopyBufferRect(Buffer *srcBuffer, Buffer *dstBuffer, const size_t *srcOrigin, const size_t *dstOrigin,
|
|
|
|
const size_t *region, size_t srcRowPitch, size_t srcSlicePitch, size_t dstRowPitch, size_t dstSlicePitch,
|
|
|
|
cl_uint numEventsInWaitList, const cl_event *eventWaitList, cl_event *event) = 0;
|
|
|
|
|
|
|
|
virtual cl_int enqueueWriteBufferRect(Buffer *buffer, cl_bool blockingWrite, const size_t *bufferOrigin,
|
|
|
|
const size_t *hostOrigin, const size_t *region, size_t bufferRowPitch,
|
|
|
|
size_t bufferSlicePitch, size_t hostRowPitch, size_t hostSlicePitch,
|
|
|
|
const void *ptr, cl_uint numEventsInWaitList, const cl_event *eventWaitList, cl_event *event) = 0;
|
|
|
|
|
|
|
|
virtual cl_int enqueueReadBufferRect(Buffer *buffer, cl_bool blockingRead, const size_t *bufferOrigin,
|
|
|
|
const size_t *hostOrigin, const size_t *region, size_t bufferRowPitch,
|
|
|
|
size_t bufferSlicePitch, size_t hostRowPitch, size_t hostSlicePitch,
|
|
|
|
void *ptr, cl_uint numEventsInWaitList, const cl_event *eventWaitList, cl_event *event) = 0;
|
|
|
|
|
|
|
|
virtual cl_int enqueueCopyBufferToImage(Buffer *srcBuffer, Image *dstImage, size_t srcOffset,
|
|
|
|
const size_t *dstOrigin, const size_t *region,
|
|
|
|
cl_uint numEventsInWaitList, const cl_event *eventWaitList, cl_event *event) = 0;
|
|
|
|
|
|
|
|
virtual cl_int enqueueCopyImageToBuffer(Image *srcImage, Buffer *dstBuffer, const size_t *srcOrigin, const size_t *region,
|
|
|
|
size_t dstOffset, cl_uint numEventsInWaitList, const cl_event *eventWaitList, cl_event *event) = 0;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
cl_int enqueueAcquireSharedObjects(cl_uint numObjects,
|
|
|
|
const cl_mem *memObjects,
|
|
|
|
cl_uint numEventsInWaitList,
|
|
|
|
const cl_event *eventWaitList,
|
|
|
|
cl_event *oclEvent,
|
|
|
|
cl_uint cmdType);
|
|
|
|
|
|
|
|
cl_int enqueueReleaseSharedObjects(cl_uint numObjects,
|
|
|
|
const cl_mem *memObjects,
|
|
|
|
cl_uint numEventsInWaitList,
|
|
|
|
const cl_event *eventWaitList,
|
|
|
|
cl_event *oclEvent,
|
|
|
|
cl_uint cmdType);
|
|
|
|
|
2019-04-03 19:15:07 +08:00
|
|
|
MOCKABLE_VIRTUAL void *cpuDataTransferHandler(TransferProperties &transferProperties, EventsRequest &eventsRequest, cl_int &retVal);
|
2018-02-09 05:59:03 +08:00
|
|
|
|
2020-03-04 22:28:58 +08:00
|
|
|
virtual cl_int enqueueResourceBarrier(BarrierCommand *resourceBarrier, cl_uint numEventsInWaitList,
|
|
|
|
const cl_event *eventWaitList, cl_event *event) = 0;
|
|
|
|
|
|
|
|
virtual cl_int finish() = 0;
|
|
|
|
virtual cl_int enqueueInitDispatchGlobals(DispatchGlobalsArgs *dispatchGlobalsArgs, cl_uint numEventsInWaitList,
|
|
|
|
const cl_event *eventWaitList, cl_event *event) = 0;
|
|
|
|
|
|
|
|
virtual cl_int flush() = 0;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2020-08-26 17:26:44 +08:00
|
|
|
void updateFromCompletionStamp(const CompletionStamp &completionStamp, Event *outEvent);
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-07-23 02:55:09 +08:00
|
|
|
virtual bool isCacheFlushCommand(uint32_t commandType) const { return false; }
|
2019-03-22 20:40:41 +08:00
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
cl_int getCommandQueueInfo(cl_command_queue_info paramName,
|
|
|
|
size_t paramValueSize, void *paramValue,
|
|
|
|
size_t *paramValueSizeRet);
|
|
|
|
|
|
|
|
uint32_t getHwTag() const;
|
|
|
|
|
|
|
|
volatile uint32_t *getHwTagAddress() const;
|
|
|
|
|
2020-06-26 17:21:07 +08:00
|
|
|
bool isCompleted(uint32_t gpgpuTaskCount, uint32_t bcsTaskCount) const;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
MOCKABLE_VIRTUAL bool isQueueBlocked();
|
|
|
|
|
2020-06-25 17:35:29 +08:00
|
|
|
MOCKABLE_VIRTUAL void waitUntilComplete(uint32_t gpgpuTaskCountToWait, uint32_t bcsTaskCountToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep);
|
2020-08-26 21:44:12 +08:00
|
|
|
void waitUntilComplete(bool blockedQueue, PrintfHandler *printfHandler);
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
static uint32_t getTaskLevelFromWaitList(uint32_t taskLevel,
|
|
|
|
cl_uint numEventsInWaitList,
|
|
|
|
const cl_event *eventWaitList);
|
|
|
|
|
2019-11-24 21:50:41 +08:00
|
|
|
MOCKABLE_VIRTUAL CommandStreamReceiver &getGpgpuCommandStreamReceiver() const;
|
2019-07-16 15:23:02 +08:00
|
|
|
CommandStreamReceiver *getBcsCommandStreamReceiver() const;
|
2020-10-27 20:27:13 +08:00
|
|
|
MOCKABLE_VIRTUAL CommandStreamReceiver &getCommandStreamReceiver(bool blitAllowed) const;
|
2020-01-14 21:32:11 +08:00
|
|
|
Device &getDevice() const noexcept;
|
2020-10-22 18:14:54 +08:00
|
|
|
ClDevice &getClDevice() const { return *device; }
|
2019-02-21 23:59:10 +08:00
|
|
|
Context &getContext() const { return *context; }
|
|
|
|
Context *getContextPtr() const { return context; }
|
2019-07-15 20:28:09 +08:00
|
|
|
EngineControl &getGpgpuEngine() const { return *gpgpuEngine; }
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2018-08-24 14:48:59 +08:00
|
|
|
MOCKABLE_VIRTUAL LinearStream &getCS(size_t minRequiredSize);
|
2017-12-21 07:45:38 +08:00
|
|
|
IndirectHeap &getIndirectHeap(IndirectHeap::Type heapType,
|
2018-04-16 22:39:00 +08:00
|
|
|
size_t minRequiredSize);
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2018-04-05 21:12:28 +08:00
|
|
|
void allocateHeapMemory(IndirectHeap::Type heapType,
|
|
|
|
size_t minRequiredSize, IndirectHeap *&indirectHeap);
|
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
MOCKABLE_VIRTUAL void releaseIndirectHeap(IndirectHeap::Type heapType);
|
|
|
|
|
2019-02-04 20:08:47 +08:00
|
|
|
void releaseVirtualEvent() {
|
|
|
|
if (this->virtualEvent != nullptr) {
|
|
|
|
this->virtualEvent->decRefInternal();
|
|
|
|
this->virtualEvent = nullptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
cl_command_queue_properties getCommandQueueProperties() const {
|
|
|
|
return commandQueueProperties;
|
|
|
|
}
|
|
|
|
|
2019-04-18 18:25:29 +08:00
|
|
|
bool isProfilingEnabled() const {
|
2017-12-21 07:45:38 +08:00
|
|
|
return !!(this->getCommandQueueProperties() & CL_QUEUE_PROFILING_ENABLE);
|
|
|
|
}
|
|
|
|
|
2019-04-18 18:25:29 +08:00
|
|
|
bool isOOQEnabled() const {
|
2017-12-21 07:45:38 +08:00
|
|
|
return !!(this->getCommandQueueProperties() & CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE);
|
|
|
|
}
|
|
|
|
|
2019-04-18 18:25:29 +08:00
|
|
|
bool isPerfCountersEnabled() const {
|
2017-12-21 07:45:38 +08:00
|
|
|
return perfCountersEnabled;
|
|
|
|
}
|
|
|
|
|
|
|
|
PerformanceCounters *getPerfCounters();
|
|
|
|
|
2019-12-19 19:58:02 +08:00
|
|
|
bool setPerfCountersEnabled();
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2018-01-05 18:33:30 +08:00
|
|
|
void setIsSpecialCommandQueue(bool newValue) {
|
|
|
|
this->isSpecialCommandQueue = newValue;
|
|
|
|
}
|
|
|
|
|
2020-04-30 23:12:01 +08:00
|
|
|
bool isSpecial() {
|
|
|
|
return this->isSpecialCommandQueue;
|
|
|
|
}
|
|
|
|
|
2018-01-24 19:00:27 +08:00
|
|
|
QueuePriority getPriority() const {
|
|
|
|
return priority;
|
|
|
|
}
|
|
|
|
|
2018-01-29 18:18:34 +08:00
|
|
|
QueueThrottle getThrottle() const {
|
|
|
|
return throttle;
|
|
|
|
}
|
|
|
|
|
2020-09-29 21:39:50 +08:00
|
|
|
const TimestampPacketContainer *getTimestampPacketContainer() const {
|
|
|
|
return timestampPacketContainer.get();
|
|
|
|
}
|
|
|
|
|
2020-05-27 23:12:32 +08:00
|
|
|
const std::vector<uint64_t> &getPropertiesVector() const { return propertiesVector; }
|
|
|
|
|
2018-02-09 05:59:03 +08:00
|
|
|
void enqueueBlockedMapUnmapOperation(const cl_event *eventWaitList,
|
|
|
|
size_t numEventsInWaitlist,
|
|
|
|
MapOperationType opType,
|
|
|
|
MemObj *memObj,
|
2018-02-18 05:26:28 +08:00
|
|
|
MemObjSizeArray ©Size,
|
|
|
|
MemObjOffsetArray ©Offset,
|
|
|
|
bool readOnly,
|
2018-02-09 05:59:03 +08:00
|
|
|
EventBuilder &externalEventBuilder);
|
|
|
|
|
2018-03-21 19:58:30 +08:00
|
|
|
MOCKABLE_VIRTUAL bool setupDebugSurface(Kernel *kernel);
|
|
|
|
|
2020-11-24 21:29:07 +08:00
|
|
|
bool validateCapability(cl_command_queue_capabilities_intel capability) const;
|
|
|
|
bool validateCapabilityForOperation(cl_command_queue_capabilities_intel capability, const cl_event *waitList, const cl_event *outEvent) const;
|
2020-11-26 02:10:05 +08:00
|
|
|
cl_uint getQueueFamilyIndex() const { return queueFamilyIndex; }
|
|
|
|
cl_uint getQueueIndexWithinFamily() const { return queueIndexWithinFamily; }
|
|
|
|
bool isQueueFamilySelected() const { return queueFamilySelected; }
|
2020-11-24 21:29:07 +08:00
|
|
|
|
2019-02-11 00:50:54 +08:00
|
|
|
bool getRequiresCacheFlushAfterWalker() const {
|
|
|
|
return requiresCacheFlushAfterWalker;
|
|
|
|
}
|
|
|
|
|
2019-10-22 17:25:14 +08:00
|
|
|
void updateBcsTaskCount(uint32_t newBcsTaskCount) { this->bcsTaskCount = newBcsTaskCount; }
|
2020-06-25 17:35:29 +08:00
|
|
|
uint32_t peekBcsTaskCount() const { return bcsTaskCount; }
|
2019-10-22 17:25:14 +08:00
|
|
|
|
2020-06-26 17:21:07 +08:00
|
|
|
void updateLatestSentEnqueueType(EnqueueProperties::Operation newEnqueueType) { this->latestSentEnqueueType = newEnqueueType; }
|
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
// taskCount of last task
|
2018-12-06 16:21:28 +08:00
|
|
|
uint32_t taskCount = 0;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
// current taskLevel. Used for determining if a PIPE_CONTROL is needed.
|
2018-12-06 16:21:28 +08:00
|
|
|
uint32_t taskLevel = 0;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
std::unique_ptr<FlushStampTracker> flushStamp;
|
|
|
|
|
|
|
|
// virtual event that holds last Enqueue information
|
2018-12-06 16:21:28 +08:00
|
|
|
Event *virtualEvent = nullptr;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-02-21 23:59:10 +08:00
|
|
|
size_t estimateTimestampPacketNodesCount(const MultiDispatchInfo &dispatchInfo) const;
|
|
|
|
|
2019-08-21 18:50:47 +08:00
|
|
|
uint64_t getSliceCount() const { return sliceCount; }
|
|
|
|
|
2019-10-11 12:54:10 +08:00
|
|
|
uint64_t dispatchHints = 0;
|
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
protected:
|
2018-02-09 05:59:03 +08:00
|
|
|
void *enqueueReadMemObjForMap(TransferProperties &transferProperties, EventsRequest &eventsRequest, cl_int &errcodeRet);
|
|
|
|
cl_int enqueueWriteMemObjForUnmap(MemObj *memObj, void *mappedPtr, EventsRequest &eventsRequest);
|
|
|
|
|
|
|
|
void *enqueueMapMemObject(TransferProperties &transferProperties, EventsRequest &eventsRequest, cl_int &errcodeRet);
|
|
|
|
cl_int enqueueUnmapMemObject(TransferProperties &transferProperties, EventsRequest &eventsRequest);
|
|
|
|
|
2019-07-03 15:30:30 +08:00
|
|
|
virtual void obtainTaskLevelAndBlockedStatus(unsigned int &taskLevel, cl_uint &numEventsInWaitList, const cl_event *&eventWaitList, bool &blockQueueStatus, unsigned int commandType){};
|
2019-07-23 02:55:09 +08:00
|
|
|
bool isBlockedCommandStreamRequired(uint32_t commandType, const EventsRequest &eventsRequest, bool blockedQueue) const;
|
2018-02-01 20:40:30 +08:00
|
|
|
|
2020-07-07 20:40:29 +08:00
|
|
|
MOCKABLE_VIRTUAL void obtainNewTimestampPacketNodes(size_t numberOfNodes, TimestampPacketContainer &previousNodes, bool clearAllDependencies, bool blitEnqueue);
|
2020-05-27 23:12:32 +08:00
|
|
|
void storeProperties(const cl_queue_properties *properties);
|
2018-12-06 16:21:28 +08:00
|
|
|
void processProperties(const cl_queue_properties *properties);
|
2020-11-13 22:28:52 +08:00
|
|
|
void processPropertiesExtra(const cl_queue_properties *properties);
|
2020-11-16 19:43:03 +08:00
|
|
|
void overrideEngine(aub_stream::EngineType engineType);
|
2019-05-30 20:36:12 +08:00
|
|
|
bool bufferCpuCopyAllowed(Buffer *buffer, cl_command_type commandType, cl_bool blocking, size_t size, void *ptr,
|
|
|
|
cl_uint numEventsInWaitList, const cl_event *eventWaitList);
|
2019-06-13 17:05:31 +08:00
|
|
|
void providePerformanceHint(TransferProperties &transferProperties);
|
2019-06-13 15:56:06 +08:00
|
|
|
bool queueDependenciesClearRequired() const;
|
2019-09-02 16:16:44 +08:00
|
|
|
bool blitEnqueueAllowed(cl_command_type cmdType) const;
|
2020-10-28 00:17:26 +08:00
|
|
|
MOCKABLE_VIRTUAL bool blitEnqueueImageAllowed(const size_t *origin, const size_t *region);
|
2019-08-02 21:56:28 +08:00
|
|
|
void aubCaptureHook(bool &blocking, bool &clearAllDependencies, const MultiDispatchInfo &multiDispatchInfo);
|
2020-03-06 21:56:23 +08:00
|
|
|
virtual bool obtainTimestampPacketForCacheFlush(bool isCacheFlushRequired) const = 0;
|
2018-08-28 20:11:25 +08:00
|
|
|
|
2018-11-22 20:57:10 +08:00
|
|
|
Context *context = nullptr;
|
2020-01-14 21:32:11 +08:00
|
|
|
ClDevice *device = nullptr;
|
2019-07-15 20:28:09 +08:00
|
|
|
EngineControl *gpgpuEngine = nullptr;
|
2019-07-16 15:23:02 +08:00
|
|
|
EngineControl *bcsEngine = nullptr;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2018-12-06 16:21:28 +08:00
|
|
|
cl_command_queue_properties commandQueueProperties = 0;
|
2020-05-27 23:12:32 +08:00
|
|
|
std::vector<uint64_t> propertiesVector;
|
2020-11-26 02:10:05 +08:00
|
|
|
|
2020-12-08 20:40:04 +08:00
|
|
|
cl_command_queue_capabilities_intel queueCapabilities = CL_QUEUE_DEFAULT_CAPABILITIES_INTEL;
|
2020-11-26 02:10:05 +08:00
|
|
|
cl_uint queueFamilyIndex = 0;
|
|
|
|
cl_uint queueIndexWithinFamily = 0;
|
|
|
|
bool queueFamilySelected = false;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2018-12-06 16:21:28 +08:00
|
|
|
QueuePriority priority = QueuePriority::MEDIUM;
|
|
|
|
QueueThrottle throttle = QueueThrottle::MEDIUM;
|
2020-06-24 19:32:09 +08:00
|
|
|
EnqueueProperties::Operation latestSentEnqueueType = EnqueueProperties::Operation::None;
|
2019-08-21 18:50:47 +08:00
|
|
|
uint64_t sliceCount = QueueSliceCount::defaultSliceCount;
|
2019-10-22 17:25:14 +08:00
|
|
|
uint32_t bcsTaskCount = 0;
|
2018-01-24 19:00:27 +08:00
|
|
|
|
2018-12-06 16:21:28 +08:00
|
|
|
bool perfCountersEnabled = false;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2020-09-25 22:42:45 +08:00
|
|
|
bool isCopyOnly = false;
|
|
|
|
|
2018-12-06 16:21:28 +08:00
|
|
|
LinearStream *commandStream = nullptr;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2018-01-05 18:33:30 +08:00
|
|
|
bool isSpecialCommandQueue = false;
|
2019-02-11 00:50:54 +08:00
|
|
|
bool requiresCacheFlushAfterWalker = false;
|
2018-02-15 23:13:22 +08:00
|
|
|
|
2018-10-03 05:37:30 +08:00
|
|
|
std::unique_ptr<TimestampPacketContainer> timestampPacketContainer;
|
2017-12-21 07:45:38 +08:00
|
|
|
};
|
|
|
|
|
2020-01-21 16:35:12 +08:00
|
|
|
using CommandQueueCreateFunc = CommandQueue *(*)(Context *context, ClDevice *device, const cl_queue_properties *properties, bool internalUsage);
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|