|
1 | 1 | /*
|
2 |
| - * Copyright (C) 2021-2023 Intel Corporation |
| 2 | + * Copyright (C) 2021-2024 Intel Corporation |
3 | 3 | *
|
4 | 4 | * SPDX-License-Identifier: MIT
|
5 | 5 | *
|
|
44 | 44 | #include "shared/test/common/mocks/mock_execution_environment.h"
|
45 | 45 | #include "shared/test/common/mocks/mock_internal_allocation_storage.h"
|
46 | 46 | #include "shared/test/common/mocks/mock_memory_manager.h"
|
| 47 | +#include "shared/test/common/mocks/mock_os_context.h" |
47 | 48 | #include "shared/test/common/mocks/mock_scratch_space_controller_xehp_and_later.h"
|
48 | 49 | #include "shared/test/common/mocks/mock_timestamp_container.h"
|
49 | 50 | #include "shared/test/common/mocks/ult_device_factory.h"
|
@@ -806,13 +807,27 @@ HWTEST_F(CommandStreamReceiverTest, givenOverrideCsrAllocationSizeWhenCreatingCo
|
806 | 807 | int32_t overrideSize = 10 * MemoryConstants::pageSize;
|
807 | 808 | debugManager.flags.OverrideCsrAllocationSize.set(overrideSize);
|
808 | 809 |
|
| 810 | + auto defaultEngine = defaultHwInfo->capabilityTable.defaultEngineType; |
| 811 | + |
| 812 | + MockOsContext mockOsContext(0, EngineDescriptorHelper::getDefaultDescriptor({defaultEngine, EngineUsage::regular})); |
809 | 813 | MockCsrHw<FamilyType> commandStreamReceiver(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
| 814 | + commandStreamReceiver.setupContext(mockOsContext); |
810 | 815 |
|
811 | 816 | bool ret = commandStreamReceiver.createPreemptionAllocation();
|
812 | 817 | ASSERT_TRUE(ret);
|
813 | 818 | EXPECT_EQ(static_cast<size_t>(overrideSize), commandStreamReceiver.preemptionAllocation->getUnderlyingBufferSize());
|
814 | 819 | }
|
815 | 820 |
|
| 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 | + |
816 | 831 | HWTEST_F(CommandStreamReceiverTest, givenCommandStreamReceiverWhenCallingGetMemoryCompressionStateThenReturnNotApplicable) {
|
817 | 832 | CommandStreamReceiverHw<FamilyType> commandStreamReceiver(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
818 | 833 |
|
|
0 commit comments