mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 14:55:24 +08:00
OpenCL Queue Families extension 6/n
Add queue family and index querying from existing queue Signed-off-by: Maciej Dziuban <maciej.dziuban@intel.com> Related-To: NEO-5120
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
4732a4e692
commit
2293fc0cb5
@@ -736,12 +736,15 @@ void CommandQueue::processProperties(const cl_queue_properties *properties) {
|
||||
}
|
||||
|
||||
if (specificEngineSelected) {
|
||||
this->queueFamilySelected = true;
|
||||
if (getDevice().getNumAvailableDevices() == 1) {
|
||||
auto queueFamily = getDevice().getNonEmptyEngineGroup(selectedQueueFamilyIndex);
|
||||
auto engine = queueFamily->at(selectedQueueIndex);
|
||||
auto engineType = engine.getEngineType();
|
||||
this->overrideEngine(engineType);
|
||||
this->queueCapabilities = getClDevice().getDeviceInfo().queueFamilyProperties[selectedQueueFamilyIndex].capabilities;
|
||||
this->queueFamilyIndex = selectedQueueFamilyIndex;
|
||||
this->queueIndexWithinFamily = selectedQueueIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -302,6 +302,9 @@ class CommandQueue : public BaseObject<_cl_command_queue> {
|
||||
|
||||
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;
|
||||
cl_uint getQueueFamilyIndex() const { return queueFamilyIndex; }
|
||||
cl_uint getQueueIndexWithinFamily() const { return queueIndexWithinFamily; }
|
||||
bool isQueueFamilySelected() const { return queueFamilySelected; }
|
||||
|
||||
bool getRequiresCacheFlushAfterWalker() const {
|
||||
return requiresCacheFlushAfterWalker;
|
||||
@@ -360,7 +363,11 @@ class CommandQueue : public BaseObject<_cl_command_queue> {
|
||||
|
||||
cl_command_queue_properties commandQueueProperties = 0;
|
||||
std::vector<uint64_t> propertiesVector;
|
||||
|
||||
cl_command_queue_capabilities_intel queueCapabilities = CL_QUEUE_CAPABILITY_ALL_INTEL;
|
||||
cl_uint queueFamilyIndex = 0;
|
||||
cl_uint queueIndexWithinFamily = 0;
|
||||
bool queueFamilySelected = false;
|
||||
|
||||
QueuePriority priority = QueuePriority::MEDIUM;
|
||||
QueueThrottle throttle = QueueThrottle::MEDIUM;
|
||||
|
||||
@@ -37,8 +37,6 @@ void retainQueue(cl_command_queue commandQueue, cl_int &retVal) {
|
||||
}
|
||||
}
|
||||
|
||||
void getIntelQueueInfo(CommandQueue *queue, cl_command_queue_info paramName, GetInfoHelper &getInfoHelper, cl_int &retVal);
|
||||
|
||||
template <typename QueueType>
|
||||
void releaseQueue(cl_command_queue commandQueue, cl_int &retVal) {
|
||||
using BaseType = typename QueueType::BaseType;
|
||||
@@ -62,6 +60,30 @@ inline void releaseQueue<CommandQueue>(cl_command_queue commandQueue, cl_int &re
|
||||
}
|
||||
}
|
||||
|
||||
void getIntelQueueInfo(CommandQueue *queue, cl_command_queue_info paramName, GetInfoHelper &getInfoHelper, cl_int &retVal);
|
||||
|
||||
inline void getHostQueueInfo(CommandQueue *queue, cl_command_queue_info paramName, GetInfoHelper &getInfoHelper, cl_int &retVal) {
|
||||
switch (paramName) {
|
||||
case CL_QUEUE_FAMILY_INTEL:
|
||||
if (queue->isQueueFamilySelected()) {
|
||||
retVal = changeGetInfoStatusToCLResultType(getInfoHelper.set<cl_uint>(queue->getQueueFamilyIndex()));
|
||||
} else {
|
||||
retVal = CL_INVALID_VALUE;
|
||||
}
|
||||
break;
|
||||
case CL_QUEUE_INDEX_INTEL:
|
||||
if (queue->isQueueFamilySelected()) {
|
||||
retVal = changeGetInfoStatusToCLResultType(getInfoHelper.set<cl_uint>(queue->getQueueIndexWithinFamily()));
|
||||
} else {
|
||||
retVal = CL_INVALID_VALUE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
getIntelQueueInfo(queue, paramName, getInfoHelper, retVal);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename QueueType>
|
||||
cl_int getQueueInfo(QueueType *queue,
|
||||
cl_command_queue_info paramName,
|
||||
@@ -110,7 +132,7 @@ cl_int getQueueInfo(QueueType *queue,
|
||||
default:
|
||||
if (std::is_same<QueueType, class CommandQueue>::value) {
|
||||
auto cmdQ = reinterpret_cast<CommandQueue *>(queue);
|
||||
getIntelQueueInfo(cmdQ, paramName, getInfoHelper, retVal);
|
||||
getHostQueueInfo(cmdQ, paramName, getInfoHelper, retVal);
|
||||
break;
|
||||
}
|
||||
retVal = CL_INVALID_VALUE;
|
||||
|
||||
Reference in New Issue
Block a user