2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2021-05-17 02:51:16 +08:00
|
|
|
* Copyright (C) 2018-2021 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-23 05:50:57 +08:00
|
|
|
#include "opencl/source/command_queue/command_queue.h"
|
2020-02-23 22:20:22 +08:00
|
|
|
#include "opencl/test/unit_test/mocks/mock_context.h"
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-02-27 18:39:32 +08:00
|
|
|
#include "CL/cl.h"
|
|
|
|
#include "gtest/gtest.h"
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2017-12-21 07:45:38 +08:00
|
|
|
class Device;
|
|
|
|
|
|
|
|
struct CommandQueueHwFixture {
|
2020-01-14 21:32:11 +08:00
|
|
|
CommandQueue *createCommandQueue(ClDevice *device) {
|
2019-02-11 00:50:54 +08:00
|
|
|
return createCommandQueue(device, cl_command_queue_properties{0});
|
|
|
|
}
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
CommandQueue *createCommandQueue(
|
2020-01-14 21:32:11 +08:00
|
|
|
ClDevice *device,
|
2017-12-21 07:45:38 +08:00
|
|
|
cl_command_queue_properties properties);
|
|
|
|
|
2019-02-11 00:50:54 +08:00
|
|
|
CommandQueue *createCommandQueue(
|
2020-01-14 21:32:11 +08:00
|
|
|
ClDevice *device,
|
2019-02-11 00:50:54 +08:00
|
|
|
const cl_command_queue_properties *properties);
|
|
|
|
|
2021-07-02 00:00:22 +08:00
|
|
|
CommandQueue *createCommandQueue(
|
|
|
|
ClDevice *device,
|
|
|
|
const cl_command_queue_properties *properties,
|
|
|
|
Context *context);
|
|
|
|
|
2021-10-18 23:07:01 +08:00
|
|
|
static void forceMapBufferOnGpu(Buffer &buffer);
|
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
virtual void SetUp();
|
2020-03-12 14:54:21 +08:00
|
|
|
virtual void SetUp(ClDevice *pDevice, cl_command_queue_properties properties);
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
virtual void TearDown();
|
|
|
|
|
2019-02-11 00:50:54 +08:00
|
|
|
CommandQueue *pCmdQ = nullptr;
|
2020-11-16 19:08:30 +08:00
|
|
|
MockClDevice *device = nullptr;
|
2019-02-11 00:50:54 +08:00
|
|
|
MockContext *context = nullptr;
|
2020-11-16 19:08:30 +08:00
|
|
|
bool createdDevice = false;
|
2017-12-21 07:45:38 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct OOQueueFixture : public CommandQueueHwFixture {
|
|
|
|
typedef CommandQueueHwFixture BaseClass;
|
|
|
|
|
2020-03-10 22:21:12 +08:00
|
|
|
void SetUp(ClDevice *pDevice, cl_command_queue_properties properties) override {
|
|
|
|
ASSERT_NE(nullptr, pDevice);
|
|
|
|
BaseClass::pCmdQ = BaseClass::createCommandQueue(pDevice, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE);
|
2017-12-21 07:45:38 +08:00
|
|
|
ASSERT_NE(nullptr, BaseClass::pCmdQ);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct CommandQueueFixture {
|
|
|
|
virtual void SetUp(
|
|
|
|
Context *context,
|
2020-01-14 21:32:11 +08:00
|
|
|
ClDevice *device,
|
2017-12-21 07:45:38 +08:00
|
|
|
cl_command_queue_properties properties);
|
|
|
|
virtual void TearDown();
|
|
|
|
|
|
|
|
CommandQueue *createCommandQueue(
|
|
|
|
Context *context,
|
2020-01-14 21:32:11 +08:00
|
|
|
ClDevice *device,
|
2021-07-23 18:36:36 +08:00
|
|
|
cl_command_queue_properties properties,
|
|
|
|
bool internalUsage);
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2020-03-13 21:59:00 +08:00
|
|
|
CommandQueue *pCmdQ = nullptr;
|
2017-12-21 07:45:38 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static const cl_command_queue_properties AllCommandQueueProperties[] = {
|
|
|
|
0,
|
|
|
|
CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE,
|
|
|
|
CL_QUEUE_ON_DEVICE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE,
|
|
|
|
CL_QUEUE_ON_DEVICE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE_DEFAULT,
|
|
|
|
CL_QUEUE_PROFILING_ENABLE,
|
|
|
|
CL_QUEUE_PROFILING_ENABLE | CL_QUEUE_ON_DEVICE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE,
|
|
|
|
CL_QUEUE_PROFILING_ENABLE | CL_QUEUE_ON_DEVICE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE_DEFAULT};
|
|
|
|
|
|
|
|
static const cl_command_queue_properties DefaultCommandQueueProperties[] = {
|
|
|
|
0,
|
|
|
|
CL_QUEUE_PROFILING_ENABLE,
|
|
|
|
};
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|