Skip to content

Commit f3afde1

Browse files
Dont expose internal copy engine if blitter operations are disabled
Related-To: NEO-6325 Signed-off-by: Mateusz Jablonski <[email protected]>
1 parent 03540d5 commit f3afde1

File tree

5 files changed

+39
-0
lines changed

5 files changed

+39
-0
lines changed

level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_3.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -877,6 +877,8 @@ HWTEST2_F(CommandListCreate, givenImmediateCommandListWhenCopyRegionFromImageToI
877877
const ze_command_queue_desc_t queueDesc = {};
878878
bool internalEngine = true;
879879

880+
neoDevice->getRootDeviceEnvironment().getMutableHardwareInfo()->capabilityTable.blitterOperationsSupported = true;
881+
880882
ze_result_t returnValue;
881883
std::unique_ptr<L0::CommandList> commandList0(CommandList::createImmediate(productFamily,
882884
device,
@@ -921,6 +923,7 @@ HWTEST2_F(CommandListCreate, givenImmediateCommandListWhenCopyRegionFromImageToI
921923
const ze_command_queue_desc_t queueDesc = {};
922924
bool internalEngine = true;
923925

926+
neoDevice->getRootDeviceEnvironment().getMutableHardwareInfo()->capabilityTable.blitterOperationsSupported = true;
924927
ze_result_t returnValue;
925928
std::unique_ptr<L0::CommandList> commandList0(CommandList::createImmediate(productFamily,
926929
device,
@@ -966,6 +969,7 @@ HWTEST2_F(CommandListCreate, givenImmediateCommandListWhenCopyFromImageToImageUs
966969
const ze_command_queue_desc_t queueDesc = {};
967970
bool internalEngine = true;
968971

972+
neoDevice->getRootDeviceEnvironment().getMutableHardwareInfo()->capabilityTable.blitterOperationsSupported = true;
969973
ze_result_t returnValue;
970974
std::unique_ptr<L0::CommandList> commandList0(CommandList::createImmediate(productFamily,
971975
device,
@@ -1009,6 +1013,7 @@ HWTEST2_F(CommandListCreate, givenImmediateCommandListWhenMemoryCopyRegionWithSi
10091013
const ze_command_queue_desc_t desc = {};
10101014
bool internalEngine = true;
10111015

1016+
neoDevice->getRootDeviceEnvironment().getMutableHardwareInfo()->capabilityTable.blitterOperationsSupported = true;
10121017
ze_result_t result = ZE_RESULT_SUCCESS;
10131018
std::unique_ptr<L0::CommandList> commandList0(CommandList::createImmediate(productFamily,
10141019
device,

level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,7 @@ HWTEST2_F(L0DebuggerInternalUsageTest, givenUseCsrImmediateSubmissionEnabledForI
737737
void *srcPtr = reinterpret_cast<void *>(0x1234);
738738
void *dstPtr = reinterpret_cast<void *>(0x2345);
739739

740+
neoDevice->getRootDeviceEnvironment().getMutableHardwareInfo()->capabilityTable.blitterOperationsSupported = true;
740741
ze_result_t returnValue;
741742
std::unique_ptr<L0::CommandList> commandList0(CommandList::createImmediate(productFamily,
742743
device,
@@ -789,6 +790,7 @@ HWTEST2_F(L0DebuggerInternalUsageTest, givenUseCsrImmediateSubmissionDisabledFor
789790
void *srcPtr = reinterpret_cast<void *>(0x1234);
790791
void *dstPtr = reinterpret_cast<void *>(0x2345);
791792

793+
neoDevice->getRootDeviceEnvironment().getMutableHardwareInfo()->capabilityTable.blitterOperationsSupported = true;
792794
ze_result_t returnValue;
793795
std::unique_ptr<L0::CommandList> commandList0(CommandList::createImmediate(productFamily,
794796
device,

shared/source/device/device.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,9 @@ EngineControl &Device::getInternalEngine() {
566566
}
567567

568568
EngineControl *Device::getInternalCopyEngine() {
569+
if (!getHardwareInfo().capabilityTable.blitterOperationsSupported) {
570+
return nullptr;
571+
}
569572
for (auto &engine : engines) {
570573
if (engine.osContext->getEngineType() == aub_stream::ENGINE_BCS &&
571574
engine.osContext->isInternalEngine()) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#
2+
# Copyright (C) 2021 Intel Corporation
3+
#
4+
# SPDX-License-Identifier: MIT
5+
#
6+
7+
target_sources(${TARGET_NAME} PRIVATE
8+
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
9+
${CMAKE_CURRENT_SOURCE_DIR}/neo_device_tests.cpp
10+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Copyright (C) 2021 Intel Corporation
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*
6+
*/
7+
8+
#include "shared/test/common/fixtures/device_fixture.h"
9+
10+
#include "test.h"
11+
12+
using namespace NEO;
13+
14+
typedef Test<DeviceFixture> DeviceTest;
15+
16+
TEST_F(DeviceTest, whenBlitterOperationsSupportIsDisabledThenNoInternalCopyEngineIsReturned) {
17+
pDevice->getRootDeviceEnvironment().getMutableHardwareInfo()->capabilityTable.blitterOperationsSupported = false;
18+
EXPECT_EQ(nullptr, pDevice->getInternalCopyEngine());
19+
}

0 commit comments

Comments
 (0)