2022-09-15 00:28:41 +00:00
|
|
|
/*
|
2025-01-21 10:48:43 +00:00
|
|
|
* Copyright (C) 2022-2025 Intel Corporation
|
2022-09-15 00:28:41 +00:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "shared/test/unit_test/fixtures/command_container_fixture.h"
|
|
|
|
|
|
2023-03-16 00:12:49 +00:00
|
|
|
#include "shared/source/indirect_heap/heap_size.h"
|
2024-01-30 01:00:53 +00:00
|
|
|
#include "shared/source/indirect_heap/indirect_heap.h"
|
2023-03-10 12:28:11 +00:00
|
|
|
#include "shared/source/os_interface/product_helper.h"
|
2023-01-16 15:30:27 +00:00
|
|
|
#include "shared/test/common/mocks/mock_device.h"
|
2024-01-30 01:00:53 +00:00
|
|
|
#include "shared/test/common/mocks/mock_graphics_allocation.h"
|
2022-09-15 00:28:41 +00:00
|
|
|
|
|
|
|
|
namespace NEO {
|
|
|
|
|
|
|
|
|
|
void CommandEncodeStatesFixture::setUp() {
|
|
|
|
|
DeviceFixture::setUp();
|
|
|
|
|
cmdContainer = std::make_unique<MyMockCommandContainer>();
|
2023-03-16 00:12:49 +00:00
|
|
|
cmdContainer->initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
2022-09-15 00:28:41 +00:00
|
|
|
cmdContainer->setDirtyStateForAllHeaps(false);
|
|
|
|
|
const auto &hwInfo = pDevice->getHardwareInfo();
|
2023-01-23 13:20:47 +00:00
|
|
|
auto &productHelper = pDevice->getProductHelper();
|
2023-03-16 10:09:21 +00:00
|
|
|
cmdContainer->systolicModeSupportRef() = productHelper.isSystolicModeConfigurable(hwInfo);
|
|
|
|
|
cmdContainer->doubleSbaWaRef() = productHelper.isAdditionalStateBaseAddressWARequired(hwInfo);
|
2023-02-24 16:55:21 +00:00
|
|
|
this->l1CachePolicyData.init(productHelper);
|
2023-03-16 10:09:21 +00:00
|
|
|
cmdContainer->l1CachePolicyDataRef() = &this->l1CachePolicyData;
|
2022-09-15 00:28:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CommandEncodeStatesFixture::tearDown() {
|
|
|
|
|
cmdContainer.reset();
|
|
|
|
|
DeviceFixture::tearDown();
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-29 22:15:22 +00:00
|
|
|
EncodeWalkerArgs CommandEncodeStatesFixture::createDefaultEncodeWalkerArgs(const KernelDescriptor &kernelDescriptor) {
|
2025-01-21 22:07:41 +00:00
|
|
|
|
2024-10-29 22:15:22 +00:00
|
|
|
EncodeWalkerArgs args{
|
2025-01-21 22:07:41 +00:00
|
|
|
.kernelExecutionType = KernelExecutionType::defaultType,
|
|
|
|
|
.requiredDispatchWalkOrder = RequiredDispatchWalkOrder::none,
|
|
|
|
|
.localRegionSize = 0,
|
|
|
|
|
.maxFrontEndThreads = 0,
|
|
|
|
|
.requiredSystemFence = false,
|
|
|
|
|
.hasSample = kernelDescriptor.kernelAttributes.flags.hasSample};
|
2024-10-29 22:15:22 +00:00
|
|
|
|
|
|
|
|
return args;
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-30 01:00:53 +00:00
|
|
|
void ScratchProgrammingFixture::setUp() {
|
|
|
|
|
NEO::DeviceFixture::setUp();
|
|
|
|
|
size_t sizeStream = 512;
|
|
|
|
|
size_t alignmentStream = 0x1000;
|
|
|
|
|
ssh = new IndirectHeap{nullptr};
|
|
|
|
|
sshBuffer = alignedMalloc(sizeStream, alignmentStream);
|
|
|
|
|
ASSERT_NE(nullptr, sshBuffer);
|
|
|
|
|
ssh->replaceBuffer(sshBuffer, sizeStream);
|
|
|
|
|
auto graphicsAllocation = new MockGraphicsAllocation(sshBuffer, sizeStream);
|
|
|
|
|
ssh->replaceGraphicsAllocation(graphicsAllocation);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScratchProgrammingFixture::tearDown() {
|
|
|
|
|
delete ssh->getGraphicsAllocation();
|
|
|
|
|
delete ssh;
|
|
|
|
|
alignedFree(sshBuffer);
|
|
|
|
|
NEO::DeviceFixture::tearDown();
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-15 00:28:41 +00:00
|
|
|
} // namespace NEO
|
|
|
|
|
|
|
|
|
|
void WalkerThreadFixture::setUp() {
|
|
|
|
|
startWorkGroup[0] = startWorkGroup[1] = startWorkGroup[2] = 0u;
|
|
|
|
|
numWorkGroups[0] = numWorkGroups[1] = numWorkGroups[2] = 1u;
|
|
|
|
|
workGroupSizes[0] = 32u;
|
|
|
|
|
workGroupSizes[1] = workGroupSizes[2] = 1u;
|
|
|
|
|
simd = 32u;
|
|
|
|
|
localIdDimensions = 3u;
|
|
|
|
|
requiredWorkGroupOrder = 0u;
|
|
|
|
|
}
|