Remove device enqueue part 4

-remove structs, class and tests with REQUIRE_DEVICE_ENQUEUE_OR_SKIP

Related-To: NEO-6559
Signed-off-by: Katarzyna Cencelewska <katarzyna.cencelewska@intel.com>
This commit is contained in:
Katarzyna Cencelewska
2022-01-11 15:45:49 +00:00
committed by Compute-Runtime-Automation
parent 45ae4fe881
commit c52223e642
16 changed files with 11 additions and 1767 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -273,51 +273,6 @@ TEST_F(clCreateCommandQueueWithPropertiesApi, GivenDefaultDeviceQueueWithoutQueu
EXPECT_EQ(retVal, CL_INVALID_VALUE);
}
HWCMDTEST_F(IGFX_GEN8_CORE, clCreateCommandQueueWithPropertiesApi, GivenNumberOfDevicesGreaterThanMaxWhenCreatingCommandQueueWithPropertiesThenOutOfResourcesErrorIsReturned) {
REQUIRE_DEVICE_ENQUEUE_OR_SKIP(pContext);
cl_int retVal = CL_SUCCESS;
auto pDevice = castToObject<ClDevice>(testedClDevice);
cl_queue_properties odq[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE, 0};
auto cmdq1 = clCreateCommandQueueWithProperties(pContext, testedClDevice, odq, &retVal);
EXPECT_NE(nullptr, cmdq1);
EXPECT_EQ(retVal, CL_SUCCESS);
auto cmdq2 = clCreateCommandQueueWithProperties(pContext, testedClDevice, odq, &retVal);
if (pDevice->getDeviceInfo().maxOnDeviceQueues > 1) {
EXPECT_NE(nullptr, cmdq2);
EXPECT_EQ(retVal, CL_SUCCESS);
} else {
EXPECT_EQ(nullptr, cmdq2);
EXPECT_EQ(retVal, CL_OUT_OF_RESOURCES);
}
clReleaseCommandQueue(cmdq1);
if (cmdq2) {
clReleaseCommandQueue(cmdq2);
}
}
HWCMDTEST_F(IGFX_GEN8_CORE, clCreateCommandQueueWithPropertiesApi, GivenFailedAllocationWhenCreatingCommandQueueWithPropertiesThenOutOfHostMemoryErrorIsReturned) {
REQUIRE_DEVICE_ENQUEUE_OR_SKIP(pContext);
InjectedFunction method = [this](size_t failureIndex) {
cl_queue_properties ooq[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE | CL_QUEUE_ON_DEVICE_DEFAULT, 0};
auto retVal = CL_INVALID_VALUE;
auto cmdq = clCreateCommandQueueWithProperties(pContext, testedClDevice, ooq, &retVal);
if (MemoryManagement::nonfailingAllocation == failureIndex) {
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_NE(nullptr, cmdq);
clReleaseCommandQueue(cmdq);
} else {
EXPECT_EQ(CL_OUT_OF_HOST_MEMORY, retVal) << "for allocation " << failureIndex;
EXPECT_EQ(nullptr, cmdq);
}
};
injectFailureOnIndex(method, 0);
}
TEST_F(clCreateCommandQueueWithPropertiesApi, GivenHighPriorityWhenCreatingOoqCommandQueueWithPropertiesThenInvalidQueuePropertiesErrorIsReturned) {
cl_int retVal = CL_SUCCESS;
cl_queue_properties ondevice[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_ON_DEVICE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, CL_QUEUE_PRIORITY_KHR, CL_QUEUE_PRIORITY_HIGH_KHR, 0};
@ -455,33 +410,6 @@ TEST_F(clCreateCommandQueueWithPropertiesApi, GivenCommandQueueCreatedWithVariou
}
}
TEST_F(clCreateCommandQueueWithPropertiesApi, GivenDeviceQueueCreatedWithVariousPropertiesWhenQueryingPropertiesArrayThenCorrectValuesAreReturned) {
REQUIRE_DEVICE_ENQUEUE_OR_SKIP(pContext);
cl_int retVal = CL_SUCCESS;
cl_queue_properties propertiesArray[5];
size_t propertiesArraySize;
std::vector<std::vector<uint64_t>> propertiesToTest{
{CL_QUEUE_PROPERTIES, CL_QUEUE_ON_DEVICE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, 0},
{CL_QUEUE_PROPERTIES, CL_QUEUE_ON_DEVICE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, CL_QUEUE_SIZE, 16, 0}};
for (auto properties : propertiesToTest) {
auto commandQueue = clCreateCommandQueueWithProperties(pContext, testedClDevice, properties.data(), &retVal);
EXPECT_EQ(CL_SUCCESS, retVal);
retVal = clGetCommandQueueInfo(commandQueue, CL_QUEUE_PROPERTIES_ARRAY,
sizeof(propertiesArray), propertiesArray, &propertiesArraySize);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(properties.size() * sizeof(cl_queue_properties), propertiesArraySize);
for (size_t i = 0; i < properties.size(); i++) {
EXPECT_EQ(properties[i], propertiesArray[i]);
}
clReleaseCommandQueue(commandQueue);
}
}
TEST_F(clCreateCommandQueueWithPropertiesApi, givenQueueFamilySelectedAndNotIndexWhenCreatingQueueThenFail) {
cl_queue_properties queueProperties[] = {
CL_QUEUE_FAMILY_INTEL,

View File

@ -1,10 +0,0 @@
#
# Copyright (C) 2019-2021 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
target_sources(igdrcl_aub_tests PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/enqueue_parent_kernel_tests_gen11.cpp
)

View File

@ -1,118 +0,0 @@
/*
* Copyright (C) 2019-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/built_ins/built_ins.h"
#include "shared/test/common/test_macros/test.h"
#include "opencl/source/mem_obj/image.h"
#include "opencl/source/sampler/sampler.h"
#include "opencl/test/unit_test/aub_tests/fixtures/aub_parent_kernel_fixture.h"
#include "opencl/test/unit_test/fixtures/buffer_fixture.h"
#include "opencl/test/unit_test/test_macros/test_checks_ocl.h"
using namespace NEO;
typedef AUBParentKernelFixture GEN11AUBParentKernelFixture;
GEN11TEST_F(GEN11AUBParentKernelFixture, WhenEnqueuingParentKernelThenExpectationsMet) {
REQUIRE_DEVICE_ENQUEUE_OR_SKIP(pClDevice);
ASSERT_NE(nullptr, pKernel);
ASSERT_TRUE(pKernel->isParentKernel);
const cl_queue_properties properties[3] = {(CL_QUEUE_ON_DEVICE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE),
0, 0};
DeviceQueue *devQueue = DeviceQueue::create(
&pCmdQ->getContext(),
pClDevice,
properties[0],
retVal);
SchedulerKernel &scheduler = pCmdQ->getContext().getSchedulerKernel();
// Aub execution takes huge time for bigger GWS
scheduler.setGws(24);
size_t offset[3] = {0, 0, 0};
size_t gws[3] = {1, 1, 1};
size_t lws[3] = {1, 1, 1};
// clang-format off
cl_image_format imageFormat;
imageFormat.image_channel_data_type = CL_UNSIGNED_INT8;
imageFormat.image_channel_order = CL_R;
cl_image_desc desc = { 0 };
desc.image_array_size = 0;
desc.image_depth = 1;
desc.image_height = 4;
desc.image_width = 4;
desc.image_type = CL_MEM_OBJECT_IMAGE3D;
desc.image_row_pitch = 0;
desc.image_slice_pitch = 0;
// clang-format on
auto memoryProperties = ClMemoryPropertiesHelper::createMemoryProperties(0, 0, 0, &pClDevice->getDevice());
auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
Image *image = Image::create(
pContext,
memoryProperties,
0,
0,
surfaceFormat,
&desc,
nullptr,
retVal);
Buffer *buffer = BufferHelper<BufferUseHostPtr<>>::create(pContext);
cl_mem bufferMem = buffer;
cl_mem imageMem = image;
auto sampler = Sampler::create(
pContext,
CL_TRUE,
CL_ADDRESS_NONE,
CL_FILTER_LINEAR,
retVal);
uint64_t argScalar = 2;
pKernel->setArg(
3,
sizeof(uint64_t),
&argScalar);
pKernel->setArg(
2,
sizeof(cl_mem),
&bufferMem);
pKernel->setArg(
1,
sizeof(cl_mem),
&imageMem);
pKernel->setArg(
0,
sizeof(cl_sampler),
&sampler);
pCmdQ->enqueueKernel(pKernel, 1, offset, gws, lws, 0, 0, 0);
pCmdQ->finish();
uint32_t expectedNumberOfEnqueues = 1;
uint64_t gpuAddress = devQueue->getQueueBuffer()->getGpuAddress() + offsetof(IGIL_CommandQueue, m_controls.m_TotalNumberOfQueues);
AUBCommandStreamFixture::expectMemory<FamilyType>(reinterpret_cast<void *>(gpuAddress), &expectedNumberOfEnqueues, sizeof(uint32_t));
AUBCommandStreamFixture::expectMemory<FamilyType>(reinterpret_cast<void *>(buffer->getGraphicsAllocation(pClDevice->getRootDeviceIndex())->getGpuAddress()), &argScalar, sizeof(size_t));
delete devQueue;
delete image;
delete buffer;
delete sampler;
}

View File

@ -1,10 +0,0 @@
#
# Copyright (C) 2018-2021 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
target_sources(igdrcl_aub_tests PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/enqueue_parent_kernel_tests_gen9.cpp
)

View File

@ -1,116 +0,0 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/built_ins/built_ins.h"
#include "shared/test/common/test_macros/test.h"
#include "opencl/source/mem_obj/image.h"
#include "opencl/source/sampler/sampler.h"
#include "opencl/test/unit_test/aub_tests/fixtures/aub_parent_kernel_fixture.h"
#include "opencl/test/unit_test/fixtures/buffer_fixture.h"
#include "opencl/test/unit_test/test_macros/test_checks_ocl.h"
using namespace NEO;
GEN9TEST_F(AUBParentKernelFixture, WhenEnqueuingParentKernelThenExpectationsMet) {
REQUIRE_DEVICE_ENQUEUE_OR_SKIP(pClDevice);
ASSERT_NE(nullptr, pKernel);
ASSERT_TRUE(pKernel->isParentKernel);
const cl_queue_properties properties[3] = {(CL_QUEUE_ON_DEVICE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE),
0, 0};
DeviceQueue *devQueue = DeviceQueue::create(
&pCmdQ->getContext(),
pClDevice,
properties[0],
retVal);
SchedulerKernel &scheduler = pCmdQ->getContext().getSchedulerKernel();
// Aub execution takes huge time for bigger GWS
scheduler.setGws(24);
size_t offset[3] = {0, 0, 0};
size_t gws[3] = {1, 1, 1};
size_t lws[3] = {1, 1, 1};
// clang-format off
cl_image_format imageFormat;
imageFormat.image_channel_data_type = CL_UNSIGNED_INT8;
imageFormat.image_channel_order = CL_R;
cl_image_desc desc = { 0 };
desc.image_array_size = 0;
desc.image_depth = 1;
desc.image_height = 4;
desc.image_width = 4;
desc.image_type = CL_MEM_OBJECT_IMAGE3D;
desc.image_row_pitch = 0;
desc.image_slice_pitch = 0;
// clang-format on
auto memoryProperties = ClMemoryPropertiesHelper::createMemoryProperties(0, 0, 0, &context->getDevice(0)->getDevice());
auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
Image *image = Image::create(
pContext,
memoryProperties,
0,
0,
surfaceFormat,
&desc,
nullptr,
retVal);
Buffer *buffer = BufferHelper<BufferUseHostPtr<>>::create(pContext);
cl_mem bufferMem = buffer;
cl_mem imageMem = image;
auto sampler = Sampler::create(
pContext,
CL_TRUE,
CL_ADDRESS_NONE,
CL_FILTER_LINEAR,
retVal);
uint64_t argScalar = 2;
pKernel->setArg(
3,
sizeof(uint64_t),
&argScalar);
pKernel->setArg(
2,
sizeof(cl_mem),
&bufferMem);
pKernel->setArg(
1,
sizeof(cl_mem),
&imageMem);
pKernel->setArg(
0,
sizeof(cl_sampler),
&sampler);
pCmdQ->enqueueKernel(pKernel, 1, offset, gws, lws, 0, 0, 0);
pCmdQ->finish();
uint32_t expectedNumberOfEnqueues = 1;
uint64_t gpuAddress = devQueue->getQueueBuffer()->getGpuAddress() + offsetof(IGIL_CommandQueue, m_controls.m_TotalNumberOfQueues);
AUBCommandStreamFixture::expectMemory<FamilyType>(reinterpret_cast<void *>(gpuAddress), &expectedNumberOfEnqueues, sizeof(uint32_t));
AUBCommandStreamFixture::expectMemory<FamilyType>(reinterpret_cast<void *>(buffer->getGraphicsAllocation(pClDevice->getRootDeviceIndex())->getGpuAddress()), &argScalar, sizeof(size_t));
delete devQueue;
delete image;
delete buffer;
delete sampler;
}

View File

@ -995,20 +995,6 @@ HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueKernelTest, givenCacheFlushAfterWalkerEnabled
EXPECT_TRUE(pipeControl->getDcFlushEnable());
}
HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueAuxKernelTests, givenParentKernelButNoDeviceQueueWhenEnqueueIsCalledThenItReturnsInvalidOperation) {
REQUIRE_DEVICE_ENQUEUE_OR_SKIP(pClDevice);
MyCmdQ<FamilyType> cmdQ(context, pClDevice);
size_t gws[3] = {1, 0, 0};
MockParentKernel::CreateParams createParams{};
std::unique_ptr<MockParentKernel> parentKernel(MockParentKernel::create(*context, createParams));
parentKernel->initialize();
auto status = cmdQ.enqueueKernel(parentKernel.get(), 1, nullptr, gws, nullptr, 0, nullptr, nullptr);
EXPECT_EQ(CL_INVALID_OPERATION, status);
}
HWTEST_F(EnqueueKernelTest, givenTimestampWriteEnableWhenMarkerProfilingWithoutWaitListThenSizeHasFourMMIOStoresAndPipeControll) {
pDevice->getUltCommandStreamReceiver<FamilyType>().timestampPacketWriteEnabled = true;
MockKernelWithInternals mockKernel(*pClDevice);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -131,15 +131,6 @@ TEST_F(ContextTest, WhenSettingSpecialQueueThenQueueIsAvailable) {
EXPECT_NE(specialQ, nullptr);
}
TEST_F(ContextTest, WhenSettingDefaultQueueThenQueueIsAvailable) {
REQUIRE_DEVICE_ENQUEUE_OR_SKIP(context);
EXPECT_EQ(nullptr, context->getDefaultDeviceQueue());
auto dq = new DeviceQueue();
context->setDefaultDeviceQueue(dq);
EXPECT_EQ(dq, context->getDefaultDeviceQueue());
delete dq;
}
TEST_F(ContextTest, givenCmdQueueWithoutContextWhenBeingCreatedNextDeletedThenContextRefCountShouldNeitherBeIncrementedNorNextDecremented) {
MockContext context((ClDevice *)devices[0]);
EXPECT_EQ(1, context.getRefInternalCount());
@ -157,25 +148,6 @@ TEST_F(ContextTest, givenCmdQueueWithoutContextWhenBeingCreatedNextDeletedThenCo
EXPECT_EQ(1, context.getRefInternalCount());
}
TEST_F(ContextTest, givenDeviceQueueWithoutContextWhenBeingCreatedNextDeletedThenContextRefCountShouldNeitherBeIncrementedNorNextDecremented) {
REQUIRE_DEVICE_ENQUEUE_OR_SKIP(context);
MockContext context((ClDevice *)devices[0]);
EXPECT_EQ(1, context.getRefInternalCount());
auto cmdQ1 = new DeviceQueue();
EXPECT_EQ(1, context.getRefInternalCount());
delete cmdQ1;
EXPECT_EQ(1, context.getRefInternalCount());
cl_queue_properties properties = 0;
auto cmdQ2 = new DeviceQueue(nullptr, (ClDevice *)devices[0], properties);
EXPECT_EQ(1, context.getRefInternalCount());
delete cmdQ2;
EXPECT_EQ(1, context.getRefInternalCount());
}
TEST_F(ContextTest, givenCmdQueueWithContextWhenBeingCreatedNextDeletedThenContextRefCountShouldBeIncrementedNextDecremented) {
MockContext context((ClDevice *)devices[0]);
EXPECT_EQ(1, context.getRefInternalCount());
@ -187,33 +159,6 @@ TEST_F(ContextTest, givenCmdQueueWithContextWhenBeingCreatedNextDeletedThenConte
EXPECT_EQ(1, context.getRefInternalCount());
}
TEST_F(ContextTest, givenDeviceCmdQueueWithContextWhenBeingCreatedNextDeletedThenContextRefCountShouldBeIncrementedNextDecremented) {
REQUIRE_DEVICE_ENQUEUE_OR_SKIP(context);
MockContext context((ClDevice *)devices[0]);
EXPECT_EQ(1, context.getRefInternalCount());
cl_queue_properties properties = 0;
auto cmdQ = new DeviceQueue(&context, (ClDevice *)devices[0], properties);
EXPECT_EQ(2, context.getRefInternalCount());
delete cmdQ;
EXPECT_EQ(1, context.getRefInternalCount());
}
TEST_F(ContextTest, givenDefaultDeviceCmdQueueWithContextWhenBeingCreatedNextDeletedThenContextRefCountShouldBeIncrementedNextDecremented) {
REQUIRE_DEVICE_ENQUEUE_OR_SKIP(context);
MockContext context((ClDevice *)devices[0]);
EXPECT_EQ(1, context.getRefInternalCount());
cl_queue_properties properties = 0;
auto cmdQ = new DeviceQueue(&context, (ClDevice *)devices[0], properties);
context.setDefaultDeviceQueue(cmdQ);
EXPECT_EQ(2, context.getRefInternalCount());
delete cmdQ;
EXPECT_EQ(1, context.getRefInternalCount());
}
TEST_F(ContextTest, givenContextWhenItIsCreatedFromDeviceThenItAddsRefCountToThisDevice) {
auto device = castToObject<ClDevice>(devices[0]);
EXPECT_EQ(2, device->getRefInternalCount());

View File

@ -20,7 +20,6 @@ set(IGDRCL_SRCS_tests_fixtures
${CMAKE_CURRENT_SOURCE_DIR}/device_instrumentation_fixture.h
${CMAKE_CURRENT_SOURCE_DIR}/enqueue_handler_fixture.h
${CMAKE_CURRENT_SOURCE_DIR}/execution_model_fixture.h
${CMAKE_CURRENT_SOURCE_DIR}/execution_model_kernel_fixture.h
${CMAKE_CURRENT_SOURCE_DIR}/hello_world_fixture.h
${CMAKE_CURRENT_SOURCE_DIR}/hello_world_kernel_fixture.h
${CMAKE_CURRENT_SOURCE_DIR}/image_fixture.cpp

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -11,104 +11,10 @@
#include "opencl/source/device_queue/device_queue.h"
#include "opencl/test/unit_test/command_queue/command_queue_fixture.h"
#include "opencl/test/unit_test/fixtures/execution_model_kernel_fixture.h"
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
#include "opencl/test/unit_test/mocks/mock_kernel.h"
#include "opencl/test/unit_test/test_macros/test_checks_ocl.h"
class DeviceQueueFixture {
public:
void SetUp(Context *context, ClDevice *device) {
REQUIRE_DEVICE_ENQUEUE_OR_SKIP(device);
cl_int errcodeRet = 0;
cl_queue_properties properties[3];
properties[0] = CL_QUEUE_PROPERTIES;
properties[1] = CL_QUEUE_ON_DEVICE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE;
properties[2] = 0;
ASSERT_NE(nullptr, context);
ASSERT_NE(nullptr, device);
pDevQueue = DeviceQueue::create(context, device,
properties[0],
errcodeRet);
ASSERT_NE(nullptr, pDevQueue);
auto devQueue = context->getDefaultDeviceQueue();
ASSERT_NE(nullptr, devQueue);
EXPECT_EQ(pDevQueue, devQueue);
}
void TearDown() {
delete pDevQueue;
}
DeviceQueue *pDevQueue = nullptr;
};
class ExecutionModelKernelTest : public ExecutionModelKernelFixture,
public CommandQueueHwFixture,
public DeviceQueueFixture,
public ::testing::WithParamInterface<std::tuple<const char *, const char *>> {
public:
void SetUp() override {
REQUIRE_DEVICE_ENQUEUE_OR_SKIP(defaultHwInfo);
DebugManager.flags.EnableTimestampPacket.set(0);
ExecutionModelKernelFixture::SetUp(std::get<0>(GetParam()), std::get<1>(GetParam()));
CommandQueueHwFixture::SetUp(pClDevice, 0);
DeviceQueueFixture::SetUp(context, pClDevice);
}
void TearDown() override {
if (!IsSkipped()) {
DeviceQueueFixture::TearDown();
CommandQueueHwFixture::TearDown();
ExecutionModelKernelFixture::TearDown();
}
}
std::unique_ptr<KernelOperation> createBlockedCommandsData(CommandQueue &commandQueue) {
auto commandStream = new LinearStream();
auto &gpgpuCsr = commandQueue.getGpgpuCommandStreamReceiver();
gpgpuCsr.ensureCommandBufferAllocation(*commandStream, 1, 1);
return std::make_unique<KernelOperation>(commandStream, *gpgpuCsr.getInternalAllocationStorage());
}
DebugManagerStateRestore dbgRestore;
};
class ExecutionModelSchedulerTest : public ClDeviceFixture,
public CommandQueueHwFixture,
public DeviceQueueFixture {
public:
void SetUp() override {
ClDeviceFixture::SetUp();
CommandQueueHwFixture::SetUp(pClDevice, 0);
DeviceQueueFixture::SetUp(context, pClDevice);
parentKernel = MockParentKernel::create(*context);
ASSERT_NE(nullptr, parentKernel);
kernelInfos = MockKernel::toKernelInfoContainer(parentKernel->getKernelInfo(), rootDeviceIndex);
pMultiDeviceKernel = new MockMultiDeviceKernel(MockMultiDeviceKernel::toKernelVector(parentKernel), kernelInfos);
}
void TearDown() override {
pMultiDeviceKernel->release();
DeviceQueueFixture::TearDown();
CommandQueueHwFixture::TearDown();
ClDeviceFixture::TearDown();
}
KernelInfoContainer kernelInfos;
MockMultiDeviceKernel *pMultiDeviceKernel = nullptr;
MockParentKernel *parentKernel = nullptr;
};
struct ParentKernelCommandQueueFixture : public CommandQueueHwFixture,
testing::Test {

View File

@ -1,74 +0,0 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/test/common/test_macros/test.h"
#include "opencl/source/kernel/kernel.h"
#include "opencl/test/unit_test/fixtures/platform_fixture.h"
#include "opencl/test/unit_test/mocks/mock_kernel.h"
#include "opencl/test/unit_test/program/program_from_binary.h"
#include "opencl/test/unit_test/test_macros/test_checks_ocl.h"
using namespace NEO;
struct ExecutionModelKernelFixture : public ProgramFromBinaryFixture,
public PlatformFixture {
using ProgramFromBinaryFixture::SetUp;
void SetUp(const char *binaryFileName, const char *kernelName) {
REQUIRE_DEVICE_ENQUEUE_OR_SKIP(defaultHwInfo);
PlatformFixture::SetUp();
std::string options("-cl-std=CL2.0");
this->setOptions(options);
ProgramFromBinaryFixture::SetUp(binaryFileName, kernelName);
ASSERT_NE(nullptr, pProgram);
ASSERT_EQ(CL_SUCCESS, retVal);
retVal = pProgram->build(
pProgram->getDevices(),
nullptr,
false);
ASSERT_EQ(CL_SUCCESS, retVal);
pMultiDeviceKernel = MultiDeviceKernel::create<MockKernel>(pProgram,
pProgram->getKernelInfosForKernel(kernelName),
&retVal);
pKernel = pMultiDeviceKernel->getKernel(rootDeviceIndex);
ASSERT_EQ(CL_SUCCESS, retVal);
ASSERT_NE(nullptr, pKernel);
}
void TearDown() override {
if (IsSkipped()) {
return;
}
if (pMultiDeviceKernel != nullptr) {
pMultiDeviceKernel->release();
}
ProgramFromBinaryFixture::TearDown();
PlatformFixture::TearDown();
if (pDevice != nullptr) {
delete pDevice;
pDevice = nullptr;
}
if (pClDevice != nullptr) {
delete pClDevice;
pClDevice = nullptr;
}
}
MultiDeviceKernel *pMultiDeviceKernel = nullptr;
Kernel *pKernel = nullptr;
cl_int retVal = CL_SUCCESS;
};

View File

@ -16,13 +16,13 @@
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/mocks/mock_allocation_properties.h"
#include "shared/test/common/mocks/mock_graphics_allocation.h"
#include "shared/test/common/test_macros/test_checks_shared.h"
#include "shared/test/unit_test/utilities/base_object_utils.h"
#include "opencl/source/api/api.h"
#include "opencl/source/built_ins/builtins_dispatch_builder.h"
#include "opencl/source/command_queue/command_queue_hw.h"
#include "opencl/source/helpers/hardware_commands_helper.h"
#include "opencl/test/unit_test/fixtures/execution_model_kernel_fixture.h"
#include "opencl/test/unit_test/fixtures/hello_world_fixture.h"
#include "opencl/test/unit_test/fixtures/image_fixture.h"
@ -1003,59 +1003,6 @@ HWCMDTEST_F(IGFX_GEN8_CORE, HardwareCommandsTest, GivenKernelWithSamplersWhenInd
delete[] mockDsh;
}
struct ParentKernelCommandsFromBinaryTest : public ExecutionModelKernelFixture,
public ::testing::WithParamInterface<std::tuple<const char *, const char *>> {
void SetUp() override {
ExecutionModelKernelFixture::SetUp(std::get<0>(GetParam()), std::get<1>(GetParam()));
}
};
HWCMDTEST_P(IGFX_GEN8_CORE, ParentKernelCommandsFromBinaryTest, WhenGettingSizeRequiredForExecutionModelForSurfaceStatesThenReturnSizeOfBlocksPlusMaxBindingTableSizeForAllIdtEntriesAndSchedulerSshSize) {
using BINDING_TABLE_STATE = typename FamilyType::BINDING_TABLE_STATE;
REQUIRE_DEVICE_ENQUEUE_OR_SKIP(defaultHwInfo);
EXPECT_TRUE(pKernel->isParentKernel);
size_t totalSize = 0;
BlockKernelManager *blockManager = pKernel->getProgram()->getBlockKernelManager();
uint32_t blockCount = static_cast<uint32_t>(blockManager->getCount());
totalSize = BINDING_TABLE_STATE::SURFACESTATEPOINTER_ALIGN_SIZE - 1; // for initial alignment
uint32_t maxBindingTableCount = 0;
for (uint32_t i = 0; i < blockCount; i++) {
const KernelInfo *pBlockInfo = blockManager->getBlockKernelInfo(i);
totalSize += pBlockInfo->heapInfo.SurfaceStateHeapSize;
totalSize = alignUp(totalSize, BINDING_TABLE_STATE::SURFACESTATEPOINTER_ALIGN_SIZE);
maxBindingTableCount = std::max(maxBindingTableCount, static_cast<uint32_t>(pBlockInfo->kernelDescriptor.payloadMappings.bindingTable.numEntries));
}
totalSize += maxBindingTableCount * sizeof(BINDING_TABLE_STATE) * DeviceQueue::interfaceDescriptorEntries;
auto &scheduler = pContext->getSchedulerKernel();
auto schedulerSshSize = scheduler.getSurfaceStateHeapSize();
totalSize += schedulerSshSize + ((schedulerSshSize != 0) ? BINDING_TABLE_STATE::SURFACESTATEPOINTER_ALIGN_SIZE : 0);
totalSize = alignUp(totalSize, BINDING_TABLE_STATE::SURFACESTATEPOINTER_ALIGN_SIZE);
EXPECT_EQ(totalSize, HardwareCommandsHelper<FamilyType>::getSshSizeForExecutionModel(*pKernel));
}
static const char *binaryFile = "simple_block_kernel";
static const char *KernelNames[] = {"kernel_reflection", "simple_block_kernel"};
INSTANTIATE_TEST_CASE_P(ParentKernelCommandsFromBinaryTest,
ParentKernelCommandsFromBinaryTest,
::testing::Combine(
::testing::Values(binaryFile),
::testing::ValuesIn(KernelNames)));
HWTEST_F(HardwareCommandsTest, givenEnabledPassInlineDataWhenKernelAllowsInlineThenReturnTrue) {
DebugManagerStateRestore restore;
DebugManager.flags.EnablePassInlineData.set(1u);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -8,7 +8,7 @@
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/common/test_macros/test.h"
#include "opencl/test/unit_test/fixtures/execution_model_kernel_fixture.h"
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
#include "opencl/test/unit_test/mocks/mock_kernel.h"
#include "opencl/test/unit_test/mocks/mock_program.h"

View File

@ -441,24 +441,6 @@ typedef Test<ClDeviceFixture> KernelPrivateSurfaceTest;
typedef Test<ClDeviceFixture> KernelGlobalSurfaceTest;
typedef Test<ClDeviceFixture> KernelConstantSurfaceTest;
struct KernelWithDeviceQueueFixture : public ClDeviceFixture,
public DeviceQueueFixture,
public testing::Test {
void SetUp() override {
ClDeviceFixture::SetUp();
DeviceQueueFixture::SetUp(&context, pClDevice);
}
void TearDown() override {
DeviceQueueFixture::TearDown();
ClDeviceFixture::TearDown();
}
MockContext context;
};
typedef KernelWithDeviceQueueFixture KernelDefaultDeviceQueueSurfaceTest;
typedef KernelWithDeviceQueueFixture KernelEventPoolSurfaceTest;
class CommandStreamReceiverMock : public CommandStreamReceiver {
typedef CommandStreamReceiver BaseClass;

View File

@ -8,7 +8,7 @@
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/common/test_macros/test.h"
#include "opencl/test/unit_test/fixtures/execution_model_kernel_fixture.h"
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
#include "opencl/test/unit_test/mocks/mock_kernel.h"
#include "opencl/test/unit_test/mocks/mock_program.h"
@ -144,15 +144,3 @@ TEST(ParentKernelTest, WhenInitializingParentKernelThenPrivateMemoryForBlocksIsA
EXPECT_NE(nullptr, program->getBlockKernelManager()->getPrivateSurface(program->getBlockKernelManager()->getCount() - 1));
}
struct ParentKernelFromBinaryTest : public ExecutionModelKernelFixture {
void SetUp() override {
ExecutionModelKernelFixture::SetUp("simple_block_kernel", "simple_block_kernel");
}
};
TEST_F(ParentKernelFromBinaryTest, GivenParentKernelWhenGettingInstructionHeapSizeForExecutionModelThenSizeIsGreaterThanZero) {
EXPECT_TRUE(pKernel->isParentKernel);
EXPECT_LT(0u, pKernel->getInstructionHeapSizeForExecutionModel());
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -41,11 +41,6 @@ bool supportsAuxResolves();
GTEST_SKIP(); \
}
#define REQUIRE_DEVICE_ENQUEUE_OR_SKIP(param) \
if (NEO::TestChecks::supportsDeviceEnqueue(param) == false) { \
GTEST_SKIP(); \
}
#define REQUIRE_AUX_RESOLVES() \
if (NEO::TestChecks::supportsAuxResolves() == false) { \
GTEST_SKIP(); \