Remove device enqueue part 11

- remove templates from queue functions

Related-To: NEO-6559
Signed-off-by: Katarzyna Cencelewska <katarzyna.cencelewska@intel.com>
This commit is contained in:
Katarzyna Cencelewska
2022-01-24 15:01:40 +00:00
committed by Compute-Runtime-Automation
parent f1a8bb821a
commit 3d9e1ea3a5
11 changed files with 55 additions and 154 deletions

View File

@@ -8,7 +8,6 @@
#include "shared/test/common/helpers/unit_test_helper.h"
#include "opencl/source/context/context.h"
#include "opencl/test/unit_test/fixtures/device_host_queue_fixture.h"
#include "opencl/test/unit_test/mocks/mock_kernel.h"
#include "cl_api_tests.h"

View File

@@ -7,24 +7,36 @@
#include "shared/test/common/helpers/unit_test_helper.h"
#include "opencl/source/command_queue/command_queue.h"
#include "opencl/source/context/context.h"
#include "opencl/test/unit_test/fixtures/device_host_queue_fixture.h"
#include "opencl/test/unit_test/api/cl_api_tests.h"
using namespace NEO;
namespace DeviceHostQueue {
typedef ::testing::Types<CommandQueue> QueueTypes;
namespace ULT {
template <typename T>
class clRetainReleaseCommandQueueTests : public DeviceHostQueueFixture<T> {};
class clRetainReleaseCommandQueueTests : public ApiFixture<>,
public ::testing::Test {
public:
void SetUp() override {
ApiFixture::SetUp();
}
void TearDown() override {
ApiFixture::TearDown();
}
TYPED_TEST_CASE(clRetainReleaseCommandQueueTests, QueueTypes);
cl_command_queue createClQueue() {
return clCreateCommandQueueWithProperties(pContext, testedClDevice, noProperties, &retVal);
}
TYPED_TEST(clRetainReleaseCommandQueueTests, GivenValidCommandQueueWhenRetainingAndReleasingThenReferenceCountIsUpdatedCorrectly) {
using BaseType = typename TypeParam::BaseType;
protected:
cl_queue_properties noProperties[5] = {0};
};
TEST_F(clRetainReleaseCommandQueueTests, GivenValidCommandQueueWhenRetainingAndReleasingThenReferenceCountIsUpdatedCorrectly) {
auto queue = this->createClQueue();
ASSERT_EQ(CL_SUCCESS, this->retVal);
auto qObject = castToObject<TypeParam>(static_cast<BaseType *>(queue));
auto qObject = castToObject<CommandQueue>(queue);
ASSERT_NE(qObject, nullptr);
cl_uint refCount;
@@ -52,4 +64,4 @@ TYPED_TEST(clRetainReleaseCommandQueueTests, GivenValidCommandQueueWhenRetaining
this->retVal = clReleaseCommandQueue(queue);
EXPECT_EQ(CL_SUCCESS, this->retVal);
}
} // namespace DeviceHostQueue
} // namespace ULT

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -560,7 +560,7 @@ HWTEST_F(CommandQueueHwTest, whenReleaseQueueCalledThenFlushIsCalled) {
cl_int retVal = 0;
auto mockCmdQ = new MockCommandQueueHw<FamilyType>(context, pClDevice, 0);
mockCmdQ->incRefInternal();
releaseQueue<CommandQueue>(mockCmdQ, retVal);
releaseQueue(mockCmdQ, retVal);
EXPECT_TRUE(mockCmdQ->flushCalled);
//this call will release the queue
mockCmdQ->decRefInternal();
@@ -703,7 +703,7 @@ HWTEST_F(CommandQueueHwRefCountTest, givenBlockedCmdQWhenNewBlockedEnqueueReplac
EXPECT_EQ(2, mockCmdQ->getRefInternalCount());
//this call will release the queue
releaseQueue<CommandQueue>(mockCmdQ, retVal);
releaseQueue(mockCmdQ, retVal);
}
HWTEST_F(CommandQueueHwRefCountTest, givenBlockedCmdQWithOutputEventAsVirtualEventWhenNewBlockedEnqueueReplacesVirtualEventCreatedFromOutputEventThenPreviousVirtualEventDoesntDecrementRefCount) {
@@ -748,7 +748,7 @@ HWTEST_F(CommandQueueHwRefCountTest, givenBlockedCmdQWithOutputEventAsVirtualEve
EXPECT_EQ(2, mockCmdQ->getRefInternalCount());
mockCmdQ->isQueueBlocked();
releaseQueue<CommandQueue>(mockCmdQ, retVal);
releaseQueue(mockCmdQ, retVal);
}
HWTEST_F(CommandQueueHwRefCountTest, givenSeriesOfBlockedEnqueuesWhenEveryEventIsDeletedAndCmdQIsReleasedThenCmdQIsDeleted) {
@@ -798,7 +798,7 @@ HWTEST_F(CommandQueueHwRefCountTest, givenSeriesOfBlockedEnqueuesWhenEveryEventI
EXPECT_EQ(1, mockCmdQ->getRefInternalCount());
releaseQueue<CommandQueue>(mockCmdQ, retVal);
releaseQueue(mockCmdQ, retVal);
}
HWTEST_F(CommandQueueHwRefCountTest, givenSeriesOfBlockedEnqueuesWhenCmdQIsReleasedBeforeOutputEventThenOutputEventDeletesCmdQ) {
@@ -838,7 +838,7 @@ HWTEST_F(CommandQueueHwRefCountTest, givenSeriesOfBlockedEnqueuesWhenCmdQIsRelea
// releasing UserEvent doesn't change the queue refCount
EXPECT_EQ(3, mockCmdQ->getRefInternalCount());
releaseQueue<CommandQueue>(mockCmdQ, retVal);
releaseQueue(mockCmdQ, retVal);
// releasing cmdQ decrements refCount
EXPECT_EQ(1, mockCmdQ->getRefInternalCount());

View File

@@ -13,8 +13,6 @@ set(IGDRCL_SRCS_tests_fixtures
${CMAKE_CURRENT_SOURCE_DIR}/context_fixture.h
${CMAKE_CURRENT_SOURCE_DIR}/d3d_test_fixture.h
${CMAKE_CURRENT_SOURCE_DIR}/dispatch_flags_fixture.h
${CMAKE_CURRENT_SOURCE_DIR}/device_host_queue_fixture.cpp
${CMAKE_CURRENT_SOURCE_DIR}/device_host_queue_fixture.h
${CMAKE_CURRENT_SOURCE_DIR}/device_info_fixture.h
${CMAKE_CURRENT_SOURCE_DIR}/device_instrumentation_fixture.cpp
${CMAKE_CURRENT_SOURCE_DIR}/device_instrumentation_fixture.h

View File

@@ -1,35 +0,0 @@
/*
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "opencl/test/unit_test/fixtures/device_host_queue_fixture.h"
using namespace NEO;
namespace DeviceHostQueue {
cl_queue_properties deviceQueueProperties::minimumProperties[5] = {
CL_QUEUE_PROPERTIES,
CL_QUEUE_ON_DEVICE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE,
0, 0, 0};
cl_queue_properties deviceQueueProperties::minimumPropertiesWithProfiling[5] = {
CL_QUEUE_PROPERTIES,
CL_QUEUE_ON_DEVICE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_PROFILING_ENABLE,
0, 0, 0};
cl_queue_properties deviceQueueProperties::noProperties[5] = {0};
cl_queue_properties deviceQueueProperties::allProperties[5] = {
CL_QUEUE_PROPERTIES, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_PROFILING_ENABLE | CL_QUEUE_ON_DEVICE,
CL_QUEUE_SIZE, 128 * 1024,
0};
template <>
cl_command_queue DeviceHostQueueFixture<CommandQueue>::create(cl_context ctx, cl_device_id device, cl_int &retVal,
cl_queue_properties properties[5]) {
return clCreateCommandQueueWithProperties(ctx, device, properties, &retVal);
}
} // namespace DeviceHostQueue

View File

@@ -1,52 +0,0 @@
/*
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/test/common/test_macros/test.h"
#include "opencl/source/cl_device/cl_device.h"
#include "opencl/source/command_queue/command_queue.h"
#include "opencl/test/unit_test/api/cl_api_tests.h"
#include "opencl/test/unit_test/test_macros/test_checks_ocl.h"
using namespace NEO;
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];
};
template <typename T>
class DeviceHostQueueFixture : public ApiFixture<>,
public ::testing::Test {
public:
void SetUp() override {
ApiFixture::SetUp();
}
void TearDown() override {
ApiFixture::TearDown();
}
cl_command_queue createClQueue(cl_queue_properties properties[5] = deviceQueueProperties::noProperties) {
return create(pContext, testedClDevice, retVal, properties);
}
T *createQueueObject(cl_queue_properties properties[5] = deviceQueueProperties::noProperties) {
using BaseType = typename T::BaseType;
cl_context context = (cl_context)(pContext);
auto clQueue = create(context, testedClDevice, retVal, properties);
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);
};
} // namespace DeviceHostQueue

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -24,7 +24,7 @@ TEST(QueueHelpersTest, givenCommandQueueWithoutVirtualEventWhenReleaseQueueIsCal
cmdQ->incRefInternal();
EXPECT_EQ(2, cmdQ->getRefInternalCount());
releaseQueue<CommandQueue>(cmdQ, retVal);
releaseQueue(cmdQ, retVal);
EXPECT_EQ(1, cmdQ->getRefInternalCount());
cmdQ->decRefInternal();

View File

@@ -33,7 +33,6 @@
#include "opencl/source/kernel/kernel.h"
#include "opencl/source/mem_obj/image.h"
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
#include "opencl/test/unit_test/fixtures/device_host_queue_fixture.h"
#include "opencl/test/unit_test/fixtures/multi_root_device_fixture.h"
#include "opencl/test/unit_test/helpers/gtest_helpers.h"
#include "opencl/test/unit_test/mocks/mock_command_queue.h"
@@ -47,7 +46,6 @@
#include <memory>
using namespace NEO;
using namespace DeviceHostQueue;
using KernelTest = ::testing::Test;