Skip to content

Commit 5c7955b

Browse files
Update getInternalEngine() implementation and remove unused method
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
1 parent cfd3945 commit 5c7955b

File tree

9 files changed

+35
-82
lines changed

9 files changed

+35
-82
lines changed

opencl/source/cl_device/cl_device.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ class ClDevice : public BaseObject<_cl_device_id> {
6969
EngineControl &getEngine(aub_stream::EngineType engineType, EngineUsage engineUsage);
7070
EngineControl &getDefaultEngine();
7171
EngineControl &getInternalEngine();
72-
EngineControl *getInternalCopyEngine();
7372
SelectorCopyEngine &getSelectorCopyEngine();
7473
MemoryManager *getMemoryManager() const;
7574
GmmHelper *getGmmHelper() const;

opencl/test/unit_test/device/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
set(IGDRCL_SRCS_tests_device
88
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
99
${CMAKE_CURRENT_SOURCE_DIR}/device_caps_tests.cpp
10-
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/device_get_engine_tests.cpp
1110
${CMAKE_CURRENT_SOURCE_DIR}/device_tests.cpp
1211
${CMAKE_CURRENT_SOURCE_DIR}/device_timers_tests.cpp
1312
${CMAKE_CURRENT_SOURCE_DIR}/get_device_info_size_tests.cpp

opencl/test/unit_test/device/device_get_engine_tests.cpp

Lines changed: 0 additions & 30 deletions
This file was deleted.

opencl/test/unit_test/device/device_tests.cpp

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "shared/test/common/mocks/mock_driver_info.h"
1818
#include "shared/test/common/mocks/mock_execution_environment.h"
1919
#include "shared/test/common/mocks/ult_device_factory.h"
20+
#include "shared/test/common/test_macros/test_checks_shared.h"
2021

2122
#include "opencl/source/platform/platform.h"
2223
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
@@ -552,30 +553,30 @@ HWTEST_F(DeviceHwTest, givenDeviceCreationWhenCsrFailsToCreateGlobalSyncAllocati
552553
EXPECT_EQ(nullptr, mockDevice);
553554
}
554555

555-
TEST(DeviceGenEngineTest, givenHwCsrModeWhenGetEngineThenDedicatedForInternalUsageEngineIsReturned) {
556+
TEST(DeviceGetEngineTest, givenHwCsrModeWhenGetEngineThenDedicatedForInternalUsageEngineIsReturned) {
556557
auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<Device>(nullptr));
557558

558559
auto &internalEngine = device->getInternalEngine();
559560
auto &defaultEngine = device->getDefaultEngine();
560561
EXPECT_NE(defaultEngine.commandStreamReceiver, internalEngine.commandStreamReceiver);
561562
}
562563

563-
TEST(DeviceGenEngineTest, whenCreateDeviceThenInternalEngineHasDefaultType) {
564+
TEST(DeviceGetEngineTest, whenCreateDeviceThenInternalEngineHasDefaultType) {
564565
auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<Device>(nullptr));
565566

566567
auto internalEngineType = device->getInternalEngine().osContext->getEngineType();
567568
auto defaultEngineType = getChosenEngineType(device->getHardwareInfo());
568569
EXPECT_EQ(defaultEngineType, internalEngineType);
569570
}
570571

571-
TEST(DeviceGenEngineTest, givenCreatedDeviceWhenRetrievingDefaultEngineThenOsContextHasDefaultFieldSet) {
572+
TEST(DeviceGetEngineTest, givenCreatedDeviceWhenRetrievingDefaultEngineThenOsContextHasDefaultFieldSet) {
572573
auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<Device>(nullptr));
573574

574575
auto &defaultEngine = device->getDefaultEngine();
575576
EXPECT_TRUE(defaultEngine.osContext->isDefaultContext());
576577
}
577578

578-
TEST(DeviceGenEngineTest, givenNoEmptyGroupsWhenGettingNonEmptyGroupsThenReturnCorrectResults) {
579+
TEST(DeviceGetEngineTest, givenNoEmptyGroupsWhenGettingNonEmptyGroupsThenReturnCorrectResults) {
579580
const auto nonEmptyEngineGroup = std::vector<EngineControl>{EngineControl{nullptr, nullptr}};
580581

581582
auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<Device>(nullptr));
@@ -593,7 +594,7 @@ TEST(DeviceGenEngineTest, givenNoEmptyGroupsWhenGettingNonEmptyGroupsThenReturnC
593594
EXPECT_EQ(nullptr, device->getNonEmptyEngineGroup(4));
594595
}
595596

596-
TEST(DeviceGenEngineTest, givenEmptyGroupsWhenGettingNonEmptyGroupsThenReturnCorrectResults) {
597+
TEST(DeviceGetEngineTest, givenEmptyGroupsWhenGettingNonEmptyGroupsThenReturnCorrectResults) {
597598
const auto emptyEngineGroup = std::vector<EngineControl>{};
598599
const auto nonEmptyEngineGroup = std::vector<EngineControl>{EngineControl{nullptr, nullptr}};
599600

@@ -610,7 +611,7 @@ TEST(DeviceGenEngineTest, givenEmptyGroupsWhenGettingNonEmptyGroupsThenReturnCor
610611
EXPECT_EQ(nullptr, device->getNonEmptyEngineGroup(2));
611612
}
612613

613-
TEST(DeviceGenEngineTest, givenNoEmptyGroupsWhenGettingNonEmptyGroupIndexThenReturnCorrectResults) {
614+
TEST(DeviceGetEngineTest, givenNoEmptyGroupsWhenGettingNonEmptyGroupIndexThenReturnCorrectResults) {
614615
const auto nonEmptyEngineGroup = std::vector<EngineControl>{EngineControl{nullptr, nullptr}};
615616

616617
auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<Device>(nullptr));
@@ -629,7 +630,7 @@ TEST(DeviceGenEngineTest, givenNoEmptyGroupsWhenGettingNonEmptyGroupIndexThenRet
629630
EXPECT_ANY_THROW(device->getIndexOfNonEmptyEngineGroup(static_cast<EngineGroupType>(5u)));
630631
}
631632

632-
TEST(DeviceGenEngineTest, givenEmptyGroupsWhenGettingNonEmptyGroupIndexThenReturnCorrectResults) {
633+
TEST(DeviceGetEngineTest, givenEmptyGroupsWhenGettingNonEmptyGroupIndexThenReturnCorrectResults) {
633634
const auto emptyEngineGroup = std::vector<EngineControl>{};
634635
const auto nonEmptyEngineGroup = std::vector<EngineControl>{EngineControl{nullptr, nullptr}};
635636

@@ -649,7 +650,7 @@ TEST(DeviceGenEngineTest, givenEmptyGroupsWhenGettingNonEmptyGroupIndexThenRetur
649650
EXPECT_ANY_THROW(device->getIndexOfNonEmptyEngineGroup(static_cast<EngineGroupType>(5u)));
650651
}
651652

652-
TEST(DeviceGenEngineTest, givenDeferredContextInitializationEnabledWhenCreatingEnginesThenInitializeOnlyOsContextsWhichRequireIt) {
653+
TEST(DeviceGetEngineTest, givenDeferredContextInitializationEnabledWhenCreatingEnginesThenInitializeOnlyOsContextsWhichRequireIt) {
653654
DebugManagerStateRestore restore{};
654655
DebugManager.flags.DeferOsContextInitialization.set(1);
655656

@@ -664,7 +665,7 @@ TEST(DeviceGenEngineTest, givenDeferredContextInitializationEnabledWhenCreatingE
664665
}
665666
}
666667

667-
TEST(DeviceGenEngineTest, givenDeferredContextInitializationDisabledWhenCreatingEnginesThenInitializeAllOsContexts) {
668+
TEST(DeviceGetEngineTest, givenDeferredContextInitializationDisabledWhenCreatingEnginesThenInitializeAllOsContexts) {
668669
DebugManagerStateRestore restore{};
669670
DebugManager.flags.DeferOsContextInitialization.set(0);
670671

@@ -675,6 +676,20 @@ TEST(DeviceGenEngineTest, givenDeferredContextInitializationDisabledWhenCreating
675676
}
676677
}
677678

679+
TEST(DeviceGetEngineTest, givenNonHwCsrModeWhenGetEngineThenDefaultEngineIsReturned) {
680+
DebugManagerStateRestore dbgRestorer;
681+
DebugManager.flags.SetCommandStreamReceiver.set(CommandStreamReceiverType::CSR_AUB);
682+
683+
VariableBackup<UltHwConfig> backup(&ultHwConfig);
684+
ultHwConfig.useHwCsr = true;
685+
686+
auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<Device>(nullptr));
687+
688+
auto &internalEngine = device->getInternalEngine();
689+
auto &defaultEngine = device->getDefaultEngine();
690+
EXPECT_EQ(defaultEngine.commandStreamReceiver, internalEngine.commandStreamReceiver);
691+
}
692+
678693
using DeviceQueueFamiliesTests = ::testing::Test;
679694

680695
HWTEST_F(DeviceQueueFamiliesTests, whenGettingQueueFamilyCapabilitiesAllThenReturnCorrectValue) {

opencl/test/unit_test/gen12lp/hw_helper_tests_gen12lp.inl

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -167,16 +167,6 @@ GEN12LPTEST_F(HwHelperTestGen12Lp, givenFtrCcsNodeNotSetWhenGetGpgpuEnginesThenR
167167
EXPECT_EQ(aub_stream::ENGINE_RCS, engines[2].first);
168168
}
169169

170-
GEN12LPTEST_F(HwHelperTestGen12Lp,
171-
whenCallingGetInternalCopyEngineThenNullptrIsReturned) {
172-
HardwareInfo hwInfo = *defaultHwInfo;
173-
hwInfo.featureTable.ftrBcsInfo = 1;
174-
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo, 0));
175-
176-
auto internalCopyEngine = device->getInternalCopyEngine();
177-
EXPECT_EQ(internalCopyEngine, nullptr);
178-
}
179-
180170
GEN12LPTEST_F(HwHelperTestGen12Lp, givenFtrCcsNodeSetWhenGetGpgpuEnginesThenReturnTwoRcsAndCcsEngines) {
181171
HardwareInfo hwInfo = *defaultHwInfo;
182172
hwInfo.featureTable.ftrCCSNode = true;

shared/source/device/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (C) 2020 Intel Corporation
2+
# Copyright (C) 2020-2021 Intel Corporation
33
#
44
# SPDX-License-Identifier: MIT
55
#
@@ -9,7 +9,6 @@ set(NEO_CORE_DEVICE
99
${CMAKE_CURRENT_SOURCE_DIR}/device.cpp
1010
${CMAKE_CURRENT_SOURCE_DIR}/device.h
1111
${CMAKE_CURRENT_SOURCE_DIR}/device_caps.cpp
12-
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/device_get_engine.cpp
1312
${CMAKE_CURRENT_SOURCE_DIR}/device_info.h
1413
${CMAKE_CURRENT_SOURCE_DIR}/root_device.cpp
1514
${CMAKE_CURRENT_SOURCE_DIR}/root_device.h

shared/source/device/device.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,16 @@ const std::vector<EngineControl> &Device::getEngines() const {
543543
return this->engines;
544544
}
545545

546+
EngineControl &Device::getInternalEngine() {
547+
if (this->engines[0].commandStreamReceiver->getType() != CommandStreamReceiverType::CSR_HW) {
548+
return this->getDefaultEngine();
549+
}
550+
551+
auto engineType = getChosenEngineType(getHardwareInfo());
552+
553+
return this->getDeviceById(0)->getEngine(engineType, EngineUsage::Internal);
554+
}
555+
546556
void Device::initializeRayTracing() {
547557
if (rtMemoryBackedBuffer == nullptr) {
548558
auto size = RayTracingHelper::getTotalMemoryBackedFifoSize(*this);

shared/source/device/device.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ class Device : public ReferenceTrackedObject<Device> {
6464
EngineControl &getEngine(uint32_t index);
6565
EngineControl &getDefaultEngine();
6666
EngineControl &getInternalEngine();
67-
EngineControl *getInternalCopyEngine();
6867
SelectorCopyEngine &getSelectorCopyEngine();
6968
MemoryManager *getMemoryManager() const;
7069
GmmHelper *getGmmHelper() const;

shared/source/device/device_get_engine.cpp

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)