mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 14:02:58 +08:00
Update getGraphicsAllocationType
Change-Id: I7613d0d5550d8032b960f86aa117b4baf6b9216f Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
783f408f9f
commit
3fe78d263b
@@ -16,18 +16,19 @@
|
||||
#include "runtime/memory_manager/os_agnostic_memory_manager.h"
|
||||
#include "runtime/os_interface/debug_settings_manager.h"
|
||||
#include "runtime/os_interface/os_context.h"
|
||||
#include "test.h"
|
||||
#include "unit_tests/fixtures/device_fixture.h"
|
||||
#include "unit_tests/fixtures/execution_model_fixture.h"
|
||||
#include "unit_tests/fixtures/memory_management_fixture.h"
|
||||
#include "unit_tests/helpers/debug_manager_state_restore.h"
|
||||
#include "unit_tests/helpers/gtest_helpers.h"
|
||||
#include "test.h"
|
||||
#include "unit_tests/mocks/mock_graphics_allocation.h"
|
||||
#include "unit_tests/mocks/mock_kernel.h"
|
||||
#include "unit_tests/mocks/mock_program.h"
|
||||
#include "unit_tests/mocks/mock_context.h"
|
||||
#include "unit_tests/program/program_from_binary.h"
|
||||
#include "unit_tests/program/program_tests.h"
|
||||
#include "unit_tests/utilities/base_object_utils.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
@@ -1684,46 +1685,46 @@ HWTEST_F(KernelResidencyTest, givenKernelWhenMakeResidentIsCalledThenKernelIsaIs
|
||||
}
|
||||
|
||||
TEST(KernelImageDetectionTests, givenKernelWithImagesOnlyWhenItIsAskedIfItHasImagesOnlyThenTrueIsReturned) {
|
||||
auto device = std::make_unique<MockDevice>(*platformDevices[0]);
|
||||
auto pKernelInfo = std::make_unique<KernelInfo>();
|
||||
|
||||
pKernelInfo->kernelArgInfo.resize(3);
|
||||
pKernelInfo->kernelArgInfo[2].isImage = true;
|
||||
pKernelInfo->kernelArgInfo[1].isMediaBlockImage = true;
|
||||
pKernelInfo->kernelArgInfo[0].isMediaImage = true;
|
||||
|
||||
MockProgram program(*device->getExecutionEnvironment());
|
||||
std::unique_ptr<MockKernel> kernel(new MockKernel(&program, *pKernelInfo, *device));
|
||||
std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
|
||||
auto context = clUniquePtr(new MockContext(device.get()));
|
||||
auto program = clUniquePtr(new MockProgram(*device->getExecutionEnvironment(), context.get(), false));
|
||||
auto kernel = clUniquePtr(new MockKernel(program.get(), *pKernelInfo, *device));
|
||||
EXPECT_FALSE(kernel->usesOnlyImages());
|
||||
kernel->initialize();
|
||||
EXPECT_TRUE(kernel->usesOnlyImages());
|
||||
}
|
||||
|
||||
TEST(KernelImageDetectionTests, givenKernelWithImagesAndBuffersWhenItIsAskedIfItHasImagesOnlyThenFalseIsReturned) {
|
||||
auto device = std::make_unique<MockDevice>(*platformDevices[0]);
|
||||
auto pKernelInfo = std::make_unique<KernelInfo>();
|
||||
|
||||
pKernelInfo->kernelArgInfo.resize(3);
|
||||
pKernelInfo->kernelArgInfo[2].isImage = true;
|
||||
pKernelInfo->kernelArgInfo[1].isBuffer = true;
|
||||
pKernelInfo->kernelArgInfo[0].isMediaImage = true;
|
||||
|
||||
MockProgram program(*device->getExecutionEnvironment());
|
||||
std::unique_ptr<MockKernel> kernel(new MockKernel(&program, *pKernelInfo, *device));
|
||||
std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
|
||||
auto context = clUniquePtr(new MockContext(device.get()));
|
||||
auto program = clUniquePtr(new MockProgram(*device->getExecutionEnvironment(), context.get(), false));
|
||||
auto kernel = clUniquePtr(new MockKernel(program.get(), *pKernelInfo, *device));
|
||||
EXPECT_FALSE(kernel->usesOnlyImages());
|
||||
kernel->initialize();
|
||||
EXPECT_FALSE(kernel->usesOnlyImages());
|
||||
}
|
||||
|
||||
TEST(KernelImageDetectionTests, givenKernelWithNoImagesWhenItIsAskedIfItHasImagesOnlyThenFalseIsReturned) {
|
||||
auto device = std::make_unique<MockDevice>(*platformDevices[0]);
|
||||
auto pKernelInfo = std::make_unique<KernelInfo>();
|
||||
|
||||
pKernelInfo->kernelArgInfo.resize(1);
|
||||
pKernelInfo->kernelArgInfo[0].isBuffer = true;
|
||||
|
||||
MockProgram program(*device->getExecutionEnvironment());
|
||||
std::unique_ptr<MockKernel> kernel(new MockKernel(&program, *pKernelInfo, *device));
|
||||
std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
|
||||
auto context = clUniquePtr(new MockContext(device.get()));
|
||||
auto program = clUniquePtr(new MockProgram(*device->getExecutionEnvironment(), context.get(), false));
|
||||
auto kernel = clUniquePtr(new MockKernel(program.get(), *pKernelInfo, *device));
|
||||
EXPECT_FALSE(kernel->usesOnlyImages());
|
||||
kernel->initialize();
|
||||
EXPECT_FALSE(kernel->usesOnlyImages());
|
||||
@@ -2319,8 +2320,10 @@ TEST(KernelTest, givenKernelWithKernelInfoWith64bitPointerSizeThenReport64bit) {
|
||||
TEST(KernelTest, givenFtrRenderCompressedBuffersWhenInitializingArgsWithNonStatefulAccessThenMarkKernelForAuxTranslation) {
|
||||
HardwareInfo localHwInfo = *platformDevices[0];
|
||||
|
||||
auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&localHwInfo));
|
||||
MockKernelWithInternals kernel(*device);
|
||||
std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&localHwInfo));
|
||||
auto context = clUniquePtr(new MockContext(device.get()));
|
||||
context->setContextType(ContextType::CONTEXT_TYPE_UNRESTRICTIVE);
|
||||
MockKernelWithInternals kernel(*device, context.get());
|
||||
kernel.kernelInfo.kernelArgInfo.resize(1);
|
||||
kernel.kernelInfo.kernelArgInfo.at(0).typeStr = "char *";
|
||||
|
||||
@@ -2340,12 +2343,13 @@ TEST(KernelTest, givenFtrRenderCompressedBuffersWhenInitializingArgsWithNonState
|
||||
|
||||
TEST(KernelTest, givenDebugVariableSetWhenKernelHasStatefulBufferAccessThenMarkKernelForAuxTranslation) {
|
||||
DebugManagerStateRestore restore;
|
||||
HardwareInfo localHwInfo = *platformDevices[0];
|
||||
|
||||
DebugManager.flags.RenderCompressedBuffersEnabled.set(1);
|
||||
|
||||
auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&localHwInfo));
|
||||
MockKernelWithInternals kernel(*device);
|
||||
HardwareInfo localHwInfo = *platformDevices[0];
|
||||
|
||||
std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&localHwInfo));
|
||||
auto context = clUniquePtr(new MockContext(device.get()));
|
||||
MockKernelWithInternals kernel(*device, context.get());
|
||||
kernel.kernelInfo.kernelArgInfo.resize(1);
|
||||
kernel.kernelInfo.kernelArgInfo.at(0).typeStr = "char *";
|
||||
|
||||
|
||||
@@ -289,8 +289,8 @@ TEST(Buffer, givenAllocHostPtrFlagPassedToBufferCreateWhenNoSharedContextOrRende
|
||||
}
|
||||
|
||||
TEST(Buffer, givenRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferCompressedTypeIsReturnedIn64Bit) {
|
||||
cl_mem_flags flags = 0;
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(flags, false, true, false);
|
||||
MemoryProperties properties;
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(properties, false, ContextType::CONTEXT_TYPE_UNRESTRICTIVE, true, false);
|
||||
if (is32bit) {
|
||||
EXPECT_EQ(GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, type);
|
||||
} else {
|
||||
@@ -299,26 +299,28 @@ TEST(Buffer, givenRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenB
|
||||
}
|
||||
|
||||
TEST(Buffer, givenSharedContextWhenAllocationTypeIsQueriedThenBufferHostMemoryTypeIsReturned) {
|
||||
cl_mem_flags flags = 0;
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(flags, true, false, false);
|
||||
MemoryProperties properties;
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(properties, true, ContextType::CONTEXT_TYPE_UNRESTRICTIVE, false, false);
|
||||
EXPECT_EQ(GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, type);
|
||||
}
|
||||
|
||||
TEST(Buffer, givenSharedContextAndRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferHostMemoryTypeIsReturned) {
|
||||
cl_mem_flags flags = 0;
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(flags, true, true, false);
|
||||
MemoryProperties properties;
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(properties, true, ContextType::CONTEXT_TYPE_UNRESTRICTIVE, true, false);
|
||||
EXPECT_EQ(GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, type);
|
||||
}
|
||||
|
||||
TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryDisabledWhenAllocationTypeIsQueriedThenBufferHostMemoryTypeIsReturned) {
|
||||
cl_mem_flags flags = CL_MEM_USE_HOST_PTR;
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(flags, false, false, false);
|
||||
MemoryProperties properties;
|
||||
properties.flags = CL_MEM_USE_HOST_PTR;
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(properties, false, ContextType::CONTEXT_TYPE_UNRESTRICTIVE, false, false);
|
||||
EXPECT_EQ(GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, type);
|
||||
}
|
||||
|
||||
TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryEnabledWhenAllocationTypeIsQueriedThenBufferTypeIsReturned) {
|
||||
cl_mem_flags flags = CL_MEM_USE_HOST_PTR;
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(flags, false, false, true);
|
||||
MemoryProperties properties;
|
||||
properties.flags = CL_MEM_USE_HOST_PTR;
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(properties, false, ContextType::CONTEXT_TYPE_UNRESTRICTIVE, false, true);
|
||||
if (is64bit) {
|
||||
EXPECT_EQ(GraphicsAllocation::AllocationType::BUFFER, type);
|
||||
} else {
|
||||
@@ -327,8 +329,9 @@ TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryEnabledWhenAllocationTypeIsQueried
|
||||
}
|
||||
|
||||
TEST(Buffer, givenAllocHostPtrFlagWhenAllocationTypeIsQueriedThenBufferTypeIsReturned) {
|
||||
cl_mem_flags flags = CL_MEM_ALLOC_HOST_PTR;
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(flags, false, false, false);
|
||||
MemoryProperties properties;
|
||||
properties.flags = CL_MEM_ALLOC_HOST_PTR;
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(properties, false, ContextType::CONTEXT_TYPE_UNRESTRICTIVE, false, false);
|
||||
if (is64bit) {
|
||||
EXPECT_EQ(GraphicsAllocation::AllocationType::BUFFER, type);
|
||||
} else {
|
||||
@@ -337,14 +340,16 @@ TEST(Buffer, givenAllocHostPtrFlagWhenAllocationTypeIsQueriedThenBufferTypeIsRet
|
||||
}
|
||||
|
||||
TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryDisabledAndRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferMemoryTypeIsReturned) {
|
||||
cl_mem_flags flags = CL_MEM_USE_HOST_PTR;
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(flags, false, true, false);
|
||||
MemoryProperties properties;
|
||||
properties.flags = CL_MEM_USE_HOST_PTR;
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(properties, false, ContextType::CONTEXT_TYPE_UNRESTRICTIVE, true, false);
|
||||
EXPECT_EQ(GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, type);
|
||||
}
|
||||
|
||||
TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryEnabledAndRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferMemoryTypeIsReturned) {
|
||||
cl_mem_flags flags = CL_MEM_USE_HOST_PTR;
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(flags, false, true, true);
|
||||
MemoryProperties properties;
|
||||
properties.flags = CL_MEM_USE_HOST_PTR;
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(properties, false, ContextType::CONTEXT_TYPE_UNRESTRICTIVE, true, true);
|
||||
if (is64bit) {
|
||||
EXPECT_EQ(GraphicsAllocation::AllocationType::BUFFER, type);
|
||||
} else {
|
||||
@@ -353,14 +358,16 @@ TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryEnabledAndRenderCompressedBuffersE
|
||||
}
|
||||
|
||||
TEST(Buffer, givenUseHostPointerFlagAndForceSharedPhysicalStorageWhenLocalMemoryIsEnabledThenBufferHostMemoryTypeIsReturned) {
|
||||
cl_mem_flags flags = CL_MEM_USE_HOST_PTR | CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL;
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(flags, false, true, true);
|
||||
MemoryProperties properties;
|
||||
properties.flags = CL_MEM_USE_HOST_PTR | CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL;
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(properties, false, ContextType::CONTEXT_TYPE_UNRESTRICTIVE, true, true);
|
||||
EXPECT_EQ(GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, type);
|
||||
}
|
||||
|
||||
TEST(Buffer, givenAllocHostPtrFlagAndRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferCompressedTypeIsReturned) {
|
||||
cl_mem_flags flags = CL_MEM_ALLOC_HOST_PTR;
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(flags, false, true, false);
|
||||
MemoryProperties properties;
|
||||
properties.flags = CL_MEM_ALLOC_HOST_PTR;
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(properties, false, ContextType::CONTEXT_TYPE_UNRESTRICTIVE, true, false);
|
||||
if (is64bit) {
|
||||
EXPECT_EQ(GraphicsAllocation::AllocationType::BUFFER_COMPRESSED, type);
|
||||
} else {
|
||||
@@ -369,8 +376,8 @@ TEST(Buffer, givenAllocHostPtrFlagAndRenderCompressedBuffersEnabledWhenAllocatio
|
||||
}
|
||||
|
||||
TEST(Buffer, givenZeroFlagsNoSharedContextAndRenderCompressedBuffersDisabledWhenAllocationTypeIsQueriedThenBufferTypeIsReturned) {
|
||||
cl_mem_flags flags = 0;
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(flags, false, false, false);
|
||||
MemoryProperties properties;
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(properties, false, ContextType::CONTEXT_TYPE_UNRESTRICTIVE, false, false);
|
||||
if (is32bit) {
|
||||
EXPECT_EQ(GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, type);
|
||||
} else {
|
||||
@@ -409,6 +416,7 @@ struct RenderCompressedBuffersTests : public ::testing::Test {
|
||||
localHwInfo = *platformDevices[0];
|
||||
device.reset(Device::create<MockDevice>(&localHwInfo, new ExecutionEnvironment(), 0u));
|
||||
context = std::make_unique<MockContext>(device.get(), true);
|
||||
context->setContextType(ContextType::CONTEXT_TYPE_UNRESTRICTIVE);
|
||||
}
|
||||
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "unit_tests/mocks/mock_mdi.h"
|
||||
#include "unit_tests/mocks/mock_program.h"
|
||||
#include "unit_tests/os_interface/debug_settings_manager_fixture.h"
|
||||
#include "unit_tests/utilities/base_object_utils.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
@@ -451,11 +452,11 @@ TEST(DebugSettingsManager, WithDebugFunctionalityDumpKernelArgsLocalBuffer) {
|
||||
}
|
||||
|
||||
TEST(DebugSettingsManager, WithDebugFunctionalityDumpKernelArgsBufferNotSet) {
|
||||
|
||||
auto kernelInfo = std::make_unique<KernelInfo>();
|
||||
auto device = unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<Device>(nullptr));
|
||||
MockProgram program(*device->getExecutionEnvironment());
|
||||
auto kernel = unique_ptr<MockKernel>(new MockKernel(&program, *kernelInfo, *device));
|
||||
unique_ptr<Device> device(MockDevice::createWithNewExecutionEnvironment<Device>(nullptr));
|
||||
auto context = clUniquePtr(new MockContext(device.get()));
|
||||
auto program = clUniquePtr(new MockProgram(*device->getExecutionEnvironment(), context.get(), false));
|
||||
auto kernel = clUniquePtr(new MockKernel(program.get(), *kernelInfo, *device));
|
||||
|
||||
KernelArgPatchInfo kernelArgPatchInfo;
|
||||
|
||||
@@ -479,14 +480,14 @@ TEST(DebugSettingsManager, WithDebugFunctionalityDumpKernelArgsBufferNotSet) {
|
||||
}
|
||||
|
||||
TEST(DebugSettingsManager, WithDebugFunctionalityDumpKernelArgsBuffer) {
|
||||
MockContext context;
|
||||
auto buffer = BufferHelper<>::create(&context);
|
||||
unique_ptr<Device> device(MockDevice::createWithNewExecutionEnvironment<Device>(nullptr));
|
||||
auto context = clUniquePtr(new MockContext(device.get()));
|
||||
auto buffer = BufferHelper<>::create(context.get());
|
||||
cl_mem clObj = buffer;
|
||||
|
||||
auto kernelInfo = std::make_unique<KernelInfo>();
|
||||
auto device = unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<Device>(nullptr));
|
||||
MockProgram program(*device->getExecutionEnvironment(), &context, false);
|
||||
auto kernel = unique_ptr<MockKernel>(new MockKernel(&program, *kernelInfo, *device));
|
||||
auto program = clUniquePtr(new MockProgram(*device->getExecutionEnvironment(), context.get(), false));
|
||||
auto kernel = clUniquePtr(new MockKernel(program.get(), *kernelInfo, *device));
|
||||
|
||||
KernelArgPatchInfo kernelArgPatchInfo;
|
||||
|
||||
@@ -517,11 +518,11 @@ TEST(DebugSettingsManager, WithDebugFunctionalityDumpKernelArgsBuffer) {
|
||||
}
|
||||
|
||||
TEST(DebugSettingsManager, WithDebugFunctionalityDumpKernelArgsSampler) {
|
||||
|
||||
auto kernelInfo = std::make_unique<KernelInfo>();
|
||||
auto device = unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<Device>(nullptr));
|
||||
MockProgram program(*device->getExecutionEnvironment());
|
||||
auto kernel = unique_ptr<MockKernel>(new MockKernel(&program, *kernelInfo, *device));
|
||||
unique_ptr<Device> device(MockDevice::createWithNewExecutionEnvironment<Device>(nullptr));
|
||||
auto context = clUniquePtr(new MockContext(device.get()));
|
||||
auto program = clUniquePtr(new MockProgram(*device->getExecutionEnvironment(), context.get(), false));
|
||||
auto kernel = clUniquePtr(new MockKernel(program.get(), *kernelInfo, *device));
|
||||
|
||||
KernelArgPatchInfo kernelArgPatchInfo;
|
||||
|
||||
@@ -543,9 +544,10 @@ TEST(DebugSettingsManager, WithDebugFunctionalityDumpKernelArgsSampler) {
|
||||
TEST(DebugSettingsManager, WithDebugFunctionalityDumpKernelArgsImageNotSet) {
|
||||
|
||||
auto kernelInfo = std::make_unique<KernelInfo>();
|
||||
auto device = unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<Device>(nullptr));
|
||||
MockProgram program(*device->getExecutionEnvironment());
|
||||
auto kernel = unique_ptr<MockKernel>(new MockKernel(&program, *kernelInfo, *device));
|
||||
unique_ptr<Device> device(MockDevice::createWithNewExecutionEnvironment<Device>(nullptr));
|
||||
auto context = clUniquePtr(new MockContext(device.get()));
|
||||
auto program = clUniquePtr(new MockProgram(*device->getExecutionEnvironment(), context.get(), false));
|
||||
auto kernel = clUniquePtr(new MockKernel(program.get(), *kernelInfo, *device));
|
||||
|
||||
SKernelBinaryHeaderCommon kernelHeader;
|
||||
char surfaceStateHeap[0x80];
|
||||
|
||||
@@ -1,21 +1,23 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2018 Intel Corporation
|
||||
* Copyright (C) 2017-2019 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include <cstdint>
|
||||
#include "runtime/helpers/options.h"
|
||||
#include "runtime/scheduler/scheduler_kernel.h"
|
||||
#include "test.h"
|
||||
#include "unit_tests/fixtures/device_fixture.h"
|
||||
#include "unit_tests/helpers/debug_manager_state_restore.h"
|
||||
#include "unit_tests/mocks/mock_context.h"
|
||||
#include "unit_tests/mocks/mock_program.h"
|
||||
#include "unit_tests/mocks/mock_device.h"
|
||||
#include "unit_tests/mocks/mock_graphics_allocation.h"
|
||||
#include "unit_tests/mocks/mock_ostime.h"
|
||||
#include "runtime/helpers/options.h"
|
||||
#include "unit_tests/utilities/base_object_utils.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "test.h"
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
|
||||
using namespace OCLRT;
|
||||
@@ -116,12 +118,13 @@ TEST(SchedulerKernelTest, getCurbeSize) {
|
||||
}
|
||||
|
||||
TEST(SchedulerKernelTest, setArgsForSchedulerKernel) {
|
||||
auto device = unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
MockProgram program(*device->getExecutionEnvironment());
|
||||
program.setDevice(device.get());
|
||||
unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
auto context = clUniquePtr(new MockContext(device.get()));
|
||||
auto program = clUniquePtr(new MockProgram(*device->getExecutionEnvironment(), context.get(), false));
|
||||
program->setDevice(device.get());
|
||||
unique_ptr<KernelInfo> info(nullptr);
|
||||
KernelInfo *infoPtr = nullptr;
|
||||
unique_ptr<MockSchedulerKernel> scheduler = unique_ptr<MockSchedulerKernel>(MockSchedulerKernel::create(program, *device.get(), infoPtr));
|
||||
unique_ptr<MockSchedulerKernel> scheduler = unique_ptr<MockSchedulerKernel>(MockSchedulerKernel::create(*program, *device, infoPtr));
|
||||
info.reset(infoPtr);
|
||||
unique_ptr<MockGraphicsAllocation> allocs[9];
|
||||
|
||||
@@ -145,13 +148,14 @@ TEST(SchedulerKernelTest, setArgsForSchedulerKernel) {
|
||||
}
|
||||
|
||||
TEST(SchedulerKernelTest, setArgsForSchedulerKernelWithNullDebugQueue) {
|
||||
auto device = unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
MockProgram program(*device->getExecutionEnvironment());
|
||||
program.setDevice(device.get());
|
||||
unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
auto context = clUniquePtr(new MockContext(device.get()));
|
||||
auto program = clUniquePtr(new MockProgram(*device->getExecutionEnvironment(), context.get(), false));
|
||||
program->setDevice(device.get());
|
||||
|
||||
unique_ptr<KernelInfo> info(nullptr);
|
||||
KernelInfo *infoPtr = nullptr;
|
||||
unique_ptr<MockSchedulerKernel> scheduler = unique_ptr<MockSchedulerKernel>(MockSchedulerKernel::create(program, *device.get(), infoPtr));
|
||||
unique_ptr<MockSchedulerKernel> scheduler = unique_ptr<MockSchedulerKernel>(MockSchedulerKernel::create(*program, *device, infoPtr));
|
||||
info.reset(infoPtr);
|
||||
unique_ptr<MockGraphicsAllocation> allocs[9];
|
||||
|
||||
@@ -178,13 +182,14 @@ TEST(SchedulerKernelTest, createKernelReflectionForForcedSchedulerDispatch) {
|
||||
DebugManagerStateRestore dbgRestorer;
|
||||
|
||||
DebugManager.flags.ForceDispatchScheduler.set(true);
|
||||
auto device = unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
MockProgram program(*device->getExecutionEnvironment());
|
||||
program.setDevice(device.get());
|
||||
unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
auto context = clUniquePtr(new MockContext(device.get()));
|
||||
auto program = clUniquePtr(new MockProgram(*device->getExecutionEnvironment(), context.get(), false));
|
||||
program->setDevice(device.get());
|
||||
|
||||
unique_ptr<KernelInfo> info(nullptr);
|
||||
KernelInfo *infoPtr = nullptr;
|
||||
unique_ptr<MockSchedulerKernel> scheduler = unique_ptr<MockSchedulerKernel>(MockSchedulerKernel::create(program, *device.get(), infoPtr));
|
||||
unique_ptr<MockSchedulerKernel> scheduler = unique_ptr<MockSchedulerKernel>(MockSchedulerKernel::create(*program, *device, infoPtr));
|
||||
info.reset(infoPtr);
|
||||
|
||||
scheduler->createReflectionSurface();
|
||||
@@ -196,13 +201,14 @@ TEST(SchedulerKernelTest, createKernelReflectionSecondTimeForForcedSchedulerDisp
|
||||
DebugManagerStateRestore dbgRestorer;
|
||||
|
||||
DebugManager.flags.ForceDispatchScheduler.set(true);
|
||||
auto device = unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
MockProgram program(*device->getExecutionEnvironment());
|
||||
program.setDevice(device.get());
|
||||
unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
auto context = clUniquePtr(new MockContext(device.get()));
|
||||
auto program = clUniquePtr(new MockProgram(*device->getExecutionEnvironment(), context.get(), false));
|
||||
program->setDevice(device.get());
|
||||
|
||||
unique_ptr<KernelInfo> info(nullptr);
|
||||
KernelInfo *infoPtr = nullptr;
|
||||
unique_ptr<MockSchedulerKernel> scheduler = unique_ptr<MockSchedulerKernel>(MockSchedulerKernel::create(program, *device.get(), infoPtr));
|
||||
unique_ptr<MockSchedulerKernel> scheduler = unique_ptr<MockSchedulerKernel>(MockSchedulerKernel::create(*program, *device, infoPtr));
|
||||
info.reset(infoPtr);
|
||||
|
||||
scheduler->createReflectionSurface();
|
||||
@@ -218,13 +224,14 @@ TEST(SchedulerKernelTest, createKernelReflectionForSchedulerDoesNothing) {
|
||||
DebugManagerStateRestore dbgRestorer;
|
||||
|
||||
DebugManager.flags.ForceDispatchScheduler.set(false);
|
||||
auto device = unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
MockProgram program(*device->getExecutionEnvironment());
|
||||
program.setDevice(device.get());
|
||||
unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
auto context = clUniquePtr(new MockContext(device.get()));
|
||||
auto program = clUniquePtr(new MockProgram(*device->getExecutionEnvironment(), context.get(), false));
|
||||
program->setDevice(device.get());
|
||||
|
||||
unique_ptr<KernelInfo> info(nullptr);
|
||||
KernelInfo *infoPtr = nullptr;
|
||||
unique_ptr<MockSchedulerKernel> scheduler = unique_ptr<MockSchedulerKernel>(MockSchedulerKernel::create(program, *device.get(), infoPtr));
|
||||
unique_ptr<MockSchedulerKernel> scheduler = unique_ptr<MockSchedulerKernel>(MockSchedulerKernel::create(*program, *device, infoPtr));
|
||||
info.reset(infoPtr);
|
||||
|
||||
scheduler->createReflectionSurface();
|
||||
|
||||
Reference in New Issue
Block a user