Stop creating osInterface in WddmCSR and DrmCSR constructors
Change-Id: Ic8ca21824882dfae5df3fe05c7ec1ff96311f286
This commit is contained in:
parent
8bec1906ec
commit
c202c95634
|
@ -28,14 +28,9 @@ template <typename GfxFamily>
|
|||
DrmCommandStreamReceiver<GfxFamily>::DrmCommandStreamReceiver(const HardwareInfo &hwInfoIn,
|
||||
ExecutionEnvironment &executionEnvironment, gemCloseWorkerMode mode)
|
||||
: BaseClass(hwInfoIn, executionEnvironment), gemCloseWorkerOperationMode(mode) {
|
||||
if (!executionEnvironment.osInterface) {
|
||||
executionEnvironment.osInterface = std::make_unique<OSInterface>();
|
||||
this->drm = Drm::get(0);
|
||||
} else {
|
||||
this->drm = executionEnvironment.osInterface->get()->getDrm()
|
||||
? executionEnvironment.osInterface->get()->getDrm()
|
||||
: Drm::get(0);
|
||||
}
|
||||
|
||||
this->drm = executionEnvironment.osInterface->get()->getDrm();
|
||||
|
||||
residency.reserve(512);
|
||||
execObjectsStorage.reserve(512);
|
||||
|
||||
|
|
|
@ -38,15 +38,8 @@ WddmCommandStreamReceiver<GfxFamily>::WddmCommandStreamReceiver(const HardwareIn
|
|||
ExecutionEnvironment &executionEnvironment)
|
||||
: BaseClass(hwInfoIn, executionEnvironment) {
|
||||
|
||||
if (!executionEnvironment.osInterface) {
|
||||
executionEnvironment.osInterface = std::make_unique<OSInterface>();
|
||||
this->wddm = Wddm::createWddm();
|
||||
this->osInterface = executionEnvironment.osInterface.get();
|
||||
this->osInterface->get()->setWddm(this->wddm);
|
||||
} else {
|
||||
this->wddm = executionEnvironment.osInterface->get()->getWddm();
|
||||
this->osInterface = executionEnvironment.osInterface.get();
|
||||
}
|
||||
|
||||
GPUNODE_ORDINAL nodeOrdinal = GPUNODE_3D;
|
||||
UNRECOVERABLE_IF(!WddmEngineMapper<GfxFamily>::engineNodeMap(hwInfoIn.capabilityTable.defaultEngineType, nodeOrdinal));
|
||||
|
|
|
@ -9,31 +9,30 @@
|
|||
#include "runtime/context/context.h"
|
||||
#include "runtime/command_queue/command_queue.h"
|
||||
#include "runtime/event/event.h"
|
||||
#include "unit_tests/fixtures/device_instrumentation_fixture.h"
|
||||
#include "unit_tests/os_interface/mock_performance_counters.h"
|
||||
|
||||
using namespace OCLRT;
|
||||
|
||||
struct clCreatePerfCountersCommandQueueINTELTests : public api_fixture,
|
||||
struct clCreatePerfCountersCommandQueueINTELTests : public DeviceInstrumentationFixture,
|
||||
public PerformanceCountersDeviceFixture,
|
||||
::testing::Test {
|
||||
void SetUp() override {
|
||||
PerformanceCountersDeviceFixture::SetUp();
|
||||
api_fixture::SetUp();
|
||||
DeviceInstrumentationFixture::SetUp(true);
|
||||
|
||||
const HardwareInfo &hwInfo = pPlatform->getDevice(0)->getHardwareInfo();
|
||||
pInHwInfo = const_cast<HardwareInfo *>(&hwInfo);
|
||||
instrumentationEnabled = pInHwInfo->capabilityTable.instrumentationEnabled;
|
||||
pInHwInfo->capabilityTable.instrumentationEnabled = true;
|
||||
clDevice = device.get();
|
||||
retVal = CL_SUCCESS;
|
||||
context = std::unique_ptr<Context>(Context::create<MockContext>(nullptr, DeviceVector(&clDevice, 1),
|
||||
nullptr, nullptr, retVal));
|
||||
}
|
||||
void TearDown() override {
|
||||
pInHwInfo->capabilityTable.instrumentationEnabled = instrumentationEnabled;
|
||||
|
||||
api_fixture::TearDown();
|
||||
PerformanceCountersDeviceFixture::TearDown();
|
||||
}
|
||||
|
||||
HardwareInfo *pInHwInfo;
|
||||
bool instrumentationEnabled;
|
||||
std::unique_ptr<Context> context;
|
||||
cl_device_id clDevice;
|
||||
cl_int retVal;
|
||||
};
|
||||
|
||||
namespace ULT {
|
||||
|
@ -43,7 +42,7 @@ TEST_F(clCreatePerfCountersCommandQueueINTELTests, GivenCorrectParamatersWhenCre
|
|||
cl_queue_properties properties = CL_QUEUE_PROFILING_ENABLE;
|
||||
cl_uint configuration = 1;
|
||||
|
||||
cmdQ = clCreatePerfCountersCommandQueueINTEL(pContext, devices[0], properties, configuration, &retVal);
|
||||
cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), clDevice, properties, configuration, &retVal);
|
||||
ASSERT_NE(nullptr, cmdQ);
|
||||
ASSERT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
|
@ -62,7 +61,7 @@ TEST_F(clCreatePerfCountersCommandQueueINTELTests, GivenNullPropertiesWhenCreati
|
|||
cl_queue_properties properties = 0;
|
||||
cl_uint configuration = 0;
|
||||
|
||||
cmdQ = clCreatePerfCountersCommandQueueINTEL(pContext, devices[0], properties, configuration, &retVal);
|
||||
cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), clDevice, properties, configuration, &retVal);
|
||||
|
||||
ASSERT_EQ(nullptr, cmdQ);
|
||||
ASSERT_EQ(CL_INVALID_QUEUE_PROPERTIES, retVal);
|
||||
|
@ -73,12 +72,12 @@ TEST_F(clCreatePerfCountersCommandQueueINTELTests, GivenClQueueOnDevicePropertyW
|
|||
cl_queue_properties properties = CL_QUEUE_PROFILING_ENABLE | CL_QUEUE_ON_DEVICE;
|
||||
cl_uint configuration = 0;
|
||||
|
||||
cmdQ = clCreatePerfCountersCommandQueueINTEL(pContext, devices[0], properties, configuration, &retVal);
|
||||
cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), clDevice, properties, configuration, &retVal);
|
||||
ASSERT_EQ(nullptr, cmdQ);
|
||||
ASSERT_EQ(CL_INVALID_QUEUE_PROPERTIES, retVal);
|
||||
|
||||
properties = CL_QUEUE_PROFILING_ENABLE | CL_QUEUE_ON_DEVICE_DEFAULT;
|
||||
cmdQ = clCreatePerfCountersCommandQueueINTEL(pContext, devices[0], properties, configuration, &retVal);
|
||||
cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), clDevice, properties, configuration, &retVal);
|
||||
|
||||
ASSERT_EQ(nullptr, cmdQ);
|
||||
ASSERT_EQ(CL_INVALID_QUEUE_PROPERTIES, retVal);
|
||||
|
@ -89,7 +88,7 @@ TEST_F(clCreatePerfCountersCommandQueueINTELTests, GivenNullContextWhenCreatingP
|
|||
cl_queue_properties properties = CL_QUEUE_PROFILING_ENABLE;
|
||||
cl_uint configuration = 0;
|
||||
|
||||
cmdQ = clCreatePerfCountersCommandQueueINTEL(nullptr, devices[0], properties, configuration, &retVal);
|
||||
cmdQ = clCreatePerfCountersCommandQueueINTEL(nullptr, clDevice, properties, configuration, &retVal);
|
||||
|
||||
ASSERT_EQ(nullptr, cmdQ);
|
||||
ASSERT_EQ(CL_INVALID_CONTEXT, retVal);
|
||||
|
@ -100,7 +99,7 @@ TEST_F(clCreatePerfCountersCommandQueueINTELTests, GivenMaximumGtdiConfiguration
|
|||
cl_queue_properties properties = CL_QUEUE_PROFILING_ENABLE;
|
||||
cl_uint configuration = GTDI_CONFIGURATION_SET_MAX;
|
||||
|
||||
cmdQ = clCreatePerfCountersCommandQueueINTEL(pContext, devices[0], properties, configuration, &retVal);
|
||||
cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), clDevice, properties, configuration, &retVal);
|
||||
|
||||
ASSERT_EQ(nullptr, cmdQ);
|
||||
ASSERT_EQ(CL_OUT_OF_RESOURCES, retVal);
|
||||
|
@ -111,7 +110,7 @@ TEST_F(clCreatePerfCountersCommandQueueINTELTests, GivenCorrectCmdQWhenEventIsCr
|
|||
cl_queue_properties properties = CL_QUEUE_PROFILING_ENABLE;
|
||||
cl_uint configuration = 1;
|
||||
|
||||
cmdQ = clCreatePerfCountersCommandQueueINTEL(pContext, devices[0], properties, configuration, &retVal);
|
||||
cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), clDevice, properties, configuration, &retVal);
|
||||
ASSERT_NE(nullptr, cmdQ);
|
||||
ASSERT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
|
@ -126,12 +125,12 @@ TEST_F(clCreatePerfCountersCommandQueueINTELTests, GivenCorrectCmdQWhenEventIsCr
|
|||
}
|
||||
|
||||
TEST_F(clCreatePerfCountersCommandQueueINTELTests, GivenInstrumentationEnabledIsFalseWhenCreatingPerfCountersCmdQThenInvalidDeviceErrorIsReturned) {
|
||||
pInHwInfo->capabilityTable.instrumentationEnabled = false;
|
||||
hwInfo->capabilityTable.instrumentationEnabled = false;
|
||||
cl_command_queue cmdQ = nullptr;
|
||||
cl_queue_properties properties = CL_QUEUE_PROFILING_ENABLE;
|
||||
cl_uint configuration = 1;
|
||||
|
||||
cmdQ = clCreatePerfCountersCommandQueueINTEL(pContext, devices[0], properties, configuration, &retVal);
|
||||
cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), clDevice, properties, configuration, &retVal);
|
||||
ASSERT_EQ(nullptr, cmdQ);
|
||||
EXPECT_EQ(CL_INVALID_DEVICE, retVal);
|
||||
}
|
||||
|
@ -141,7 +140,7 @@ TEST_F(clCreatePerfCountersCommandQueueINTELTests, GivenInvalidDeviceWhenCreatin
|
|||
cl_queue_properties properties = CL_QUEUE_PROFILING_ENABLE;
|
||||
cl_uint configuration = 0;
|
||||
|
||||
cmdQ = clCreatePerfCountersCommandQueueINTEL(pContext, (cl_device_id)pContext, properties, configuration, &retVal);
|
||||
cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), (cl_device_id)context.get(), properties, configuration, &retVal);
|
||||
|
||||
ASSERT_EQ(nullptr, cmdQ);
|
||||
ASSERT_EQ(CL_INVALID_DEVICE, retVal);
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "runtime/event/event.h"
|
||||
#include "runtime/event/user_event.h"
|
||||
#include "unit_tests/api/cl_api_tests.h"
|
||||
#include "unit_tests/fixtures/device_instrumentation_fixture.h"
|
||||
#include "unit_tests/os_interface/mock_performance_counters.h"
|
||||
#include "test.h"
|
||||
|
||||
|
@ -247,22 +248,30 @@ TEST(clGetEventProfilingInfo, IsPerfCountersEnabledRegularEvent) {
|
|||
delete pEvent;
|
||||
}
|
||||
|
||||
class clEventProfilingWithPerfCountersTests : public api_fixture, public PerformanceCountersDeviceFixture, public ::testing::Test {
|
||||
class clEventProfilingWithPerfCountersTests : public DeviceInstrumentationFixture,
|
||||
public PerformanceCountersDeviceFixture,
|
||||
public ::testing::Test {
|
||||
public:
|
||||
void SetUp() override {
|
||||
PerformanceCountersDeviceFixture::SetUp();
|
||||
api_fixture::SetUp();
|
||||
DeviceInstrumentationFixture::SetUp(true);
|
||||
|
||||
cl_device_id clDevice = device.get();
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
context = std::unique_ptr<Context>(Context::create<MockContext>(nullptr, DeviceVector(&clDevice, 1),
|
||||
nullptr, nullptr, retVal));
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
api_fixture::TearDown();
|
||||
PerformanceCountersDeviceFixture::TearDown();
|
||||
}
|
||||
|
||||
std::unique_ptr<Context> context;
|
||||
};
|
||||
|
||||
TEST_F(clEventProfilingWithPerfCountersTests, clGetEventProfilingInfoGetPerfCounters) {
|
||||
CommandQueue *pCommandQueue;
|
||||
pCommandQueue = new CommandQueue(pContext, pPlatform->getDevice(0), 0);
|
||||
pCommandQueue = new CommandQueue(context.get(), device.get(), 0);
|
||||
Event *pEvent = new Event(pCommandQueue, 0, 0, 0);
|
||||
pEvent->setStatus(CL_COMPLETE);
|
||||
size_t param_value_size;
|
||||
|
|
|
@ -6,19 +6,19 @@
|
|||
*/
|
||||
|
||||
#include "cl_api_tests.h"
|
||||
#include "unit_tests/fixtures/device_instrumentation_fixture.h"
|
||||
#include "unit_tests/os_interface/mock_performance_counters.h"
|
||||
|
||||
using namespace OCLRT;
|
||||
|
||||
struct clSetPerformanceConfigurationINTELTests : public api_fixture,
|
||||
struct clSetPerformanceConfigurationINTELTests : public DeviceInstrumentationFixture,
|
||||
public PerformanceCountersDeviceFixture,
|
||||
::testing::Test {
|
||||
void SetUp() override {
|
||||
PerformanceCountersDeviceFixture::SetUp();
|
||||
api_fixture::SetUp();
|
||||
DeviceInstrumentationFixture::SetUp(true);
|
||||
}
|
||||
void TearDown() override {
|
||||
api_fixture::TearDown();
|
||||
PerformanceCountersDeviceFixture::TearDown();
|
||||
}
|
||||
};
|
||||
|
@ -29,7 +29,7 @@ TEST_F(clSetPerformanceConfigurationINTELTests, positiveSetPerfConfig) {
|
|||
cl_uint offsets[2];
|
||||
cl_uint values[2];
|
||||
|
||||
ret = clSetPerformanceConfigurationINTEL(devices[0], 2, offsets, values);
|
||||
ret = clSetPerformanceConfigurationINTEL(device.get(), 2, offsets, values);
|
||||
EXPECT_EQ(CL_SUCCESS, ret);
|
||||
}
|
||||
|
||||
|
@ -37,9 +37,9 @@ TEST_F(clSetPerformanceConfigurationINTELTests, negativeInvalidDevice) {
|
|||
cl_int ret = CL_OUT_OF_RESOURCES;
|
||||
cl_uint offsets[2];
|
||||
cl_uint values[2];
|
||||
cl_device_id device = {0};
|
||||
cl_device_id clDevice = {0};
|
||||
|
||||
ret = clSetPerformanceConfigurationINTEL(device, 2, offsets, values);
|
||||
ret = clSetPerformanceConfigurationINTEL(clDevice, 2, offsets, values);
|
||||
EXPECT_EQ(CL_INVALID_DEVICE, ret);
|
||||
}
|
||||
|
||||
|
@ -48,12 +48,11 @@ TEST_F(clSetPerformanceConfigurationINTELTests, negativeInstrumentationDisabled)
|
|||
cl_uint offsets[2];
|
||||
cl_uint values[2];
|
||||
|
||||
const HardwareInfo &hwInfo = pPlatform->getDevice(0)->getHardwareInfo();
|
||||
HardwareInfo *pInHwInfo = const_cast<HardwareInfo *>(&hwInfo);
|
||||
HardwareInfo *pInHwInfo = const_cast<HardwareInfo *>(hwInfo);
|
||||
bool instrumentationEnabled = pInHwInfo->capabilityTable.instrumentationEnabled;
|
||||
pInHwInfo->capabilityTable.instrumentationEnabled = false;
|
||||
|
||||
ret = clSetPerformanceConfigurationINTEL(devices[0], 2, offsets, values);
|
||||
ret = clSetPerformanceConfigurationINTEL(device.get(), 2, offsets, values);
|
||||
EXPECT_EQ(CL_PROFILING_INFO_NOT_AVAILABLE, ret);
|
||||
|
||||
pInHwInfo->capabilityTable.instrumentationEnabled = instrumentationEnabled;
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "runtime/memory_manager/os_agnostic_memory_manager.h"
|
||||
#include "runtime/helpers/options.h"
|
||||
#include "unit_tests/fixtures/gmm_environment_fixture.h"
|
||||
#include "unit_tests/helpers/execution_environment_helper.h"
|
||||
#include "unit_tests/libult/create_command_stream.h"
|
||||
#include "unit_tests/helpers/debug_manager_state_restore.h"
|
||||
#include "test.h"
|
||||
|
@ -34,21 +35,24 @@ struct CreateCommandStreamReceiverTest : public GmmEnvironmentFixture, public ::
|
|||
|
||||
HWTEST_P(CreateCommandStreamReceiverTest, givenCreateCommandStreamWhenCsrIsSetToValidTypeThenTheFuntionReturnsCommandStreamReceiver) {
|
||||
DebugManagerStateRestore stateRestorer;
|
||||
const HardwareInfo hwInfo = *platformDevices[0];
|
||||
HardwareInfo *hwInfo = nullptr;
|
||||
std::unique_ptr<ExecutionEnvironment> executionEnvironment = std::unique_ptr<ExecutionEnvironment>(getExecutionEnvironmentImpl(hwInfo));
|
||||
|
||||
CommandStreamReceiverType csrType = GetParam();
|
||||
|
||||
overrideCommandStreamReceiverCreation = true;
|
||||
DebugManager.flags.SetCommandStreamReceiver.set(csrType);
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
executionEnvironment.commandStreamReceivers.push_back(std::unique_ptr<CommandStreamReceiver>(createCommandStream(&hwInfo, executionEnvironment)));
|
||||
|
||||
executionEnvironment->commandStreamReceivers.push_back(std::unique_ptr<CommandStreamReceiver>(createCommandStream(hwInfo,
|
||||
*executionEnvironment)));
|
||||
|
||||
if (csrType < CommandStreamReceiverType::CSR_TYPES_NUM) {
|
||||
EXPECT_NE(nullptr, executionEnvironment.commandStreamReceivers[0u].get());
|
||||
executionEnvironment.memoryManager.reset(executionEnvironment.commandStreamReceivers[0u]->createMemoryManager(false, false));
|
||||
EXPECT_NE(nullptr, executionEnvironment.memoryManager.get());
|
||||
EXPECT_NE(nullptr, executionEnvironment->commandStreamReceivers[0u].get());
|
||||
executionEnvironment->memoryManager.reset(executionEnvironment->commandStreamReceivers[0u]->createMemoryManager(false, false));
|
||||
EXPECT_NE(nullptr, executionEnvironment->memoryManager.get());
|
||||
} else {
|
||||
EXPECT_EQ(nullptr, executionEnvironment.commandStreamReceivers[0u]);
|
||||
EXPECT_EQ(nullptr, executionEnvironment.memoryManager.get());
|
||||
EXPECT_EQ(nullptr, executionEnvironment->commandStreamReceivers[0u]);
|
||||
EXPECT_EQ(nullptr, executionEnvironment->memoryManager.get());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,8 @@ set(IGDRCL_SRCS_tests_fixtures
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/context_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_instrumentation_fixture.cpp
|
||||
${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
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* Copyright (C) 2018 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "unit_tests/fixtures/device_instrumentation_fixture.h"
|
||||
#include "unit_tests/helpers/execution_environment_helper.h"
|
||||
#include "unit_tests/mocks/mock_device.h"
|
||||
|
||||
namespace OCLRT {
|
||||
void DeviceInstrumentationFixture::SetUp(bool instrumentation) {
|
||||
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo);
|
||||
if (instrumentation)
|
||||
hwInfo->capabilityTable.instrumentationEnabled = true;
|
||||
device = std::unique_ptr<Device>(Device::create<Device>(&hwInfo[0], executionEnvironment, 0));
|
||||
}
|
||||
} // namespace OCLRT
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* Copyright (C) 2018 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace OCLRT {
|
||||
|
||||
class Device;
|
||||
struct HardwareInfo;
|
||||
|
||||
struct DeviceInstrumentationFixture {
|
||||
void SetUp(bool instrumentation);
|
||||
|
||||
std::unique_ptr<Device> device = nullptr;
|
||||
HardwareInfo *hwInfo = nullptr;
|
||||
};
|
||||
} // namespace OCLRT
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* Copyright (C) 2018 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "runtime/os_interface/device_factory.h"
|
||||
#include "unit_tests/helpers/execution_environment_helper.h"
|
||||
|
||||
namespace OCLRT {
|
||||
|
||||
ExecutionEnvironment *getExecutionEnvironmentImpl(HardwareInfo *&hwInfo) {
|
||||
ExecutionEnvironment *executionEnvironment = new ExecutionEnvironment;
|
||||
size_t numDevicesReturned = 0;
|
||||
hwInfo = nullptr;
|
||||
DeviceFactory::getDevices(&hwInfo, numDevicesReturned, *executionEnvironment);
|
||||
return executionEnvironment;
|
||||
}
|
||||
} // namespace OCLRT
|
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
* Copyright (C) 2018 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "CL/cl.h"
|
||||
#include <cstdint>
|
||||
#include "runtime/execution_environment/execution_environment.h"
|
||||
|
||||
namespace OCLRT {
|
||||
ExecutionEnvironment *getExecutionEnvironmentImpl(HardwareInfo *&hwInfo);
|
||||
} // namespace OCLRT
|
|
@ -20,6 +20,8 @@ set(IGDRCL_SRCS_LIB_ULT
|
|||
${IGDRCL_SOURCE_DIR}/unit_tests/gen_common/gen_cmd_parse.h
|
||||
${IGDRCL_SOURCE_DIR}/unit_tests/abort.cpp
|
||||
${IGDRCL_SOURCE_DIR}/unit_tests/helpers/built_ins_helper.cpp
|
||||
${IGDRCL_SOURCE_DIR}/unit_tests/helpers/execution_environment_helper.cpp
|
||||
${IGDRCL_SOURCE_DIR}/unit_tests/helpers/execution_environment_helper.h
|
||||
${IGDRCL_SOURCE_DIR}/unit_tests/libult/create_tbx_sockets.cpp
|
||||
${IGDRCL_SOURCE_DIR}/unit_tests/libult/ult_command_stream_receiver.h
|
||||
${IGDRCL_SOURCE_DIR}/unit_tests/helpers/debug_helpers.cpp
|
||||
|
|
|
@ -16,31 +16,39 @@
|
|||
#include "runtime/os_interface/linux/os_interface.h"
|
||||
#include "hw_cmds.h"
|
||||
#include "unit_tests/fixtures/device_fixture.h"
|
||||
#include "unit_tests/helpers/execution_environment_helper.h"
|
||||
#include "test.h"
|
||||
|
||||
#include "unit_tests/os_interface/linux/device_command_stream_fixture.h"
|
||||
|
||||
using namespace OCLRT;
|
||||
|
||||
typedef Test<DeviceFixture> DeviceCommandStreamLeaksTest;
|
||||
struct DeviceCommandStreamLeaksTest : ::testing::Test {
|
||||
void SetUp() override {
|
||||
HardwareInfo *hwInfo = nullptr;
|
||||
executionEnvironment = std::unique_ptr<ExecutionEnvironment>(getExecutionEnvironmentImpl(hwInfo));
|
||||
}
|
||||
|
||||
std::unique_ptr<ExecutionEnvironment> executionEnvironment;
|
||||
};
|
||||
|
||||
HWTEST_F(DeviceCommandStreamLeaksTest, Create) {
|
||||
this->executionEnvironment.osInterface = std::make_unique<OSInterface>();
|
||||
std::unique_ptr<CommandStreamReceiver> ptr(DeviceCommandStreamReceiver<FamilyType>::create(*platformDevices[0], false, this->executionEnvironment));
|
||||
std::unique_ptr<CommandStreamReceiver> ptr(DeviceCommandStreamReceiver<FamilyType>::create(*platformDevices[0], false,
|
||||
*executionEnvironment));
|
||||
DrmMockSuccess mockDrm;
|
||||
EXPECT_NE(nullptr, ptr);
|
||||
}
|
||||
|
||||
HWTEST_F(DeviceCommandStreamLeaksTest, givenDefaultDrmCsrWhenItIsCreatedThenGemCloseWorkerInactiveModeIsSelected) {
|
||||
this->executionEnvironment.osInterface = std::make_unique<OSInterface>();
|
||||
std::unique_ptr<CommandStreamReceiver> ptr(DeviceCommandStreamReceiver<FamilyType>::create(*platformDevices[0], false, this->executionEnvironment));
|
||||
std::unique_ptr<CommandStreamReceiver> ptr(DeviceCommandStreamReceiver<FamilyType>::create(*platformDevices[0], false,
|
||||
*executionEnvironment));
|
||||
auto drmCsr = (DrmCommandStreamReceiver<FamilyType> *)ptr.get();
|
||||
EXPECT_EQ(drmCsr->peekGemCloseWorkerOperationMode(), gemCloseWorkerMode::gemCloseWorkerActive);
|
||||
}
|
||||
|
||||
HWTEST_F(DeviceCommandStreamLeaksTest, givenDefaultDrmCsrWithAubDumWhenItIsCreatedThenGemCloseWorkerInactiveModeIsSelected) {
|
||||
this->executionEnvironment.osInterface = std::make_unique<OSInterface>();
|
||||
std::unique_ptr<CommandStreamReceiver> ptr(DeviceCommandStreamReceiver<FamilyType>::create(*platformDevices[0], true, this->executionEnvironment));
|
||||
std::unique_ptr<CommandStreamReceiver> ptr(DeviceCommandStreamReceiver<FamilyType>::create(*platformDevices[0], true,
|
||||
*executionEnvironment));
|
||||
auto drmCsrWithAubDump = (CommandStreamReceiverWithAUBDump<DrmCommandStreamReceiver<FamilyType>> *)ptr.get();
|
||||
EXPECT_EQ(drmCsrWithAubDump->peekGemCloseWorkerOperationMode(), gemCloseWorkerMode::gemCloseWorkerActive);
|
||||
auto aubCSR = static_cast<CommandStreamReceiverWithAUBDump<DrmCommandStreamReceiver<FamilyType>> *>(ptr.get())->aubCSR;
|
||||
|
@ -49,8 +57,8 @@ HWTEST_F(DeviceCommandStreamLeaksTest, givenDefaultDrmCsrWithAubDumWhenItIsCreat
|
|||
|
||||
HWTEST_F(DeviceCommandStreamLeaksTest, givenDefaultDrmCsrWhenOsInterfaceIsNullptrThenValidateDrm) {
|
||||
std::unique_ptr<CommandStreamReceiver> ptr(DeviceCommandStreamReceiver<FamilyType>::create(*platformDevices[0], false,
|
||||
this->executionEnvironment));
|
||||
*executionEnvironment));
|
||||
auto drmCsr = (DrmCommandStreamReceiver<FamilyType> *)ptr.get();
|
||||
EXPECT_NE(nullptr, executionEnvironment.osInterface);
|
||||
EXPECT_EQ(drmCsr->getOSInterface()->get()->getDrm(), executionEnvironment.osInterface->get()->getDrm());
|
||||
EXPECT_NE(nullptr, executionEnvironment->osInterface);
|
||||
EXPECT_EQ(drmCsr->getOSInterface()->get()->getDrm(), executionEnvironment->osInterface->get()->getDrm());
|
||||
}
|
|
@ -15,6 +15,7 @@
|
|||
#include "runtime/os_interface/linux/os_interface.h"
|
||||
#include "unit_tests/fixtures/device_fixture.h"
|
||||
#include "unit_tests/helpers/debug_manager_state_restore.h"
|
||||
#include "unit_tests/helpers/execution_environment_helper.h"
|
||||
#include "unit_tests/helpers/hw_parse.h"
|
||||
#include "unit_tests/mocks/mock_program.h"
|
||||
#include "unit_tests/mocks/mock_host_ptr_manager.h"
|
||||
|
@ -508,14 +509,19 @@ struct DrmCsrVfeTests : ::testing::Test {
|
|||
csr.flushTask(stream, 0, stream, stream, stream, 0, dispatchFlags, device);
|
||||
}
|
||||
|
||||
void SetUp() override {
|
||||
HardwareInfo *hwInfo = nullptr;
|
||||
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo);
|
||||
device = std::unique_ptr<MockDevice>(MockDevice::create<MockDevice>(hwInfo, executionEnvironment, 0));
|
||||
}
|
||||
|
||||
HardwareParse hwParser;
|
||||
DispatchFlags dispatchFlags = {};
|
||||
CommandStreamReceiver *oldCsr = nullptr;
|
||||
std::unique_ptr<MockDevice> device = nullptr;
|
||||
};
|
||||
|
||||
HWCMDTEST_F(IGFX_GEN8_CORE, DrmCsrVfeTests, givenNonDirtyVfeForDefaultContextWhenLowPriorityIsFlushedThenReprogram) {
|
||||
std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
device->executionEnvironment->osInterface = std::make_unique<OSInterface>();
|
||||
auto mockCsr = new MyCsr<FamilyType>(*device->executionEnvironment);
|
||||
|
||||
device->resetCommandStreamReceiver(mockCsr);
|
||||
|
@ -543,8 +549,6 @@ HWCMDTEST_F(IGFX_GEN8_CORE, DrmCsrVfeTests, givenNonDirtyVfeForDefaultContextWhe
|
|||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_GEN8_CORE, DrmCsrVfeTests, givenNonDirtyVfeForLowPriorityContextWhenDefaultPriorityIsFlushedThenReprogram) {
|
||||
std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
device->executionEnvironment->osInterface = std::make_unique<OSInterface>();
|
||||
auto mockCsr = new MyCsr<FamilyType>(*device->executionEnvironment);
|
||||
|
||||
device->resetCommandStreamReceiver(mockCsr);
|
||||
|
@ -572,8 +576,6 @@ HWCMDTEST_F(IGFX_GEN8_CORE, DrmCsrVfeTests, givenNonDirtyVfeForLowPriorityContex
|
|||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_GEN8_CORE, DrmCsrVfeTests, givenNonDirtyVfeForLowPriorityContextWhenLowPriorityIsFlushedThenDontReprogram) {
|
||||
std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
device->executionEnvironment->osInterface = std::make_unique<OSInterface>();
|
||||
auto mockCsr = new MyCsr<FamilyType>(*device->executionEnvironment);
|
||||
|
||||
device->resetCommandStreamReceiver(mockCsr);
|
||||
|
@ -601,8 +603,6 @@ HWCMDTEST_F(IGFX_GEN8_CORE, DrmCsrVfeTests, givenNonDirtyVfeForLowPriorityContex
|
|||
}
|
||||
|
||||
HWTEST_F(DrmCsrVfeTests, givenNonDirtyVfeForBothPriorityContextWhenFlushedLowWithScratchRequirementThenMakeDefaultDirty) {
|
||||
std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
device->executionEnvironment->osInterface = std::make_unique<OSInterface>();
|
||||
auto mockCsr = new MyCsr<FamilyType>(*device->executionEnvironment);
|
||||
|
||||
device->resetCommandStreamReceiver(mockCsr);
|
||||
|
@ -623,8 +623,6 @@ HWTEST_F(DrmCsrVfeTests, givenNonDirtyVfeForBothPriorityContextWhenFlushedLowWit
|
|||
}
|
||||
|
||||
HWTEST_F(DrmCsrVfeTests, givenNonDirtyVfeForBothPriorityContextWhenFlushedDefaultWithScratchRequirementThenMakeLowDirty) {
|
||||
std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
device->executionEnvironment->osInterface = std::make_unique<OSInterface>();
|
||||
auto mockCsr = new MyCsr<FamilyType>(*device->executionEnvironment);
|
||||
|
||||
device->resetCommandStreamReceiver(mockCsr);
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "runtime/helpers/options.h"
|
||||
#include "runtime/os_interface/os_time.h"
|
||||
#include "runtime/os_interface/os_interface.h"
|
||||
#include "unit_tests/fixtures/device_instrumentation_fixture.h"
|
||||
#include "unit_tests/os_interface/mock_performance_counters.h"
|
||||
#include "unit_tests/mocks/mock_device.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
@ -15,35 +16,27 @@
|
|||
using namespace OCLRT;
|
||||
|
||||
struct PerformanceCountersDeviceTest : public PerformanceCountersDeviceFixture,
|
||||
public DeviceInstrumentationFixture,
|
||||
public ::testing::Test {
|
||||
void SetUp() override {
|
||||
PerformanceCountersDeviceFixture::SetUp();
|
||||
PerfCounterFlags::resetPerfCountersFlags();
|
||||
hwInfoToModify = (HardwareInfo *)(platformDevices[0]);
|
||||
instrumentationEnabledFlag = hwInfoToModify->capabilityTable.instrumentationEnabled;
|
||||
}
|
||||
void TearDown() override {
|
||||
PerformanceCountersDeviceFixture::TearDown();
|
||||
hwInfoToModify->capabilityTable.instrumentationEnabled = instrumentationEnabledFlag;
|
||||
}
|
||||
HardwareInfo *hwInfoToModify;
|
||||
bool instrumentationEnabledFlag;
|
||||
};
|
||||
|
||||
TEST_F(PerformanceCountersDeviceTest, createDeviceWithPerformanceCounters) {
|
||||
hwInfoToModify->capabilityTable.instrumentationEnabled = true;
|
||||
auto device = MockDevice::createWithNewExecutionEnvironment<Device>(hwInfoToModify);
|
||||
DeviceInstrumentationFixture::SetUp(true);
|
||||
EXPECT_NE(nullptr, device->getPerformanceCounters());
|
||||
EXPECT_EQ(1, PerfCounterFlags::initalizeCalled);
|
||||
delete device;
|
||||
}
|
||||
|
||||
TEST_F(PerformanceCountersDeviceTest, createDeviceWithoutPerformanceCounters) {
|
||||
hwInfoToModify->capabilityTable.instrumentationEnabled = false;
|
||||
auto device = MockDevice::createWithNewExecutionEnvironment<Device>(hwInfoToModify);
|
||||
DeviceInstrumentationFixture::SetUp(false);
|
||||
EXPECT_EQ(nullptr, device->getPerformanceCounters());
|
||||
EXPECT_EQ(0, PerfCounterFlags::initalizeCalled);
|
||||
delete device;
|
||||
}
|
||||
|
||||
struct PerformanceCountersTest : public PerformanceCountersFixture,
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "runtime/program/kernel_info.h"
|
||||
#include "runtime/source_level_debugger/source_level_debugger.h"
|
||||
#include "unit_tests/fixtures/device_fixture.h"
|
||||
#include "unit_tests/helpers/execution_environment_helper.h"
|
||||
#include "unit_tests/libult/source_level_debugger_library.h"
|
||||
#include "unit_tests/libult/create_command_stream.h"
|
||||
#include "unit_tests/mocks/mock_source_level_debugger.h"
|
||||
|
@ -429,8 +430,12 @@ TEST(SourceLevelDebugger, givenKernelDebuggerLibraryActiveWhenDeviceImplIsCreate
|
|||
|
||||
overrideCommandStreamReceiverCreation = true;
|
||||
|
||||
// Device::create must be used to create correct OS memory manager
|
||||
unique_ptr<Device> device(MockDevice::createWithNewExecutionEnvironment<Device>(platformDevices[0]));
|
||||
HardwareInfo *hwInfo = nullptr;
|
||||
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo);
|
||||
|
||||
hwInfo->capabilityTable.instrumentationEnabled = true;
|
||||
unique_ptr<Device> device(Device::create<Device>(&hwInfo[0], executionEnvironment, 0));
|
||||
|
||||
ASSERT_NE(nullptr, device->getCommandStreamReceiver().getOSInterface());
|
||||
|
||||
EXPECT_TRUE(interceptor.newDeviceCalled);
|
||||
|
|
Loading…
Reference in New Issue