Skip to content

Commit a673347

Browse files
fix: don't allocate preemption surface for BCS engines
Signed-off-by: Mateusz Jablonski <[email protected]>
1 parent 3a5e6c0 commit a673347

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

shared/source/command_stream/command_stream_receiver.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2018-2023 Intel Corporation
2+
* Copyright (C) 2018-2024 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -867,6 +867,9 @@ bool CommandStreamReceiver::createGlobalFenceAllocation() {
867867
}
868868

869869
bool CommandStreamReceiver::createPreemptionAllocation() {
870+
if (EngineHelpers::isBcs(osContext->getEngineType())) {
871+
return true;
872+
}
870873
auto hwInfo = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getHardwareInfo();
871874
auto &gfxCoreHelper = getGfxCoreHelper();
872875
size_t preemptionSurfaceSize = hwInfo->capabilityTable.requiredPreemptionSurfaceSize;

shared/test/unit_test/command_stream/command_stream_receiver_tests.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2021-2023 Intel Corporation
2+
* Copyright (C) 2021-2024 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -44,6 +44,7 @@
4444
#include "shared/test/common/mocks/mock_execution_environment.h"
4545
#include "shared/test/common/mocks/mock_internal_allocation_storage.h"
4646
#include "shared/test/common/mocks/mock_memory_manager.h"
47+
#include "shared/test/common/mocks/mock_os_context.h"
4748
#include "shared/test/common/mocks/mock_scratch_space_controller_xehp_and_later.h"
4849
#include "shared/test/common/mocks/mock_timestamp_container.h"
4950
#include "shared/test/common/mocks/ult_device_factory.h"
@@ -806,13 +807,27 @@ HWTEST_F(CommandStreamReceiverTest, givenOverrideCsrAllocationSizeWhenCreatingCo
806807
int32_t overrideSize = 10 * MemoryConstants::pageSize;
807808
debugManager.flags.OverrideCsrAllocationSize.set(overrideSize);
808809

810+
auto defaultEngine = defaultHwInfo->capabilityTable.defaultEngineType;
811+
812+
MockOsContext mockOsContext(0, EngineDescriptorHelper::getDefaultDescriptor({defaultEngine, EngineUsage::regular}));
809813
MockCsrHw<FamilyType> commandStreamReceiver(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
814+
commandStreamReceiver.setupContext(mockOsContext);
810815

811816
bool ret = commandStreamReceiver.createPreemptionAllocation();
812817
ASSERT_TRUE(ret);
813818
EXPECT_EQ(static_cast<size_t>(overrideSize), commandStreamReceiver.preemptionAllocation->getUnderlyingBufferSize());
814819
}
815820

821+
HWTEST_F(CommandStreamReceiverTest, whenCreatingPreemptionAllocationForBcsThenNoAllocationIsCreated) {
822+
MockOsContext mockOsContext(0, EngineDescriptorHelper::getDefaultDescriptor({aub_stream::EngineType::ENGINE_BCS, EngineUsage::regular}));
823+
MockCsrHw<FamilyType> commandStreamReceiver(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
824+
commandStreamReceiver.setupContext(mockOsContext);
825+
826+
bool ret = commandStreamReceiver.createPreemptionAllocation();
827+
EXPECT_TRUE(ret);
828+
EXPECT_EQ(nullptr, commandStreamReceiver.preemptionAllocation);
829+
}
830+
816831
HWTEST_F(CommandStreamReceiverTest, givenCommandStreamReceiverWhenCallingGetMemoryCompressionStateThenReturnNotApplicable) {
817832
CommandStreamReceiverHw<FamilyType> commandStreamReceiver(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
818833

0 commit comments

Comments
 (0)