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-03-20 18:15:25 +08:00
|
|
|
#include "opencl/source/cl_device/cl_device.h"
|
2020-02-23 05:50:57 +08:00
|
|
|
#include "opencl/source/command_queue/command_queue.h"
|
|
|
|
#include "opencl/source/device_queue/device_queue.h"
|
|
|
|
#include "opencl/source/device_queue/device_queue_hw.h"
|
2020-02-23 22:20:22 +08:00
|
|
|
#include "opencl/test/unit_test/api/cl_api_tests.h"
|
2020-04-28 19:00:33 +08:00
|
|
|
#include "opencl/test/unit_test/test_macros/test_checks_ocl.h"
|
2017-12-21 07:45:38 +08:00
|
|
|
#include "test.h"
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
using namespace NEO;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
namespace DeviceHostQueue {
|
|
|
|
struct deviceQueueProperties {
|
|
|
|
static cl_queue_properties minimumProperties[5];
|
|
|
|
static cl_queue_properties minimumPropertiesWithProfiling[5];
|
|
|
|
static cl_queue_properties noProperties[5];
|
|
|
|
static cl_queue_properties allProperties[5];
|
|
|
|
};
|
|
|
|
|
|
|
|
IGIL_CommandQueue getExpectedInitIgilCmdQueue(DeviceQueue *deviceQueue);
|
|
|
|
IGIL_CommandQueue getExpectedgilCmdQueueAfterReset(DeviceQueue *deviceQueue);
|
|
|
|
|
|
|
|
template <typename T>
|
2020-02-12 18:27:28 +08:00
|
|
|
class DeviceHostQueueFixture : public ApiFixture<>,
|
2017-12-21 07:45:38 +08:00
|
|
|
public ::testing::Test {
|
|
|
|
public:
|
|
|
|
void SetUp() override {
|
2019-12-02 21:19:24 +08:00
|
|
|
ApiFixture::SetUp();
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
|
|
|
void TearDown() override {
|
2019-12-02 21:19:24 +08:00
|
|
|
ApiFixture::TearDown();
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
cl_command_queue createClQueue(cl_queue_properties properties[5] = deviceQueueProperties::noProperties) {
|
2020-04-24 18:58:39 +08:00
|
|
|
return create(pContext, testedClDevice, retVal, properties);
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
T *createQueueObject(cl_queue_properties properties[5] = deviceQueueProperties::noProperties) {
|
|
|
|
using BaseType = typename T::BaseType;
|
|
|
|
cl_context context = (cl_context)(pContext);
|
2020-04-24 18:58:39 +08:00
|
|
|
auto clQueue = create(context, testedClDevice, retVal, properties);
|
2017-12-21 07:45:38 +08:00
|
|
|
return castToObject<T>(static_cast<BaseType *>(clQueue));
|
|
|
|
}
|
|
|
|
|
|
|
|
cl_command_queue create(cl_context ctx, cl_device_id device, cl_int &retVal,
|
|
|
|
cl_queue_properties properties[5] = deviceQueueProperties::noProperties);
|
|
|
|
};
|
|
|
|
|
|
|
|
class DeviceQueueHwTest : public DeviceHostQueueFixture<DeviceQueue> {
|
|
|
|
public:
|
|
|
|
using BaseClass = DeviceHostQueueFixture<DeviceQueue>;
|
|
|
|
void SetUp() override {
|
|
|
|
BaseClass::SetUp();
|
2020-04-24 18:58:39 +08:00
|
|
|
device = castToObject<ClDevice>(testedClDevice);
|
2017-12-21 07:45:38 +08:00
|
|
|
ASSERT_NE(device, nullptr);
|
2020-04-28 19:00:33 +08:00
|
|
|
REQUIRE_DEVICE_ENQUEUE_OR_SKIP(device);
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void TearDown() override {
|
|
|
|
BaseClass::TearDown();
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
DeviceQueueHw<GfxFamily> *castToHwType(DeviceQueue *deviceQueue) {
|
|
|
|
return reinterpret_cast<DeviceQueueHw<GfxFamily> *>(deviceQueue);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
size_t getMinimumSlbSize() {
|
|
|
|
return sizeof(typename GfxFamily::MEDIA_STATE_FLUSH) +
|
|
|
|
sizeof(typename GfxFamily::MEDIA_INTERFACE_DESCRIPTOR_LOAD) +
|
|
|
|
sizeof(typename GfxFamily::PIPE_CONTROL) +
|
|
|
|
sizeof(typename GfxFamily::GPGPU_WALKER) +
|
|
|
|
sizeof(typename GfxFamily::MEDIA_STATE_FLUSH) +
|
|
|
|
sizeof(typename GfxFamily::PIPE_CONTROL) +
|
|
|
|
DeviceQueueHw<GfxFamily>::getCSPrefetchSize(); // prefetch size
|
|
|
|
}
|
|
|
|
|
|
|
|
DeviceQueue *deviceQueue;
|
2020-01-14 21:32:11 +08:00
|
|
|
ClDevice *device;
|
2017-12-21 07:45:38 +08:00
|
|
|
};
|
2018-06-13 03:54:39 +08:00
|
|
|
} // namespace DeviceHostQueue
|