Correct getting engines from device with sub devices

use first sub device to take engine for low priority or blit operations

Related-To: NEO-3691

Change-Id: I29737df06cc764a10a22a41017ab827cde7960b8
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2019-10-15 16:17:12 +02:00
committed by sys_ocldev
parent dbad1d7081
commit 37bd67e791
4 changed files with 49 additions and 2 deletions

View File

@@ -5,6 +5,7 @@
*
*/
#include "core/unit_tests/helpers/debug_manager_state_restore.h"
#include "runtime/command_queue/command_queue.h"
#include "runtime/command_stream/command_stream_receiver.h"
#include "runtime/device/device.h"
@@ -378,6 +379,24 @@ HWTEST_F(clCreateCommandQueueWithPropertiesApi, GivenLowPriorityWhenCreatingComm
clReleaseCommandQueue(cmdQ);
}
using LowPriorityCommandQueueTest = ::testing::Test;
HWTEST_F(LowPriorityCommandQueueTest, GivenDeviceWithSubdevicesWhenCreatingLowPriorityCommandQueueThenEngineFromFirstSubdeviceIsTaken) {
DebugManagerStateRestore restorer;
DebugManager.flags.CreateMultipleSubDevices.set(2);
MockContext context;
cl_queue_properties properties[] = {CL_QUEUE_PRIORITY_KHR, CL_QUEUE_PRIORITY_LOW_KHR, 0};
EXPECT_EQ(2u, context.getDevice(0)->getNumAvailableDevices());
auto cmdQ = clCreateCommandQueueWithProperties(&context, context.getDevice(0), properties, nullptr);
auto commandQueueObj = castToObject<CommandQueue>(cmdQ);
auto subDevice = context.getDevice(0)->getDeviceById(0);
auto engine = subDevice->getEngine(HwHelperHw<FamilyType>::lowPriorityEngineType, true);
EXPECT_EQ(engine.commandStreamReceiver, &commandQueueObj->getGpgpuCommandStreamReceiver());
EXPECT_EQ(engine.osContext, &commandQueueObj->getGpgpuCommandStreamReceiver().getOsContext());
clReleaseCommandQueue(cmdQ);
}
std::pair<uint32_t, QueuePriority> priorityParams[3]{
std::make_pair(CL_QUEUE_PRIORITY_LOW_KHR, QueuePriority::LOW),
std::make_pair(CL_QUEUE_PRIORITY_MED_KHR, QueuePriority::MEDIUM),