mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-28 16:48:45 +08:00
Add getIntelQueueInfo helper function
Change-Id: I5daed24c36db8f5da143db8665b4353582dbc94b Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
e42e952d21
commit
cdd46679c8
@@ -334,6 +334,7 @@ class CommandQueue : public BaseObject<_cl_command_queue> {
|
||||
Device &getDevice() const { return *device; }
|
||||
Context &getContext() const { return *context; }
|
||||
Context *getContextPtr() const { return context; }
|
||||
EngineControl &getEngine() const { return *engine; }
|
||||
|
||||
MOCKABLE_VIRTUAL LinearStream &getCS(size_t minRequiredSize);
|
||||
IndirectHeap &getIndirectHeap(IndirectHeap::Type heapType,
|
||||
@@ -448,7 +449,6 @@ class CommandQueue : public BaseObject<_cl_command_queue> {
|
||||
|
||||
QueuePriority priority = QueuePriority::MEDIUM;
|
||||
QueueThrottle throttle = QueueThrottle::MEDIUM;
|
||||
uint32_t engineId = 0;
|
||||
|
||||
bool perfCountersEnabled = false;
|
||||
cl_uint perfCountersConfig = std::numeric_limits<uint32_t>::max();
|
||||
|
||||
@@ -18,4 +18,8 @@ bool verifyExtraTokens(Device *&device, Context &context, const cl_queue_propert
|
||||
|
||||
void CommandQueue::processProperties(const cl_queue_properties *properties) {
|
||||
}
|
||||
|
||||
void getIntelQueueInfo(CommandQueue *queue, cl_command_queue_info paramName, GetInfoHelper &getInfoHelper, cl_int &retVal) {
|
||||
retVal = CL_INVALID_VALUE;
|
||||
}
|
||||
} // namespace OCLRT
|
||||
|
||||
@@ -31,6 +31,8 @@ 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;
|
||||
@@ -77,6 +79,11 @@ cl_int getQueueInfo(QueueType *queue,
|
||||
retVal = CL_INVALID_VALUE;
|
||||
break;
|
||||
default:
|
||||
if (std::is_same<QueueType, class CommandQueue>::value) {
|
||||
auto cmdQ = reinterpret_cast<CommandQueue *>(queue);
|
||||
getIntelQueueInfo(cmdQ, paramName, getInfoHelper, retVal);
|
||||
break;
|
||||
}
|
||||
retVal = CL_INVALID_VALUE;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1023,3 +1023,10 @@ TEST(CommandQueuePropertiesTests, whenDefaultCommandQueueIsCreatedThenItIsNotMul
|
||||
queue.multiEngineQueue = true;
|
||||
EXPECT_TRUE(queue.isMultiEngineQueue());
|
||||
}
|
||||
|
||||
TEST(CommandQueuePropertiesTests, whenGetEngineIsCalledThenQueueEngineIsReturned) {
|
||||
MockCommandQueue queue;
|
||||
EngineControl engineControl;
|
||||
queue.engine = &engineControl;
|
||||
EXPECT_EQ(queue.engine, &queue.getEngine());
|
||||
}
|
||||
|
||||
@@ -104,6 +104,18 @@ TEST_P(GetCommandQueueInfoTest, QUEUE_DEVICE_DEFAULT) {
|
||||
EXPECT_NE(pCmdQ, commandQueueReturned);
|
||||
}
|
||||
|
||||
TEST_P(GetCommandQueueInfoTest, GivenInvalidParameterWhenGettingCommandQueueInfoThenInvalidValueIsReturned) {
|
||||
cl_uint parameterReturned = 0;
|
||||
cl_command_queue_info invalidParameter = 0xdeadbeef;
|
||||
|
||||
auto retVal = pCmdQ->getCommandQueueInfo(
|
||||
invalidParameter,
|
||||
sizeof(parameterReturned),
|
||||
¶meterReturned,
|
||||
nullptr);
|
||||
EXPECT_EQ(CL_INVALID_VALUE, retVal);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
GetCommandQueueInfoTest,
|
||||
GetCommandQueueInfoTest,
|
||||
|
||||
Reference in New Issue
Block a user